Skip to content

Commit b343b91

Browse files
author
Liudmila Molkova
authored
ACR arch board feedback (Azure#34070)
* Address arch board feedback * Rename client and methods * update manifest media types and autorest * remove /oauth2/token and regenerate * config -> configuration * Remove response from downloadStreamWithResponse * align swagger
1 parent 3178009 commit b343b91

File tree

56 files changed

+966
-2276
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+966
-2276
lines changed

eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ the main ServiceBusClientBuilder. -->
193193

194194
<!-- suppress eceptions caught to for tracing-->
195195
<suppress checks="com.azure.tools.checkstyle.checks.ThrowFromClientLoggerCheck"
196-
files="com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClient.java"/>
196+
files="com.azure.containers.containerregistry.ContainerRegistryContentClient.java"/>
197197

198198

199199
<!-- Nested blocks are still readable in the switch statements in Avro. -->

sdk/containerregistry/azure-containers-containerregistry-perf/src/main/java/com/azure/containers/containerregistry/perf/DownloadBlobTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import com.azure.containers.containerregistry.perf.core.ServiceTest;
77
import com.azure.core.util.Context;
8+
import com.azure.core.util.FluxUtil;
89
import com.azure.perf.test.core.NullOutputStream;
910
import com.azure.perf.test.core.PerfStressOptions;
1011
import reactor.core.publisher.Mono;
@@ -36,13 +37,13 @@ public Mono<Void> setupAsync() {
3637

3738
@Override
3839
public void run() {
39-
blobClient.downloadStream(digest[0], Channels.newChannel(output), Context.NONE);
40+
blobClient.downloadStream(digest[0], Channels.newChannel(output));
4041
}
4142

4243
@Override
4344
public Mono<Void> runAsync() {
4445
return blobAsyncClient.downloadStream(digest[0])
45-
.flatMap(result -> result.writeValueTo(Channels.newChannel(output)))
46+
.flatMap(result -> FluxUtil.writeToOutputStream(result.toFluxByteBuffer(), output))
4647
.then();
4748
}
4849
}

sdk/containerregistry/azure-containers-containerregistry-perf/src/main/java/com/azure/containers/containerregistry/perf/core/ServiceTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import com.azure.containers.containerregistry.ContainerRegistryAsyncClient;
77
import com.azure.containers.containerregistry.ContainerRegistryClient;
88
import com.azure.containers.containerregistry.ContainerRegistryClientBuilder;
9-
import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobAsyncClient;
10-
import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClient;
11-
import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClientBuilder;
9+
import com.azure.containers.containerregistry.ContainerRegistryContentAsyncClient;
10+
import com.azure.containers.containerregistry.ContainerRegistryContentClient;
11+
import com.azure.containers.containerregistry.ContainerRegistryContentClientBuilder;
1212
import com.azure.core.credential.TokenCredential;
1313
import com.azure.core.http.netty.NettyAsyncHttpClientProvider;
1414
import com.azure.core.http.okhttp.OkHttpAsyncClientProvider;
@@ -60,8 +60,8 @@ public abstract class ServiceTest<TOptions extends PerfStressOptions> extends Pe
6060
*/
6161
protected ContainerRegistryAsyncClient containerRegistryAsyncClient;
6262

63-
protected ContainerRegistryBlobClient blobClient;
64-
protected ContainerRegistryBlobAsyncClient blobAsyncClient;
63+
protected ContainerRegistryContentClient blobClient;
64+
protected ContainerRegistryContentAsyncClient blobAsyncClient;
6565

6666
/**
6767
* The base class for Azure Container Registry performance tests.
@@ -91,11 +91,11 @@ public ServiceTest(TOptions options) {
9191
this.containerRegistryClient = builder.buildClient();
9292
this.containerRegistryAsyncClient = builder.buildAsyncClient();
9393

94-
ContainerRegistryBlobClientBuilder blobClientBuilder = new ContainerRegistryBlobClientBuilder()
94+
ContainerRegistryContentClientBuilder blobClientBuilder = new ContainerRegistryContentClientBuilder()
9595
.credential(tokenCredential)
9696
.clientOptions(httpOptions)
9797
.endpoint(registryEndpoint)
98-
.repository("oci-artifact");
98+
.repositoryName("oci-artifact");
9999

100100
this.blobClient = blobClientBuilder.buildClient();
101101
this.blobAsyncClient = blobClientBuilder.buildAsyncClient();

sdk/containerregistry/azure-containers-containerregistry/CHANGELOG.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,22 @@
44

55
### Features Added
66

7-
### Breaking Changes
8-
9-
- Replaced `uploadManifest(OciImageManifest)` method on `ContainerRegistryBlobClient` and `ContainerRegistryBlobAsyncClient` classes
10-
with `uploadManifest(OciImageManifest manifest, String tag)` method.
7+
### Breaking Changes from version 1.1.0-beta.3
8+
9+
- `ContainerRegistryBlobClientBuilder`, `ContainerRegistryBlobClient` and `ContainerRegistryBlobAsyncClient` were renamed to `ContainerRegistryContentClientBuilder`,
10+
`ContainerRegistryContentClient`, and `ContainerRegistryContentAsyncClient` and moved to `com.azure.containers.containerregistry` package.
11+
- `UploadBlobResult` was renamed to `UploadRegistryBlobResult`
12+
- `ContainerRegistryContentClient` and `ContainerRegistryContentAsyncClient` changes:
13+
- `uploadManifest` method was renamed to `setManifest`, `uploadManifestWithResponse` renamed to `setManifestWithResponse`, the return type of these methods was renamed to `SetManifestResult`.
14+
`UploadManifestOptions` renamed to `SetManifestOptions`.
15+
- `downloadManifest` method was renamed to `getManifest`, `downloadManifestWithResponse` renamed to `getManifestWithResponse`, the return type of these methods renamed to `GetManifestResult`.
16+
- Removed `DownloadBlobAsyncResult` and changes `ContainerRegistryContentAsyncClient.downloadStream` return type to `Mono<BinaryData>`.
17+
- Removed `Collection<ManifestMediaType> mediaTypes` parameter from `downloadManifestWithResponse` method on blob clients.
18+
- Renamed `ContainerRegistryContentClientBuilder.repository` method to `repositoryName`.
19+
- Renamed `GetManifestResult.getMediaType` and `UploadManifestOptions.getMediaType` to `getManifestMediaType`.
20+
- Removed `GetManifestResult.asOciManifest` - use `GetManifestResult.getManifest().toObject(OciImageManifest.class)` instead.
21+
- Renamed `OciImageManifest.getConfig` and `setConfig` methods to `getConfiguration` and `setConfiguration`.
22+
- Renamed `OciAnnotations.getCreated` and `setCreated` methods to `getCreatedOn` and `setCreatedOn`.
1123

1224
### Bugs Fixed
1325

@@ -183,8 +195,8 @@
183195
## 1.0.0 (2022-01-11)
184196

185197
### Breaking Changes
186-
- Renamed `ArtifactTagOrderBy` to `ArtifactTagOrder`.
187-
- Renamed `ArtifactManifestOrderBy` to `ArtifactManifestOrder`.
198+
- Renamed `ArtifactTagOrderBy` to `ArtifactTagOrder`.
199+
- Renamed `ArtifactManifestOrderBy` to `ArtifactManifestOrder`.
188200

189201
### Other Changes
190202

sdk/containerregistry/azure-containers-containerregistry/README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -251,16 +251,16 @@ try {
251251

252252
### Blob and manifest operations
253253

254-
This section contains samples for `ContainerRegistryBlobClient` that show how to upload and download images.
254+
This section contains samples for `ContainerRegistryContentClient` that show how to upload and download images.
255255

256256
First, we need to create blob client.
257257

258-
```java readme-sample-createBlobClient
258+
```java readme-sample-createContentClient
259259
DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build();
260-
ContainerRegistryBlobClient blobClient = new ContainerRegistryBlobClientBuilder()
260+
ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder()
261261
.endpoint(endpoint)
262262
.credential(credential)
263-
.repository(repository)
263+
.repositoryName(repository)
264264
.buildClient();
265265
```
266266

@@ -272,7 +272,7 @@ which describes an image or artifact and assign it a tag.
272272
```java readme-sample-uploadImage
273273
BinaryData configContent = BinaryData.fromObject(Collections.singletonMap("hello", "world"));
274274

275-
UploadBlobResult configUploadResult = blobClient.uploadBlob(configContent);
275+
UploadRegistryBlobResult configUploadResult = contentClient.uploadBlob(configContent);
276276
System.out.printf("Uploaded config: digest - %s, size - %s\n", configUploadResult.getDigest(), configContent.getLength());
277277

278278
OciDescriptor configDescriptor = new OciDescriptor()
@@ -281,19 +281,19 @@ OciDescriptor configDescriptor = new OciDescriptor()
281281
.setSizeInBytes(configContent.getLength());
282282

283283
BinaryData layerContent = BinaryData.fromString("Hello Azure Container Registry");
284-
UploadBlobResult layerUploadResult = blobClient.uploadBlob(layerContent);
284+
UploadRegistryBlobResult layerUploadResult = contentClient.uploadBlob(layerContent);
285285
System.out.printf("Uploaded layer: digest - %s, size - %s\n", layerUploadResult.getDigest(), layerContent.getLength());
286286

287287
OciImageManifest manifest = new OciImageManifest()
288-
.setConfig(configDescriptor)
288+
.setConfiguration(configDescriptor)
289289
.setSchemaVersion(2)
290290
.setLayers(Collections.singletonList(
291291
new OciDescriptor()
292292
.setDigest(layerUploadResult.getDigest())
293293
.setSizeInBytes(layerContent.getLength())
294294
.setMediaType("application/octet-stream")));
295295

296-
UploadManifestResult manifestResult = blobClient.uploadManifest(manifest, "latest");
296+
SetManifestResult manifestResult = contentClient.setManifest(manifest, "latest");
297297
System.out.printf("Uploaded manifest: digest - %s\n", manifestResult.getDigest());
298298
```
299299

@@ -302,37 +302,37 @@ System.out.printf("Uploaded manifest: digest - %s\n", manifestResult.getDigest()
302302
To download a full image, we need to download its manifest and then download individual layers and configuration.
303303

304304
```java readme-sample-downloadImage
305-
DownloadManifestResult manifestResult = blobClient.downloadManifest("latest");
305+
GetManifestResult manifestResult = contentClient.getManifest("latest");
306306

307-
OciImageManifest manifest = manifestResult.asOciManifest();
307+
OciImageManifest manifest = manifestResult.getManifest().toObject(OciImageManifest.class);
308308
System.out.printf("Got manifest:\n%s\n", PRETTY_PRINT.writeValueAsString(manifest));
309309

310-
String configFileName = manifest.getConfig().getDigest() + ".json";
311-
blobClient.downloadStream(manifest.getConfig().getDigest(), createFileChannel(configFileName));
310+
String configFileName = manifest.getConfiguration().getDigest() + ".json";
311+
contentClient.downloadStream(manifest.getConfiguration().getDigest(), createFileChannel(configFileName));
312312
System.out.printf("Got config: %s\n", configFileName);
313313

314314
for (OciDescriptor layer : manifest.getLayers()) {
315-
blobClient.downloadStream(layer.getDigest(), createFileChannel(layer.getDigest()));
315+
contentClient.downloadStream(layer.getDigest(), createFileChannel(layer.getDigest()));
316316
System.out.printf("Got layer: %s\n", layer.getDigest());
317317
}
318318
```
319319

320320
#### Delete blob
321321

322322
```java readme-sample-deleteBlob
323-
DownloadManifestResult manifestResult = blobClient.downloadManifest("latest");
323+
GetManifestResult manifestResult = contentClient.getManifest("latest");
324324

325-
OciImageManifest manifest = manifestResult.asOciManifest();
325+
OciImageManifest manifest = manifestResult.getManifest().toObject(OciImageManifest.class);
326326
for (OciDescriptor layer : manifest.getLayers()) {
327-
blobClient.deleteBlob(layer.getDigest());
327+
contentClient.deleteBlob(layer.getDigest());
328328
}
329329
```
330330

331331
#### Delete manifest
332332

333333
```java readme-sample-deleteManifest
334-
DownloadManifestResult manifestResult = blobClient.downloadManifest("latest");
335-
blobClient.deleteManifest(manifestResult.getDigest());
334+
GetManifestResult manifestResult = contentClient.getManifest("latest");
335+
contentClient.deleteManifest(manifestResult.getDigest());
336336
```
337337

338338
## Troubleshooting

0 commit comments

Comments
 (0)