Skip to content

Commit 556da80

Browse files
authored
[ContainerRegistry] switch to use official TS code generator (Azure#15777)
and re-generate code. * Don't set userAgentPrefix in convenience layer * Update version constant prefix * Use latest @autorest/typescript plugin
1 parent 0eeb81a commit 556da80

File tree

15 files changed

+588
-64
lines changed

15 files changed

+588
-64
lines changed

sdk/containerregistry/container-registry/package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@
1515
"constantPaths": [
1616
{
1717
"path": "src/generated/generatedClientContext.ts",
18-
"prefix": "packageVersion"
19-
},
20-
{
21-
"path": "src/constants.ts",
22-
"prefix": "SDK_VERSION"
18+
"prefix": "const packageDetails"
2319
},
2420
{
2521
"path": "swagger/README.md",

sdk/containerregistry/container-registry/src/constants.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

sdk/containerregistry/container-registry/src/containerRegistryClient.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { SpanStatusCode } from "@azure/core-tracing";
1515
import "@azure/core-paging";
1616
import { PageSettings, PagedAsyncIterableIterator } from "@azure/core-paging";
1717

18-
import { SDK_VERSION } from "./constants";
1918
import { logger } from "./logger";
2019
import { GeneratedClient } from "./generated";
2120
import { createSpan } from "./tracing";
@@ -122,17 +121,6 @@ export class ContainerRegistryClient {
122121
options = credentialOrOptions ?? {};
123122
}
124123

125-
// The below code helps us set a proper User-Agent header on all requests
126-
const libInfo = `azsdk-js-container-registry/${SDK_VERSION}`;
127-
if (!options.userAgentOptions) {
128-
options.userAgentOptions = {};
129-
}
130-
if (options.userAgentOptions.userAgentPrefix) {
131-
options.userAgentOptions.userAgentPrefix = `${options.userAgentOptions.userAgentPrefix} ${libInfo}`;
132-
} else {
133-
options.userAgentOptions.userAgentPrefix = libInfo;
134-
}
135-
136124
const internalPipelineOptions: InternalPipelineOptions = {
137125
...options,
138126
loggingOptions: {

sdk/containerregistry/container-registry/src/generated/generatedClient.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@
66
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
*/
88

9+
import {
10+
ContainerRegistryImpl,
11+
ContainerRegistryBlobImpl,
12+
AuthenticationImpl
13+
} from "./operations";
914
import {
1015
ContainerRegistry,
1116
ContainerRegistryBlob,
1217
Authentication
13-
} from "./operations";
18+
} from "./operationsInterfaces";
1419
import { GeneratedClientContext } from "./generatedClientContext";
1520
import { GeneratedClientOptionalParams } from "./models";
1621

@@ -23,9 +28,9 @@ export class GeneratedClient extends GeneratedClientContext {
2328
*/
2429
constructor(url: string, options?: GeneratedClientOptionalParams) {
2530
super(url, options);
26-
this.containerRegistry = new ContainerRegistry(this);
27-
this.containerRegistryBlob = new ContainerRegistryBlob(this);
28-
this.authentication = new Authentication(this);
31+
this.containerRegistry = new ContainerRegistryImpl(this);
32+
this.containerRegistryBlob = new ContainerRegistryBlobImpl(this);
33+
this.authentication = new AuthenticationImpl(this);
2934
}
3035

3136
containerRegistry: ContainerRegistry;

sdk/containerregistry/container-registry/src/generated/generatedClientContext.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,24 @@ export class GeneratedClientContext extends coreClient.ServiceClient {
2727
if (!options) {
2828
options = {};
2929
}
30-
3130
const defaults: GeneratedClientOptionalParams = {
3231
requestContentType: "application/json; charset=utf-8"
3332
};
3433

34+
const packageDetails = `azsdk-js-container-registry/1.0.0-beta.4`;
35+
const userAgentPrefix =
36+
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
37+
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
38+
: `${packageDetails}`;
39+
3540
const optionsWithDefaults = {
3641
...defaults,
3742
...options,
43+
userAgentOptions: {
44+
userAgentPrefix
45+
},
3846
baseUri: options.endpoint || "{url}"
3947
};
40-
4148
super(optionsWithDefaults);
4249
// Parameter assignments
4350
this.url = url;

sdk/containerregistry/container-registry/src/generated/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
export * from "./models";
1010
export { GeneratedClient } from "./generatedClient";
1111
export { GeneratedClientContext } from "./generatedClientContext";
12+
export * from "./operationsInterfaces";

sdk/containerregistry/container-registry/src/generated/models/index.ts

Lines changed: 84 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import * as coreClient from "@azure/core-client";
10-
import * as coreHttps from "@azure/core-rest-pipeline";
10+
import * as coreRestPipeline from "@azure/core-rest-pipeline";
1111

1212
/** Acr error response describing why the operation failed */
1313
export interface AcrErrors {
@@ -230,12 +230,12 @@ export interface ManifestAttributesBase {
230230
* CPU architecture
231231
* NOTE: This property will not be serialized. It can only be populated by the server.
232232
*/
233-
readonly architecture?: ArtifactArchitecture | null;
233+
readonly architecture?: ArtifactArchitecture;
234234
/**
235235
* Operating system
236236
* NOTE: This property will not be serialized. It can only be populated by the server.
237237
*/
238-
readonly operatingSystem?: ArtifactOperatingSystem | null;
238+
readonly operatingSystem?: ArtifactOperatingSystem;
239239
/**
240240
* List of artifacts that are referenced by this manifest list, with information about the platform each supports. This list will be empty if this is a leaf manifest and not a manifest list.
241241
* NOTE: This property will not be serialized. It can only be populated by the server.
@@ -331,12 +331,12 @@ export interface ArtifactManifestProperties {
331331
* CPU architecture
332332
* NOTE: This property will not be serialized. It can only be populated by the server.
333333
*/
334-
readonly architecture?: ArtifactArchitecture | null;
334+
readonly architecture?: ArtifactArchitecture;
335335
/**
336336
* Operating system
337337
* NOTE: This property will not be serialized. It can only be populated by the server.
338338
*/
339-
readonly operatingSystem?: ArtifactOperatingSystem | null;
339+
readonly operatingSystem?: ArtifactOperatingSystem;
340340
/**
341341
* List of artifacts that are referenced by this manifest list, with information about the platform each supports. This list will be empty if this is a leaf manifest and not a manifest list.
342342
* NOTE: This property will not be serialized. It can only be populated by the server.
@@ -468,7 +468,7 @@ export interface Descriptor {
468468
/** Specifies a list of URIs from which this object may be downloaded. */
469469
urls?: string[];
470470
/** Additional information provided through arbitrary metadata. */
471-
annotations?: Annotations | null;
471+
annotations?: Annotations;
472472
}
473473

474474
/** Additional information provided through arbitrary metadata. */
@@ -553,7 +553,7 @@ export type ManifestWrapper = Manifest & {
553553
/** (V2, OCI) List of V2 image layer information */
554554
layers?: Descriptor[];
555555
/** (OCI, OCIIndex) Additional metadata */
556-
annotations?: Annotations | null;
556+
annotations?: Annotations;
557557
/** (V1) CPU architecture */
558558
architecture?: string;
559559
/** (V1) Image name */
@@ -593,15 +593,15 @@ export type OCIManifest = Manifest & {
593593
/** List of V2 image layer information */
594594
layers?: Descriptor[];
595595
/** Additional information provided through arbitrary metadata. */
596-
annotations?: Annotations | null;
596+
annotations?: Annotations;
597597
};
598598

599599
/** Returns the requested OCI index file */
600600
export type OCIIndex = Manifest & {
601601
/** List of OCI image layer information */
602602
manifests?: ManifestListAttributes[];
603603
/** Additional information provided through arbitrary metadata. */
604-
annotations?: Annotations | null;
604+
annotations?: Annotations;
605605
};
606606

607607
/** Returns the requested V1 manifest file */
@@ -773,7 +773,7 @@ export const enum KnownArtifactArchitecture {
773773
* Defines values for ArtifactArchitecture. \
774774
* {@link KnownArtifactArchitecture} can be used interchangeably with ArtifactArchitecture,
775775
* this enum contains the known values that the service supports.
776-
* ### Know values supported by the service
776+
* ### Known values supported by the service
777777
* **386** \
778778
* **amd64** \
779779
* **arm** \
@@ -812,7 +812,7 @@ export const enum KnownArtifactOperatingSystem {
812812
* Defines values for ArtifactOperatingSystem. \
813813
* {@link KnownArtifactOperatingSystem} can be used interchangeably with ArtifactOperatingSystem,
814814
* this enum contains the known values that the service supports.
815-
* ### Know values supported by the service
815+
* ### Known values supported by the service
816816
* **aix** \
817817
* **android** \
818818
* **darwin** \
@@ -836,6 +836,10 @@ export type ArtifactTagOrderBy = "none" | "timedesc" | "timeasc";
836836
/** Defines values for ArtifactManifestOrderBy. */
837837
export type ArtifactManifestOrderBy = "none" | "timedesc" | "timeasc";
838838

839+
/** Optional parameters. */
840+
export interface ContainerRegistryCheckDockerV2SupportOptionalParams
841+
extends coreClient.OperationOptions {}
842+
839843
/** Optional parameters. */
840844
export interface ContainerRegistryGetManifestOptionalParams
841845
extends coreClient.OperationOptions {
@@ -846,12 +850,20 @@ export interface ContainerRegistryGetManifestOptionalParams
846850
/** Contains response data for the getManifest operation. */
847851
export type ContainerRegistryGetManifestResponse = Manifest;
848852

853+
/** Optional parameters. */
854+
export interface ContainerRegistryCreateManifestOptionalParams
855+
extends coreClient.OperationOptions {}
856+
849857
/** Contains response data for the createManifest operation. */
850858
export type ContainerRegistryCreateManifestResponse = ContainerRegistryCreateManifestHeaders & {
851859
/** The parsed response body. */
852860
body: any;
853861
};
854862

863+
/** Optional parameters. */
864+
export interface ContainerRegistryDeleteManifestOptionalParams
865+
extends coreClient.OperationOptions {}
866+
855867
/** Optional parameters. */
856868
export interface ContainerRegistryGetRepositoriesOptionalParams
857869
extends coreClient.OperationOptions {
@@ -865,9 +877,17 @@ export interface ContainerRegistryGetRepositoriesOptionalParams
865877
export type ContainerRegistryGetRepositoriesResponse = ContainerRegistryGetRepositoriesHeaders &
866878
Repositories;
867879

880+
/** Optional parameters. */
881+
export interface ContainerRegistryGetPropertiesOptionalParams
882+
extends coreClient.OperationOptions {}
883+
868884
/** Contains response data for the getProperties operation. */
869885
export type ContainerRegistryGetPropertiesResponse = ContainerRepositoryProperties;
870886

887+
/** Optional parameters. */
888+
export interface ContainerRegistryDeleteRepositoryOptionalParams
889+
extends coreClient.OperationOptions {}
890+
871891
/** Optional parameters. */
872892
export interface ContainerRegistryUpdatePropertiesOptionalParams
873893
extends coreClient.OperationOptions {
@@ -895,6 +915,10 @@ export interface ContainerRegistryGetTagsOptionalParams
895915
export type ContainerRegistryGetTagsResponse = ContainerRegistryGetTagsHeaders &
896916
TagList;
897917

918+
/** Optional parameters. */
919+
export interface ContainerRegistryGetTagPropertiesOptionalParams
920+
extends coreClient.OperationOptions {}
921+
898922
/** Contains response data for the getTagProperties operation. */
899923
export type ContainerRegistryGetTagPropertiesResponse = ArtifactTagProperties;
900924

@@ -908,6 +932,10 @@ export interface ContainerRegistryUpdateTagAttributesOptionalParams
908932
/** Contains response data for the updateTagAttributes operation. */
909933
export type ContainerRegistryUpdateTagAttributesResponse = ArtifactTagProperties;
910934

935+
/** Optional parameters. */
936+
export interface ContainerRegistryDeleteTagOptionalParams
937+
extends coreClient.OperationOptions {}
938+
911939
/** Optional parameters. */
912940
export interface ContainerRegistryGetManifestsOptionalParams
913941
extends coreClient.OperationOptions {
@@ -923,6 +951,10 @@ export interface ContainerRegistryGetManifestsOptionalParams
923951
export type ContainerRegistryGetManifestsResponse = ContainerRegistryGetManifestsHeaders &
924952
AcrManifests;
925953

954+
/** Optional parameters. */
955+
export interface ContainerRegistryGetManifestPropertiesOptionalParams
956+
extends coreClient.OperationOptions {}
957+
926958
/** Contains response data for the getManifestProperties operation. */
927959
export type ContainerRegistryGetManifestPropertiesResponse = ArtifactManifestProperties;
928960

@@ -981,6 +1013,10 @@ export interface ContainerRegistryGetManifestsNextOptionalParams
9811013
export type ContainerRegistryGetManifestsNextResponse = ContainerRegistryGetManifestsNextHeaders &
9821014
AcrManifests;
9831015

1016+
/** Optional parameters. */
1017+
export interface ContainerRegistryBlobGetBlobOptionalParams
1018+
extends coreClient.OperationOptions {}
1019+
9841020
/** Contains response data for the getBlob operation. */
9851021
export type ContainerRegistryBlobGetBlobResponse = ContainerRegistryBlobGetBlobHeaders & {
9861022
/**
@@ -999,9 +1035,17 @@ export type ContainerRegistryBlobGetBlobResponse = ContainerRegistryBlobGetBlobH
9991035
readableStreamBody?: NodeJS.ReadableStream;
10001036
};
10011037

1038+
/** Optional parameters. */
1039+
export interface ContainerRegistryBlobCheckBlobExistsOptionalParams
1040+
extends coreClient.OperationOptions {}
1041+
10021042
/** Contains response data for the checkBlobExists operation. */
10031043
export type ContainerRegistryBlobCheckBlobExistsResponse = ContainerRegistryBlobCheckBlobExistsHeaders;
10041044

1045+
/** Optional parameters. */
1046+
export interface ContainerRegistryBlobDeleteBlobOptionalParams
1047+
extends coreClient.OperationOptions {}
1048+
10051049
/** Contains response data for the deleteBlob operation. */
10061050
export type ContainerRegistryBlobDeleteBlobResponse = ContainerRegistryBlobDeleteBlobHeaders & {
10071051
/**
@@ -1020,28 +1064,52 @@ export type ContainerRegistryBlobDeleteBlobResponse = ContainerRegistryBlobDelet
10201064
readableStreamBody?: NodeJS.ReadableStream;
10211065
};
10221066

1067+
/** Optional parameters. */
1068+
export interface ContainerRegistryBlobMountBlobOptionalParams
1069+
extends coreClient.OperationOptions {}
1070+
10231071
/** Contains response data for the mountBlob operation. */
10241072
export type ContainerRegistryBlobMountBlobResponse = ContainerRegistryBlobMountBlobHeaders;
10251073

1074+
/** Optional parameters. */
1075+
export interface ContainerRegistryBlobGetUploadStatusOptionalParams
1076+
extends coreClient.OperationOptions {}
1077+
10261078
/** Contains response data for the getUploadStatus operation. */
10271079
export type ContainerRegistryBlobGetUploadStatusResponse = ContainerRegistryBlobGetUploadStatusHeaders;
10281080

1081+
/** Optional parameters. */
1082+
export interface ContainerRegistryBlobUploadChunkOptionalParams
1083+
extends coreClient.OperationOptions {}
1084+
10291085
/** Contains response data for the uploadChunk operation. */
10301086
export type ContainerRegistryBlobUploadChunkResponse = ContainerRegistryBlobUploadChunkHeaders;
10311087

10321088
/** Optional parameters. */
10331089
export interface ContainerRegistryBlobCompleteUploadOptionalParams
10341090
extends coreClient.OperationOptions {
10351091
/** Optional raw data of blob */
1036-
value?: coreHttps.RequestBodyType;
1092+
value?: coreRestPipeline.RequestBodyType;
10371093
}
10381094

10391095
/** Contains response data for the completeUpload operation. */
10401096
export type ContainerRegistryBlobCompleteUploadResponse = ContainerRegistryBlobCompleteUploadHeaders;
10411097

1098+
/** Optional parameters. */
1099+
export interface ContainerRegistryBlobCancelUploadOptionalParams
1100+
extends coreClient.OperationOptions {}
1101+
1102+
/** Optional parameters. */
1103+
export interface ContainerRegistryBlobStartUploadOptionalParams
1104+
extends coreClient.OperationOptions {}
1105+
10421106
/** Contains response data for the startUpload operation. */
10431107
export type ContainerRegistryBlobStartUploadResponse = ContainerRegistryBlobStartUploadHeaders;
10441108

1109+
/** Optional parameters. */
1110+
export interface ContainerRegistryBlobGetChunkOptionalParams
1111+
extends coreClient.OperationOptions {}
1112+
10451113
/** Contains response data for the getChunk operation. */
10461114
export type ContainerRegistryBlobGetChunkResponse = ContainerRegistryBlobGetChunkHeaders & {
10471115
/**
@@ -1060,6 +1128,10 @@ export type ContainerRegistryBlobGetChunkResponse = ContainerRegistryBlobGetChun
10601128
readableStreamBody?: NodeJS.ReadableStream;
10611129
};
10621130

1131+
/** Optional parameters. */
1132+
export interface ContainerRegistryBlobCheckChunkExistsOptionalParams
1133+
extends coreClient.OperationOptions {}
1134+
10631135
/** Contains response data for the checkChunkExists operation. */
10641136
export type ContainerRegistryBlobCheckChunkExistsResponse = ContainerRegistryBlobCheckChunkExistsHeaders;
10651137

sdk/containerregistry/container-registry/src/generated/operations/authentication.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
*/
88

9+
import { Authentication } from "../operationsInterfaces";
910
import * as coreClient from "@azure/core-client";
1011
import * as Mappers from "../models/mappers";
1112
import * as Parameters from "../models/parameters";
@@ -18,7 +19,7 @@ import {
1819
} from "../models";
1920

2021
/** Class representing a Authentication. */
21-
export class Authentication {
22+
export class AuthenticationImpl implements Authentication {
2223
private readonly client: GeneratedClientContext;
2324

2425
/**

0 commit comments

Comments
 (0)