diff --git a/sdk/imagebuilder/arm-imagebuilder/CHANGELOG.md b/sdk/imagebuilder/arm-imagebuilder/CHANGELOG.md index a299c8cb023b..69e062b2ac48 100644 --- a/sdk/imagebuilder/arm-imagebuilder/CHANGELOG.md +++ b/sdk/imagebuilder/arm-imagebuilder/CHANGELOG.md @@ -1,15 +1,30 @@ # Release History + +## 2.0.0 (2022-05-24) + +**Features** -## 1.0.3 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - Added Interface ImageTemplateInVMValidator + - Added Interface ImageTemplatePropertiesValidate + - Added Type Alias ImageTemplateInVMValidatorUnion + - Added Type Alias ImageTemplatePowerShellValidator + - Added Type Alias ImageTemplateShellValidator + - Added Type Alias ProxyResource + - Interface Resource has a new optional parameter systemData + - Add parameters of ProxyResource to TypeAlias RunOutput + - Type Alias ImageTemplate has a new parameter validate + - Type Alias ImageTemplate has a new parameter stagingResourceGroup + - Type Alias ImageTemplate has a new parameter exactStagingResourceGroup + - Enum KnownProvisioningErrorCode has a new value BadStagingResourceGroup + - Enum KnownProvisioningErrorCode has a new value BadValidatorType + - Enum KnownProvisioningErrorCode has a new value NoValidatorScript + - Enum KnownProvisioningErrorCode has a new value UnsupportedValidatorType + +**Breaking Changes** + + - Delete parameters of SubResource in TypeAlias RunOutput + - Type Alias ImageTemplate no longer has parameter systemData + ## 1.0.2 (2022-04-26) **Features** diff --git a/sdk/imagebuilder/arm-imagebuilder/_meta.json b/sdk/imagebuilder/arm-imagebuilder/_meta.json index e88c318662a3..7114be63c973 100644 --- a/sdk/imagebuilder/arm-imagebuilder/_meta.json +++ b/sdk/imagebuilder/arm-imagebuilder/_meta.json @@ -1,8 +1,8 @@ { - "commit": "1f1d5b0b9ce6cc94605b2fd619dce374fb6e033a", - "readme": "specification\\frontdoor\\resource-manager\\readme.md", - "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\frontdoor\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true", + "commit": "9f3ac7b135ac83007b7f3f68ca8ca9705284cff9", + "readme": "specification/imagebuilder/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --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/imagebuilder/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220425.1", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.2.6", - "use": "@autorest/typescript@6.0.0-alpha.19.20220408.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.3.0", + "use": "@autorest/typescript@6.0.0-alpha.19.20220425.1" } \ No newline at end of file diff --git a/sdk/imagebuilder/arm-imagebuilder/package.json b/sdk/imagebuilder/arm-imagebuilder/package.json index 983d6eceeae3..f8560276a175 100644 --- a/sdk/imagebuilder/arm-imagebuilder/package.json +++ b/sdk/imagebuilder/arm-imagebuilder/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for ImageBuilderClient.", - "version": "1.0.3", + "version": "2.0.0", "engines": { "node": ">=12.0.0" }, @@ -40,12 +40,11 @@ "uglify-js": "^3.4.9", "rimraf": "^3.0.0", "@azure/identity": "^2.0.1", - "@azure-tools/test-recorder": "^1.0.0", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", "mocha": "^7.1.1", "cross-env": "^7.0.2", - "@azure/arm-compute": "^17.0.0", - "@azure/arm-msi": "^2.0.0", - "@types/node": "^12.0.0" + "@azure/dev-tool": "^1.0.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/imagebuilder/arm-imagebuilder", "repository": { @@ -96,7 +95,7 @@ "unit-test:node": "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": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", "integration-test:browser": "echo skipped", "docs": "echo skipped" }, @@ -109,13 +108,5 @@ } ] }, - "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-imagebuilder?view=azure-node-preview" - } -} + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/imagebuilder/arm-imagebuilder/review/arm-imagebuilder.api.md b/sdk/imagebuilder/arm-imagebuilder/review/arm-imagebuilder.api.md index 10dd08c3c9a9..2ff7122abaf6 100644 --- a/sdk/imagebuilder/arm-imagebuilder/review/arm-imagebuilder.api.md +++ b/sdk/imagebuilder/arm-imagebuilder/review/arm-imagebuilder.api.md @@ -57,15 +57,17 @@ export interface ImageBuilderClientOptionalParams extends coreClient.ServiceClie // @public export type ImageTemplate = TrackedResource & { identity: ImageTemplateIdentity; - readonly systemData?: SystemData; source?: ImageTemplateSourceUnion; customize?: ImageTemplateCustomizerUnion[]; + validate?: ImageTemplatePropertiesValidate; distribute?: ImageTemplateDistributorUnion[]; readonly provisioningState?: ProvisioningState; readonly provisioningError?: ProvisioningError; readonly lastRunStatus?: ImageTemplateLastRunStatus; buildTimeoutInMinutes?: number; vmProfile?: ImageTemplateVmProfile; + stagingResourceGroup?: string; + readonly exactStagingResourceGroup?: string; }; // @public @@ -105,6 +107,15 @@ export interface ImageTemplateIdentity { }; } +// @public +export interface ImageTemplateInVMValidator { + name?: string; + type: "Shell" | "PowerShell"; +} + +// @public (undocumented) +export type ImageTemplateInVMValidatorUnion = ImageTemplateInVMValidator | ImageTemplateShellValidator | ImageTemplatePowerShellValidator; + // @public export interface ImageTemplateLastRunStatus { endTime?: Date; @@ -155,6 +166,24 @@ export type ImageTemplatePowerShellCustomizer = ImageTemplateCustomizer & { validExitCodes?: number[]; }; +// @public +export type ImageTemplatePowerShellValidator = ImageTemplateInVMValidator & { + type: "PowerShell"; + scriptUri?: string; + sha256Checksum?: string; + inline?: string[]; + runElevated?: boolean; + runAsSystem?: boolean; + validExitCodes?: number[]; +}; + +// @public +export interface ImageTemplatePropertiesValidate { + continueDistributeOnFailure?: boolean; + inVMValidations?: ImageTemplateInVMValidatorUnion[]; + sourceValidationOnly?: boolean; +} + // @public export type ImageTemplateRestartCustomizer = ImageTemplateCustomizer & { type: "WindowsRestart"; @@ -186,6 +215,14 @@ export type ImageTemplateShellCustomizer = ImageTemplateCustomizer & { inline?: string[]; }; +// @public +export type ImageTemplateShellValidator = ImageTemplateInVMValidator & { + type: "Shell"; + scriptUri?: string; + sha256Checksum?: string; + inline?: string[]; +}; + // @public export interface ImageTemplateSource { type: "PlatformImage" | "ManagedImage" | "SharedImageVersion"; @@ -252,13 +289,21 @@ export enum KnownProvisioningErrorCode { // (undocumented) BadSourceType = "BadSourceType", // (undocumented) + BadStagingResourceGroup = "BadStagingResourceGroup", + // (undocumented) + BadValidatorType = "BadValidatorType", + // (undocumented) NoCustomizerScript = "NoCustomizerScript", // (undocumented) + NoValidatorScript = "NoValidatorScript", + // (undocumented) Other = "Other", // (undocumented) ServerError = "ServerError", // (undocumented) - UnsupportedCustomizerType = "UnsupportedCustomizerType" + UnsupportedCustomizerType = "UnsupportedCustomizerType", + // (undocumented) + UnsupportedValidatorType = "UnsupportedValidatorType" } // @public @@ -330,10 +375,14 @@ export type ProvisioningErrorCode = string; // @public export type ProvisioningState = "Creating" | "Updating" | "Succeeded" | "Failed" | "Deleting"; +// @public +export type ProxyResource = Resource & {}; + // @public export interface Resource { readonly id?: string; readonly name?: string; + readonly systemData?: SystemData; readonly type?: string; } @@ -341,7 +390,7 @@ export interface Resource { export type ResourceIdentityType = "UserAssigned" | "None"; // @public -export type RunOutput = SubResource & { +export type RunOutput = ProxyResource & { artifactId?: string; artifactUri?: string; readonly provisioningState?: ProvisioningState; @@ -357,18 +406,11 @@ export interface RunOutputCollection { export type RunState = "Running" | "Canceling" | "Succeeded" | "PartiallySucceeded" | "Failed" | "Canceled"; // @public -export type RunSubState = "Queued" | "Building" | "Customizing" | "Distributing"; +export type RunSubState = "Queued" | "Building" | "Customizing" | "Validating" | "Distributing"; // @public export type SharedImageStorageAccountType = string; -// @public -export interface SubResource { - readonly id?: string; - name: string; - readonly type?: string; -} - // @public export interface SystemData { createdAt?: Date; diff --git a/sdk/imagebuilder/arm-imagebuilder/src/imageBuilderClient.ts b/sdk/imagebuilder/arm-imagebuilder/src/imageBuilderClient.ts index 29d1fffec9f4..c0d14b074347 100644 --- a/sdk/imagebuilder/arm-imagebuilder/src/imageBuilderClient.ts +++ b/sdk/imagebuilder/arm-imagebuilder/src/imageBuilderClient.ts @@ -8,6 +8,11 @@ import * as coreClient from "@azure/core-client"; import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; import { VirtualMachineImageTemplatesImpl, OperationsImpl } from "./operations"; import { @@ -49,7 +54,7 @@ export class ImageBuilderClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-imagebuilder/1.0.3`; + const packageDetails = `azsdk-js-arm-imagebuilder/2.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -96,11 +101,40 @@ export class ImageBuilderClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2021-10-01"; + this.apiVersion = options.apiVersion || "2022-02-14"; this.virtualMachineImageTemplates = new VirtualMachineImageTemplatesImpl( this ); this.operations = new OperationsImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return item.replace(/(?<==).*$/, apiVersion); + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); } virtualMachineImageTemplates: VirtualMachineImageTemplates; diff --git a/sdk/imagebuilder/arm-imagebuilder/src/models/index.ts b/sdk/imagebuilder/arm-imagebuilder/src/models/index.ts index 6a1093d31bd2..3172e9ccea4b 100644 --- a/sdk/imagebuilder/arm-imagebuilder/src/models/index.ts +++ b/sdk/imagebuilder/arm-imagebuilder/src/models/index.ts @@ -20,6 +20,10 @@ export type ImageTemplateCustomizerUnion = | ImageTemplateWindowsUpdateCustomizer | ImageTemplatePowerShellCustomizer | ImageTemplateFileCustomizer; +export type ImageTemplateInVMValidatorUnion = + | ImageTemplateInVMValidator + | ImageTemplateShellValidator + | ImageTemplatePowerShellValidator; export type ImageTemplateDistributorUnion = | ImageTemplateDistributor | ImageTemplateManagedImageDistributor @@ -48,6 +52,24 @@ export interface ImageTemplateCustomizer { name?: string; } +/** Configuration options and list of validations to be performed on the resulting image. */ +export interface ImageTemplatePropertiesValidate { + /** If validation fails and this field is set to false, output image(s) will not be distributed. This is the default behavior. If validation fails and this field is set to true, output image(s) will still be distributed. Please use this option with caution as it may result in bad images being distributed for use. In either case (true or false), the end to end image run will be reported as having failed in case of a validation failure. [Note: This field has no effect if validation succeeds.] */ + continueDistributeOnFailure?: boolean; + /** If this field is set to true, the image specified in the 'source' section will directly be validated. No separate build will be run to generate and then validate a customized image. */ + sourceValidationOnly?: boolean; + /** List of validations to be performed. */ + inVMValidations?: ImageTemplateInVMValidatorUnion[]; +} + +/** Describes a unit of in-VM validation of image */ +export interface ImageTemplateInVMValidator { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "Shell" | "PowerShell"; + /** Friendly Name to provide context on what this validation step does */ + name?: string; +} + /** Generic distribution object */ export interface ImageTemplateDistributor { /** Polymorphic discriminator, which specifies the different types this object can be */ @@ -80,15 +102,15 @@ export interface ImageTemplateLastRunStatus { message?: string; } -/** Describes the virtual machine used to build, customize and capture images */ +/** Describes the virtual machines used to build and validate images */ export interface ImageTemplateVmProfile { - /** Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D2ds_v4). */ + /** Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2 for Gen1 images and Standard_D2ds_v4 for Gen2 images). */ vmSize?: string; /** Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. */ osDiskSizeGB?: number; - /** Optional array of resource IDs of user assigned managed identities to be configured on the build VM. This may include the identity of the image template. */ + /** Optional array of resource IDs of user assigned managed identities to be configured on the build VM and validation VM. This may include the identity of the image template. */ userAssignedIdentities?: string[]; - /** Optional configuration of the virtual network to use to deploy the build virtual machine in. Omit if no specific virtual network needs to be used. */ + /** Optional configuration of the virtual network to use to deploy the build VM and validation VM in. Omit if no specific virtual network needs to be used. */ vnetConfig?: VirtualNetworkConfig; } @@ -96,7 +118,7 @@ export interface ImageTemplateVmProfile { export interface VirtualNetworkConfig { /** Resource id of a pre-existing subnet. */ subnetId?: string; - /** Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2 for Gen1 images and Standard_D2ds_v4 for Gen2 images). */ + /** Size of the proxy virtual machine used to pass traffic to the build VM and validation VM. Omit or specify empty string to use the default (Standard_A1_v2). */ proxyVmSize?: string; } @@ -123,22 +145,6 @@ export interface ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassig readonly clientId?: string; } -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData { - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource. */ - createdByType?: CreatedByType; - /** The timestamp of resource creation (UTC). */ - createdAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource. */ - lastModifiedByType?: CreatedByType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date; -} - /** Common fields that are returned in the response for all Azure Resource Manager resources */ export interface Resource { /** @@ -156,6 +162,27 @@ export interface Resource { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; } /** An error response from the Azure VM Image Builder service. */ @@ -192,22 +219,6 @@ export interface RunOutputCollection { nextLink?: string; } -/** The Sub Resource model definition. */ -export interface SubResource { - /** - * Resource Id - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** Resource name */ - name: string; - /** - * Resource type - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; -} - /** Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. */ export interface OperationListResult { /** The list of operations supported by the resource provider. */ @@ -273,7 +284,7 @@ export type ImageTemplatePlatformImageSource = ImageTemplateSource & { planInfo?: PlatformImagePurchasePlan; }; -/** Describes an image source that is a managed image in customer subscription. */ +/** Describes an image source that is a managed image in customer subscription. This image must reside in the same subscription and region as the Image Builder template. */ export type ImageTemplateManagedImageSource = ImageTemplateSource & { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "ManagedImage"; @@ -355,6 +366,36 @@ export type ImageTemplateFileCustomizer = ImageTemplateCustomizer & { destination?: string; }; +/** Runs the specified shell script during the validation phase (Linux). Corresponds to Packer shell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified. */ +export type ImageTemplateShellValidator = ImageTemplateInVMValidator & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "Shell"; + /** URI of the shell script to be run for validation. It can be a github link, Azure Storage URI, etc */ + scriptUri?: string; + /** SHA256 checksum of the shell script provided in the scriptUri field */ + sha256Checksum?: string; + /** Array of shell commands to execute */ + inline?: string[]; +}; + +/** Runs the specified PowerShell script during the validation phase (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified. */ +export type ImageTemplatePowerShellValidator = ImageTemplateInVMValidator & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "PowerShell"; + /** URI of the PowerShell script to be run for validation. It can be a github link, Azure Storage URI, etc */ + scriptUri?: string; + /** SHA256 checksum of the power shell script provided in the scriptUri field above */ + sha256Checksum?: string; + /** Array of PowerShell commands to execute */ + inline?: string[]; + /** If specified, the PowerShell script will be run with elevated privileges */ + runElevated?: boolean; + /** If specified, the PowerShell script will be run with elevated privileges using the Local System user. Can only be true when the runElevated field above is set to true. */ + runAsSystem?: boolean; + /** Valid exit codes for the PowerShell script. [Default: 0] */ + validExitCodes?: number[]; +}; + /** Distribute as a Managed Disk Image. */ export type ImageTemplateManagedImageDistributor = ImageTemplateDistributor & { /** Polymorphic discriminator, which specifies the different types this object can be */ @@ -393,32 +434,19 @@ export type TrackedResource = Resource & { location: string; }; -/** Represents an output that was created by running an image template. */ -export type RunOutput = SubResource & { - /** The resource id of the artifact. */ - artifactId?: string; - /** The location URI of the artifact. */ - artifactUri?: string; - /** - * Provisioning state of the resource - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: ProvisioningState; -}; +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export type ProxyResource = Resource & {}; /** Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider */ export type ImageTemplate = TrackedResource & { /** The identity of the image template, if configured. */ identity: ImageTemplateIdentity; - /** - * Metadata pertaining to creation and last modification of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; /** Specifies the properties used to describe the source image. */ source?: ImageTemplateSourceUnion; /** Specifies the properties used to describe the customization steps of the image, like Image source etc */ customize?: ImageTemplateCustomizerUnion[]; + /** Configuration options and list of validations to be performed on the resulting image. */ + validate?: ImageTemplatePropertiesValidate; /** The distribution targets where the image output needs to go to. */ distribute?: ImageTemplateDistributorUnion[]; /** @@ -436,10 +464,30 @@ export type ImageTemplate = TrackedResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly lastRunStatus?: ImageTemplateLastRunStatus; - /** Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours). */ + /** Maximum duration to wait while building the image template (includes all customizations, validations, and distributions). Omit or specify 0 to use the default (4 hours). */ buildTimeoutInMinutes?: number; /** Describes how virtual machine is set up to build images */ vmProfile?: ImageTemplateVmProfile; + /** The staging resource group id in the same subscription as the image template that will be used to build the image. If this field is empty, a resource group with a random name will be created. If the resource group specified in this field doesn't exist, it will be created with the same name. If the resource group specified exists, it must be empty and in the same region as the image template. The resource group created will be deleted during template deletion if this field is empty or the resource group specified doesn't exist, but if the resource group specified exists the resources created in the resource group will be deleted during template deletion and the resource group itself will remain. */ + stagingResourceGroup?: string; + /** + * The staging resource group id in the same subscription as the image template that will be used to build the image. This read-only field differs from 'stagingResourceGroup' only if the value specified in the 'stagingResourceGroup' field is empty. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly exactStagingResourceGroup?: string; +}; + +/** Represents an output that was created by running an image template. */ +export type RunOutput = ProxyResource & { + /** The resource id of the artifact. */ + artifactId?: string; + /** The location URI of the artifact. */ + artifactUri?: string; + /** + * Provisioning state of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; }; /** Known values of {@link ProvisioningErrorCode} that the service accepts. */ @@ -451,8 +499,12 @@ export enum KnownProvisioningErrorCode { BadCustomizerType = "BadCustomizerType", UnsupportedCustomizerType = "UnsupportedCustomizerType", NoCustomizerScript = "NoCustomizerScript", + BadValidatorType = "BadValidatorType", + UnsupportedValidatorType = "UnsupportedValidatorType", + NoValidatorScript = "NoValidatorScript", BadDistributeType = "BadDistributeType", BadSharedImageDistribute = "BadSharedImageDistribute", + BadStagingResourceGroup = "BadStagingResourceGroup", ServerError = "ServerError", Other = "Other" } @@ -469,8 +521,12 @@ export enum KnownProvisioningErrorCode { * **BadCustomizerType** \ * **UnsupportedCustomizerType** \ * **NoCustomizerScript** \ + * **BadValidatorType** \ + * **UnsupportedValidatorType** \ + * **NoValidatorScript** \ * **BadDistributeType** \ * **BadSharedImageDistribute** \ + * **BadStagingResourceGroup** \ * **ServerError** \ * **Other** */ @@ -531,6 +587,7 @@ export type RunSubState = | "Queued" | "Building" | "Customizing" + | "Validating" | "Distributing"; /** Defines values for ResourceIdentityType. */ export type ResourceIdentityType = "UserAssigned" | "None"; diff --git a/sdk/imagebuilder/arm-imagebuilder/src/models/mappers.ts b/sdk/imagebuilder/arm-imagebuilder/src/models/mappers.ts index f4e9534c4ea1..e474168894d1 100644 --- a/sdk/imagebuilder/arm-imagebuilder/src/models/mappers.ts +++ b/sdk/imagebuilder/arm-imagebuilder/src/models/mappers.ts @@ -83,6 +83,68 @@ export const ImageTemplateCustomizer: coreClient.CompositeMapper = { } }; +export const ImageTemplatePropertiesValidate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ImageTemplatePropertiesValidate", + modelProperties: { + continueDistributeOnFailure: { + defaultValue: false, + serializedName: "continueDistributeOnFailure", + type: { + name: "Boolean" + } + }, + sourceValidationOnly: { + defaultValue: false, + serializedName: "sourceValidationOnly", + type: { + name: "Boolean" + } + }, + inVMValidations: { + serializedName: "inVMValidations", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ImageTemplateInVMValidator" + } + } + } + } + } + } +}; + +export const ImageTemplateInVMValidator: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ImageTemplateInVMValidator", + uberParent: "ImageTemplateInVMValidator", + polymorphicDiscriminator: { + serializedName: "type", + clientName: "type" + }, + modelProperties: { + type: { + serializedName: "type", + required: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + } + } + } +}; + export const ImageTemplateDistributor: coreClient.CompositeMapper = { type: { name: "Composite", @@ -177,7 +239,13 @@ export const ImageTemplateLastRunStatus: coreClient.CompositeMapper = { serializedName: "runSubState", type: { name: "Enum", - allowedValues: ["Queued", "Building", "Customizing", "Distributing"] + allowedValues: [ + "Queued", + "Building", + "Customizing", + "Validating", + "Distributing" + ] } }, message: { @@ -309,6 +377,43 @@ export const ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedi } }; +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + export const SystemData: coreClient.CompositeMapper = { type: { name: "Composite", @@ -354,36 +459,6 @@ export const SystemData: coreClient.CompositeMapper = { } }; -export const Resource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Resource", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String" - } - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - export const CloudError: coreClient.CompositeMapper = { type: { name: "Composite", @@ -489,36 +564,6 @@ export const RunOutputCollection: coreClient.CompositeMapper = { } }; -export const SubResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SubResource", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String" - } - }, - name: { - serializedName: "name", - required: true, - type: { - name: "String" - } - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - export const OperationListResult: coreClient.CompositeMapper = { type: { name: "Composite", @@ -947,6 +992,107 @@ export const ImageTemplateFileCustomizer: coreClient.CompositeMapper = { } }; +export const ImageTemplateShellValidator: coreClient.CompositeMapper = { + serializedName: "Shell", + type: { + name: "Composite", + className: "ImageTemplateShellValidator", + uberParent: "ImageTemplateInVMValidator", + polymorphicDiscriminator: + ImageTemplateInVMValidator.type.polymorphicDiscriminator, + modelProperties: { + ...ImageTemplateInVMValidator.type.modelProperties, + scriptUri: { + serializedName: "scriptUri", + type: { + name: "String" + } + }, + sha256Checksum: { + defaultValue: "", + serializedName: "sha256Checksum", + type: { + name: "String" + } + }, + inline: { + serializedName: "inline", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const ImageTemplatePowerShellValidator: coreClient.CompositeMapper = { + serializedName: "PowerShell", + type: { + name: "Composite", + className: "ImageTemplatePowerShellValidator", + uberParent: "ImageTemplateInVMValidator", + polymorphicDiscriminator: + ImageTemplateInVMValidator.type.polymorphicDiscriminator, + modelProperties: { + ...ImageTemplateInVMValidator.type.modelProperties, + scriptUri: { + serializedName: "scriptUri", + type: { + name: "String" + } + }, + sha256Checksum: { + defaultValue: "", + serializedName: "sha256Checksum", + type: { + name: "String" + } + }, + inline: { + serializedName: "inline", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + runElevated: { + defaultValue: false, + serializedName: "runElevated", + type: { + name: "Boolean" + } + }, + runAsSystem: { + defaultValue: false, + serializedName: "runAsSystem", + type: { + name: "Boolean" + } + }, + validExitCodes: { + serializedName: "validExitCodes", + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + } + } + } +}; + export const ImageTemplateManagedImageDistributor: coreClient.CompositeMapper = { serializedName: "ManagedImage", type: { @@ -1059,38 +1205,12 @@ export const TrackedResource: coreClient.CompositeMapper = { } }; -export const RunOutput: coreClient.CompositeMapper = { +export const ProxyResource: coreClient.CompositeMapper = { type: { name: "Composite", - className: "RunOutput", + className: "ProxyResource", modelProperties: { - ...SubResource.type.modelProperties, - artifactId: { - serializedName: "properties.artifactId", - type: { - name: "String" - } - }, - artifactUri: { - serializedName: "properties.artifactUri", - type: { - name: "String" - } - }, - provisioningState: { - serializedName: "properties.provisioningState", - readOnly: true, - type: { - name: "Enum", - allowedValues: [ - "Creating", - "Updating", - "Succeeded", - "Failed", - "Deleting" - ] - } - } + ...Resource.type.modelProperties } } }; @@ -1108,13 +1228,6 @@ export const ImageTemplate: coreClient.CompositeMapper = { className: "ImageTemplateIdentity" } }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - }, source: { serializedName: "properties.source", type: { @@ -1134,6 +1247,13 @@ export const ImageTemplate: coreClient.CompositeMapper = { } } }, + validate: { + serializedName: "properties.validate", + type: { + name: "Composite", + className: "ImageTemplatePropertiesValidate" + } + }, distribute: { serializedName: "properties.distribute", type: { @@ -1191,6 +1311,55 @@ export const ImageTemplate: coreClient.CompositeMapper = { name: "Composite", className: "ImageTemplateVmProfile" } + }, + stagingResourceGroup: { + serializedName: "properties.stagingResourceGroup", + type: { + name: "String" + } + }, + exactStagingResourceGroup: { + serializedName: "properties.exactStagingResourceGroup", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const RunOutput: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RunOutput", + modelProperties: { + ...ProxyResource.type.modelProperties, + artifactId: { + serializedName: "properties.artifactId", + type: { + name: "String" + } + }, + artifactUri: { + serializedName: "properties.artifactUri", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "Enum", + allowedValues: [ + "Creating", + "Updating", + "Succeeded", + "Failed", + "Deleting" + ] + } } } } @@ -1199,6 +1368,7 @@ export const ImageTemplate: coreClient.CompositeMapper = { export let discriminators = { ImageTemplateSource: ImageTemplateSource, ImageTemplateCustomizer: ImageTemplateCustomizer, + ImageTemplateInVMValidator: ImageTemplateInVMValidator, ImageTemplateDistributor: ImageTemplateDistributor, "ImageTemplateSource.PlatformImage": ImageTemplatePlatformImageSource, "ImageTemplateSource.ManagedImage": ImageTemplateManagedImageSource, @@ -1208,6 +1378,8 @@ export let discriminators = { "ImageTemplateCustomizer.WindowsUpdate": ImageTemplateWindowsUpdateCustomizer, "ImageTemplateCustomizer.PowerShell": ImageTemplatePowerShellCustomizer, "ImageTemplateCustomizer.File": ImageTemplateFileCustomizer, + "ImageTemplateInVMValidator.Shell": ImageTemplateShellValidator, + "ImageTemplateInVMValidator.PowerShell": ImageTemplatePowerShellValidator, "ImageTemplateDistributor.ManagedImage": ImageTemplateManagedImageDistributor, "ImageTemplateDistributor.SharedImage": ImageTemplateSharedImageDistributor, "ImageTemplateDistributor.VHD": ImageTemplateVhdDistributor diff --git a/sdk/imagebuilder/arm-imagebuilder/src/models/parameters.ts b/sdk/imagebuilder/arm-imagebuilder/src/models/parameters.ts index e700cb32404f..1eb237985c50 100644 --- a/sdk/imagebuilder/arm-imagebuilder/src/models/parameters.ts +++ b/sdk/imagebuilder/arm-imagebuilder/src/models/parameters.ts @@ -54,7 +54,7 @@ export const subscriptionId: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2021-10-01", + defaultValue: "2022-02-14", isConstant: true, serializedName: "api-version", type: { diff --git a/sdk/imagebuilder/arm-imagebuilder/test/sampleTest.ts b/sdk/imagebuilder/arm-imagebuilder/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/imagebuilder/arm-imagebuilder/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/imagebuilder/arm-imagebuilder/tsconfig.json b/sdk/imagebuilder/arm-imagebuilder/tsconfig.json index 685d3a99e92a..3e6ae96443f3 100644 --- a/sdk/imagebuilder/arm-imagebuilder/tsconfig.json +++ b/sdk/imagebuilder/arm-imagebuilder/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-imagebuilder": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"