Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ContainerRegistry] switch to use official TS code generator #15777

Merged
merged 5 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions sdk/containerregistry/container-registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
"constantPaths": [
{
"path": "src/generated/generatedClientContext.ts",
"prefix": "packageVersion"
},
{
"path": "src/constants.ts",
"prefix": "SDK_VERSION"
"prefix": "const packageDetails"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeremymeng do you remember why having the const part here?

Copy link
Member Author

@jeremymeng jeremymeng Jul 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deyaaeldeen
Because this metadata is named "prefix" and the line

const packageDetails =azsdk-js-container-registry/1.0.0-beta.4;

contains const packageDetails at the beginning. However it doesn't have to be here, if packageDetails alone also works when the bot is bumping versions.

},
{
"path": "swagger/README.md",
Expand Down
4 changes: 0 additions & 4 deletions sdk/containerregistry/container-registry/src/constants.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { SpanStatusCode } from "@azure/core-tracing";
import "@azure/core-paging";
import { PageSettings, PagedAsyncIterableIterator } from "@azure/core-paging";

import { SDK_VERSION } from "./constants";
import { logger } from "./logger";
import { GeneratedClient } from "./generated";
import { createSpan } from "./tracing";
Expand Down Expand Up @@ -122,17 +121,6 @@ export class ContainerRegistryClient {
options = credentialOrOptions ?? {};
}

// The below code helps us set a proper User-Agent header on all requests
const libInfo = `azsdk-js-container-registry/${SDK_VERSION}`;
if (!options.userAgentOptions) {
options.userAgentOptions = {};
}
if (options.userAgentOptions.userAgentPrefix) {
options.userAgentOptions.userAgentPrefix = `${options.userAgentOptions.userAgentPrefix} ${libInfo}`;
} else {
options.userAgentOptions.userAgentPrefix = libInfo;
}

const internalPipelineOptions: InternalPipelineOptions = {
...options,
loggingOptions: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/

import {
ContainerRegistryImpl,
ContainerRegistryBlobImpl,
AuthenticationImpl
} from "./operations";
import {
ContainerRegistry,
ContainerRegistryBlob,
Authentication
} from "./operations";
} from "./operationsInterfaces";
import { GeneratedClientContext } from "./generatedClientContext";
import { GeneratedClientOptionalParams } from "./models";

Expand All @@ -23,9 +28,9 @@ export class GeneratedClient extends GeneratedClientContext {
*/
constructor(url: string, options?: GeneratedClientOptionalParams) {
super(url, options);
this.containerRegistry = new ContainerRegistry(this);
this.containerRegistryBlob = new ContainerRegistryBlob(this);
this.authentication = new Authentication(this);
this.containerRegistry = new ContainerRegistryImpl(this);
this.containerRegistryBlob = new ContainerRegistryBlobImpl(this);
this.authentication = new AuthenticationImpl(this);
}

containerRegistry: ContainerRegistry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,24 @@ export class GeneratedClientContext extends coreClient.ServiceClient {
if (!options) {
options = {};
}

const defaults: GeneratedClientOptionalParams = {
requestContentType: "application/json; charset=utf-8"
};

const packageDetails = `azsdk-js-container-registry/1.0.0-beta.4`;
ramya-rao-a marked this conversation as resolved.
Show resolved Hide resolved
const userAgentPrefix =
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
: `${packageDetails}`;

const optionsWithDefaults = {
...defaults,
...options,
userAgentOptions: {
userAgentPrefix
},
baseUri: options.endpoint || "{url}"
};

super(optionsWithDefaults);
// Parameter assignments
this.url = url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
export * from "./models";
export { GeneratedClient } from "./generatedClient";
export { GeneratedClientContext } from "./generatedClientContext";
export * from "./operationsInterfaces";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

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

/** Acr error response describing why the operation failed */
export interface AcrErrors {
Expand Down Expand Up @@ -230,12 +230,12 @@ export interface ManifestAttributesBase {
* CPU architecture
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly architecture?: ArtifactArchitecture | null;
readonly architecture?: ArtifactArchitecture;
/**
* Operating system
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly operatingSystem?: ArtifactOperatingSystem | null;
readonly operatingSystem?: ArtifactOperatingSystem;
/**
* 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.
* NOTE: This property will not be serialized. It can only be populated by the server.
Expand Down Expand Up @@ -331,12 +331,12 @@ export interface ArtifactManifestProperties {
* CPU architecture
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly architecture?: ArtifactArchitecture | null;
readonly architecture?: ArtifactArchitecture;
/**
* Operating system
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly operatingSystem?: ArtifactOperatingSystem | null;
readonly operatingSystem?: ArtifactOperatingSystem;
/**
* 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.
* NOTE: This property will not be serialized. It can only be populated by the server.
Expand Down Expand Up @@ -468,7 +468,7 @@ export interface Descriptor {
/** Specifies a list of URIs from which this object may be downloaded. */
urls?: string[];
/** Additional information provided through arbitrary metadata. */
annotations?: Annotations | null;
annotations?: Annotations;
}

/** Additional information provided through arbitrary metadata. */
Expand Down Expand Up @@ -553,7 +553,7 @@ export type ManifestWrapper = Manifest & {
/** (V2, OCI) List of V2 image layer information */
layers?: Descriptor[];
/** (OCI, OCIIndex) Additional metadata */
annotations?: Annotations | null;
annotations?: Annotations;
/** (V1) CPU architecture */
architecture?: string;
/** (V1) Image name */
Expand Down Expand Up @@ -593,15 +593,15 @@ export type OCIManifest = Manifest & {
/** List of V2 image layer information */
layers?: Descriptor[];
/** Additional information provided through arbitrary metadata. */
annotations?: Annotations | null;
annotations?: Annotations;
};

/** Returns the requested OCI index file */
export type OCIIndex = Manifest & {
/** List of OCI image layer information */
manifests?: ManifestListAttributes[];
/** Additional information provided through arbitrary metadata. */
annotations?: Annotations | null;
annotations?: Annotations;
};

/** Returns the requested V1 manifest file */
Expand Down Expand Up @@ -773,7 +773,7 @@ export const enum KnownArtifactArchitecture {
* Defines values for ArtifactArchitecture. \
* {@link KnownArtifactArchitecture} can be used interchangeably with ArtifactArchitecture,
* this enum contains the known values that the service supports.
* ### Know values supported by the service
* ### Known values supported by the service
* **386** \
* **amd64** \
* **arm** \
Expand Down Expand Up @@ -812,7 +812,7 @@ export const enum KnownArtifactOperatingSystem {
* Defines values for ArtifactOperatingSystem. \
* {@link KnownArtifactOperatingSystem} can be used interchangeably with ArtifactOperatingSystem,
* this enum contains the known values that the service supports.
* ### Know values supported by the service
* ### Known values supported by the service
* **aix** \
* **android** \
* **darwin** \
Expand All @@ -836,6 +836,10 @@ export type ArtifactTagOrderBy = "none" | "timedesc" | "timeasc";
/** Defines values for ArtifactManifestOrderBy. */
export type ArtifactManifestOrderBy = "none" | "timedesc" | "timeasc";

/** Optional parameters. */
export interface ContainerRegistryCheckDockerV2SupportOptionalParams
extends coreClient.OperationOptions {}

/** Optional parameters. */
export interface ContainerRegistryGetManifestOptionalParams
extends coreClient.OperationOptions {
Expand All @@ -846,12 +850,20 @@ export interface ContainerRegistryGetManifestOptionalParams
/** Contains response data for the getManifest operation. */
export type ContainerRegistryGetManifestResponse = Manifest;

/** Optional parameters. */
export interface ContainerRegistryCreateManifestOptionalParams
extends coreClient.OperationOptions {}

/** Contains response data for the createManifest operation. */
export type ContainerRegistryCreateManifestResponse = ContainerRegistryCreateManifestHeaders & {
/** The parsed response body. */
body: any;
};

/** Optional parameters. */
export interface ContainerRegistryDeleteManifestOptionalParams
extends coreClient.OperationOptions {}

/** Optional parameters. */
export interface ContainerRegistryGetRepositoriesOptionalParams
extends coreClient.OperationOptions {
Expand All @@ -865,9 +877,17 @@ export interface ContainerRegistryGetRepositoriesOptionalParams
export type ContainerRegistryGetRepositoriesResponse = ContainerRegistryGetRepositoriesHeaders &
Repositories;

/** Optional parameters. */
export interface ContainerRegistryGetPropertiesOptionalParams
extends coreClient.OperationOptions {}

/** Contains response data for the getProperties operation. */
export type ContainerRegistryGetPropertiesResponse = ContainerRepositoryProperties;

/** Optional parameters. */
export interface ContainerRegistryDeleteRepositoryOptionalParams
extends coreClient.OperationOptions {}

/** Optional parameters. */
export interface ContainerRegistryUpdatePropertiesOptionalParams
extends coreClient.OperationOptions {
Expand Down Expand Up @@ -895,6 +915,10 @@ export interface ContainerRegistryGetTagsOptionalParams
export type ContainerRegistryGetTagsResponse = ContainerRegistryGetTagsHeaders &
TagList;

/** Optional parameters. */
export interface ContainerRegistryGetTagPropertiesOptionalParams
extends coreClient.OperationOptions {}

/** Contains response data for the getTagProperties operation. */
export type ContainerRegistryGetTagPropertiesResponse = ArtifactTagProperties;

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

/** Optional parameters. */
export interface ContainerRegistryDeleteTagOptionalParams
extends coreClient.OperationOptions {}

/** Optional parameters. */
export interface ContainerRegistryGetManifestsOptionalParams
extends coreClient.OperationOptions {
Expand All @@ -923,6 +951,10 @@ export interface ContainerRegistryGetManifestsOptionalParams
export type ContainerRegistryGetManifestsResponse = ContainerRegistryGetManifestsHeaders &
AcrManifests;

/** Optional parameters. */
export interface ContainerRegistryGetManifestPropertiesOptionalParams
extends coreClient.OperationOptions {}

/** Contains response data for the getManifestProperties operation. */
export type ContainerRegistryGetManifestPropertiesResponse = ArtifactManifestProperties;

Expand Down Expand Up @@ -981,6 +1013,10 @@ export interface ContainerRegistryGetManifestsNextOptionalParams
export type ContainerRegistryGetManifestsNextResponse = ContainerRegistryGetManifestsNextHeaders &
AcrManifests;

/** Optional parameters. */
export interface ContainerRegistryBlobGetBlobOptionalParams
extends coreClient.OperationOptions {}

/** Contains response data for the getBlob operation. */
export type ContainerRegistryBlobGetBlobResponse = ContainerRegistryBlobGetBlobHeaders & {
/**
Expand All @@ -999,9 +1035,17 @@ export type ContainerRegistryBlobGetBlobResponse = ContainerRegistryBlobGetBlobH
readableStreamBody?: NodeJS.ReadableStream;
};

/** Optional parameters. */
export interface ContainerRegistryBlobCheckBlobExistsOptionalParams
extends coreClient.OperationOptions {}

/** Contains response data for the checkBlobExists operation. */
export type ContainerRegistryBlobCheckBlobExistsResponse = ContainerRegistryBlobCheckBlobExistsHeaders;

/** Optional parameters. */
export interface ContainerRegistryBlobDeleteBlobOptionalParams
extends coreClient.OperationOptions {}

/** Contains response data for the deleteBlob operation. */
export type ContainerRegistryBlobDeleteBlobResponse = ContainerRegistryBlobDeleteBlobHeaders & {
/**
Expand All @@ -1020,28 +1064,52 @@ export type ContainerRegistryBlobDeleteBlobResponse = ContainerRegistryBlobDelet
readableStreamBody?: NodeJS.ReadableStream;
};

/** Optional parameters. */
export interface ContainerRegistryBlobMountBlobOptionalParams
extends coreClient.OperationOptions {}

/** Contains response data for the mountBlob operation. */
export type ContainerRegistryBlobMountBlobResponse = ContainerRegistryBlobMountBlobHeaders;

/** Optional parameters. */
export interface ContainerRegistryBlobGetUploadStatusOptionalParams
extends coreClient.OperationOptions {}

/** Contains response data for the getUploadStatus operation. */
export type ContainerRegistryBlobGetUploadStatusResponse = ContainerRegistryBlobGetUploadStatusHeaders;

/** Optional parameters. */
export interface ContainerRegistryBlobUploadChunkOptionalParams
extends coreClient.OperationOptions {}

/** Contains response data for the uploadChunk operation. */
export type ContainerRegistryBlobUploadChunkResponse = ContainerRegistryBlobUploadChunkHeaders;

/** Optional parameters. */
export interface ContainerRegistryBlobCompleteUploadOptionalParams
extends coreClient.OperationOptions {
/** Optional raw data of blob */
value?: coreHttps.RequestBodyType;
value?: coreRestPipeline.RequestBodyType;
}

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

/** Optional parameters. */
export interface ContainerRegistryBlobCancelUploadOptionalParams
extends coreClient.OperationOptions {}

/** Optional parameters. */
export interface ContainerRegistryBlobStartUploadOptionalParams
extends coreClient.OperationOptions {}

/** Contains response data for the startUpload operation. */
export type ContainerRegistryBlobStartUploadResponse = ContainerRegistryBlobStartUploadHeaders;

/** Optional parameters. */
export interface ContainerRegistryBlobGetChunkOptionalParams
extends coreClient.OperationOptions {}

/** Contains response data for the getChunk operation. */
export type ContainerRegistryBlobGetChunkResponse = ContainerRegistryBlobGetChunkHeaders & {
/**
Expand All @@ -1060,6 +1128,10 @@ export type ContainerRegistryBlobGetChunkResponse = ContainerRegistryBlobGetChun
readableStreamBody?: NodeJS.ReadableStream;
};

/** Optional parameters. */
export interface ContainerRegistryBlobCheckChunkExistsOptionalParams
extends coreClient.OperationOptions {}

/** Contains response data for the checkChunkExists operation. */
export type ContainerRegistryBlobCheckChunkExistsResponse = ContainerRegistryBlobCheckChunkExistsHeaders;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/

import { Authentication } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
Expand All @@ -18,7 +19,7 @@ import {
} from "../models";

/** Class representing a Authentication. */
export class Authentication {
export class AuthenticationImpl implements Authentication {
private readonly client: GeneratedClientContext;

/**
Expand Down
Loading