From 03da0d918a66bbbdf86e1211146fb79f26821da9 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 22 Oct 2024 07:19:43 +0000 Subject: [PATCH] CodeGen from PR 31094 in Azure/azure-rest-api-specs Merge be8d6548085526f9dfb6fa0899d56e24b65233da into 0ea6f3e87651c19268983f3cc7411e21b1aed343 --- common/config/rush/pnpm-lock.yaml | 8 +- sdk/compute/arm-compute/CHANGELOG.md | 23 +- sdk/compute/arm-compute/_meta.json | 8 +- sdk/compute/arm-compute/package.json | 74 +++--- .../arm-compute/review/arm-compute.api.md | 34 +++ .../src/computeManagementClient.ts | 6 +- sdk/compute/arm-compute/src/models/index.ts | 44 +++- sdk/compute/arm-compute/src/models/mappers.ts | 56 ++++ .../arm-compute/src/models/parameters.ts | 44 +++- .../arm-compute/src/operations/index.ts | 1 + .../src/operations/softDeletedResource.ts | 243 ++++++++++++++++++ .../src/operationsInterfaces/index.ts | 1 + .../softDeletedResource.ts | 35 +++ sdk/compute/arm-compute/test/sampleTest.ts | 43 ++++ sdk/compute/arm-compute/tsconfig.json | 10 +- 15 files changed, 555 insertions(+), 75 deletions(-) create mode 100644 sdk/compute/arm-compute/src/operations/softDeletedResource.ts create mode 100644 sdk/compute/arm-compute/src/operationsInterfaces/softDeletedResource.ts create mode 100644 sdk/compute/arm-compute/test/sampleTest.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index c1aa47916a97..267ce9345e04 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -10843,7 +10843,7 @@ packages: resolve-import: 1.4.6 rimraf: 5.0.10 sync-content: 1.0.2 - typescript: 5.5.4 + typescript: 5.6.3 walk-up-path: 3.0.1 dev: false @@ -13756,7 +13756,7 @@ packages: dev: false file:projects/arm-compute-1.tgz: - resolution: {integrity: sha512-ODLRyAFUrC7ZPKjPMg854wvS/rryYoa+X++OJM8UtXpZOnw/PumlLJLt0upMGBFN0oD2lFoRAvm18H0K0i2uuA==, tarball: file:projects/arm-compute-1.tgz} + resolution: {integrity: sha512-FRq4R191ehgUoTZ1NnbCnBhr0TOSPI3wtx5EhYWn7wV0T4h5YnAkmwobf86bTYujt9ar259eLnuSk+YvhmHG3g==, tarball: file:projects/arm-compute-1.tgz} name: '@rush-temp/arm-compute-1' version: 0.0.0 dependencies: @@ -13775,10 +13775,10 @@ packages: mkdirp: 3.0.1 mocha: 10.7.3 rimraf: 5.0.10 - ts-node: 10.9.2(@types/node@18.19.57)(typescript@5.6.3) + ts-node: 10.9.2(@types/node@18.19.57)(typescript@5.5.4) tslib: 2.8.0 tsx: 4.19.1 - typescript: 5.6.3 + typescript: 5.5.4 uglify-js: 3.19.3 transitivePeerDependencies: - '@swc/core' diff --git a/sdk/compute/arm-compute/CHANGELOG.md b/sdk/compute/arm-compute/CHANGELOG.md index dc8b08a3c947..417833c71ae3 100644 --- a/sdk/compute/arm-compute/CHANGELOG.md +++ b/sdk/compute/arm-compute/CHANGELOG.md @@ -1,15 +1,18 @@ # Release History - -## 22.1.1 (Unreleased) - + +## 22.2.0 (2024-10-22) + ### Features Added -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - Added operation group SoftDeletedResource + - Added Interface GallerySoftDeletedResource + - Added Interface GallerySoftDeletedResourceList + - Added Interface SoftDeletedResourceListByArtifactNameNextOptionalParams + - Added Interface SoftDeletedResourceListByArtifactNameOptionalParams + - Added Type Alias SoftDeletedResourceListByArtifactNameNextResponse + - Added Type Alias SoftDeletedResourceListByArtifactNameResponse + + ## 22.1.0 (2024-08-12) ### Features Added @@ -579,7 +582,7 @@ ## 17.3.1 (2022-04-06) -### Features Added +**features** - Bug fix diff --git a/sdk/compute/arm-compute/_meta.json b/sdk/compute/arm-compute/_meta.json index 08483ff528c8..ddf0297324e9 100644 --- a/sdk/compute/arm-compute/_meta.json +++ b/sdk/compute/arm-compute/_meta.json @@ -1,8 +1,8 @@ { - "commit": "3cef1bf0125458cc60dfb9e644e6bc28b787beab", + "commit": "257cff940cdf54e42f4fd6b037003db4ca0f14bd", "readme": "specification/compute/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\compute\\resource-manager\\readme.md --use=@autorest/typescript@6.0.23 --generate-sample=true", + "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/compute/resource-manager/readme.md --use=@autorest/typescript@^6.0.12", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.7.11", - "use": "@autorest/typescript@6.0.23" + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.14", + "use": "@autorest/typescript@^6.0.12" } \ No newline at end of file diff --git a/sdk/compute/arm-compute/package.json b/sdk/compute/arm-compute/package.json index 2f5aebfa28d7..5cebc01696fd 100644 --- a/sdk/compute/arm-compute/package.json +++ b/sdk/compute/arm-compute/package.json @@ -3,16 +3,16 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for ComputeManagementClient.", - "version": "22.1.1", + "version": "22.2.0", "engines": { "node": ">=18.0.0" }, "dependencies": { - "@azure/abort-controller": "^1.0.0", - "@azure/core-auth": "^1.6.0", - "@azure/core-client": "^1.7.0", "@azure/core-lro": "^2.5.4", + "@azure/abort-controller": "^2.1.2", "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.7.0", + "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.14.0", "tslib": "^2.2.0" }, @@ -28,25 +28,24 @@ "module": "./dist-esm/src/index.js", "types": "./types/arm-compute.d.ts", "devDependencies": { - "@azure-tools/test-credential": "^1.1.0", - "@azure-tools/test-recorder": "^3.0.0", - "@azure/arm-network": "^32.2.0", - "@azure/dev-tool": "^1.0.0", - "@azure/identity": "^4.0.1", "@microsoft/api-extractor": "^7.31.1", - "@types/chai": "^4.2.8", - "@types/mocha": "^10.0.0", - "@types/node": "^18.0.0", - "chai": "^4.2.0", - "cross-env": "^7.0.2", - "dotenv": "^16.0.0", "mkdirp": "^3.0.1", - "mocha": "^10.0.0", + "typescript": "~5.5.3", + "uglify-js": "^3.4.9", "rimraf": "^5.0.0", - "ts-node": "^10.0.0", + "dotenv": "^16.0.0", + "@azure/dev-tool": "^1.0.0", + "@azure/identity": "^4.2.1", + "@azure-tools/test-recorder": "^3.0.0", + "@azure-tools/test-credential": "^1.1.0", + "mocha": "^10.0.0", + "@types/mocha": "^10.0.0", "tsx": "^4.7.1", - "typescript": "~5.6.2", - "uglify-js": "^3.4.9" + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@types/node": "^18.0.0", + "ts-node": "^10.0.0" }, "repository": { "type": "git", @@ -74,29 +73,28 @@ ], "scripts": { "build": "npm run clean && tsc && dev-tool run bundle && npm run minify && mkdirp ./review && npm run extract-api", - "build:browser": "echo skipped", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "dev-tool run extract-api", + "lint": "echo skipped", + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", - "build:samples": "echo skipped.", + "build:browser": "echo skipped", "build:test": "echo skipped", + "build:samples": "echo skipped.", "check-format": "echo skipped", - "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "execute:samples": "echo skipped", - "extract-api": "dev-tool run extract-api", "format": "echo skipped", - "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:browser": "echo skipped", - "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", - "lint": "echo skipped", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", - "pack": "npm pack 2>&1", - "prepack": "npm run build", "test": "npm run integration-test", - "test:browser": "echo skipped", "test:node": "echo skipped", + "test:browser": "echo skipped", "unit-test": "npm run unit-test:node && npm run unit-test:browser", - "unit-test:browser": "echo skipped", "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", - "update-snippets": "echo skipped" + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" }, "sideEffects": false, "//metadata": { @@ -108,13 +106,5 @@ ] }, "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/compute/arm-compute", - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-compute?view=azure-node-preview" - } + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/compute/arm-compute" } \ No newline at end of file diff --git a/sdk/compute/arm-compute/review/arm-compute.api.md b/sdk/compute/arm-compute/review/arm-compute.api.md index d9f1a58260a2..1ef5e699c91d 100644 --- a/sdk/compute/arm-compute/review/arm-compute.api.md +++ b/sdk/compute/arm-compute/review/arm-compute.api.md @@ -1150,6 +1150,8 @@ export class ComputeManagementClient extends coreClient.ServiceClient { // (undocumented) snapshots: Snapshots; // (undocumented) + softDeletedResource: SoftDeletedResource; + // (undocumented) sshPublicKeys: SshPublicKeys; // (undocumented) subscriptionId: string; @@ -2859,6 +2861,19 @@ export interface GallerySharingProfileUpdateOptionalParams extends coreClient.Op // @public export type GallerySharingProfileUpdateResponse = SharingUpdate; +// @public +export interface GallerySoftDeletedResource extends Resource { + resourceArmId?: string; + softDeletedArtifactType?: string; + softDeletedTime?: string; +} + +// @public +export interface GallerySoftDeletedResourceList { + nextLink?: string; + value: GallerySoftDeletedResource[]; +} + // @public (undocumented) export interface GalleryTargetExtendedLocation { encryption?: EncryptionImages; @@ -5699,6 +5714,25 @@ export interface SnapshotUpdate { }; } +// @public +export interface SoftDeletedResource { + listByArtifactName(resourceGroupName: string, galleryName: string, artifactType: string, artifactName: string, options?: SoftDeletedResourceListByArtifactNameOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface SoftDeletedResourceListByArtifactNameNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SoftDeletedResourceListByArtifactNameNextResponse = GallerySoftDeletedResourceList; + +// @public +export interface SoftDeletedResourceListByArtifactNameOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SoftDeletedResourceListByArtifactNameResponse = GallerySoftDeletedResourceList; + // @public export interface SoftDeletePolicy { isSoftDeleteEnabled?: boolean; diff --git a/sdk/compute/arm-compute/src/computeManagementClient.ts b/sdk/compute/arm-compute/src/computeManagementClient.ts index c266e72e2ce4..7bd2b9048e31 100644 --- a/sdk/compute/arm-compute/src/computeManagementClient.ts +++ b/sdk/compute/arm-compute/src/computeManagementClient.ts @@ -47,6 +47,7 @@ import { GalleryImageVersionsImpl, GalleryApplicationsImpl, GalleryApplicationVersionsImpl, + SoftDeletedResourceImpl, GallerySharingProfileImpl, SharedGalleriesImpl, SharedGalleryImagesImpl, @@ -98,6 +99,7 @@ import { GalleryImageVersions, GalleryApplications, GalleryApplicationVersions, + SoftDeletedResource, GallerySharingProfile, SharedGalleries, SharedGalleryImages, @@ -145,7 +147,7 @@ export class ComputeManagementClient extends coreClient.ServiceClient { credential: credentials, }; - const packageDetails = `azsdk-js-arm-compute/22.1.1`; + const packageDetails = `azsdk-js-arm-compute/22.2.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -244,6 +246,7 @@ export class ComputeManagementClient extends coreClient.ServiceClient { this.galleryImageVersions = new GalleryImageVersionsImpl(this); this.galleryApplications = new GalleryApplicationsImpl(this); this.galleryApplicationVersions = new GalleryApplicationVersionsImpl(this); + this.softDeletedResource = new SoftDeletedResourceImpl(this); this.gallerySharingProfile = new GallerySharingProfileImpl(this); this.sharedGalleries = new SharedGalleriesImpl(this); this.sharedGalleryImages = new SharedGalleryImagesImpl(this); @@ -299,6 +302,7 @@ export class ComputeManagementClient extends coreClient.ServiceClient { galleryImageVersions: GalleryImageVersions; galleryApplications: GalleryApplications; galleryApplicationVersions: GalleryApplicationVersions; + softDeletedResource: SoftDeletedResource; gallerySharingProfile: GallerySharingProfile; sharedGalleries: SharedGalleries; sharedGalleryImages: SharedGalleryImages; diff --git a/sdk/compute/arm-compute/src/models/index.ts b/sdk/compute/arm-compute/src/models/index.ts index 4097b9dd04c9..023a288f8799 100644 --- a/sdk/compute/arm-compute/src/models/index.ts +++ b/sdk/compute/arm-compute/src/models/index.ts @@ -1709,7 +1709,7 @@ export interface DataDisk { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly diskMBpsReadWrite?: number; - /** Specifies the detach behavior to be used while detaching a disk or which is already in the process of detachment from the virtual machine. Supported values: **ForceDetach.** detachOption: **ForceDetach** is applicable only for managed data disks. If a previous detachment attempt of the data disk did not complete due to an unexpected failure from the virtual machine and the disk is still not released then use force-detach as a last resort option to detach the disk forcibly from the VM. All writes might not have been flushed when using this detach behavior. **This feature is still in preview** mode and is not supported for VirtualMachineScaleSet. To force-detach a data disk update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. */ + /** Specifies the detach behavior to be used while detaching a disk or which is already in the process of detachment from the virtual machine. Supported values: **ForceDetach.** detachOption: **ForceDetach** is applicable only for managed data disks. If a previous detachment attempt of the data disk did not complete due to an unexpected failure from the virtual machine and the disk is still not released then use force-detach as a last resort option to detach the disk forcibly from the VM. All writes might not have been flushed when using this detach behavior. **This feature is still in preview**. To force-detach a data disk update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. */ detachOption?: DiskDetachOptionTypes; /** Specifies whether data disk should be deleted or detached upon VM deletion. Possible values are: **Delete.** If this value is used, the data disk is deleted when VM is deleted. **Detach.** If this value is used, the data disk is retained after VM is deleted. The default value is set to **Detach**. */ deleteOption?: DiskDeleteOptionTypes; @@ -4125,6 +4125,14 @@ export interface GalleryApplicationVersionList { nextLink?: string; } +/** The List Soft-deleted Resources operation response. */ +export interface GallerySoftDeletedResourceList { + /** A list of soft-deleted resources. */ + value: GallerySoftDeletedResource[]; + /** The uri to fetch the next page of soft-deleted resources. Call ListNext() with this to fetch the next page of soft-deleted resources. */ + nextLink?: string; +} + /** Specifies information about the gallery sharing profile update. */ export interface SharingUpdate { /** This property allows you to specify the operation type of gallery sharing update. Possible values are: **Add,** **Remove,** **Reset.** */ @@ -6003,7 +6011,7 @@ export interface GalleryImage extends Resource { readonly provisioningState?: GalleryProvisioningState; /** A list of gallery image features. */ features?: GalleryImageFeature[]; - /** The architecture of the image. Applicable to OS disks only. */ + /** CPU architecture supported by an OS disk. */ architecture?: Architecture; } @@ -6065,6 +6073,16 @@ export interface GalleryApplicationVersion extends Resource { readonly replicationStatus?: ReplicationStatus; } +/** The details information of soft-deleted resource. */ +export interface GallerySoftDeletedResource extends Resource { + /** arm id of the soft-deleted resource */ + resourceArmId?: string; + /** artifact type of the soft-deleted resource */ + softDeletedArtifactType?: string; + /** The timestamp for when the resource is soft-deleted. */ + softDeletedTime?: string; +} + /** Describes a Virtual Machine Scale Set. */ export interface VirtualMachineScaleSetUpdate extends UpdateResource { /** The virtual machine scale set sku. */ @@ -6672,7 +6690,7 @@ export interface GalleryImageUpdate extends UpdateResourceDefinition { readonly provisioningState?: GalleryProvisioningState; /** A list of gallery image features. */ features?: GalleryImageFeature[]; - /** The architecture of the image. Applicable to OS disks only. */ + /** CPU architecture supported by an OS disk. */ architecture?: Architecture; } @@ -6857,7 +6875,7 @@ export interface CommunityGalleryImage extends PirCommunityGalleryResource { features?: GalleryImageFeature[]; /** Describes the gallery image definition purchase plan. This is used by marketplace images. */ purchasePlan?: ImagePurchasePlan; - /** The architecture of the image. Applicable to OS disks only. */ + /** CPU architecture supported by an OS disk. */ architecture?: Architecture; /** Privacy statement URI for the current community gallery image. */ privacyStatementUri?: string; @@ -6942,7 +6960,7 @@ export interface SharedGalleryImage extends PirSharedGalleryResource { features?: GalleryImageFeature[]; /** Describes the gallery image definition purchase plan. This is used by marketplace images. */ purchasePlan?: ImagePurchasePlan; - /** The architecture of the image. Applicable to OS disks only. */ + /** CPU architecture supported by an OS disk. */ architecture?: Architecture; /** Privacy statement uri for the current community gallery image. */ privacyStatementUri?: string; @@ -12538,6 +12556,22 @@ export interface GalleryApplicationVersionsListByGalleryApplicationNextOptionalP export type GalleryApplicationVersionsListByGalleryApplicationNextResponse = GalleryApplicationVersionList; +/** Optional parameters. */ +export interface SoftDeletedResourceListByArtifactNameOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByArtifactName operation. */ +export type SoftDeletedResourceListByArtifactNameResponse = + GallerySoftDeletedResourceList; + +/** Optional parameters. */ +export interface SoftDeletedResourceListByArtifactNameNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByArtifactNameNext operation. */ +export type SoftDeletedResourceListByArtifactNameNextResponse = + GallerySoftDeletedResourceList; + /** Optional parameters. */ export interface GallerySharingProfileUpdateOptionalParams extends coreClient.OperationOptions { diff --git a/sdk/compute/arm-compute/src/models/mappers.ts b/sdk/compute/arm-compute/src/models/mappers.ts index fde041ec9ae2..e471f6aae7c2 100644 --- a/sdk/compute/arm-compute/src/models/mappers.ts +++ b/sdk/compute/arm-compute/src/models/mappers.ts @@ -10919,6 +10919,34 @@ export const GalleryApplicationVersionList: coreClient.CompositeMapper = { }, }; +export const GallerySoftDeletedResourceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GallerySoftDeletedResourceList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "GallerySoftDeletedResource", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String", + }, + }, + }, + }, +}; + export const SharingUpdate: coreClient.CompositeMapper = { type: { name: "Composite", @@ -15654,6 +15682,34 @@ export const GalleryApplicationVersion: coreClient.CompositeMapper = { }, }; +export const GallerySoftDeletedResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GallerySoftDeletedResource", + modelProperties: { + ...Resource.type.modelProperties, + resourceArmId: { + serializedName: "properties.resourceArmId", + type: { + name: "String", + }, + }, + softDeletedArtifactType: { + serializedName: "properties.softDeletedArtifactType", + type: { + name: "String", + }, + }, + softDeletedTime: { + serializedName: "properties.softDeletedTime", + type: { + name: "String", + }, + }, + }, + }, +}; + export const VirtualMachineScaleSetUpdate: coreClient.CompositeMapper = { type: { name: "Composite", diff --git a/sdk/compute/arm-compute/src/models/parameters.ts b/sdk/compute/arm-compute/src/models/parameters.ts index 9db43162f04a..52d886b17b6b 100644 --- a/sdk/compute/arm-compute/src/models/parameters.ts +++ b/sdk/compute/arm-compute/src/models/parameters.ts @@ -1169,7 +1169,7 @@ export const galleryName: OperationURLParameter = { export const apiVersion3: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2023-07-03", + defaultValue: "2024-03-03", isConstant: true, serializedName: "api-version", type: { @@ -1297,6 +1297,48 @@ export const galleryApplicationVersion1: OperationParameter = { mapper: GalleryApplicationVersionUpdateMapper, }; +export const galleryName1: OperationURLParameter = { + parameterPath: "galleryName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9]+([_]?[a-zA-Z0-9]+)*$"), + }, + serializedName: "galleryName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const artifactType: OperationURLParameter = { + parameterPath: "artifactType", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9]+([_]?[a-zA-Z0-9]+)*$"), + }, + serializedName: "artifactType", + required: true, + type: { + name: "String", + }, + }, +}; + +export const artifactName: OperationURLParameter = { + parameterPath: "artifactName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9]+([_]?[a-zA-Z0-9]+)*$"), + }, + serializedName: "artifactName", + required: true, + type: { + name: "String", + }, + }, +}; + export const sharingUpdate: OperationParameter = { parameterPath: "sharingUpdate", mapper: SharingUpdateMapper, diff --git a/sdk/compute/arm-compute/src/operations/index.ts b/sdk/compute/arm-compute/src/operations/index.ts index 502684dc464f..4426c9b99678 100644 --- a/sdk/compute/arm-compute/src/operations/index.ts +++ b/sdk/compute/arm-compute/src/operations/index.ts @@ -43,6 +43,7 @@ export * from "./galleryImages"; export * from "./galleryImageVersions"; export * from "./galleryApplications"; export * from "./galleryApplicationVersions"; +export * from "./softDeletedResource"; export * from "./gallerySharingProfile"; export * from "./sharedGalleries"; export * from "./sharedGalleryImages"; diff --git a/sdk/compute/arm-compute/src/operations/softDeletedResource.ts b/sdk/compute/arm-compute/src/operations/softDeletedResource.ts new file mode 100644 index 000000000000..f95ad5267a75 --- /dev/null +++ b/sdk/compute/arm-compute/src/operations/softDeletedResource.ts @@ -0,0 +1,243 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { SoftDeletedResource } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ComputeManagementClient } from "../computeManagementClient"; +import { + GallerySoftDeletedResource, + SoftDeletedResourceListByArtifactNameNextOptionalParams, + SoftDeletedResourceListByArtifactNameOptionalParams, + SoftDeletedResourceListByArtifactNameResponse, + SoftDeletedResourceListByArtifactNameNextResponse, +} from "../models"; + +/// +/** Class containing SoftDeletedResource operations. */ +export class SoftDeletedResourceImpl implements SoftDeletedResource { + private readonly client: ComputeManagementClient; + + /** + * Initialize a new instance of the class SoftDeletedResource class. + * @param client Reference to the service client + */ + constructor(client: ComputeManagementClient) { + this.client = client; + } + + /** + * List soft-deleted resources of an artifact in the gallery, such as soft-deleted gallery image + * version of an image. + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Gallery in which the soft-deleted resources resides. + * @param artifactType The type of the artifact to be listed, such as gallery image version. + * @param artifactName The artifact name to be listed. If artifact type is Images, then the artifact + * name should be the gallery image name. + * @param options The options parameters. + */ + public listByArtifactName( + resourceGroupName: string, + galleryName: string, + artifactType: string, + artifactName: string, + options?: SoftDeletedResourceListByArtifactNameOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listByArtifactNamePagingAll( + resourceGroupName, + galleryName, + artifactType, + artifactName, + options, + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByArtifactNamePagingPage( + resourceGroupName, + galleryName, + artifactType, + artifactName, + options, + settings, + ); + }, + }; + } + + private async *listByArtifactNamePagingPage( + resourceGroupName: string, + galleryName: string, + artifactType: string, + artifactName: string, + options?: SoftDeletedResourceListByArtifactNameOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: SoftDeletedResourceListByArtifactNameResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByArtifactName( + resourceGroupName, + galleryName, + artifactType, + artifactName, + options, + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByArtifactNameNext( + resourceGroupName, + galleryName, + artifactType, + artifactName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByArtifactNamePagingAll( + resourceGroupName: string, + galleryName: string, + artifactType: string, + artifactName: string, + options?: SoftDeletedResourceListByArtifactNameOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listByArtifactNamePagingPage( + resourceGroupName, + galleryName, + artifactType, + artifactName, + options, + )) { + yield* page; + } + } + + /** + * List soft-deleted resources of an artifact in the gallery, such as soft-deleted gallery image + * version of an image. + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Gallery in which the soft-deleted resources resides. + * @param artifactType The type of the artifact to be listed, such as gallery image version. + * @param artifactName The artifact name to be listed. If artifact type is Images, then the artifact + * name should be the gallery image name. + * @param options The options parameters. + */ + private _listByArtifactName( + resourceGroupName: string, + galleryName: string, + artifactType: string, + artifactName: string, + options?: SoftDeletedResourceListByArtifactNameOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, galleryName, artifactType, artifactName, options }, + listByArtifactNameOperationSpec, + ); + } + + /** + * ListByArtifactNameNext + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Gallery in which the soft-deleted resources resides. + * @param artifactType The type of the artifact to be listed, such as gallery image version. + * @param artifactName The artifact name to be listed. If artifact type is Images, then the artifact + * name should be the gallery image name. + * @param nextLink The nextLink from the previous successful call to the ListByArtifactName method. + * @param options The options parameters. + */ + private _listByArtifactNameNext( + resourceGroupName: string, + galleryName: string, + artifactType: string, + artifactName: string, + nextLink: string, + options?: SoftDeletedResourceListByArtifactNameNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + galleryName, + artifactType, + artifactName, + nextLink, + options, + }, + listByArtifactNameNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByArtifactNameOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/softDeletedArtifactTypes/{artifactType}/artifacts/{artifactName}/versions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GallerySoftDeletedResourceList, + }, + default: { + bodyMapper: Mappers.CloudError, + }, + }, + queryParameters: [Parameters.apiVersion3], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.galleryName1, + Parameters.artifactType, + Parameters.artifactName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listByArtifactNameNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GallerySoftDeletedResourceList, + }, + default: { + bodyMapper: Mappers.CloudError, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink, + Parameters.resourceGroupName, + Parameters.galleryName1, + Parameters.artifactType, + Parameters.artifactName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/compute/arm-compute/src/operationsInterfaces/index.ts b/sdk/compute/arm-compute/src/operationsInterfaces/index.ts index 502684dc464f..4426c9b99678 100644 --- a/sdk/compute/arm-compute/src/operationsInterfaces/index.ts +++ b/sdk/compute/arm-compute/src/operationsInterfaces/index.ts @@ -43,6 +43,7 @@ export * from "./galleryImages"; export * from "./galleryImageVersions"; export * from "./galleryApplications"; export * from "./galleryApplicationVersions"; +export * from "./softDeletedResource"; export * from "./gallerySharingProfile"; export * from "./sharedGalleries"; export * from "./sharedGalleryImages"; diff --git a/sdk/compute/arm-compute/src/operationsInterfaces/softDeletedResource.ts b/sdk/compute/arm-compute/src/operationsInterfaces/softDeletedResource.ts new file mode 100644 index 000000000000..7e00f5ff512f --- /dev/null +++ b/sdk/compute/arm-compute/src/operationsInterfaces/softDeletedResource.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + GallerySoftDeletedResource, + SoftDeletedResourceListByArtifactNameOptionalParams, +} from "../models"; + +/// +/** Interface representing a SoftDeletedResource. */ +export interface SoftDeletedResource { + /** + * List soft-deleted resources of an artifact in the gallery, such as soft-deleted gallery image + * version of an image. + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Gallery in which the soft-deleted resources resides. + * @param artifactType The type of the artifact to be listed, such as gallery image version. + * @param artifactName The artifact name to be listed. If artifact type is Images, then the artifact + * name should be the gallery image name. + * @param options The options parameters. + */ + listByArtifactName( + resourceGroupName: string, + galleryName: string, + artifactType: string, + artifactName: string, + options?: SoftDeletedResourceListByArtifactNameOptionalParams, + ): PagedAsyncIterableIterator; +} diff --git a/sdk/compute/arm-compute/test/sampleTest.ts b/sdk/compute/arm-compute/test/sampleTest.ts new file mode 100644 index 000000000000..d64be981b694 --- /dev/null +++ b/sdk/compute/arm-compute/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + Recorder, + RecorderStartOptions, + env, +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id", +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables, +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function (this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function () { + await recorder.stop(); + }); + + it("sample test", async function () { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/compute/arm-compute/tsconfig.json b/sdk/compute/arm-compute/tsconfig.json index b84abc8423ab..3e6ae96443f3 100644 --- a/sdk/compute/arm-compute/tsconfig.json +++ b/sdk/compute/arm-compute/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-compute": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"