diff --git a/sdk/compute/arm-compute/CHANGELOG.md b/sdk/compute/arm-compute/CHANGELOG.md index dc8b08a3c947..e5babc7a6a64 100644 --- a/sdk/compute/arm-compute/CHANGELOG.md +++ b/sdk/compute/arm-compute/CHANGELOG.md @@ -1,15 +1,16 @@ # Release History - -## 22.1.1 (Unreleased) - + +## 22.2.0 (2024-11-29) + ### Features Added -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - Added Interface Placement + - Added Type Alias ZonePlacementPolicyType + - Interface StorageProfile has a new optional parameter alignRegionalDisksToVMZone + - Interface VirtualMachine has a new optional parameter placement + - Added Enum KnownZonePlacementPolicyType + + ## 22.1.0 (2024-08-12) ### Features Added @@ -579,7 +580,7 @@ ## 17.3.1 (2022-04-06) -### Features Added +**features** - Bug fix diff --git a/sdk/compute/arm-compute/README.md b/sdk/compute/arm-compute/README.md index 89796d2c1def..1a6c254d2960 100644 --- a/sdk/compute/arm-compute/README.md +++ b/sdk/compute/arm-compute/README.md @@ -44,7 +44,6 @@ npm install @azure/identity ``` You will also need to **register a new AAD application and grant access to Azure ComputeManagement** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). -Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). diff --git a/sdk/compute/arm-compute/_meta.json b/sdk/compute/arm-compute/_meta.json index 08483ff528c8..6acc46c70816 100644 --- a/sdk/compute/arm-compute/_meta.json +++ b/sdk/compute/arm-compute/_meta.json @@ -1,8 +1,8 @@ { - "commit": "3cef1bf0125458cc60dfb9e644e6bc28b787beab", + "commit": "f858c60c83ddb0b647e6c4801d7f32e250fb8cc0", "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.16", + "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 212a8e9ed94c..284b901a2cac 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,20 +28,19 @@ "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", - "@types/chai": "^4.2.8", - "@types/mocha": "^10.0.0", - "@types/node": "^18.0.0", - "chai": "^4.2.0", + "typescript": "~5.6.2", "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", - "ts-node": "^10.0.0", + "@types/mocha": "^10.0.0", "tsx": "^4.7.1", - "typescript": "~5.6.2" + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "@types/node": "^18.0.0", + "ts-node": "^10.0.0" }, "repository": { "type": "git", @@ -69,28 +68,28 @@ ], "scripts": { "build": "npm run clean && tsc && dev-tool run bundle && npm run minify && dev-tool run vendored mkdirp ./review && npm run extract-api", - "build:browser": "echo skipped", + "minify": "dev-tool run vendored 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": "dev-tool run vendored 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": "dev-tool run vendored 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": "dev-tool run vendored 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": "dev-tool run vendored cross-env TEST_MODE=playback npm run integration-test:node", + "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", "update-snippets": "echo skipped" }, "sideEffects": false, @@ -103,13 +102,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..0cec62b9f694 100644 --- a/sdk/compute/arm-compute/review/arm-compute.api.md +++ b/sdk/compute/arm-compute/review/arm-compute.api.md @@ -4063,6 +4063,11 @@ export enum KnownZonalPlatformFaultDomainAlignMode { Unaligned = "Unaligned" } +// @public +export enum KnownZonePlacementPolicyType { + Any = "Any" +} + // @public export interface LastPatchInstallationSummary { readonly error?: ApiError; @@ -4459,6 +4464,13 @@ export interface PirSharedGalleryResource extends PirResource { uniqueId?: string; } +// @public +export interface Placement { + excludeZones?: string[]; + includeZones?: string[]; + zonePlacementPolicy?: ZonePlacementPolicyType; +} + // @public export interface Plan { name?: string; @@ -5846,6 +5858,7 @@ export type StorageAccountTypes = string; // @public export interface StorageProfile { + alignRegionalDisksToVMZone?: boolean; dataDisks?: DataDisk[]; diskControllerType?: DiskControllerTypes; imageReference?: ImageReference; @@ -6100,6 +6113,7 @@ export interface VirtualMachine extends Resource { readonly managedBy?: string; networkProfile?: NetworkProfile; osProfile?: OSProfile; + placement?: Placement; plan?: Plan; platformFaultDomain?: number; priority?: VirtualMachinePriorityTypes; @@ -8387,6 +8401,9 @@ export interface WinRMListener { // @public export type ZonalPlatformFaultDomainAlignMode = string; +// @public +export type ZonePlacementPolicyType = string; + // (No @packageDocumentation comment for this package) ``` diff --git a/sdk/compute/arm-compute/sample.env b/sdk/compute/arm-compute/sample.env index 672847a3fea0..508439fc7d62 100644 --- a/sdk/compute/arm-compute/sample.env +++ b/sdk/compute/arm-compute/sample.env @@ -1,4 +1 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/compute/arm-compute/src/computeManagementClient.ts b/sdk/compute/arm-compute/src/computeManagementClient.ts index c266e72e2ce4..d447225992e1 100644 --- a/sdk/compute/arm-compute/src/computeManagementClient.ts +++ b/sdk/compute/arm-compute/src/computeManagementClient.ts @@ -145,7 +145,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}` diff --git a/sdk/compute/arm-compute/src/models/index.ts b/sdk/compute/arm-compute/src/models/index.ts index 4097b9dd04c9..002a46124b6f 100644 --- a/sdk/compute/arm-compute/src/models/index.ts +++ b/sdk/compute/arm-compute/src/models/index.ts @@ -1645,6 +1645,8 @@ export interface StorageProfile { dataDisks?: DataDisk[]; /** Specifies the disk controller type configured for the VM. **Note:** This property will be set to the default disk controller type if not specified provided virtual machine is being created with 'hyperVGeneration' set to V2 based on the capabilities of the operating system disk and VM size from the the specified minimum api version. You need to deallocate the VM before updating its disk controller type unless you are updating the VM size in the VM configuration which implicitly deallocates and reallocates the VM. Minimum api-version: 2022-08-01. */ diskControllerType?: DiskControllerTypes; + /** Specifies whether the regional disks should be aligned/moved to the VM zone. This is applicable only for VMs with placement property set. Please note that this change is irreversible. Minimum api-version: 2024-11-01. */ + alignRegionalDisksToVMZone?: boolean; } /** Specifies information about the operating system disk used by the virtual machine. For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). */ @@ -1709,7 +1711,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. 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; @@ -2128,6 +2130,16 @@ export interface LastPatchInstallationSummary { readonly error?: ApiError; } +/** Describes the user-defined constraints for virtual machine hardware placement. */ +export interface Placement { + /** Specifies the policy for virtual machine's placement in availability zone. Possible values are: **Any** - An availability zone will be automatically picked by system as part of virtual machine creation. */ + zonePlacementPolicy?: ZonePlacementPolicyType; + /** This property supplements the 'zonePlacementPolicy' property. If 'zonePlacementPolicy' is set to 'Any', availability zone selected by the system must be present in the list of availability zones passed with 'includeZones'. If 'includeZones' is not provided, all availability zones in region will be considered for selection. */ + includeZones?: string[]; + /** This property supplements the 'zonePlacementPolicy' property. If 'zonePlacementPolicy' is set to 'Any', availability zone selected by the system must not be present in the list of availability zones passed with 'excludeZones'. If 'excludeZones' is not provided, all availability zones in region will be considered for selection. */ + excludeZones?: string[]; +} + /** Capture Virtual Machine parameters. */ export interface VirtualMachineCaptureParameters { /** The captured virtual hard disk's name prefix. */ @@ -5363,6 +5375,8 @@ export interface VirtualMachine extends Resource { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly etag?: string; + /** Placement section specifies the user-defined constraints for virtual machine hardware placement. This property cannot be changed once VM is provisioned. Minimum api-version: 2024-11-01. */ + placement?: Placement; /** Specifies the hardware settings for the virtual machine. */ hardwareProfile?: HardwareProfile; /** Specifies Redeploy, Reboot and ScheduledEventsAdditionalPublishingTargets Scheduled Event related configurations for the virtual machine. */ @@ -8313,6 +8327,21 @@ export enum KnownPatchOperationStatus { */ export type PatchOperationStatus = string; +/** Known values of {@link ZonePlacementPolicyType} that the service accepts. */ +export enum KnownZonePlacementPolicyType { + /** Any */ + Any = "Any", +} + +/** + * Defines values for ZonePlacementPolicyType. \ + * {@link KnownZonePlacementPolicyType} can be used interchangeably with ZonePlacementPolicyType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Any** + */ +export type ZonePlacementPolicyType = string; + /** Known values of {@link ExpandTypeForListVMs} that the service accepts. */ export enum KnownExpandTypeForListVMs { /** InstanceView */ diff --git a/sdk/compute/arm-compute/src/models/mappers.ts b/sdk/compute/arm-compute/src/models/mappers.ts index fde041ec9ae2..c04d56d1587d 100644 --- a/sdk/compute/arm-compute/src/models/mappers.ts +++ b/sdk/compute/arm-compute/src/models/mappers.ts @@ -4573,6 +4573,12 @@ export const StorageProfile: coreClient.CompositeMapper = { name: "String", }, }, + alignRegionalDisksToVMZone: { + serializedName: "alignRegionalDisksToVMZone", + type: { + name: "Boolean", + }, + }, }, }, }; @@ -5866,6 +5872,43 @@ export const LastPatchInstallationSummary: coreClient.CompositeMapper = { }, }; +export const Placement: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Placement", + modelProperties: { + zonePlacementPolicy: { + serializedName: "zonePlacementPolicy", + type: { + name: "String", + }, + }, + includeZones: { + serializedName: "includeZones", + type: { + name: "Sequence", + element: { + type: { + name: "String", + }, + }, + }, + }, + excludeZones: { + serializedName: "excludeZones", + type: { + name: "Sequence", + element: { + type: { + name: "String", + }, + }, + }, + }, + }, + }, +}; + export const VirtualMachineCaptureParameters: coreClient.CompositeMapper = { type: { name: "Composite", @@ -13880,6 +13923,13 @@ export const VirtualMachine: coreClient.CompositeMapper = { name: "String", }, }, + placement: { + serializedName: "placement", + type: { + name: "Composite", + className: "Placement", + }, + }, hardwareProfile: { serializedName: "properties.hardwareProfile", type: { diff --git a/sdk/compute/arm-compute/src/models/parameters.ts b/sdk/compute/arm-compute/src/models/parameters.ts index 9db43162f04a..045789980e8d 100644 --- a/sdk/compute/arm-compute/src/models/parameters.ts +++ b/sdk/compute/arm-compute/src/models/parameters.ts @@ -112,7 +112,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2024-07-01", + defaultValue: "2024-11-01", isConstant: true, serializedName: "api-version", type: { 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..b35d05ad6e9d 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" + "src/**/*.ts", + "test/**/*.ts" ], "exclude": [ "node_modules"