From fc1a9a328309bab39c516551400d55076d50f1d6 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 4 Apr 2019 21:32:19 +0000 Subject: [PATCH] Generated from 37db3f8500b9ee3ee2da941b35e57ed202ddf183 Fix examples --- packages/@azure/arm-imagebuilder/LICENSE.txt | 21 + packages/@azure/arm-imagebuilder/README.md | 96 ++ .../lib/imageBuilderClient.ts | 45 + .../lib/imageBuilderClientContext.ts | 63 + .../arm-imagebuilder/lib/models/index.ts | 1139 +++++++++++++++++ .../arm-imagebuilder/lib/models/mappers.ts | 1014 +++++++++++++++ .../lib/models/operationsMappers.ts | 20 + .../arm-imagebuilder/lib/models/parameters.ts | 89 ++ .../virtualMachineImageTemplatesMappers.ts | 43 + .../arm-imagebuilder/lib/operations/index.ts | 12 + .../lib/operations/operations.ts | 123 ++ .../virtualMachineImageTemplates.ts | 696 ++++++++++ packages/@azure/arm-imagebuilder/package.json | 56 + .../@azure/arm-imagebuilder/rollup.config.js | 37 + .../@azure/arm-imagebuilder/tsconfig.json | 19 + 15 files changed, 3473 insertions(+) create mode 100644 packages/@azure/arm-imagebuilder/LICENSE.txt create mode 100644 packages/@azure/arm-imagebuilder/README.md create mode 100644 packages/@azure/arm-imagebuilder/lib/imageBuilderClient.ts create mode 100644 packages/@azure/arm-imagebuilder/lib/imageBuilderClientContext.ts create mode 100644 packages/@azure/arm-imagebuilder/lib/models/index.ts create mode 100644 packages/@azure/arm-imagebuilder/lib/models/mappers.ts create mode 100644 packages/@azure/arm-imagebuilder/lib/models/operationsMappers.ts create mode 100644 packages/@azure/arm-imagebuilder/lib/models/parameters.ts create mode 100644 packages/@azure/arm-imagebuilder/lib/models/virtualMachineImageTemplatesMappers.ts create mode 100644 packages/@azure/arm-imagebuilder/lib/operations/index.ts create mode 100644 packages/@azure/arm-imagebuilder/lib/operations/operations.ts create mode 100644 packages/@azure/arm-imagebuilder/lib/operations/virtualMachineImageTemplates.ts create mode 100644 packages/@azure/arm-imagebuilder/package.json create mode 100644 packages/@azure/arm-imagebuilder/rollup.config.js create mode 100644 packages/@azure/arm-imagebuilder/tsconfig.json diff --git a/packages/@azure/arm-imagebuilder/LICENSE.txt b/packages/@azure/arm-imagebuilder/LICENSE.txt new file mode 100644 index 000000000000..8f3d856145c5 --- /dev/null +++ b/packages/@azure/arm-imagebuilder/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/@azure/arm-imagebuilder/README.md b/packages/@azure/arm-imagebuilder/README.md new file mode 100644 index 000000000000..4372222853e7 --- /dev/null +++ b/packages/@azure/arm-imagebuilder/README.md @@ -0,0 +1,96 @@ +## Azure ImageBuilderClient SDK for JavaScript + +This package contains an isomorphic SDK for ImageBuilderClient. + +### Currently supported environments + +- Node.js version 6.x.x or higher +- Browser JavaScript + +### How to Install + +```bash +npm install @azure/arm-imagebuilder +``` + +### How to use + +#### nodejs - Authentication, client creation and list virtualMachineImageTemplates as an example written in TypeScript. + +##### Install @azure/ms-rest-nodeauth + +```bash +npm install @azure/ms-rest-nodeauth +``` + +##### Sample code + +```typescript +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; +import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; +import { ImageBuilderClient, ImageBuilderModels, ImageBuilderMappers } from "@azure/arm-imagebuilder"; +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +msRestNodeAuth.interactiveLogin().then((creds) => { + const client = new ImageBuilderClient(creds, subscriptionId); + client.virtualMachineImageTemplates.list().then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.error(err); +}); +``` + +#### browser - Authentication, client creation and list virtualMachineImageTemplates as an example written in JavaScript. + +##### Install @azure/ms-rest-browserauth + +```bash +npm install @azure/ms-rest-browserauth +``` + +##### Sample code + +See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. + +- index.html +```html + + + + @azure/arm-imagebuilder sample + + + + + + + + +``` + +## Related projects + +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) diff --git a/packages/@azure/arm-imagebuilder/lib/imageBuilderClient.ts b/packages/@azure/arm-imagebuilder/lib/imageBuilderClient.ts new file mode 100644 index 000000000000..7ef4ac198396 --- /dev/null +++ b/packages/@azure/arm-imagebuilder/lib/imageBuilderClient.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "./models"; +import * as Mappers from "./models/mappers"; +import * as operations from "./operations"; +import { ImageBuilderClientContext } from "./imageBuilderClientContext"; + + +class ImageBuilderClient extends ImageBuilderClientContext { + // Operation groups + virtualMachineImageTemplates: operations.VirtualMachineImageTemplates; + operations: operations.Operations; + + /** + * Initializes a new instance of the ImageBuilderClient class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure + * subscription. The subscription Id forms part of the URI for every service call. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ImageBuilderClientOptions) { + super(credentials, subscriptionId, options); + this.virtualMachineImageTemplates = new operations.VirtualMachineImageTemplates(this); + this.operations = new operations.Operations(this); + } +} + +// Operation Specifications + +export { + ImageBuilderClient, + ImageBuilderClientContext, + Models as ImageBuilderModels, + Mappers as ImageBuilderMappers +}; +export * from "./operations"; diff --git a/packages/@azure/arm-imagebuilder/lib/imageBuilderClientContext.ts b/packages/@azure/arm-imagebuilder/lib/imageBuilderClientContext.ts new file mode 100644 index 000000000000..0f581bbaa2e6 --- /dev/null +++ b/packages/@azure/arm-imagebuilder/lib/imageBuilderClientContext.ts @@ -0,0 +1,63 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as Models from "./models"; +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; + +const packageName = "@azure/arm-imagebuilder"; +const packageVersion = "1.0.0"; + +export class ImageBuilderClientContext extends msRestAzure.AzureServiceClient { + credentials: msRest.ServiceClientCredentials; + subscriptionId: string; + apiVersion?: string; + + /** + * Initializes a new instance of the ImageBuilderClient class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure + * subscription. The subscription Id forms part of the URI for every service call. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ImageBuilderClientOptions) { + if (credentials == undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId == undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) { + options = {}; + } + if(!options.userAgent) { + const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + super(credentials, options); + + this.apiVersion = '2019-05-01-preview'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; + this.requestContentType = "application/json; charset=utf-8"; + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + } +} diff --git a/packages/@azure/arm-imagebuilder/lib/models/index.ts b/packages/@azure/arm-imagebuilder/lib/models/index.ts new file mode 100644 index 000000000000..b8682fd63a01 --- /dev/null +++ b/packages/@azure/arm-imagebuilder/lib/models/index.ts @@ -0,0 +1,1139 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export { BaseResource, CloudError }; + + +/** + * Contains the possible cases for ImageTemplateSource. + */ +export type ImageTemplateSourceUnion = ImageTemplateSource | ImageTemplateIsoSource | ImageTemplatePlatformImageSource | ImageTemplateManagedImageSource | ImageTemplateSharedImageVersionSource; + +/** + * @interface + * An interface representing ImageTemplateSource. + */ +export interface ImageTemplateSource { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "ImageTemplateSource"; +} + +/** + * Contains the possible cases for ImageTemplateCustomizer. + */ +export type ImageTemplateCustomizerUnion = ImageTemplateCustomizer | ImageTemplateShellCustomizer | ImageTemplateRestartCustomizer | ImageTemplatePowerShellCustomizer | ImageTemplateFileCustomizer; + +/** + * @interface + * An interface representing ImageTemplateCustomizer. + */ +export interface ImageTemplateCustomizer { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "ImageTemplateCustomizer"; + /** + * @member {string} [name] Friendly Name to provide context on what this + * customization step does + */ + name?: string; +} + +/** + * Contains the possible cases for ImageTemplateDistributor. + */ +export type ImageTemplateDistributorUnion = ImageTemplateDistributor | ImageTemplateManagedImageDistributor | ImageTemplateSharedImageDistributor | ImageTemplateVhdDistributor; + +/** + * @interface + * An interface representing ImageTemplateDistributor. + * Generic distribution object + * + */ +export interface ImageTemplateDistributor { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "ImageTemplateDistributor"; + /** + * @member {string} runOutputName The name to be used for the associated + * RunOutput. + */ + runOutputName: string; + /** + * @member {{ [propertyName: string]: string }} [artifactTags] Tags that will + * be applied to the artifact once it has been created/updated by the + * distributor. + */ + artifactTags?: { [propertyName: string]: string }; +} + +/** + * @interface + * An interface representing ProvisioningError. + */ +export interface ProvisioningError { + /** + * @member {ProvisioningErrorCode} [provisioningErrorCode] Error code of the + * provisioning failure. Possible values include: 'BadSourceType', + * 'BadPIRSource', 'BadISOSource', 'BadManagedImageSource', + * 'BadSharedImageVersionSource', 'BadCustomizerType', + * 'UnsupportedCustomizerType', 'NoCustomizerScript', 'BadDistributeType', + * 'BadSharedImageDistribute', 'ServerError', 'Other' + */ + provisioningErrorCode?: ProvisioningErrorCode; + /** + * @member {string} [message] Verbose error message about the provisioning + * failure + */ + message?: string; +} + +/** + * @interface + * An interface representing ImageTemplateLastRunStatus. + */ +export interface ImageTemplateLastRunStatus { + /** + * @member {Date} [startTime] Start time of the last run (UTC) + */ + startTime?: Date; + /** + * @member {Date} [endTime] End time of the last run (UTC) + */ + endTime?: Date; + /** + * @member {RunState} [runState] State of the last run. Possible values + * include: 'Running', 'Succeeded', 'PartiallySucceeded', 'Failed' + */ + runState?: RunState; + /** + * @member {RunSubState} [runSubState] Sub-state of the last run. Possible + * values include: 'Queued', 'Building', 'Customizing', 'Distributing' + */ + runSubState?: RunSubState; + /** + * @member {string} [message] Verbose information about the last run state + */ + message?: string; +} + +/** + * @interface + * An interface representing ImageTemplateIdentityUserAssignedIdentitiesValue. + */ +export interface ImageTemplateIdentityUserAssignedIdentitiesValue { + /** + * @member {string} [principalId] The principal id of user assigned identity. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly principalId?: string; + /** + * @member {string} [clientId] The client id of user assigned identity. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly clientId?: string; +} + +/** + * @interface + * An interface representing ImageTemplateIdentity. + * Identity for the image template. + * + */ +export interface ImageTemplateIdentity { + /** + * @member {ResourceIdentityType} [type] The type of identity used for the + * image template. The type 'None' will remove any identities from the image + * template. Possible values include: 'UserAssigned', 'None' + */ + type?: ResourceIdentityType; + /** + * @member {{ [propertyName: string]: + * ImageTemplateIdentityUserAssignedIdentitiesValue }} + * [userAssignedIdentities] The list of user identities associated with the + * image template. The user identity dictionary key references will be ARM + * resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + userAssignedIdentities?: { [propertyName: string]: ImageTemplateIdentityUserAssignedIdentitiesValue }; +} + +/** + * @interface + * An interface representing Resource. + * The Resource model definition. + * + * @extends BaseResource + */ +export interface Resource extends BaseResource { + /** + * @member {string} [id] Resource Id + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly id?: string; + /** + * @member {string} [name] Resource name + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly name?: string; + /** + * @member {string} [type] Resource type + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly type?: string; + /** + * @member {string} location Resource location + */ + location: string; + /** + * @member {{ [propertyName: string]: string }} [tags] Resource tags + */ + tags?: { [propertyName: string]: string }; +} + +/** + * @interface + * An interface representing ImageTemplate. + * @extends Resource + */ +export interface ImageTemplate extends Resource { + /** + * @member {ImageTemplateSourceUnion} source Specifies the properties used to + * describe the source image. + */ + source: ImageTemplateSourceUnion; + /** + * @member {ImageTemplateCustomizerUnion[]} [customize] Specifies the + * properties used to describe the customization steps of the image, like + * Image source etc + */ + customize?: ImageTemplateCustomizerUnion[]; + /** + * @member {ImageTemplateDistributorUnion[]} distribute The distribution + * targets where the image output needs to go to. + */ + distribute: ImageTemplateDistributorUnion[]; + /** + * @member {ProvisioningState} [provisioningState] Provisioning state of the + * resource. Possible values include: 'Creating', 'Updating', 'Succeeded', + * 'Failed', 'Deleting' + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly provisioningState?: ProvisioningState; + /** + * @member {ProvisioningError} [provisioningError] Provisioning error, if any + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly provisioningError?: ProvisioningError; + /** + * @member {ImageTemplateLastRunStatus} [lastRunStatus] State of 'run' that + * is currently executing or was last executed. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly lastRunStatus?: ImageTemplateLastRunStatus; + /** + * @member {number} [buildTimeoutInMinutes] Maximum duration to wait while + * building the image template. Default is 60 minutes. + */ + buildTimeoutInMinutes?: number; + /** + * @member {ImageTemplateIdentity} [identity] The identity of the image + * template, if configured. + */ + identity?: ImageTemplateIdentity; +} + +/** + * @interface + * An interface representing ImageTemplateIsoSource. + * Describes an image source that is an installation ISO. Currently only + * supports Red Hat Enterprise Linux 7.2-7.5 ISO's. + * + */ +export interface ImageTemplateIsoSource { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "ISO"; + /** + * @member {string} sourceUri URI to get the ISO image. This URI has to be + * accessible to the resource provider at the time of the image template + * creation. + */ + sourceUri: string; + /** + * @member {string} sha256Checksum SHA256 Checksum of the ISO image. + */ + sha256Checksum: string; +} + +/** + * @interface + * An interface representing ImageTemplatePlatformImageSource. + * Describes an image source from [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + * + */ +export interface ImageTemplatePlatformImageSource { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "PlatformImage"; + /** + * @member {string} [publisher] Image Publisher in [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + */ + publisher?: string; + /** + * @member {string} [offer] Image offer from the [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + */ + offer?: string; + /** + * @member {string} [sku] Image sku from the [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + */ + sku?: string; + /** + * @member {string} [version] Image version from the [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + */ + version?: string; +} + +/** + * @interface + * An interface representing ImageTemplateManagedImageSource. + * Describes an image source that is a managed image in customer subscription. + * + */ +export interface ImageTemplateManagedImageSource { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "ManagedImage"; + /** + * @member {string} imageId ARM resource id of the managed image in customer + * subscription + */ + imageId: string; +} + +/** + * @interface + * An interface representing ImageTemplateSharedImageVersionSource. + * Describes an image source that is an image version in a shared image + * gallery. + * + */ +export interface ImageTemplateSharedImageVersionSource { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "SharedImageVersion"; + /** + * @member {string} imageVersionId ARM resource id of the image version in + * the shared image gallery + */ + imageVersionId: string; +} + +/** + * @interface + * An interface representing ImageTemplateShellCustomizer. + * Runs a shell script during the customization phase (Linux). Corresponds to + * Packer shell provisioner. Exactly one of 'scriptUri' or 'inline' can be + * specified. + * + */ +export interface ImageTemplateShellCustomizer { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "Shell"; + /** + * @member {string} [name] Friendly Name to provide context on what this + * customization step does + */ + name?: string; + /** + * @member {string} [scriptUri] URI of the shell script to be run for + * customizing. It can be a github link, SAS URI for Azure Storage, etc + */ + scriptUri?: string; + /** + * @member {string[]} [inline] Array of shell commands to execute + */ + inline?: string[]; +} + +/** + * @interface + * An interface representing ImageTemplateRestartCustomizer. + * Reboots a VM and waits for it to come back online (Windows). Corresponds to + * Packer windows-restart provisioner + * + */ +export interface ImageTemplateRestartCustomizer { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "WindowsRestart"; + /** + * @member {string} [name] Friendly Name to provide context on what this + * customization step does + */ + name?: string; + /** + * @member {string} [restartCommand] Command to execute the restart [Default: + * 'shutdown /r /f /t 0 /c "packer restart"'] + */ + restartCommand?: string; + /** + * @member {string} [restartCheckCommand] Command to check if restart + * succeeded [Default: ''] + */ + restartCheckCommand?: string; + /** + * @member {string} [restartTimeout] Restart timeout specified as a string of + * magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: + * '5m'] + */ + restartTimeout?: string; +} + +/** + * @interface + * An interface representing ImageTemplatePowerShellCustomizer. + * Runs the specified PowerShell on the VM (Windows). Corresponds to Packer + * powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be + * specified. + * + */ +export interface ImageTemplatePowerShellCustomizer { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "PowerShell"; + /** + * @member {string} [name] Friendly Name to provide context on what this + * customization step does + */ + name?: string; + /** + * @member {string} [scriptUri] URI of the PowerShell script to be run for + * customizing. It can be a github link, SAS URI for Azure Storage, etc + */ + scriptUri?: string; + /** + * @member {string[]} [inline] Array of PowerShell commands to execute + */ + inline?: string[]; + /** + * @member {number[]} [validExitCodes] Valid exit codes for the PowerShell + * script. [Default: 0] + */ + validExitCodes?: number[]; +} + +/** + * @interface + * An interface representing ImageTemplateFileCustomizer. + * Uploads files to VMs (Linux, Windows). Corresponds to Packer file + * provisioner + * + */ +export interface ImageTemplateFileCustomizer { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "File"; + /** + * @member {string} [name] Friendly Name to provide context on what this + * customization step does + */ + name?: string; + /** + * @member {string} [sourceUri] The URI of the file to be uploaded for + * customizing the VM. It can be a github link, SAS URI for Azure Storage, + * etc + */ + sourceUri?: string; + /** + * @member {string} [destination] The absolute path (with existing directory + * structure) where the file will be uploaded to in the VM + */ + destination?: string; +} + +/** + * @interface + * An interface representing ImageTemplateManagedImageDistributor. + * Distribute as a Managed Disk Image. + * + */ +export interface ImageTemplateManagedImageDistributor { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "ManagedImage"; + /** + * @member {string} runOutputName The name to be used for the associated + * RunOutput. + */ + runOutputName: string; + /** + * @member {{ [propertyName: string]: string }} [artifactTags] Tags that will + * be applied to the artifact once it has been created/updated by the + * distributor. + */ + artifactTags?: { [propertyName: string]: string }; + /** + * @member {string} imageId Resource Id of the Managed Disk Image + */ + imageId: string; + /** + * @member {string} location Azure location for the image, should match if + * image already exists + */ + location: string; +} + +/** + * @interface + * An interface representing ImageTemplateSharedImageDistributor. + * Distribute via Shared Image Gallery. + * + */ +export interface ImageTemplateSharedImageDistributor { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "SharedImage"; + /** + * @member {string} runOutputName The name to be used for the associated + * RunOutput. + */ + runOutputName: string; + /** + * @member {{ [propertyName: string]: string }} [artifactTags] Tags that will + * be applied to the artifact once it has been created/updated by the + * distributor. + */ + artifactTags?: { [propertyName: string]: string }; + /** + * @member {string} galleryImageId Resource Id of the Shared Image Gallery + * image + */ + galleryImageId: string; + /** + * @member {string[]} replicationRegions + */ + replicationRegions: string[]; +} + +/** + * @interface + * An interface representing ImageTemplateVhdDistributor. + * Distribute via VHD in a storage account. + * + */ +export interface ImageTemplateVhdDistributor { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "VHD"; + /** + * @member {string} runOutputName The name to be used for the associated + * RunOutput. + */ + runOutputName: string; + /** + * @member {{ [propertyName: string]: string }} [artifactTags] Tags that will + * be applied to the artifact once it has been created/updated by the + * distributor. + */ + artifactTags?: { [propertyName: string]: string }; +} + +/** + * @interface + * An interface representing ImageTemplateUpdateParameters. + * Parameters for updating an image template. + * + */ +export interface ImageTemplateUpdateParameters { + /** + * @member {ImageTemplateIdentity} [identity] The identity of the image + * template, if configured. + */ + identity?: ImageTemplateIdentity; + /** + * @member {{ [propertyName: string]: string }} [tags] The user-specified + * tags associated with the image template. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * @interface + * An interface representing SubResource. + * The Sub Resource model definition. + * + */ +export interface SubResource { + /** + * @member {string} [id] Resource Id + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly id?: string; + /** + * @member {string} name Resource name + */ + name: string; + /** + * @member {string} [type] Resource type + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly type?: string; +} + +/** + * @interface + * An interface representing RunOutput. + * Represents an output that was created by running an image template. + * + * @extends SubResource + */ +export interface RunOutput extends SubResource { + /** + * @member {string} [artifactId] The resource id of the artifact. + */ + artifactId?: string; + /** + * @member {string} [artifactUri] The location URI of the artifact. + */ + artifactUri?: string; + /** + * @member {ProvisioningState1} [provisioningState] Provisioning state of the + * resource. Possible values include: 'Creating', 'Updating', 'Succeeded', + * 'Failed', 'Deleting' + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly provisioningState?: ProvisioningState1; +} + +/** + * @interface + * An interface representing OperationDisplay. + * @summary The object that describes the operation. + * + */ +export interface OperationDisplay { + /** + * @member {string} [provider] Friendly name of the resource provider. + */ + provider?: string; + /** + * @member {string} [operation] The operation type. For example: read, write, + * delete, or listKeys/action + */ + operation?: string; + /** + * @member {string} [resource] The resource type on which the operation is + * performed. + */ + resource?: string; + /** + * @member {string} [description] The friendly name of the operation. + */ + description?: string; +} + +/** + * @interface + * An interface representing Operation. + * @summary A REST API operation + * + */ +export interface Operation { + /** + * @member {string} [name] The operation name. This is of the format + * {provider}/{resource}/{operation} + */ + name?: string; + /** + * @member {OperationDisplay} [display] The object that describes the + * operation. + */ + display?: OperationDisplay; + /** + * @member {string} [origin] The intended executor of the operation. + */ + origin?: string; + /** + * @member {any} [properties] Properties of the operation. + */ + properties?: any; +} + +/** + * @interface + * An interface representing ApiErrorBase. + * Api error base. + * + */ +export interface ApiErrorBase { + /** + * @member {string} [code] The error code. + */ + code?: string; + /** + * @member {string} [target] The target of the particular error. + */ + target?: string; + /** + * @member {string} [message] The error message. + */ + message?: string; +} + +/** + * @interface + * An interface representing InnerError. + * Inner error details. + * + */ +export interface InnerError { + /** + * @member {string} [exceptionType] The exception type. + */ + exceptionType?: string; + /** + * @member {string} [errorDetail] The internal error message or exception + * dump. + */ + errorDetail?: string; +} + +/** + * @interface + * An interface representing ApiError. + * Api error. + * + */ +export interface ApiError { + /** + * @member {ApiErrorBase[]} [details] The Api error details + */ + details?: ApiErrorBase[]; + /** + * @member {InnerError} [innerError] The Api inner error + */ + innerError?: InnerError; + /** + * @member {string} [code] The error code. + */ + code?: string; + /** + * @member {string} [target] The target of the particular error. + */ + target?: string; + /** + * @member {string} [message] The error message. + */ + message?: string; +} + +/** + * @interface + * An interface representing ImageBuilderClientOptions. + * @extends AzureServiceClientOptions + */ +export interface ImageBuilderClientOptions extends AzureServiceClientOptions { + /** + * @member {string} [baseUri] + */ + baseUri?: string; +} + + +/** + * @interface + * An interface representing the ImageTemplateListResult. + * @extends Array + */ +export interface ImageTemplateListResult extends Array { + /** + * @member {string} [nextLink] The continuation token. + */ + nextLink?: string; +} + +/** + * @interface + * An interface representing the RunOutputCollection. + * @extends Array + */ +export interface RunOutputCollection extends Array { + /** + * @member {string} [nextLink] The continuation token. + */ + nextLink?: string; +} + +/** + * @interface + * An interface representing the OperationListResult. + * @summary 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. + * + * @extends Array + */ +export interface OperationListResult extends Array { + /** + * @member {string} [nextLink] + */ + nextLink?: string; +} + +/** + * Defines values for ResourceIdentityType. + * Possible values include: 'UserAssigned', 'None' + * @readonly + * @enum {string} + */ +export type ResourceIdentityType = 'UserAssigned' | 'None'; + +/** + * Defines values for ProvisioningErrorCode. + * Possible values include: 'BadSourceType', 'BadPIRSource', 'BadISOSource', + * 'BadManagedImageSource', 'BadSharedImageVersionSource', 'BadCustomizerType', + * 'UnsupportedCustomizerType', 'NoCustomizerScript', 'BadDistributeType', + * 'BadSharedImageDistribute', 'ServerError', 'Other' + * @readonly + * @enum {string} + */ +export type ProvisioningErrorCode = 'BadSourceType' | 'BadPIRSource' | 'BadISOSource' | 'BadManagedImageSource' | 'BadSharedImageVersionSource' | 'BadCustomizerType' | 'UnsupportedCustomizerType' | 'NoCustomizerScript' | 'BadDistributeType' | 'BadSharedImageDistribute' | 'ServerError' | 'Other'; + +/** + * Defines values for RunState. + * Possible values include: 'Running', 'Succeeded', 'PartiallySucceeded', 'Failed' + * @readonly + * @enum {string} + */ +export type RunState = 'Running' | 'Succeeded' | 'PartiallySucceeded' | 'Failed'; + +/** + * Defines values for RunSubState. + * Possible values include: 'Queued', 'Building', 'Customizing', 'Distributing' + * @readonly + * @enum {string} + */ +export type RunSubState = 'Queued' | 'Building' | 'Customizing' | 'Distributing'; + +/** + * Defines values for ProvisioningState. + * Possible values include: 'Creating', 'Updating', 'Succeeded', 'Failed', 'Deleting' + * @readonly + * @enum {string} + */ +export type ProvisioningState = 'Creating' | 'Updating' | 'Succeeded' | 'Failed' | 'Deleting'; + +/** + * Defines values for ProvisioningState1. + * Possible values include: 'Creating', 'Updating', 'Succeeded', 'Failed', 'Deleting' + * @readonly + * @enum {string} + */ +export type ProvisioningState1 = 'Creating' | 'Updating' | 'Succeeded' | 'Failed' | 'Deleting'; + +/** + * Contains response data for the list operation. + */ +export type VirtualMachineImageTemplatesListResponse = ImageTemplateListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ImageTemplateListResult; + }; +}; + +/** + * Contains response data for the listByResourceGroup operation. + */ +export type VirtualMachineImageTemplatesListByResourceGroupResponse = ImageTemplateListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ImageTemplateListResult; + }; +}; + +/** + * Contains response data for the createOrUpdate operation. + */ +export type VirtualMachineImageTemplatesCreateOrUpdateResponse = ImageTemplate & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ImageTemplate; + }; +}; + +/** + * Contains response data for the update operation. + */ +export type VirtualMachineImageTemplatesUpdateResponse = ImageTemplate & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ImageTemplate; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type VirtualMachineImageTemplatesGetResponse = ImageTemplate & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ImageTemplate; + }; +}; + +/** + * Contains response data for the listRunOutputs operation. + */ +export type VirtualMachineImageTemplatesListRunOutputsResponse = RunOutputCollection & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RunOutputCollection; + }; +}; + +/** + * Contains response data for the getRunOutput operation. + */ +export type VirtualMachineImageTemplatesGetRunOutputResponse = RunOutput & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RunOutput; + }; +}; + +/** + * Contains response data for the beginCreateOrUpdate operation. + */ +export type VirtualMachineImageTemplatesBeginCreateOrUpdateResponse = ImageTemplate & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ImageTemplate; + }; +}; + +/** + * Contains response data for the beginUpdate operation. + */ +export type VirtualMachineImageTemplatesBeginUpdateResponse = ImageTemplate & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ImageTemplate; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type VirtualMachineImageTemplatesListNextResponse = ImageTemplateListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ImageTemplateListResult; + }; +}; + +/** + * Contains response data for the listByResourceGroupNext operation. + */ +export type VirtualMachineImageTemplatesListByResourceGroupNextResponse = ImageTemplateListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ImageTemplateListResult; + }; +}; + +/** + * Contains response data for the listRunOutputsNext operation. + */ +export type VirtualMachineImageTemplatesListRunOutputsNextResponse = RunOutputCollection & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RunOutputCollection; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type OperationsListResponse = OperationListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: OperationListResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type OperationsListNextResponse = OperationListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: OperationListResult; + }; +}; diff --git a/packages/@azure/arm-imagebuilder/lib/models/mappers.ts b/packages/@azure/arm-imagebuilder/lib/models/mappers.ts new file mode 100644 index 000000000000..533275db7cbd --- /dev/null +++ b/packages/@azure/arm-imagebuilder/lib/models/mappers.ts @@ -0,0 +1,1014 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export const CloudError = CloudErrorMapper; +export const BaseResource = BaseResourceMapper; + +export const ImageTemplateSource: msRest.CompositeMapper = { + serializedName: "ImageTemplateSource", + type: { + name: "Composite", + polymorphicDiscriminator: { + serializedName: "type", + clientName: "type" + }, + uberParent: "ImageTemplateSource", + className: "ImageTemplateSource", + modelProperties: { + type: { + required: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const ImageTemplateCustomizer: msRest.CompositeMapper = { + serializedName: "ImageTemplateCustomizer", + type: { + name: "Composite", + polymorphicDiscriminator: { + serializedName: "type", + clientName: "type" + }, + uberParent: "ImageTemplateCustomizer", + className: "ImageTemplateCustomizer", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + type: { + required: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const ImageTemplateDistributor: msRest.CompositeMapper = { + serializedName: "ImageTemplateDistributor", + type: { + name: "Composite", + polymorphicDiscriminator: { + serializedName: "type", + clientName: "type" + }, + uberParent: "ImageTemplateDistributor", + className: "ImageTemplateDistributor", + modelProperties: { + runOutputName: { + required: true, + serializedName: "runOutputName", + constraints: { + Pattern: /^[A-Za-z0-9-_]{1,64}$/ + }, + type: { + name: "String" + } + }, + artifactTags: { + serializedName: "artifactTags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + }, + type: { + required: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const ProvisioningError: msRest.CompositeMapper = { + serializedName: "ProvisioningError", + type: { + name: "Composite", + className: "ProvisioningError", + modelProperties: { + provisioningErrorCode: { + serializedName: "provisioningErrorCode", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const ImageTemplateLastRunStatus: msRest.CompositeMapper = { + serializedName: "ImageTemplateLastRunStatus", + type: { + name: "Composite", + className: "ImageTemplateLastRunStatus", + modelProperties: { + startTime: { + serializedName: "startTime", + type: { + name: "DateTime" + } + }, + endTime: { + serializedName: "endTime", + type: { + name: "DateTime" + } + }, + runState: { + serializedName: "runState", + type: { + name: "String" + } + }, + runSubState: { + serializedName: "runSubState", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const ImageTemplateIdentityUserAssignedIdentitiesValue: msRest.CompositeMapper = { + serializedName: "ImageTemplateIdentity_userAssignedIdentitiesValue", + type: { + name: "Composite", + className: "ImageTemplateIdentityUserAssignedIdentitiesValue", + modelProperties: { + principalId: { + readOnly: true, + serializedName: "principalId", + type: { + name: "String" + } + }, + clientId: { + readOnly: true, + serializedName: "clientId", + type: { + name: "String" + } + } + } + } +}; + +export const ImageTemplateIdentity: msRest.CompositeMapper = { + serializedName: "ImageTemplateIdentity", + type: { + name: "Composite", + className: "ImageTemplateIdentity", + modelProperties: { + type: { + serializedName: "type", + type: { + name: "Enum", + allowedValues: [ + "UserAssigned", + "None" + ] + } + }, + userAssignedIdentities: { + serializedName: "userAssignedIdentities", + type: { + name: "Dictionary", + value: { + type: { + name: "Composite", + className: "ImageTemplateIdentityUserAssignedIdentitiesValue" + } + } + } + } + } + } +}; + +export const Resource: msRest.CompositeMapper = { + serializedName: "Resource", + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + }, + location: { + required: true, + serializedName: "location", + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const ImageTemplate: msRest.CompositeMapper = { + serializedName: "ImageTemplate", + type: { + name: "Composite", + className: "ImageTemplate", + modelProperties: { + ...Resource.type.modelProperties, + source: { + required: true, + serializedName: "properties.source", + type: { + name: "Composite", + className: "ImageTemplateSource" + } + }, + customize: { + serializedName: "properties.customize", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ImageTemplateCustomizer" + } + } + } + }, + distribute: { + required: true, + serializedName: "properties.distribute", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ImageTemplateDistributor" + } + } + } + }, + provisioningState: { + readOnly: true, + serializedName: "properties.provisioningState", + type: { + name: "String" + } + }, + provisioningError: { + readOnly: true, + serializedName: "properties.provisioningError", + type: { + name: "Composite", + className: "ProvisioningError" + } + }, + lastRunStatus: { + readOnly: true, + serializedName: "properties.lastRunStatus", + type: { + name: "Composite", + className: "ImageTemplateLastRunStatus" + } + }, + buildTimeoutInMinutes: { + serializedName: "properties.buildTimeoutInMinutes", + type: { + name: "Number" + } + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "ImageTemplateIdentity" + } + } + } + } +}; + +export const ImageTemplateIsoSource: msRest.CompositeMapper = { + serializedName: "ISO", + type: { + name: "Composite", + polymorphicDiscriminator: ImageTemplateSource.type.polymorphicDiscriminator, + uberParent: "ImageTemplateSource", + className: "ImageTemplateIsoSource", + modelProperties: { + ...ImageTemplateSource.type.modelProperties, + sourceUri: { + required: true, + serializedName: "sourceUri", + type: { + name: "String" + } + }, + sha256Checksum: { + required: true, + serializedName: "sha256Checksum", + type: { + name: "String" + } + } + } + } +}; + +export const ImageTemplatePlatformImageSource: msRest.CompositeMapper = { + serializedName: "PlatformImage", + type: { + name: "Composite", + polymorphicDiscriminator: ImageTemplateSource.type.polymorphicDiscriminator, + uberParent: "ImageTemplateSource", + className: "ImageTemplatePlatformImageSource", + modelProperties: { + ...ImageTemplateSource.type.modelProperties, + publisher: { + serializedName: "publisher", + type: { + name: "String" + } + }, + offer: { + serializedName: "offer", + type: { + name: "String" + } + }, + sku: { + serializedName: "sku", + type: { + name: "String" + } + }, + version: { + serializedName: "version", + type: { + name: "String" + } + } + } + } +}; + +export const ImageTemplateManagedImageSource: msRest.CompositeMapper = { + serializedName: "ManagedImage", + type: { + name: "Composite", + polymorphicDiscriminator: ImageTemplateSource.type.polymorphicDiscriminator, + uberParent: "ImageTemplateSource", + className: "ImageTemplateManagedImageSource", + modelProperties: { + ...ImageTemplateSource.type.modelProperties, + imageId: { + required: true, + serializedName: "imageId", + type: { + name: "String" + } + } + } + } +}; + +export const ImageTemplateSharedImageVersionSource: msRest.CompositeMapper = { + serializedName: "SharedImageVersion", + type: { + name: "Composite", + polymorphicDiscriminator: ImageTemplateSource.type.polymorphicDiscriminator, + uberParent: "ImageTemplateSource", + className: "ImageTemplateSharedImageVersionSource", + modelProperties: { + ...ImageTemplateSource.type.modelProperties, + imageVersionId: { + required: true, + serializedName: "imageVersionId", + type: { + name: "String" + } + } + } + } +}; + +export const ImageTemplateShellCustomizer: msRest.CompositeMapper = { + serializedName: "Shell", + type: { + name: "Composite", + polymorphicDiscriminator: ImageTemplateCustomizer.type.polymorphicDiscriminator, + uberParent: "ImageTemplateCustomizer", + className: "ImageTemplateShellCustomizer", + modelProperties: { + ...ImageTemplateCustomizer.type.modelProperties, + scriptUri: { + serializedName: "scriptUri", + type: { + name: "String" + } + }, + inline: { + serializedName: "inline", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const ImageTemplateRestartCustomizer: msRest.CompositeMapper = { + serializedName: "WindowsRestart", + type: { + name: "Composite", + polymorphicDiscriminator: ImageTemplateCustomizer.type.polymorphicDiscriminator, + uberParent: "ImageTemplateCustomizer", + className: "ImageTemplateRestartCustomizer", + modelProperties: { + ...ImageTemplateCustomizer.type.modelProperties, + restartCommand: { + serializedName: "restartCommand", + type: { + name: "String" + } + }, + restartCheckCommand: { + serializedName: "restartCheckCommand", + type: { + name: "String" + } + }, + restartTimeout: { + serializedName: "restartTimeout", + type: { + name: "String" + } + } + } + } +}; + +export const ImageTemplatePowerShellCustomizer: msRest.CompositeMapper = { + serializedName: "PowerShell", + type: { + name: "Composite", + polymorphicDiscriminator: ImageTemplateCustomizer.type.polymorphicDiscriminator, + uberParent: "ImageTemplateCustomizer", + className: "ImageTemplatePowerShellCustomizer", + modelProperties: { + ...ImageTemplateCustomizer.type.modelProperties, + scriptUri: { + serializedName: "scriptUri", + type: { + name: "String" + } + }, + inline: { + serializedName: "inline", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + validExitCodes: { + serializedName: "validExitCodes", + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + } + } + } +}; + +export const ImageTemplateFileCustomizer: msRest.CompositeMapper = { + serializedName: "File", + type: { + name: "Composite", + polymorphicDiscriminator: ImageTemplateCustomizer.type.polymorphicDiscriminator, + uberParent: "ImageTemplateCustomizer", + className: "ImageTemplateFileCustomizer", + modelProperties: { + ...ImageTemplateCustomizer.type.modelProperties, + sourceUri: { + serializedName: "sourceUri", + type: { + name: "String" + } + }, + destination: { + serializedName: "destination", + type: { + name: "String" + } + } + } + } +}; + +export const ImageTemplateManagedImageDistributor: msRest.CompositeMapper = { + serializedName: "ManagedImage", + type: { + name: "Composite", + polymorphicDiscriminator: ImageTemplateDistributor.type.polymorphicDiscriminator, + uberParent: "ImageTemplateDistributor", + className: "ImageTemplateManagedImageDistributor", + modelProperties: { + ...ImageTemplateDistributor.type.modelProperties, + imageId: { + required: true, + serializedName: "imageId", + type: { + name: "String" + } + }, + location: { + required: true, + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const ImageTemplateSharedImageDistributor: msRest.CompositeMapper = { + serializedName: "SharedImage", + type: { + name: "Composite", + polymorphicDiscriminator: ImageTemplateDistributor.type.polymorphicDiscriminator, + uberParent: "ImageTemplateDistributor", + className: "ImageTemplateSharedImageDistributor", + modelProperties: { + ...ImageTemplateDistributor.type.modelProperties, + galleryImageId: { + required: true, + serializedName: "galleryImageId", + type: { + name: "String" + } + }, + replicationRegions: { + required: true, + serializedName: "replicationRegions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const ImageTemplateVhdDistributor: msRest.CompositeMapper = { + serializedName: "VHD", + type: { + name: "Composite", + polymorphicDiscriminator: ImageTemplateDistributor.type.polymorphicDiscriminator, + uberParent: "ImageTemplateDistributor", + className: "ImageTemplateVhdDistributor", + modelProperties: { + ...ImageTemplateDistributor.type.modelProperties + } + } +}; + +export const ImageTemplateUpdateParameters: msRest.CompositeMapper = { + serializedName: "ImageTemplateUpdateParameters", + type: { + name: "Composite", + className: "ImageTemplateUpdateParameters", + modelProperties: { + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "ImageTemplateIdentity" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const SubResource: msRest.CompositeMapper = { + serializedName: "SubResource", + type: { + name: "Composite", + className: "SubResource", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + required: true, + serializedName: "name", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const RunOutput: msRest.CompositeMapper = { + serializedName: "RunOutput", + type: { + name: "Composite", + className: "RunOutput", + modelProperties: { + ...SubResource.type.modelProperties, + artifactId: { + serializedName: "properties.artifactId", + type: { + name: "String" + } + }, + artifactUri: { + serializedName: "properties.artifactUri", + type: { + name: "String" + } + }, + provisioningState: { + readOnly: true, + serializedName: "properties.provisioningState", + type: { + name: "String" + } + } + } + } +}; + +export const OperationDisplay: msRest.CompositeMapper = { + serializedName: "Operation_display", + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const Operation: msRest.CompositeMapper = { + serializedName: "Operation", + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Object" + } + } + } + } +}; + +export const ApiErrorBase: msRest.CompositeMapper = { + serializedName: "ApiErrorBase", + type: { + name: "Composite", + className: "ApiErrorBase", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + target: { + serializedName: "target", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const InnerError: msRest.CompositeMapper = { + serializedName: "InnerError", + type: { + name: "Composite", + className: "InnerError", + modelProperties: { + exceptionType: { + serializedName: "exceptionType", + type: { + name: "String" + } + }, + errorDetail: { + serializedName: "errorDetail", + type: { + name: "String" + } + } + } + } +}; + +export const ApiError: msRest.CompositeMapper = { + serializedName: "ApiError", + type: { + name: "Composite", + className: "ApiError", + modelProperties: { + details: { + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ApiErrorBase" + } + } + } + }, + innerError: { + serializedName: "innerError", + type: { + name: "Composite", + className: "InnerError" + } + }, + code: { + serializedName: "code", + type: { + name: "String" + } + }, + target: { + serializedName: "target", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const ImageTemplateListResult: msRest.CompositeMapper = { + serializedName: "ImageTemplateListResult", + type: { + name: "Composite", + className: "ImageTemplateListResult", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ImageTemplate" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const RunOutputCollection: msRest.CompositeMapper = { + serializedName: "RunOutputCollection", + type: { + name: "Composite", + className: "RunOutputCollection", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "RunOutput" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const OperationListResult: msRest.CompositeMapper = { + serializedName: "OperationListResult", + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const discriminators = { + 'ImageTemplateSource' : ImageTemplateSource, + 'ImageTemplateCustomizer' : ImageTemplateCustomizer, + 'ImageTemplateDistributor' : ImageTemplateDistributor, + 'ImageTemplateSource.ISO' : ImageTemplateIsoSource, + 'ImageTemplateSource.PlatformImage' : ImageTemplatePlatformImageSource, + 'ImageTemplateSource.ManagedImage' : ImageTemplateManagedImageSource, + 'ImageTemplateSource.SharedImageVersion' : ImageTemplateSharedImageVersionSource, + 'ImageTemplateCustomizer.Shell' : ImageTemplateShellCustomizer, + 'ImageTemplateCustomizer.WindowsRestart' : ImageTemplateRestartCustomizer, + 'ImageTemplateCustomizer.PowerShell' : ImageTemplatePowerShellCustomizer, + 'ImageTemplateCustomizer.File' : ImageTemplateFileCustomizer, + 'ImageTemplateDistributor.ManagedImage' : ImageTemplateManagedImageDistributor, + 'ImageTemplateDistributor.SharedImage' : ImageTemplateSharedImageDistributor, + 'ImageTemplateDistributor.VHD' : ImageTemplateVhdDistributor +}; diff --git a/packages/@azure/arm-imagebuilder/lib/models/operationsMappers.ts b/packages/@azure/arm-imagebuilder/lib/models/operationsMappers.ts new file mode 100644 index 000000000000..039ca9ffef2f --- /dev/null +++ b/packages/@azure/arm-imagebuilder/lib/models/operationsMappers.ts @@ -0,0 +1,20 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export { + discriminators, + OperationListResult, + Operation, + OperationDisplay, + ApiError, + ApiErrorBase, + InnerError +} from "../models/mappers"; + diff --git a/packages/@azure/arm-imagebuilder/lib/models/parameters.ts b/packages/@azure/arm-imagebuilder/lib/models/parameters.ts new file mode 100644 index 000000000000..d6be0d24f282 --- /dev/null +++ b/packages/@azure/arm-imagebuilder/lib/models/parameters.ts @@ -0,0 +1,89 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; + +export const acceptLanguage: msRest.OperationParameter = { + parameterPath: "acceptLanguage", + mapper: { + serializedName: "accept-language", + defaultValue: 'en-US', + type: { + name: "String" + } + } +}; +export const apiVersion: msRest.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + required: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; +export const imageTemplateName: msRest.OperationURLParameter = { + parameterPath: "imageTemplateName", + mapper: { + required: true, + serializedName: "imageTemplateName", + constraints: { + Pattern: /^[A-Za-z0-9-_]{1,64}$/ + }, + type: { + name: "String" + } + } +}; +export const nextPageLink: msRest.OperationURLParameter = { + parameterPath: "nextPageLink", + mapper: { + required: true, + serializedName: "nextLink", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const resourceGroupName: msRest.OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + required: true, + serializedName: "resourceGroupName", + type: { + name: "String" + } + } +}; +export const runOutputName: msRest.OperationURLParameter = { + parameterPath: "runOutputName", + mapper: { + required: true, + serializedName: "runOutputName", + constraints: { + Pattern: /^[A-Za-z0-9-_]{1,64}$/ + }, + type: { + name: "String" + } + } +}; +export const subscriptionId: msRest.OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + required: true, + serializedName: "subscriptionId", + type: { + name: "String" + } + } +}; diff --git a/packages/@azure/arm-imagebuilder/lib/models/virtualMachineImageTemplatesMappers.ts b/packages/@azure/arm-imagebuilder/lib/models/virtualMachineImageTemplatesMappers.ts new file mode 100644 index 000000000000..b6bd68838cf6 --- /dev/null +++ b/packages/@azure/arm-imagebuilder/lib/models/virtualMachineImageTemplatesMappers.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export { + discriminators, + ImageTemplateListResult, + ImageTemplate, + Resource, + BaseResource, + ImageTemplateSource, + ImageTemplateCustomizer, + ImageTemplateDistributor, + ProvisioningError, + ImageTemplateLastRunStatus, + ImageTemplateIdentity, + ImageTemplateIdentityUserAssignedIdentitiesValue, + ApiError, + ApiErrorBase, + InnerError, + ImageTemplateUpdateParameters, + RunOutputCollection, + RunOutput, + SubResource, + ImageTemplateIsoSource, + ImageTemplatePlatformImageSource, + ImageTemplateManagedImageSource, + ImageTemplateSharedImageVersionSource, + ImageTemplateShellCustomizer, + ImageTemplateRestartCustomizer, + ImageTemplatePowerShellCustomizer, + ImageTemplateFileCustomizer, + ImageTemplateManagedImageDistributor, + ImageTemplateSharedImageDistributor, + ImageTemplateVhdDistributor +} from "../models/mappers"; + diff --git a/packages/@azure/arm-imagebuilder/lib/operations/index.ts b/packages/@azure/arm-imagebuilder/lib/operations/index.ts new file mode 100644 index 000000000000..af686508a51e --- /dev/null +++ b/packages/@azure/arm-imagebuilder/lib/operations/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export * from "./virtualMachineImageTemplates"; +export * from "./operations"; diff --git a/packages/@azure/arm-imagebuilder/lib/operations/operations.ts b/packages/@azure/arm-imagebuilder/lib/operations/operations.ts new file mode 100644 index 000000000000..2dbbcc1d02f7 --- /dev/null +++ b/packages/@azure/arm-imagebuilder/lib/operations/operations.ts @@ -0,0 +1,123 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/operationsMappers"; +import * as Parameters from "../models/parameters"; +import { ImageBuilderClientContext } from "../imageBuilderClientContext"; + +/** Class representing a Operations. */ +export class Operations { + private readonly client: ImageBuilderClientContext; + + /** + * Create a Operations. + * @param {ImageBuilderClientContext} client Reference to the service client. + */ + constructor(client: ImageBuilderClientContext) { + this.client = client; + } + + /** + * Lists available operations for the Microsoft.VirtualMachineImages provider + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Lists available operations for the Microsoft.VirtualMachineImages provider + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.VirtualMachineImages/operations", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ApiError + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ApiError + } + }, + serializer +}; diff --git a/packages/@azure/arm-imagebuilder/lib/operations/virtualMachineImageTemplates.ts b/packages/@azure/arm-imagebuilder/lib/operations/virtualMachineImageTemplates.ts new file mode 100644 index 000000000000..7b90af275e50 --- /dev/null +++ b/packages/@azure/arm-imagebuilder/lib/operations/virtualMachineImageTemplates.ts @@ -0,0 +1,696 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; +import * as Models from "../models"; +import * as Mappers from "../models/virtualMachineImageTemplatesMappers"; +import * as Parameters from "../models/parameters"; +import { ImageBuilderClientContext } from "../imageBuilderClientContext"; + +/** Class representing a VirtualMachineImageTemplates. */ +export class VirtualMachineImageTemplates { + private readonly client: ImageBuilderClientContext; + + /** + * Create a VirtualMachineImageTemplates. + * @param {ImageBuilderClientContext} client Reference to the service client. + */ + constructor(client: ImageBuilderClientContext) { + this.client = client; + } + + /** + * Gets information about the VM image templates associated with the subscription. + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * @param resourceGroupName The name of the resource group. + * @param [options] The optional parameters + * @returns Promise + */ + listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group. + * @param callback The callback + */ + listByResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. + * @param options The optional parameters + * @param callback The callback + */ + listByResourceGroup(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + options + }, + listByResourceGroupOperationSpec, + callback) as Promise; + } + + /** + * Create or update a virtual machine image template + * @param parameters Parameters supplied to the CreateImageTemplate operation + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param [options] The optional parameters + * @returns Promise + */ + createOrUpdate(parameters: Models.ImageTemplate, resourceGroupName: string, imageTemplateName: string, options?: msRest.RequestOptionsBase): Promise { + return this.beginCreateOrUpdate(parameters,resourceGroupName,imageTemplateName,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + + /** + * Update the tags for this Virtual Machine Image Template + * @param parameters Additional parameters for Image Template update. + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param [options] The optional parameters + * @returns Promise + */ + update(parameters: Models.ImageTemplateUpdateParameters, resourceGroupName: string, imageTemplateName: string, options?: msRest.RequestOptionsBase): Promise { + return this.beginUpdate(parameters,resourceGroupName,imageTemplateName,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + + /** + * Get information about a virtual machine image template + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param [options] The optional parameters + * @returns Promise + */ + get(resourceGroupName: string, imageTemplateName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param callback The callback + */ + get(resourceGroupName: string, imageTemplateName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param options The optional parameters + * @param callback The callback + */ + get(resourceGroupName: string, imageTemplateName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(resourceGroupName: string, imageTemplateName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + imageTemplateName, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Delete a virtual machine image template + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(resourceGroupName: string, imageTemplateName: string, options?: msRest.RequestOptionsBase): Promise { + return this.beginDeleteMethod(resourceGroupName,imageTemplateName,options) + .then(lroPoller => lroPoller.pollUntilFinished()); + } + + /** + * Create artifacts from a existing image template + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param [options] The optional parameters + * @returns Promise + */ + run(resourceGroupName: string, imageTemplateName: string, options?: msRest.RequestOptionsBase): Promise { + return this.beginRun(resourceGroupName,imageTemplateName,options) + .then(lroPoller => lroPoller.pollUntilFinished()); + } + + /** + * List all run outputs for the specified Image Template resource + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param [options] The optional parameters + * @returns Promise + */ + listRunOutputs(resourceGroupName: string, imageTemplateName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param callback The callback + */ + listRunOutputs(resourceGroupName: string, imageTemplateName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param options The optional parameters + * @param callback The callback + */ + listRunOutputs(resourceGroupName: string, imageTemplateName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listRunOutputs(resourceGroupName: string, imageTemplateName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + imageTemplateName, + options + }, + listRunOutputsOperationSpec, + callback) as Promise; + } + + /** + * Get the specified run output for the specified image template resource + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param runOutputName The name of the run output + * @param [options] The optional parameters + * @returns Promise + */ + getRunOutput(resourceGroupName: string, imageTemplateName: string, runOutputName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param runOutputName The name of the run output + * @param callback The callback + */ + getRunOutput(resourceGroupName: string, imageTemplateName: string, runOutputName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param runOutputName The name of the run output + * @param options The optional parameters + * @param callback The callback + */ + getRunOutput(resourceGroupName: string, imageTemplateName: string, runOutputName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getRunOutput(resourceGroupName: string, imageTemplateName: string, runOutputName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + imageTemplateName, + runOutputName, + options + }, + getRunOutputOperationSpec, + callback) as Promise; + } + + /** + * Create or update a virtual machine image template + * @param parameters Parameters supplied to the CreateImageTemplate operation + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param [options] The optional parameters + * @returns Promise + */ + beginCreateOrUpdate(parameters: Models.ImageTemplate, resourceGroupName: string, imageTemplateName: string, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + parameters, + resourceGroupName, + imageTemplateName, + options + }, + beginCreateOrUpdateOperationSpec, + options); + } + + /** + * Update the tags for this Virtual Machine Image Template + * @param parameters Additional parameters for Image Template update. + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param [options] The optional parameters + * @returns Promise + */ + beginUpdate(parameters: Models.ImageTemplateUpdateParameters, resourceGroupName: string, imageTemplateName: string, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + parameters, + resourceGroupName, + imageTemplateName, + options + }, + beginUpdateOperationSpec, + options); + } + + /** + * Delete a virtual machine image template + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param [options] The optional parameters + * @returns Promise + */ + beginDeleteMethod(resourceGroupName: string, imageTemplateName: string, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + resourceGroupName, + imageTemplateName, + options + }, + beginDeleteMethodOperationSpec, + options); + } + + /** + * Create artifacts from a existing image template + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param [options] The optional parameters + * @returns Promise + */ + beginRun(resourceGroupName: string, imageTemplateName: string, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + resourceGroupName, + imageTemplateName, + options + }, + beginRunOperationSpec, + options); + } + + /** + * Gets information about the VM image templates associated with the subscription. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listByResourceGroupNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listByResourceGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listByResourceGroupNextOperationSpec, + callback) as Promise; + } + + /** + * List all run outputs for the specified Image Template resource + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listRunOutputsNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listRunOutputsNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listRunOutputsNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listRunOutputsNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listRunOutputsNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.VirtualMachineImages/imageTemplates", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ImageTemplateListResult + }, + default: { + bodyMapper: Mappers.ApiError + } + }, + serializer +}; + +const listByResourceGroupOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ImageTemplateListResult + }, + default: { + bodyMapper: Mappers.ApiError + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.imageTemplateName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ImageTemplate + }, + default: { + bodyMapper: Mappers.ApiError + } + }, + serializer +}; + +const listRunOutputsOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.imageTemplateName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RunOutputCollection + }, + default: { + bodyMapper: Mappers.ApiError + } + }, + serializer +}; + +const getRunOutputOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs/{runOutputName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.imageTemplateName, + Parameters.runOutputName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RunOutput + }, + default: { + bodyMapper: Mappers.ApiError + } + }, + serializer +}; + +const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.imageTemplateName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "parameters", + mapper: { + ...Mappers.ImageTemplate, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.ImageTemplate + }, + 201: { + bodyMapper: Mappers.ImageTemplate + }, + default: { + bodyMapper: Mappers.ApiError + } + }, + serializer +}; + +const beginUpdateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.imageTemplateName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "parameters", + mapper: { + ...Mappers.ImageTemplateUpdateParameters, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.ImageTemplate + }, + 202: {}, + default: { + bodyMapper: Mappers.ApiError + } + }, + serializer +}; + +const beginDeleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.imageTemplateName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ApiError + } + }, + serializer +}; + +const beginRunOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/run", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.imageTemplateName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ApiError + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ImageTemplateListResult + }, + default: { + bodyMapper: Mappers.ApiError + } + }, + serializer +}; + +const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ImageTemplateListResult + }, + default: { + bodyMapper: Mappers.ApiError + } + }, + serializer +}; + +const listRunOutputsNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RunOutputCollection + }, + default: { + bodyMapper: Mappers.ApiError + } + }, + serializer +}; diff --git a/packages/@azure/arm-imagebuilder/package.json b/packages/@azure/arm-imagebuilder/package.json new file mode 100644 index 000000000000..5dcfdc8ba08f --- /dev/null +++ b/packages/@azure/arm-imagebuilder/package.json @@ -0,0 +1,56 @@ +{ + "name": "@azure/arm-imagebuilder", + "author": "Microsoft Corporation", + "description": "ImageBuilderClient Library with typescript type definitions for node.js and browser.", + "version": "1.0.0", + "dependencies": { + "@azure/ms-rest-azure-js": "^1.2.0", + "@azure/ms-rest-js": "^1.2.0", + "tslib": "^1.9.3" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/arm-imagebuilder.js", + "module": "./esm/imageBuilderClient.js", + "types": "./esm/imageBuilderClient.d.ts", + "devDependencies": { + "typescript": "^3.1.1", + "rollup": "^0.66.2", + "rollup-plugin-node-resolve": "^3.4.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "uglify-js": "^3.4.9" + }, + "homepage": "https://github.com/azure/azure-sdk-for-js/tree/master/packages/@azure/arm-imagebuilder", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "esm/**/*.js", + "esm/**/*.js.map", + "esm/**/*.d.ts", + "esm/**/*.d.ts.map", + "lib/**/*.ts", + "rollup.config.js", + "tsconfig.json" + ], + "scripts": { + "build": "tsc && rollup -c rollup.config.js && npm run minify", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-imagebuilder.js.map'\" -o ./dist/arm-imagebuilder.min.js ./dist/arm-imagebuilder.js", + "prepack": "npm install && npm run build" + }, + "sideEffects": false +} diff --git a/packages/@azure/arm-imagebuilder/rollup.config.js b/packages/@azure/arm-imagebuilder/rollup.config.js new file mode 100644 index 000000000000..438c60807331 --- /dev/null +++ b/packages/@azure/arm-imagebuilder/rollup.config.js @@ -0,0 +1,37 @@ +import rollup from "rollup"; +import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + +/** + * @type {rollup.RollupFileOptions} + */ +const config = { + input: "./esm/imageBuilderClient.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], + output: { + file: "./dist/arm-imagebuilder.js", + format: "umd", + name: "Azure.ArmImagebuilder", + sourcemap: true, + globals: { + "@azure/ms-rest-js": "msRest", + "@azure/ms-rest-azure-js": "msRestAzure" + }, + banner: `/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */` + }, + plugins: [ + nodeResolve({ module: true }), + sourcemaps() + ] +}; + +export default config; diff --git a/packages/@azure/arm-imagebuilder/tsconfig.json b/packages/@azure/arm-imagebuilder/tsconfig.json new file mode 100644 index 000000000000..51ea90961ce5 --- /dev/null +++ b/packages/@azure/arm-imagebuilder/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es5", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es6"], + "declaration": true, + "outDir": "./esm", + "importHelpers": true + }, + "include": ["./lib/**/*.ts"], + "exclude": ["node_modules"] +}