From 2ea80446233d9a20f81a959978e15018f3742e5f Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 30 Mar 2018 15:08:51 -0700 Subject: [PATCH] [AutoPR containerinstance/resource-manager] Adding April Swagger For GA (#2604) * Generated from 3f1cb3ecea72fb963c8c89dcce5a4a3fe378e878 Adding GA Swagger * Generated from ab364c6f9db63bf093fc85506577245a35f1fbb4 Moving read only to property level --- .../lib/LICENSE.txt | 21 + .../containerInstanceManagementClient.d.ts | 66 + .../lib/containerInstanceManagementClient.js | 89 + .../lib/lib/models/azureFileVolume.js | 81 + .../lib/lib/models/container.js | 190 ++ .../lib/lib/models/containerExecRequest.js | 65 + .../containerExecRequestTerminalSize.js | 60 + .../lib/lib/models/containerExecResponse.js | 62 + .../lib/lib/models/containerGroup.js | 204 ++ .../lib/models/containerGroupListResult.js | 69 + .../containerGroupPropertiesInstanceView.js | 73 + .../lib/lib/models/containerPort.js | 61 + .../models/containerPropertiesInstanceView.js | 112 + .../lib/lib/models/containerState.js | 93 + .../lib/lib/models/environmentVariable.js | 60 + .../lib/lib/models/event.js | 99 + .../lib/lib/models/gitRepoVolume.js | 71 + .../lib/lib/models/imageRegistryCredential.js | 69 + .../lib/lib/models/index.d.ts | 646 +++++ .../lib/lib/models/index.js | 50 + .../lib/lib/models/ipAddress.js | 96 + .../lib/lib/models/logs.js | 53 + .../lib/lib/models/operation.js | 80 + .../lib/lib/models/operationDisplay.js | 81 + .../lib/lib/models/operationListResult.js | 71 + .../lib/lib/models/port.js | 61 + .../lib/lib/models/resource.js | 98 + .../lib/lib/models/resourceLimits.js | 61 + .../lib/lib/models/resourceRequests.js | 61 + .../lib/lib/models/resourceRequirements.js | 72 + .../lib/lib/models/usage.js | 85 + .../lib/lib/models/usageListResult.js | 63 + .../lib/lib/models/usageName.js | 62 + .../lib/lib/models/volume.js | 110 + .../lib/lib/models/volumeMount.js | 70 + .../lib/lib/operations/containerGroupUsage.js | 251 ++ .../lib/lib/operations/containerGroups.js | 2409 +++++++++++++++++ .../lib/lib/operations/containerLogs.js | 299 ++ .../lib/lib/operations/index.d.ts | 1099 ++++++++ .../lib/lib/operations/index.js | 21 + .../lib/lib/operations/operations.js | 237 ++ .../lib/lib/operations/startContainer.js | 336 +++ .../lib/package.json | 22 + 43 files changed, 8039 insertions(+) create mode 100644 lib/services/containerinstanceManagement/lib/LICENSE.txt create mode 100644 lib/services/containerinstanceManagement/lib/lib/containerInstanceManagementClient.d.ts create mode 100644 lib/services/containerinstanceManagement/lib/lib/containerInstanceManagementClient.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/azureFileVolume.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/container.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/containerExecRequest.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/containerExecRequestTerminalSize.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/containerExecResponse.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/containerGroup.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/containerGroupListResult.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/containerGroupPropertiesInstanceView.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/containerPort.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/containerPropertiesInstanceView.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/containerState.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/environmentVariable.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/event.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/gitRepoVolume.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/imageRegistryCredential.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/index.d.ts create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/index.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/ipAddress.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/logs.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/operation.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/operationDisplay.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/operationListResult.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/port.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/resource.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/resourceLimits.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/resourceRequests.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/resourceRequirements.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/usage.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/usageListResult.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/usageName.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/volume.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/models/volumeMount.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/operations/containerGroupUsage.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/operations/containerGroups.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/operations/containerLogs.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/operations/index.d.ts create mode 100644 lib/services/containerinstanceManagement/lib/lib/operations/index.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/operations/operations.js create mode 100644 lib/services/containerinstanceManagement/lib/lib/operations/startContainer.js create mode 100644 lib/services/containerinstanceManagement/lib/package.json diff --git a/lib/services/containerinstanceManagement/lib/LICENSE.txt b/lib/services/containerinstanceManagement/lib/LICENSE.txt new file mode 100644 index 0000000000..5431ba98b9 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 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/lib/services/containerinstanceManagement/lib/lib/containerInstanceManagementClient.d.ts b/lib/services/containerinstanceManagement/lib/lib/containerInstanceManagementClient.d.ts new file mode 100644 index 0000000000..312ef4d3e0 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/containerInstanceManagementClient.d.ts @@ -0,0 +1,66 @@ +/* + * 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 { ServiceClientCredentials } from 'ms-rest'; +import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; +import * as operations from "./operations"; + +export default class ContainerInstanceManagementClient extends AzureServiceClient { + /** + * Initializes a new instance of the ContainerInstanceManagementClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param {string} [baseUri] - The base URI of the service. + * + * @param {object} [options] - The parameter options + * + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * + * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * + * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + */ + constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); + + credentials: ServiceClientCredentials; + + subscriptionId: string; + + apiVersion: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + containerGroups: operations.ContainerGroups; + operations: operations.Operations; + containerGroupUsage: operations.ContainerGroupUsage; + containerLogs: operations.ContainerLogs; + startContainer: operations.StartContainer; +} + +export { ContainerInstanceManagementClient, models as ContainerInstanceManagementModels }; diff --git a/lib/services/containerinstanceManagement/lib/lib/containerInstanceManagementClient.js b/lib/services/containerinstanceManagement/lib/lib/containerInstanceManagementClient.js new file mode 100644 index 0000000000..14aa881310 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/containerInstanceManagementClient.js @@ -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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const ServiceClient = msRestAzure.AzureServiceClient; + +const models = require('./models'); +const operations = require('./operations'); + + +/** Class representing a ContainerInstanceManagementClient. */ +class ContainerInstanceManagementClient extends ServiceClient { + /** + * Create a ContainerInstanceManagementClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * @param {string} [baseUri] - The base URI of the service. + * @param {object} [options] - The parameter options + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + */ + constructor(credentials, subscriptionId, baseUri, options) { + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId === null || subscriptionId === undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) options = {}; + + super(credentials, options); + + this.apiVersion = '2018-04-01'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.baseUri = baseUri; + if (!this.baseUri) { + this.baseUri = 'https://management.azure.com'; + } + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + let packageInfo = this.getPackageJsonInfo(__dirname); + this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { + this.generateClientRequestId = options.generateClientRequestId; + } + this.containerGroups = new operations.ContainerGroups(this); + this.operations = new operations.Operations(this); + this.containerGroupUsage = new operations.ContainerGroupUsage(this); + this.containerLogs = new operations.ContainerLogs(this); + this.startContainer = new operations.StartContainer(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = ContainerInstanceManagementClient; +module.exports['default'] = ContainerInstanceManagementClient; +module.exports.ContainerInstanceManagementClient = ContainerInstanceManagementClient; +module.exports.ContainerInstanceManagementModels = models; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/azureFileVolume.js b/lib/services/containerinstanceManagement/lib/lib/models/azureFileVolume.js new file mode 100644 index 0000000000..d80dbd8404 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/azureFileVolume.js @@ -0,0 +1,81 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The properties of the Azure File volume. Azure File shares are mounted as + * volumes. + * + */ +class AzureFileVolume { + /** + * Create a AzureFileVolume. + * @member {string} shareName The name of the Azure File share to be mounted + * as a volume. + * @member {boolean} [readOnly] The flag indicating whether the Azure File + * shared mounted as a volume is read-only. + * @member {string} storageAccountName The name of the storage account that + * contains the Azure File share. + * @member {string} [storageAccountKey] The storage account access key used + * to access the Azure File share. + */ + constructor() { + } + + /** + * Defines the metadata of AzureFileVolume + * + * @returns {object} metadata of AzureFileVolume + * + */ + mapper() { + return { + required: false, + serializedName: 'AzureFileVolume', + type: { + name: 'Composite', + className: 'AzureFileVolume', + modelProperties: { + shareName: { + required: true, + serializedName: 'shareName', + type: { + name: 'String' + } + }, + readOnly: { + required: false, + serializedName: 'readOnly', + type: { + name: 'Boolean' + } + }, + storageAccountName: { + required: true, + serializedName: 'storageAccountName', + type: { + name: 'String' + } + }, + storageAccountKey: { + required: false, + serializedName: 'storageAccountKey', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AzureFileVolume; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/container.js b/lib/services/containerinstanceManagement/lib/lib/models/container.js new file mode 100644 index 0000000000..6be2cf2c66 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/container.js @@ -0,0 +1,190 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A container instance. + * + */ +class Container { + /** + * Create a Container. + * @member {string} name The user-provided name of the container instance. + * @member {string} image The name of the image used to create the container + * instance. + * @member {array} [command] The commands to execute within the container + * instance in exec form. + * @member {array} [ports] The exposed ports on the container instance. + * @member {array} [environmentVariables] The environment variables to set in + * the container instance. + * @member {object} [instanceView] The instance view of the container + * instance. Only valid in response. + * @member {number} [instanceView.restartCount] The number of times that the + * container instance has been restarted. + * @member {object} [instanceView.currentState] Current container instance + * state. + * @member {string} [instanceView.currentState.state] The state of the + * container instance. + * @member {date} [instanceView.currentState.startTime] The date-time when + * the container instance state started. + * @member {number} [instanceView.currentState.exitCode] The container + * instance exit codes correspond to those from the `docker run` command. + * @member {date} [instanceView.currentState.finishTime] The date-time when + * the container instance state finished. + * @member {string} [instanceView.currentState.detailStatus] The + * human-readable status of the container instance state. + * @member {object} [instanceView.previousState] Previous container instance + * state. + * @member {string} [instanceView.previousState.state] The state of the + * container instance. + * @member {date} [instanceView.previousState.startTime] The date-time when + * the container instance state started. + * @member {number} [instanceView.previousState.exitCode] The container + * instance exit codes correspond to those from the `docker run` command. + * @member {date} [instanceView.previousState.finishTime] The date-time when + * the container instance state finished. + * @member {string} [instanceView.previousState.detailStatus] The + * human-readable status of the container instance state. + * @member {array} [instanceView.events] The events of the container + * instance. + * @member {object} resources The resource requirements of the container + * instance. + * @member {object} [resources.requests] The resource requests of this + * container instance. + * @member {number} [resources.requests.memoryInGB] The memory request in GB + * of this container instance. + * @member {number} [resources.requests.cpu] The CPU request of this + * container instance. + * @member {object} [resources.limits] The resource limits of this container + * instance. + * @member {number} [resources.limits.memoryInGB] The memory limit in GB of + * this container instance. + * @member {number} [resources.limits.cpu] The CPU limit of this container + * instance. + * @member {array} [volumeMounts] The volume mounts available to the + * container instance. + */ + constructor() { + } + + /** + * Defines the metadata of Container + * + * @returns {object} metadata of Container + * + */ + mapper() { + return { + required: false, + serializedName: 'Container', + type: { + name: 'Composite', + className: 'Container', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + image: { + required: true, + serializedName: 'properties.image', + type: { + name: 'String' + } + }, + command: { + required: false, + serializedName: 'properties.command', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + ports: { + required: false, + serializedName: 'properties.ports', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ContainerPortElementType', + type: { + name: 'Composite', + className: 'ContainerPort' + } + } + } + }, + environmentVariables: { + required: false, + serializedName: 'properties.environmentVariables', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EnvironmentVariableElementType', + type: { + name: 'Composite', + className: 'EnvironmentVariable' + } + } + } + }, + instanceView: { + required: false, + readOnly: true, + serializedName: 'properties.instanceView', + type: { + name: 'Composite', + className: 'ContainerPropertiesInstanceView' + } + }, + resources: { + required: true, + serializedName: 'properties.resources', + type: { + name: 'Composite', + className: 'ResourceRequirements' + } + }, + volumeMounts: { + required: false, + serializedName: 'properties.volumeMounts', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VolumeMountElementType', + type: { + name: 'Composite', + className: 'VolumeMount' + } + } + } + } + } + } + }; + } +} + +module.exports = Container; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/containerExecRequest.js b/lib/services/containerinstanceManagement/lib/lib/models/containerExecRequest.js new file mode 100644 index 0000000000..1f1ce32c55 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/containerExecRequest.js @@ -0,0 +1,65 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The start container exec request. + * + */ +class ContainerExecRequest { + /** + * Create a ContainerExecRequest. + * @member {string} [command] The command to be executed. + * @member {object} [terminalSize] The size of the terminal. + * @member {number} [terminalSize.row] The row size of the terminal + * @member {number} [terminalSize.column] The column size of the terminal + */ + constructor() { + } + + /** + * Defines the metadata of ContainerExecRequest + * + * @returns {object} metadata of ContainerExecRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'ContainerExecRequest', + type: { + name: 'Composite', + className: 'ContainerExecRequest', + modelProperties: { + command: { + required: false, + serializedName: 'command', + type: { + name: 'String' + } + }, + terminalSize: { + required: false, + serializedName: 'terminalSize', + type: { + name: 'Composite', + className: 'ContainerExecRequestTerminalSize' + } + } + } + } + }; + } +} + +module.exports = ContainerExecRequest; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/containerExecRequestTerminalSize.js b/lib/services/containerinstanceManagement/lib/lib/models/containerExecRequestTerminalSize.js new file mode 100644 index 0000000000..9c5895472f --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/containerExecRequestTerminalSize.js @@ -0,0 +1,60 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The size of the terminal. + * + */ +class ContainerExecRequestTerminalSize { + /** + * Create a ContainerExecRequestTerminalSize. + * @member {number} [row] The row size of the terminal + * @member {number} [column] The column size of the terminal + */ + constructor() { + } + + /** + * Defines the metadata of ContainerExecRequestTerminalSize + * + * @returns {object} metadata of ContainerExecRequestTerminalSize + * + */ + mapper() { + return { + required: false, + serializedName: 'ContainerExecRequest_terminalSize', + type: { + name: 'Composite', + className: 'ContainerExecRequestTerminalSize', + modelProperties: { + row: { + required: false, + serializedName: 'row', + type: { + name: 'Number' + } + }, + column: { + required: false, + serializedName: 'column', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ContainerExecRequestTerminalSize; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/containerExecResponse.js b/lib/services/containerinstanceManagement/lib/lib/models/containerExecResponse.js new file mode 100644 index 0000000000..d159ff5b83 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/containerExecResponse.js @@ -0,0 +1,62 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The information for the container exec command. + * + */ +class ContainerExecResponse { + /** + * Create a ContainerExecResponse. + * @member {string} [webSocketUri] The uri for the exec websocket. + * @member {string} [password] The password to start the exec command. + */ + constructor() { + } + + /** + * Defines the metadata of ContainerExecResponse + * + * @returns {object} metadata of ContainerExecResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ContainerExecResponse', + type: { + name: 'Composite', + className: 'ContainerExecResponse', + modelProperties: { + webSocketUri: { + required: false, + readOnly: true, + serializedName: 'webSocketUri', + type: { + name: 'String' + } + }, + password: { + required: false, + readOnly: true, + serializedName: 'password', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ContainerExecResponse; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/containerGroup.js b/lib/services/containerinstanceManagement/lib/lib/models/containerGroup.js new file mode 100644 index 0000000000..6f677f4e09 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/containerGroup.js @@ -0,0 +1,204 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A container group. + * + * @extends models['Resource'] + */ +class ContainerGroup extends models['Resource'] { + /** + * Create a ContainerGroup. + * @member {string} [provisioningState] The provisioning state of the + * container group. This only appears in the response. + * @member {array} containers The containers within the container group. + * @member {array} [imageRegistryCredentials] The image registry credentials + * by which the container group is created from. + * @member {string} [restartPolicy] Restart policy for all containers within + * the container group. + * - `Always` Always restart + * - `OnFailure` Restart on failure + * - `Never` Never restart + * . Possible values include: 'Always', 'OnFailure', 'Never' + * @member {object} [ipAddress] The IP address type of the container group. + * @member {array} [ipAddress.ports] The list of ports exposed on the + * container group. + * @member {string} [ipAddress.ip] The IP exposed to the public internet. + * @member {string} [ipAddress.dnsNameLabel] The Dns name label for the IP. + * @member {string} [ipAddress.fqdn] The FQDN for the IP. + * @member {string} osType The operating system type required by the + * containers in the container group. Possible values include: 'Windows', + * 'Linux' + * @member {array} [volumes] The list of volumes that can be mounted by + * containers in this container group. + * @member {object} [instanceView] The instance view of the container group. + * Only valid in response. + * @member {array} [instanceView.events] The events of this container group. + * @member {string} [instanceView.state] The state of the container group. + * Only valid in response. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ContainerGroup + * + * @returns {object} metadata of ContainerGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'ContainerGroup', + type: { + name: 'Composite', + className: 'ContainerGroup', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + containers: { + required: true, + serializedName: 'properties.containers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ContainerElementType', + type: { + name: 'Composite', + className: 'Container' + } + } + } + }, + imageRegistryCredentials: { + required: false, + serializedName: 'properties.imageRegistryCredentials', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ImageRegistryCredentialElementType', + type: { + name: 'Composite', + className: 'ImageRegistryCredential' + } + } + } + }, + restartPolicy: { + required: false, + serializedName: 'properties.restartPolicy', + type: { + name: 'String' + } + }, + ipAddress: { + required: false, + serializedName: 'properties.ipAddress', + type: { + name: 'Composite', + className: 'IpAddress' + } + }, + osType: { + required: true, + serializedName: 'properties.osType', + type: { + name: 'String' + } + }, + volumes: { + required: false, + serializedName: 'properties.volumes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VolumeElementType', + type: { + name: 'Composite', + className: 'Volume' + } + } + } + }, + instanceView: { + required: false, + readOnly: true, + serializedName: 'properties.instanceView', + type: { + name: 'Composite', + className: 'ContainerGroupPropertiesInstanceView' + } + } + } + } + }; + } +} + +module.exports = ContainerGroup; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/containerGroupListResult.js b/lib/services/containerinstanceManagement/lib/lib/models/containerGroupListResult.js new file mode 100644 index 0000000000..9ee4a5810b --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/containerGroupListResult.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The container group list response that contains the container group + * properties. + */ +class ContainerGroupListResult extends Array { + /** + * Create a ContainerGroupListResult. + * @member {string} [nextLink] The URI to fetch the next page of container + * groups. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ContainerGroupListResult + * + * @returns {object} metadata of ContainerGroupListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ContainerGroupListResult', + type: { + name: 'Composite', + className: 'ContainerGroupListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ContainerGroupElementType', + type: { + name: 'Composite', + className: 'ContainerGroup' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ContainerGroupListResult; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/containerGroupPropertiesInstanceView.js b/lib/services/containerinstanceManagement/lib/lib/models/containerGroupPropertiesInstanceView.js new file mode 100644 index 0000000000..5ff7e8e4a3 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/containerGroupPropertiesInstanceView.js @@ -0,0 +1,73 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The instance view of the container group. Only valid in response. + * + */ +class ContainerGroupPropertiesInstanceView { + /** + * Create a ContainerGroupPropertiesInstanceView. + * @member {array} [events] The events of this container group. + * @member {string} [state] The state of the container group. Only valid in + * response. + */ + constructor() { + } + + /** + * Defines the metadata of ContainerGroupPropertiesInstanceView + * + * @returns {object} metadata of ContainerGroupPropertiesInstanceView + * + */ + mapper() { + return { + required: false, + serializedName: 'ContainerGroup_properties_instanceView', + type: { + name: 'Composite', + className: 'ContainerGroupPropertiesInstanceView', + modelProperties: { + events: { + required: false, + readOnly: true, + serializedName: 'events', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EventElementType', + type: { + name: 'Composite', + className: 'Event' + } + } + } + }, + state: { + required: false, + readOnly: true, + serializedName: 'state', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ContainerGroupPropertiesInstanceView; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/containerPort.js b/lib/services/containerinstanceManagement/lib/lib/models/containerPort.js new file mode 100644 index 0000000000..3106ae3267 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/containerPort.js @@ -0,0 +1,61 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The port exposed on the container instance. + * + */ +class ContainerPort { + /** + * Create a ContainerPort. + * @member {string} [protocol] The protocol associated with the port. + * Possible values include: 'TCP', 'UDP' + * @member {number} port The port number exposed within the container group. + */ + constructor() { + } + + /** + * Defines the metadata of ContainerPort + * + * @returns {object} metadata of ContainerPort + * + */ + mapper() { + return { + required: false, + serializedName: 'ContainerPort', + type: { + name: 'Composite', + className: 'ContainerPort', + modelProperties: { + protocol: { + required: false, + serializedName: 'protocol', + type: { + name: 'String' + } + }, + port: { + required: true, + serializedName: 'port', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ContainerPort; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/containerPropertiesInstanceView.js b/lib/services/containerinstanceManagement/lib/lib/models/containerPropertiesInstanceView.js new file mode 100644 index 0000000000..a365329c94 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/containerPropertiesInstanceView.js @@ -0,0 +1,112 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The instance view of the container instance. Only valid in response. + * + */ +class ContainerPropertiesInstanceView { + /** + * Create a ContainerPropertiesInstanceView. + * @member {number} [restartCount] The number of times that the container + * instance has been restarted. + * @member {object} [currentState] Current container instance state. + * @member {string} [currentState.state] The state of the container instance. + * @member {date} [currentState.startTime] The date-time when the container + * instance state started. + * @member {number} [currentState.exitCode] The container instance exit codes + * correspond to those from the `docker run` command. + * @member {date} [currentState.finishTime] The date-time when the container + * instance state finished. + * @member {string} [currentState.detailStatus] The human-readable status of + * the container instance state. + * @member {object} [previousState] Previous container instance state. + * @member {string} [previousState.state] The state of the container + * instance. + * @member {date} [previousState.startTime] The date-time when the container + * instance state started. + * @member {number} [previousState.exitCode] The container instance exit + * codes correspond to those from the `docker run` command. + * @member {date} [previousState.finishTime] The date-time when the container + * instance state finished. + * @member {string} [previousState.detailStatus] The human-readable status of + * the container instance state. + * @member {array} [events] The events of the container instance. + */ + constructor() { + } + + /** + * Defines the metadata of ContainerPropertiesInstanceView + * + * @returns {object} metadata of ContainerPropertiesInstanceView + * + */ + mapper() { + return { + required: false, + serializedName: 'ContainerProperties_instanceView', + type: { + name: 'Composite', + className: 'ContainerPropertiesInstanceView', + modelProperties: { + restartCount: { + required: false, + readOnly: true, + serializedName: 'restartCount', + type: { + name: 'Number' + } + }, + currentState: { + required: false, + readOnly: true, + serializedName: 'currentState', + type: { + name: 'Composite', + className: 'ContainerState' + } + }, + previousState: { + required: false, + readOnly: true, + serializedName: 'previousState', + type: { + name: 'Composite', + className: 'ContainerState' + } + }, + events: { + required: false, + readOnly: true, + serializedName: 'events', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EventElementType', + type: { + name: 'Composite', + className: 'Event' + } + } + } + } + } + } + }; + } +} + +module.exports = ContainerPropertiesInstanceView; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/containerState.js b/lib/services/containerinstanceManagement/lib/lib/models/containerState.js new file mode 100644 index 0000000000..4a49dfee81 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/containerState.js @@ -0,0 +1,93 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The container instance state. + * + */ +class ContainerState { + /** + * Create a ContainerState. + * @member {string} [state] The state of the container instance. + * @member {date} [startTime] The date-time when the container instance state + * started. + * @member {number} [exitCode] The container instance exit codes correspond + * to those from the `docker run` command. + * @member {date} [finishTime] The date-time when the container instance + * state finished. + * @member {string} [detailStatus] The human-readable status of the container + * instance state. + */ + constructor() { + } + + /** + * Defines the metadata of ContainerState + * + * @returns {object} metadata of ContainerState + * + */ + mapper() { + return { + required: false, + serializedName: 'ContainerState', + type: { + name: 'Composite', + className: 'ContainerState', + modelProperties: { + state: { + required: false, + readOnly: true, + serializedName: 'state', + type: { + name: 'String' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'startTime', + type: { + name: 'DateTime' + } + }, + exitCode: { + required: false, + readOnly: true, + serializedName: 'exitCode', + type: { + name: 'Number' + } + }, + finishTime: { + required: false, + readOnly: true, + serializedName: 'finishTime', + type: { + name: 'DateTime' + } + }, + detailStatus: { + required: false, + readOnly: true, + serializedName: 'detailStatus', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ContainerState; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/environmentVariable.js b/lib/services/containerinstanceManagement/lib/lib/models/environmentVariable.js new file mode 100644 index 0000000000..dad63b4b37 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/environmentVariable.js @@ -0,0 +1,60 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The environment variable to set within the container instance. + * + */ +class EnvironmentVariable { + /** + * Create a EnvironmentVariable. + * @member {string} name The name of the environment variable. + * @member {string} value The value of the environment variable. + */ + constructor() { + } + + /** + * Defines the metadata of EnvironmentVariable + * + * @returns {object} metadata of EnvironmentVariable + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentVariable', + type: { + name: 'Composite', + className: 'EnvironmentVariable', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + value: { + required: true, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EnvironmentVariable; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/event.js b/lib/services/containerinstanceManagement/lib/lib/models/event.js new file mode 100644 index 0000000000..ba40c72db6 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/event.js @@ -0,0 +1,99 @@ +/* + * 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. + */ + +'use strict'; + +/** + * A container group or container instance event. + * + */ +class Event { + /** + * Create a Event. + * @member {number} [count] The count of the event. + * @member {date} [firstTimestamp] The date-time of the earliest logged + * event. + * @member {date} [lastTimestamp] The date-time of the latest logged event. + * @member {string} [name] The event name. + * @member {string} [message] The event message. + * @member {string} [type] The event type. + */ + constructor() { + } + + /** + * Defines the metadata of Event + * + * @returns {object} metadata of Event + * + */ + mapper() { + return { + required: false, + serializedName: 'Event', + type: { + name: 'Composite', + className: 'Event', + modelProperties: { + count: { + required: false, + readOnly: true, + serializedName: 'count', + type: { + name: 'Number' + } + }, + firstTimestamp: { + required: false, + readOnly: true, + serializedName: 'firstTimestamp', + type: { + name: 'DateTime' + } + }, + lastTimestamp: { + required: false, + readOnly: true, + serializedName: 'lastTimestamp', + type: { + name: 'DateTime' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Event; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/gitRepoVolume.js b/lib/services/containerinstanceManagement/lib/lib/models/gitRepoVolume.js new file mode 100644 index 0000000000..10e6161824 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/gitRepoVolume.js @@ -0,0 +1,71 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents a volume that is populated with the contents of a git repository + * + */ +class GitRepoVolume { + /** + * Create a GitRepoVolume. + * @member {string} [directory] Target directory name. Must not contain or + * start with '..'. If '.' is supplied, the volume directory will be the git + * repository. Otherwise, if specified, the volume will contain the git + * repository in the subdirectory with the given name. + * @member {string} repository Repository URL + * @member {string} [revision] Commit hash for the specified revision. + */ + constructor() { + } + + /** + * Defines the metadata of GitRepoVolume + * + * @returns {object} metadata of GitRepoVolume + * + */ + mapper() { + return { + required: false, + serializedName: 'GitRepoVolume', + type: { + name: 'Composite', + className: 'GitRepoVolume', + modelProperties: { + directory: { + required: false, + serializedName: 'directory', + type: { + name: 'String' + } + }, + repository: { + required: true, + serializedName: 'repository', + type: { + name: 'String' + } + }, + revision: { + required: false, + serializedName: 'revision', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = GitRepoVolume; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/imageRegistryCredential.js b/lib/services/containerinstanceManagement/lib/lib/models/imageRegistryCredential.js new file mode 100644 index 0000000000..ca8f89a9c4 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/imageRegistryCredential.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Image registry credential. + * + */ +class ImageRegistryCredential { + /** + * Create a ImageRegistryCredential. + * @member {string} server The Docker image registry server without a + * protocol such as "http" and "https". + * @member {string} username The username for the private registry. + * @member {string} [password] The password for the private registry. + */ + constructor() { + } + + /** + * Defines the metadata of ImageRegistryCredential + * + * @returns {object} metadata of ImageRegistryCredential + * + */ + mapper() { + return { + required: false, + serializedName: 'ImageRegistryCredential', + type: { + name: 'Composite', + className: 'ImageRegistryCredential', + modelProperties: { + server: { + required: true, + serializedName: 'server', + type: { + name: 'String' + } + }, + username: { + required: true, + serializedName: 'username', + type: { + name: 'String' + } + }, + password: { + required: false, + serializedName: 'password', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ImageRegistryCredential; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/index.d.ts b/lib/services/containerinstanceManagement/lib/lib/models/index.d.ts new file mode 100644 index 0000000000..a8d2cd9559 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/index.d.ts @@ -0,0 +1,646 @@ +/* + * 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 } from 'ms-rest-azure'; +import { CloudError } from 'ms-rest-azure'; +import * as moment from 'moment'; + +export { BaseResource } from 'ms-rest-azure'; +export { CloudError } from 'ms-rest-azure'; + + +/** + * @class + * Initializes a new instance of the ContainerPort class. + * @constructor + * The port exposed on the container instance. + * + * @member {string} [protocol] The protocol associated with the port. Possible + * values include: 'TCP', 'UDP' + * @member {number} port The port number exposed within the container group. + */ +export interface ContainerPort { + protocol?: string; + port: number; +} + +/** + * @class + * Initializes a new instance of the EnvironmentVariable class. + * @constructor + * The environment variable to set within the container instance. + * + * @member {string} name The name of the environment variable. + * @member {string} value The value of the environment variable. + */ +export interface EnvironmentVariable { + name: string; + value: string; +} + +/** + * @class + * Initializes a new instance of the ContainerState class. + * @constructor + * The container instance state. + * + * @member {string} [state] The state of the container instance. + * @member {date} [startTime] The date-time when the container instance state + * started. + * @member {number} [exitCode] The container instance exit codes correspond to + * those from the `docker run` command. + * @member {date} [finishTime] The date-time when the container instance state + * finished. + * @member {string} [detailStatus] The human-readable status of the container + * instance state. + */ +export interface ContainerState { + readonly state?: string; + readonly startTime?: Date; + readonly exitCode?: number; + readonly finishTime?: Date; + readonly detailStatus?: string; +} + +/** + * @class + * Initializes a new instance of the Event class. + * @constructor + * A container group or container instance event. + * + * @member {number} [count] The count of the event. + * @member {date} [firstTimestamp] The date-time of the earliest logged event. + * @member {date} [lastTimestamp] The date-time of the latest logged event. + * @member {string} [name] The event name. + * @member {string} [message] The event message. + * @member {string} [type] The event type. + */ +export interface Event { + readonly count?: number; + readonly firstTimestamp?: Date; + readonly lastTimestamp?: Date; + readonly name?: string; + readonly message?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the ContainerPropertiesInstanceView class. + * @constructor + * The instance view of the container instance. Only valid in response. + * + * @member {number} [restartCount] The number of times that the container + * instance has been restarted. + * @member {object} [currentState] Current container instance state. + * @member {string} [currentState.state] The state of the container instance. + * @member {date} [currentState.startTime] The date-time when the container + * instance state started. + * @member {number} [currentState.exitCode] The container instance exit codes + * correspond to those from the `docker run` command. + * @member {date} [currentState.finishTime] The date-time when the container + * instance state finished. + * @member {string} [currentState.detailStatus] The human-readable status of + * the container instance state. + * @member {object} [previousState] Previous container instance state. + * @member {string} [previousState.state] The state of the container instance. + * @member {date} [previousState.startTime] The date-time when the container + * instance state started. + * @member {number} [previousState.exitCode] The container instance exit codes + * correspond to those from the `docker run` command. + * @member {date} [previousState.finishTime] The date-time when the container + * instance state finished. + * @member {string} [previousState.detailStatus] The human-readable status of + * the container instance state. + * @member {array} [events] The events of the container instance. + */ +export interface ContainerPropertiesInstanceView { + readonly restartCount?: number; + readonly currentState?: ContainerState; + readonly previousState?: ContainerState; + readonly events?: Event[]; +} + +/** + * @class + * Initializes a new instance of the ResourceRequests class. + * @constructor + * The resource requests. + * + * @member {number} memoryInGB The memory request in GB of this container + * instance. + * @member {number} cpu The CPU request of this container instance. + */ +export interface ResourceRequests { + memoryInGB: number; + cpu: number; +} + +/** + * @class + * Initializes a new instance of the ResourceLimits class. + * @constructor + * The resource limits. + * + * @member {number} [memoryInGB] The memory limit in GB of this container + * instance. + * @member {number} [cpu] The CPU limit of this container instance. + */ +export interface ResourceLimits { + memoryInGB?: number; + cpu?: number; +} + +/** + * @class + * Initializes a new instance of the ResourceRequirements class. + * @constructor + * The resource requirements. + * + * @member {object} requests The resource requests of this container instance. + * @member {number} [requests.memoryInGB] The memory request in GB of this + * container instance. + * @member {number} [requests.cpu] The CPU request of this container instance. + * @member {object} [limits] The resource limits of this container instance. + * @member {number} [limits.memoryInGB] The memory limit in GB of this + * container instance. + * @member {number} [limits.cpu] The CPU limit of this container instance. + */ +export interface ResourceRequirements { + requests: ResourceRequests; + limits?: ResourceLimits; +} + +/** + * @class + * Initializes a new instance of the VolumeMount class. + * @constructor + * The properties of the volume mount. + * + * @member {string} name The name of the volume mount. + * @member {string} mountPath The path within the container where the volume + * should be mounted. Must not contain colon (:). + * @member {boolean} [readOnly] The flag indicating whether the volume mount is + * read-only. + */ +export interface VolumeMount { + name: string; + mountPath: string; + readOnly?: boolean; +} + +/** + * @class + * Initializes a new instance of the Container class. + * @constructor + * A container instance. + * + * @member {string} name The user-provided name of the container instance. + * @member {string} image The name of the image used to create the container + * instance. + * @member {array} [command] The commands to execute within the container + * instance in exec form. + * @member {array} [ports] The exposed ports on the container instance. + * @member {array} [environmentVariables] The environment variables to set in + * the container instance. + * @member {object} [instanceView] The instance view of the container instance. + * Only valid in response. + * @member {number} [instanceView.restartCount] The number of times that the + * container instance has been restarted. + * @member {object} [instanceView.currentState] Current container instance + * state. + * @member {string} [instanceView.currentState.state] The state of the + * container instance. + * @member {date} [instanceView.currentState.startTime] The date-time when the + * container instance state started. + * @member {number} [instanceView.currentState.exitCode] The container instance + * exit codes correspond to those from the `docker run` command. + * @member {date} [instanceView.currentState.finishTime] The date-time when the + * container instance state finished. + * @member {string} [instanceView.currentState.detailStatus] The human-readable + * status of the container instance state. + * @member {object} [instanceView.previousState] Previous container instance + * state. + * @member {string} [instanceView.previousState.state] The state of the + * container instance. + * @member {date} [instanceView.previousState.startTime] The date-time when the + * container instance state started. + * @member {number} [instanceView.previousState.exitCode] The container + * instance exit codes correspond to those from the `docker run` command. + * @member {date} [instanceView.previousState.finishTime] The date-time when + * the container instance state finished. + * @member {string} [instanceView.previousState.detailStatus] The + * human-readable status of the container instance state. + * @member {array} [instanceView.events] The events of the container instance. + * @member {object} resources The resource requirements of the container + * instance. + * @member {object} [resources.requests] The resource requests of this + * container instance. + * @member {number} [resources.requests.memoryInGB] The memory request in GB of + * this container instance. + * @member {number} [resources.requests.cpu] The CPU request of this container + * instance. + * @member {object} [resources.limits] The resource limits of this container + * instance. + * @member {number} [resources.limits.memoryInGB] The memory limit in GB of + * this container instance. + * @member {number} [resources.limits.cpu] The CPU limit of this container + * instance. + * @member {array} [volumeMounts] The volume mounts available to the container + * instance. + */ +export interface Container { + name: string; + image: string; + command?: string[]; + ports?: ContainerPort[]; + environmentVariables?: EnvironmentVariable[]; + readonly instanceView?: ContainerPropertiesInstanceView; + resources: ResourceRequirements; + volumeMounts?: VolumeMount[]; +} + +/** + * @class + * Initializes a new instance of the AzureFileVolume class. + * @constructor + * The properties of the Azure File volume. Azure File shares are mounted as + * volumes. + * + * @member {string} shareName The name of the Azure File share to be mounted as + * a volume. + * @member {boolean} [readOnly] The flag indicating whether the Azure File + * shared mounted as a volume is read-only. + * @member {string} storageAccountName The name of the storage account that + * contains the Azure File share. + * @member {string} [storageAccountKey] The storage account access key used to + * access the Azure File share. + */ +export interface AzureFileVolume { + shareName: string; + readOnly?: boolean; + storageAccountName: string; + storageAccountKey?: string; +} + +/** + * @class + * Initializes a new instance of the GitRepoVolume class. + * @constructor + * Represents a volume that is populated with the contents of a git repository + * + * @member {string} [directory] Target directory name. Must not contain or + * start with '..'. If '.' is supplied, the volume directory will be the git + * repository. Otherwise, if specified, the volume will contain the git + * repository in the subdirectory with the given name. + * @member {string} repository Repository URL + * @member {string} [revision] Commit hash for the specified revision. + */ +export interface GitRepoVolume { + directory?: string; + repository: string; + revision?: string; +} + +/** + * @class + * Initializes a new instance of the Volume class. + * @constructor + * The properties of the volume. + * + * @member {string} name The name of the volume. + * @member {object} [azureFile] The Azure File volume. + * @member {string} [azureFile.shareName] The name of the Azure File share to + * be mounted as a volume. + * @member {boolean} [azureFile.readOnly] The flag indicating whether the Azure + * File shared mounted as a volume is read-only. + * @member {string} [azureFile.storageAccountName] The name of the storage + * account that contains the Azure File share. + * @member {string} [azureFile.storageAccountKey] The storage account access + * key used to access the Azure File share. + * @member {object} [emptyDir] The empty directory volume. + * @member {object} [secret] The secret volume. + * @member {object} [gitRepo] The git repo volume. + * @member {string} [gitRepo.directory] Target directory name. Must not contain + * or start with '..'. If '.' is supplied, the volume directory will be the + * git repository. Otherwise, if specified, the volume will contain the git + * repository in the subdirectory with the given name. + * @member {string} [gitRepo.repository] Repository URL + * @member {string} [gitRepo.revision] Commit hash for the specified revision. + */ +export interface Volume { + name: string; + azureFile?: AzureFileVolume; + emptyDir?: any; + secret?: { [propertyName: string]: string }; + gitRepo?: GitRepoVolume; +} + +/** + * @class + * Initializes a new instance of the ImageRegistryCredential class. + * @constructor + * Image registry credential. + * + * @member {string} server The Docker image registry server without a protocol + * such as "http" and "https". + * @member {string} username The username for the private registry. + * @member {string} [password] The password for the private registry. + */ +export interface ImageRegistryCredential { + server: string; + username: string; + password?: string; +} + +/** + * @class + * Initializes a new instance of the Port class. + * @constructor + * The port exposed on the container group. + * + * @member {string} [protocol] The protocol associated with the port. Possible + * values include: 'TCP', 'UDP' + * @member {number} port The port number. + */ +export interface Port { + protocol?: string; + port: number; +} + +/** + * @class + * Initializes a new instance of the IpAddress class. + * @constructor + * IP address for the container group. + * + * @member {array} ports The list of ports exposed on the container group. + * @member {string} [ip] The IP exposed to the public internet. + * @member {string} [dnsNameLabel] The Dns name label for the IP. + * @member {string} [fqdn] The FQDN for the IP. + */ +export interface IpAddress { + ports: Port[]; + ip?: string; + dnsNameLabel?: string; + readonly fqdn?: string; +} + +/** + * @class + * Initializes a new instance of the ContainerGroupPropertiesInstanceView class. + * @constructor + * The instance view of the container group. Only valid in response. + * + * @member {array} [events] The events of this container group. + * @member {string} [state] The state of the container group. Only valid in + * response. + */ +export interface ContainerGroupPropertiesInstanceView { + readonly events?: Event[]; + readonly state?: string; +} + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * The Resource model definition. + * + * @member {string} [id] The resource id. + * @member {string} [name] The resource name. + * @member {string} [type] The resource type. + * @member {string} [location] The resource location. + * @member {object} [tags] The resource tags. + */ +export interface Resource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; + location?: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the ContainerGroup class. + * @constructor + * A container group. + * + * @member {string} [provisioningState] The provisioning state of the container + * group. This only appears in the response. + * @member {array} containers The containers within the container group. + * @member {array} [imageRegistryCredentials] The image registry credentials by + * which the container group is created from. + * @member {string} [restartPolicy] Restart policy for all containers within + * the container group. + * - `Always` Always restart + * - `OnFailure` Restart on failure + * - `Never` Never restart + * . Possible values include: 'Always', 'OnFailure', 'Never' + * @member {object} [ipAddress] The IP address type of the container group. + * @member {array} [ipAddress.ports] The list of ports exposed on the container + * group. + * @member {string} [ipAddress.ip] The IP exposed to the public internet. + * @member {string} [ipAddress.dnsNameLabel] The Dns name label for the IP. + * @member {string} [ipAddress.fqdn] The FQDN for the IP. + * @member {string} osType The operating system type required by the containers + * in the container group. Possible values include: 'Windows', 'Linux' + * @member {array} [volumes] The list of volumes that can be mounted by + * containers in this container group. + * @member {object} [instanceView] The instance view of the container group. + * Only valid in response. + * @member {array} [instanceView.events] The events of this container group. + * @member {string} [instanceView.state] The state of the container group. Only + * valid in response. + */ +export interface ContainerGroup extends Resource { + readonly provisioningState?: string; + containers: Container[]; + imageRegistryCredentials?: ImageRegistryCredential[]; + restartPolicy?: string; + ipAddress?: IpAddress; + osType: string; + volumes?: Volume[]; + readonly instanceView?: ContainerGroupPropertiesInstanceView; +} + +/** + * @class + * Initializes a new instance of the OperationDisplay class. + * @constructor + * The display information of the operation. + * + * @member {string} [provider] The name of the provider of the operation. + * @member {string} [resource] The name of the resource type of the operation. + * @member {string} [operation] The friendly name of the operation. + * @member {string} [description] The description of the operation. + */ +export interface OperationDisplay { + readonly provider?: string; + readonly resource?: string; + readonly operation?: string; + readonly description?: string; +} + +/** + * @class + * Initializes a new instance of the Operation class. + * @constructor + * An operation for Azure Container Instance service. + * + * @member {string} [name] The name of the operation. + * @member {object} [display] The display information of the operation. + * @member {string} [display.provider] The name of the provider of the + * operation. + * @member {string} [display.resource] The name of the resource type of the + * operation. + * @member {string} [display.operation] The friendly name of the operation. + * @member {string} [display.description] The description of the operation. + * @member {string} [origin] The intended executor of the operation. Possible + * values include: 'User', 'System' + */ +export interface Operation { + readonly name?: string; + display?: OperationDisplay; + readonly origin?: string; +} + +/** + * @class + * Initializes a new instance of the OperationListResult class. + * @constructor + * The operation list response that contains all operations for Azure Container + * Instance service. + * + * @member {array} [value] The list of operations. + * @member {string} [nextLink] The URI to fetch the next page of operations. + */ +export interface OperationListResult { + value?: Operation[]; + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the UsageName class. + * @constructor + * The name object of the resource + * + * @member {string} [value] The name of the resource + * @member {string} [localizedValue] The localized name of the resource + */ +export interface UsageName { + readonly value?: string; + readonly localizedValue?: string; +} + +/** + * @class + * Initializes a new instance of the Usage class. + * @constructor + * A single usage result + * + * @member {string} [unit] Unit of the usage result + * @member {number} [currentValue] The current usage of the resource + * @member {number} [limit] The maximum permitted usage of the resource. + * @member {object} [name] The name object of the resource + * @member {string} [name.value] The name of the resource + * @member {string} [name.localizedValue] The localized name of the resource + */ +export interface Usage { + readonly unit?: string; + readonly currentValue?: number; + readonly limit?: number; + readonly name?: UsageName; +} + +/** + * @class + * Initializes a new instance of the UsageListResult class. + * @constructor + * The response containing the usage data + * + * @member {array} [value] + */ +export interface UsageListResult { + readonly value?: Usage[]; +} + +/** + * @class + * Initializes a new instance of the Logs class. + * @constructor + * The logs. + * + * @member {string} [content] The content of the log. + */ +export interface Logs { + readonly content?: string; +} + +/** + * @class + * Initializes a new instance of the ContainerExecRequestTerminalSize class. + * @constructor + * The size of the terminal. + * + * @member {number} [row] The row size of the terminal + * @member {number} [column] The column size of the terminal + */ +export interface ContainerExecRequestTerminalSize { + row?: number; + column?: number; +} + +/** + * @class + * Initializes a new instance of the ContainerExecRequest class. + * @constructor + * The start container exec request. + * + * @member {string} [command] The command to be executed. + * @member {object} [terminalSize] The size of the terminal. + * @member {number} [terminalSize.row] The row size of the terminal + * @member {number} [terminalSize.column] The column size of the terminal + */ +export interface ContainerExecRequest { + command?: string; + terminalSize?: ContainerExecRequestTerminalSize; +} + +/** + * @class + * Initializes a new instance of the ContainerExecResponse class. + * @constructor + * The information for the container exec command. + * + * @member {string} [webSocketUri] The uri for the exec websocket. + * @member {string} [password] The password to start the exec command. + */ +export interface ContainerExecResponse { + readonly webSocketUri?: string; + readonly password?: string; +} + + +/** + * @class + * Initializes a new instance of the ContainerGroupListResult class. + * @constructor + * The container group list response that contains the container group + * properties. + * + * @member {string} [nextLink] The URI to fetch the next page of container + * groups. + */ +export interface ContainerGroupListResult extends Array { + nextLink?: string; +} diff --git a/lib/services/containerinstanceManagement/lib/lib/models/index.js b/lib/services/containerinstanceManagement/lib/lib/models/index.js new file mode 100644 index 0000000000..7c25354d6e --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/index.js @@ -0,0 +1,50 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +var msRestAzure = require('ms-rest-azure'); + +exports.BaseResource = msRestAzure.BaseResource; +exports.CloudError = msRestAzure.CloudError; +exports.ContainerPort = require('./containerPort'); +exports.EnvironmentVariable = require('./environmentVariable'); +exports.ContainerState = require('./containerState'); +exports.Event = require('./event'); +exports.ContainerPropertiesInstanceView = require('./containerPropertiesInstanceView'); +exports.ResourceRequests = require('./resourceRequests'); +exports.ResourceLimits = require('./resourceLimits'); +exports.ResourceRequirements = require('./resourceRequirements'); +exports.VolumeMount = require('./volumeMount'); +exports.Container = require('./container'); +exports.AzureFileVolume = require('./azureFileVolume'); +exports.GitRepoVolume = require('./gitRepoVolume'); +exports.Volume = require('./volume'); +exports.ImageRegistryCredential = require('./imageRegistryCredential'); +exports.Port = require('./port'); +exports.IpAddress = require('./ipAddress'); +exports.ContainerGroupPropertiesInstanceView = require('./containerGroupPropertiesInstanceView'); +exports.Resource = require('./resource'); +exports.ContainerGroup = require('./containerGroup'); +exports.OperationDisplay = require('./operationDisplay'); +exports.Operation = require('./operation'); +exports.OperationListResult = require('./operationListResult'); +exports.UsageName = require('./usageName'); +exports.Usage = require('./usage'); +exports.UsageListResult = require('./usageListResult'); +exports.Logs = require('./logs'); +exports.ContainerExecRequestTerminalSize = require('./containerExecRequestTerminalSize'); +exports.ContainerExecRequest = require('./containerExecRequest'); +exports.ContainerExecResponse = require('./containerExecResponse'); +exports.ContainerGroupListResult = require('./containerGroupListResult'); diff --git a/lib/services/containerinstanceManagement/lib/lib/models/ipAddress.js b/lib/services/containerinstanceManagement/lib/lib/models/ipAddress.js new file mode 100644 index 0000000000..484621e1c8 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/ipAddress.js @@ -0,0 +1,96 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * IP address for the container group. + * + */ +class IpAddress { + /** + * Create a IpAddress. + * @member {array} ports The list of ports exposed on the container group. + * @member {string} [ip] The IP exposed to the public internet. + * @member {string} [dnsNameLabel] The Dns name label for the IP. + * @member {string} [fqdn] The FQDN for the IP. + */ + constructor() { + } + + /** + * Defines the metadata of IpAddress + * + * @returns {object} metadata of IpAddress + * + */ + mapper() { + return { + required: false, + serializedName: 'IpAddress', + type: { + name: 'Composite', + className: 'IpAddress', + modelProperties: { + ports: { + required: true, + serializedName: 'ports', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'PortElementType', + type: { + name: 'Composite', + className: 'Port' + } + } + } + }, + type: { + required: true, + isConstant: true, + serializedName: 'type', + defaultValue: 'Public', + type: { + name: 'String' + } + }, + ip: { + required: false, + serializedName: 'ip', + type: { + name: 'String' + } + }, + dnsNameLabel: { + required: false, + serializedName: 'dnsNameLabel', + type: { + name: 'String' + } + }, + fqdn: { + required: false, + readOnly: true, + serializedName: 'fqdn', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IpAddress; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/logs.js b/lib/services/containerinstanceManagement/lib/lib/models/logs.js new file mode 100644 index 0000000000..c0bdbf3a3a --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/logs.js @@ -0,0 +1,53 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The logs. + * + */ +class Logs { + /** + * Create a Logs. + * @member {string} [content] The content of the log. + */ + constructor() { + } + + /** + * Defines the metadata of Logs + * + * @returns {object} metadata of Logs + * + */ + mapper() { + return { + required: false, + serializedName: 'Logs', + type: { + name: 'Composite', + className: 'Logs', + modelProperties: { + content: { + required: false, + readOnly: true, + serializedName: 'content', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Logs; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/operation.js b/lib/services/containerinstanceManagement/lib/lib/models/operation.js new file mode 100644 index 0000000000..b7bab29dba --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/operation.js @@ -0,0 +1,80 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * An operation for Azure Container Instance service. + * + */ +class Operation { + /** + * Create a Operation. + * @member {string} [name] The name of the operation. + * @member {object} [display] The display information of the operation. + * @member {string} [display.provider] The name of the provider of the + * operation. + * @member {string} [display.resource] The name of the resource type of the + * operation. + * @member {string} [display.operation] The friendly name of the operation. + * @member {string} [display.description] The description of the operation. + * @member {string} [origin] The intended executor of the operation. Possible + * values include: 'User', 'System' + */ + constructor() { + } + + /** + * Defines the metadata of Operation + * + * @returns {object} metadata of Operation + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation', + type: { + name: 'Composite', + className: 'Operation', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + serializedName: 'display', + type: { + name: 'Composite', + className: 'OperationDisplay' + } + }, + origin: { + required: false, + readOnly: true, + serializedName: 'origin', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Operation; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/operationDisplay.js b/lib/services/containerinstanceManagement/lib/lib/models/operationDisplay.js new file mode 100644 index 0000000000..cf8a3fd38f --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/operationDisplay.js @@ -0,0 +1,81 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The display information of the operation. + * + */ +class OperationDisplay { + /** + * Create a OperationDisplay. + * @member {string} [provider] The name of the provider of the operation. + * @member {string} [resource] The name of the resource type of the + * operation. + * @member {string} [operation] The friendly name of the operation. + * @member {string} [description] The description of the operation. + */ + constructor() { + } + + /** + * Defines the metadata of OperationDisplay + * + * @returns {object} metadata of OperationDisplay + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation_display', + type: { + name: 'Composite', + className: 'OperationDisplay', + modelProperties: { + provider: { + required: false, + readOnly: true, + serializedName: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + readOnly: true, + serializedName: 'resource', + type: { + name: 'String' + } + }, + operation: { + required: false, + readOnly: true, + serializedName: 'operation', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationDisplay; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/operationListResult.js b/lib/services/containerinstanceManagement/lib/lib/models/operationListResult.js new file mode 100644 index 0000000000..3079bd4257 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/operationListResult.js @@ -0,0 +1,71 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The operation list response that contains all operations for Azure Container + * Instance service. + * + */ +class OperationListResult { + /** + * Create a OperationListResult. + * @member {array} [value] The list of operations. + * @member {string} [nextLink] The URI to fetch the next page of operations. + */ + constructor() { + } + + /** + * Defines the metadata of OperationListResult + * + * @returns {object} metadata of OperationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationListResult', + type: { + name: 'Composite', + className: 'OperationListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationElementType', + type: { + name: 'Composite', + className: 'Operation' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationListResult; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/port.js b/lib/services/containerinstanceManagement/lib/lib/models/port.js new file mode 100644 index 0000000000..75c0e283fd --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/port.js @@ -0,0 +1,61 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The port exposed on the container group. + * + */ +class Port { + /** + * Create a Port. + * @member {string} [protocol] The protocol associated with the port. + * Possible values include: 'TCP', 'UDP' + * @member {number} port The port number. + */ + constructor() { + } + + /** + * Defines the metadata of Port + * + * @returns {object} metadata of Port + * + */ + mapper() { + return { + required: false, + serializedName: 'Port', + type: { + name: 'Composite', + className: 'Port', + modelProperties: { + protocol: { + required: false, + serializedName: 'protocol', + type: { + name: 'String' + } + }, + port: { + required: true, + serializedName: 'port', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = Port; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/resource.js b/lib/services/containerinstanceManagement/lib/lib/models/resource.js new file mode 100644 index 0000000000..59252c5ada --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/resource.js @@ -0,0 +1,98 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The Resource model definition. + * + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @member {string} [id] The resource id. + * @member {string} [name] The resource name. + * @member {string} [type] The resource type. + * @member {string} [location] The resource location. + * @member {object} [tags] The resource tags. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Resource + * + * @returns {object} metadata of Resource + * + */ + mapper() { + return { + required: false, + serializedName: 'Resource', + type: { + name: 'Composite', + className: 'Resource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = Resource; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/resourceLimits.js b/lib/services/containerinstanceManagement/lib/lib/models/resourceLimits.js new file mode 100644 index 0000000000..a3bcc824e1 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/resourceLimits.js @@ -0,0 +1,61 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The resource limits. + * + */ +class ResourceLimits { + /** + * Create a ResourceLimits. + * @member {number} [memoryInGB] The memory limit in GB of this container + * instance. + * @member {number} [cpu] The CPU limit of this container instance. + */ + constructor() { + } + + /** + * Defines the metadata of ResourceLimits + * + * @returns {object} metadata of ResourceLimits + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceLimits', + type: { + name: 'Composite', + className: 'ResourceLimits', + modelProperties: { + memoryInGB: { + required: false, + serializedName: 'memoryInGB', + type: { + name: 'Number' + } + }, + cpu: { + required: false, + serializedName: 'cpu', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ResourceLimits; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/resourceRequests.js b/lib/services/containerinstanceManagement/lib/lib/models/resourceRequests.js new file mode 100644 index 0000000000..8ff942a89b --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/resourceRequests.js @@ -0,0 +1,61 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The resource requests. + * + */ +class ResourceRequests { + /** + * Create a ResourceRequests. + * @member {number} memoryInGB The memory request in GB of this container + * instance. + * @member {number} cpu The CPU request of this container instance. + */ + constructor() { + } + + /** + * Defines the metadata of ResourceRequests + * + * @returns {object} metadata of ResourceRequests + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceRequests', + type: { + name: 'Composite', + className: 'ResourceRequests', + modelProperties: { + memoryInGB: { + required: true, + serializedName: 'memoryInGB', + type: { + name: 'Number' + } + }, + cpu: { + required: true, + serializedName: 'cpu', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ResourceRequests; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/resourceRequirements.js b/lib/services/containerinstanceManagement/lib/lib/models/resourceRequirements.js new file mode 100644 index 0000000000..eabbaf825a --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/resourceRequirements.js @@ -0,0 +1,72 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The resource requirements. + * + */ +class ResourceRequirements { + /** + * Create a ResourceRequirements. + * @member {object} requests The resource requests of this container + * instance. + * @member {number} [requests.memoryInGB] The memory request in GB of this + * container instance. + * @member {number} [requests.cpu] The CPU request of this container + * instance. + * @member {object} [limits] The resource limits of this container instance. + * @member {number} [limits.memoryInGB] The memory limit in GB of this + * container instance. + * @member {number} [limits.cpu] The CPU limit of this container instance. + */ + constructor() { + } + + /** + * Defines the metadata of ResourceRequirements + * + * @returns {object} metadata of ResourceRequirements + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceRequirements', + type: { + name: 'Composite', + className: 'ResourceRequirements', + modelProperties: { + requests: { + required: true, + serializedName: 'requests', + type: { + name: 'Composite', + className: 'ResourceRequests' + } + }, + limits: { + required: false, + serializedName: 'limits', + type: { + name: 'Composite', + className: 'ResourceLimits' + } + } + } + } + }; + } +} + +module.exports = ResourceRequirements; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/usage.js b/lib/services/containerinstanceManagement/lib/lib/models/usage.js new file mode 100644 index 0000000000..65c61d44f1 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/usage.js @@ -0,0 +1,85 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A single usage result + * + */ +class Usage { + /** + * Create a Usage. + * @member {string} [unit] Unit of the usage result + * @member {number} [currentValue] The current usage of the resource + * @member {number} [limit] The maximum permitted usage of the resource. + * @member {object} [name] The name object of the resource + * @member {string} [name.value] The name of the resource + * @member {string} [name.localizedValue] The localized name of the resource + */ + constructor() { + } + + /** + * Defines the metadata of Usage + * + * @returns {object} metadata of Usage + * + */ + mapper() { + return { + required: false, + serializedName: 'Usage', + type: { + name: 'Composite', + className: 'Usage', + modelProperties: { + unit: { + required: false, + readOnly: true, + serializedName: 'unit', + type: { + name: 'String' + } + }, + currentValue: { + required: false, + readOnly: true, + serializedName: 'currentValue', + type: { + name: 'Number' + } + }, + limit: { + required: false, + readOnly: true, + serializedName: 'limit', + type: { + name: 'Number' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'Composite', + className: 'UsageName' + } + } + } + } + }; + } +} + +module.exports = Usage; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/usageListResult.js b/lib/services/containerinstanceManagement/lib/lib/models/usageListResult.js new file mode 100644 index 0000000000..6633b3823e --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/usageListResult.js @@ -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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The response containing the usage data + * + */ +class UsageListResult { + /** + * Create a UsageListResult. + * @member {array} [value] + */ + constructor() { + } + + /** + * Defines the metadata of UsageListResult + * + * @returns {object} metadata of UsageListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'UsageListResult', + type: { + name: 'Composite', + className: 'UsageListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'UsageElementType', + type: { + name: 'Composite', + className: 'Usage' + } + } + } + } + } + } + }; + } +} + +module.exports = UsageListResult; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/usageName.js b/lib/services/containerinstanceManagement/lib/lib/models/usageName.js new file mode 100644 index 0000000000..048ce3cbff --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/usageName.js @@ -0,0 +1,62 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The name object of the resource + * + */ +class UsageName { + /** + * Create a UsageName. + * @member {string} [value] The name of the resource + * @member {string} [localizedValue] The localized name of the resource + */ + constructor() { + } + + /** + * Defines the metadata of UsageName + * + * @returns {object} metadata of UsageName + * + */ + mapper() { + return { + required: false, + serializedName: 'Usage_name', + type: { + name: 'Composite', + className: 'UsageName', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: 'value', + type: { + name: 'String' + } + }, + localizedValue: { + required: false, + readOnly: true, + serializedName: 'localizedValue', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = UsageName; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/volume.js b/lib/services/containerinstanceManagement/lib/lib/models/volume.js new file mode 100644 index 0000000000..566102f4b7 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/volume.js @@ -0,0 +1,110 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The properties of the volume. + * + */ +class Volume { + /** + * Create a Volume. + * @member {string} name The name of the volume. + * @member {object} [azureFile] The Azure File volume. + * @member {string} [azureFile.shareName] The name of the Azure File share to + * be mounted as a volume. + * @member {boolean} [azureFile.readOnly] The flag indicating whether the + * Azure File shared mounted as a volume is read-only. + * @member {string} [azureFile.storageAccountName] The name of the storage + * account that contains the Azure File share. + * @member {string} [azureFile.storageAccountKey] The storage account access + * key used to access the Azure File share. + * @member {object} [emptyDir] The empty directory volume. + * @member {object} [secret] The secret volume. + * @member {object} [gitRepo] The git repo volume. + * @member {string} [gitRepo.directory] Target directory name. Must not + * contain or start with '..'. If '.' is supplied, the volume directory will + * be the git repository. Otherwise, if specified, the volume will contain + * the git repository in the subdirectory with the given name. + * @member {string} [gitRepo.repository] Repository URL + * @member {string} [gitRepo.revision] Commit hash for the specified + * revision. + */ + constructor() { + } + + /** + * Defines the metadata of Volume + * + * @returns {object} metadata of Volume + * + */ + mapper() { + return { + required: false, + serializedName: 'Volume', + type: { + name: 'Composite', + className: 'Volume', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + azureFile: { + required: false, + serializedName: 'azureFile', + type: { + name: 'Composite', + className: 'AzureFileVolume' + } + }, + emptyDir: { + required: false, + serializedName: 'emptyDir', + type: { + name: 'Object' + } + }, + secret: { + required: false, + serializedName: 'secret', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + gitRepo: { + required: false, + serializedName: 'gitRepo', + type: { + name: 'Composite', + className: 'GitRepoVolume' + } + } + } + } + }; + } +} + +module.exports = Volume; diff --git a/lib/services/containerinstanceManagement/lib/lib/models/volumeMount.js b/lib/services/containerinstanceManagement/lib/lib/models/volumeMount.js new file mode 100644 index 0000000000..52203a7a45 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/models/volumeMount.js @@ -0,0 +1,70 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The properties of the volume mount. + * + */ +class VolumeMount { + /** + * Create a VolumeMount. + * @member {string} name The name of the volume mount. + * @member {string} mountPath The path within the container where the volume + * should be mounted. Must not contain colon (:). + * @member {boolean} [readOnly] The flag indicating whether the volume mount + * is read-only. + */ + constructor() { + } + + /** + * Defines the metadata of VolumeMount + * + * @returns {object} metadata of VolumeMount + * + */ + mapper() { + return { + required: false, + serializedName: 'VolumeMount', + type: { + name: 'Composite', + className: 'VolumeMount', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + mountPath: { + required: true, + serializedName: 'mountPath', + type: { + name: 'String' + } + }, + readOnly: { + required: false, + serializedName: 'readOnly', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = VolumeMount; diff --git a/lib/services/containerinstanceManagement/lib/lib/operations/containerGroupUsage.js b/lib/services/containerinstanceManagement/lib/lib/operations/containerGroupUsage.js new file mode 100644 index 0000000000..faf3862911 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/operations/containerGroupUsage.js @@ -0,0 +1,251 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Get the usage for a subscription + * + * @param {string} location The identifier for the physical azure location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(location, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (location === null || location === undefined || typeof location.valueOf() !== 'string') { + throw new Error('location cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/usages'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{location}', encodeURIComponent(location)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['UsageListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ContainerGroupUsage. */ +class ContainerGroupUsage { + /** + * Create a ContainerGroupUsage. + * @param {ContainerInstanceManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + } + + /** + * Get the usage for a subscription + * + * @param {string} location The identifier for the physical azure location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(location, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(location, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the usage for a subscription + * + * @param {string} location The identifier for the physical azure location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {UsageListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(location, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(location, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(location, options, optionalCallback); + } + } + +} + +module.exports = ContainerGroupUsage; diff --git a/lib/services/containerinstanceManagement/lib/lib/operations/containerGroups.js b/lib/services/containerinstanceManagement/lib/lib/operations/containerGroups.js new file mode 100644 index 0000000000..0b49d124d6 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/operations/containerGroups.js @@ -0,0 +1,2409 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * @summary Get a list of container groups in the specified subscription. + * + * Get a list of container groups in the specified subscription. This operation + * returns properties of each container group including containers, image + * registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ContainerGroupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Get a list of container groups in the specified subscription and + * resource group. + * + * Get a list of container groups in a specified subscription and resource + * group. This operation returns properties of each container group including + * containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ContainerGroupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Get the properties of the specified container group. + * + * Gets the properties of the specified container group in the specified + * subscription and resource group. The operation returns the properties of + * each container group including containers, image registry credentials, + * restart policy, IP address type, OS type, state, and volumes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, containerGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (containerGroupName === null || containerGroupName === undefined || typeof containerGroupName.valueOf() !== 'string') { + throw new Error('containerGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{containerGroupName}', encodeURIComponent(containerGroupName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ContainerGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * @summary Create or update container groups. + * + * Create or update container groups with specified configurations. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} containerGroup The properties of the container group to be + * created or updated. + * + * @param {array} containerGroup.containers The containers within the container + * group. + * + * @param {array} [containerGroup.imageRegistryCredentials] The image registry + * credentials by which the container group is created from. + * + * @param {string} [containerGroup.restartPolicy] Restart policy for all + * containers within the container group. + * - `Always` Always restart + * - `OnFailure` Restart on failure + * - `Never` Never restart + * . Possible values include: 'Always', 'OnFailure', 'Never' + * + * @param {object} [containerGroup.ipAddress] The IP address type of the + * container group. + * + * @param {array} containerGroup.ipAddress.ports The list of ports exposed on + * the container group. + * + * @param {string} [containerGroup.ipAddress.ip] The IP exposed to the public + * internet. + * + * @param {string} [containerGroup.ipAddress.dnsNameLabel] The Dns name label + * for the IP. + * + * @param {string} containerGroup.osType The operating system type required by + * the containers in the container group. Possible values include: 'Windows', + * 'Linux' + * + * @param {array} [containerGroup.volumes] The list of volumes that can be + * mounted by containers in this container group. + * + * @param {string} [containerGroup.location] The resource location. + * + * @param {object} [containerGroup.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, containerGroupName, containerGroup, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, containerGroupName, containerGroup, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ContainerGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * @summary Update container groups. + * + * Updates container group tags with specified values. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} resource The container group resource with just the tags to + * be updated. + * + * @param {string} [resource.location] The resource location. + * + * @param {object} [resource.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, containerGroupName, resource, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (containerGroupName === null || containerGroupName === undefined || typeof containerGroupName.valueOf() !== 'string') { + throw new Error('containerGroupName cannot be null or undefined and it must be of type string.'); + } + if (resource === null || resource === undefined) { + throw new Error('resource cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{containerGroupName}', encodeURIComponent(containerGroupName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (resource !== null && resource !== undefined) { + let requestModelMapper = new client.models['Resource']().mapper(); + requestModel = client.serialize(requestModelMapper, resource, 'resource'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(resource, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ContainerGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Delete the specified container group. + * + * Delete the specified container group in the specified subscription and + * resource group. The operation does not delete other resources provided by + * the user, such as volumes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, containerGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (containerGroupName === null || containerGroupName === undefined || typeof containerGroupName.valueOf() !== 'string') { + throw new Error('containerGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{containerGroupName}', encodeURIComponent(containerGroupName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ContainerGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Create or update container groups. + * + * Create or update container groups with specified configurations. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} containerGroup The properties of the container group to be + * created or updated. + * + * @param {array} containerGroup.containers The containers within the container + * group. + * + * @param {array} [containerGroup.imageRegistryCredentials] The image registry + * credentials by which the container group is created from. + * + * @param {string} [containerGroup.restartPolicy] Restart policy for all + * containers within the container group. + * - `Always` Always restart + * - `OnFailure` Restart on failure + * - `Never` Never restart + * . Possible values include: 'Always', 'OnFailure', 'Never' + * + * @param {object} [containerGroup.ipAddress] The IP address type of the + * container group. + * + * @param {array} containerGroup.ipAddress.ports The list of ports exposed on + * the container group. + * + * @param {string} [containerGroup.ipAddress.ip] The IP exposed to the public + * internet. + * + * @param {string} [containerGroup.ipAddress.dnsNameLabel] The Dns name label + * for the IP. + * + * @param {string} containerGroup.osType The operating system type required by + * the containers in the container group. Possible values include: 'Windows', + * 'Linux' + * + * @param {array} [containerGroup.volumes] The list of volumes that can be + * mounted by containers in this container group. + * + * @param {string} [containerGroup.location] The resource location. + * + * @param {object} [containerGroup.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, containerGroupName, containerGroup, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + if (containerGroup === null || containerGroup === undefined) + { + containerGroup = {}; + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (containerGroupName === null || containerGroupName === undefined || typeof containerGroupName.valueOf() !== 'string') { + throw new Error('containerGroupName cannot be null or undefined and it must be of type string.'); + } + if (containerGroup === null || containerGroup === undefined) { + throw new Error('containerGroup cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{containerGroupName}', encodeURIComponent(containerGroupName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (containerGroup !== null && containerGroup !== undefined) { + let requestModelMapper = new client.models['ContainerGroup']().mapper(); + requestModel = client.serialize(requestModelMapper, containerGroup, 'containerGroup'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(containerGroup, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ContainerGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ContainerGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Get a list of container groups in the specified subscription. + * + * Get a list of container groups in the specified subscription. This operation + * returns properties of each container group including containers, image + * registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ContainerGroupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Get a list of container groups in the specified subscription and + * resource group. + * + * Get a list of container groups in a specified subscription and resource + * group. This operation returns properties of each container group including + * containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroupNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ContainerGroupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ContainerGroups. */ +class ContainerGroups { + /** + * Create a ContainerGroups. + * @param {ContainerInstanceManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listByResourceGroup = _listByResourceGroup; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._deleteMethod = _deleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._listNext = _listNext; + this._listByResourceGroupNext = _listByResourceGroupNext; + } + + /** + * @summary Get a list of container groups in the specified subscription. + * + * Get a list of container groups in the specified subscription. This operation + * returns properties of each container group including containers, image + * registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Get a list of container groups in the specified subscription. + * + * Get a list of container groups in the specified subscription. This operation + * returns properties of each container group including containers, image + * registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ContainerGroupListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * @summary Get a list of container groups in the specified subscription and + * resource group. + * + * Get a list of container groups in a specified subscription and resource + * group. This operation returns properties of each container group including + * containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Get a list of container groups in the specified subscription and + * resource group. + * + * Get a list of container groups in a specified subscription and resource + * group. This operation returns properties of each container group including + * containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ContainerGroupListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Get the properties of the specified container group. + * + * Gets the properties of the specified container group in the specified + * subscription and resource group. The operation returns the properties of + * each container group including containers, image registry credentials, + * restart policy, IP address type, OS type, state, and volumes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, containerGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, containerGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Get the properties of the specified container group. + * + * Gets the properties of the specified container group in the specified + * subscription and resource group. The operation returns the properties of + * each container group including containers, image registry credentials, + * restart policy, IP address type, OS type, state, and volumes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ContainerGroup} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, containerGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, containerGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, containerGroupName, options, optionalCallback); + } + } + + /** + * @summary Create or update container groups. + * + * Create or update container groups with specified configurations. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} containerGroup The properties of the container group to be + * created or updated. + * + * @param {array} containerGroup.containers The containers within the container + * group. + * + * @param {array} [containerGroup.imageRegistryCredentials] The image registry + * credentials by which the container group is created from. + * + * @param {string} [containerGroup.restartPolicy] Restart policy for all + * containers within the container group. + * - `Always` Always restart + * - `OnFailure` Restart on failure + * - `Never` Never restart + * . Possible values include: 'Always', 'OnFailure', 'Never' + * + * @param {object} [containerGroup.ipAddress] The IP address type of the + * container group. + * + * @param {array} containerGroup.ipAddress.ports The list of ports exposed on + * the container group. + * + * @param {string} [containerGroup.ipAddress.ip] The IP exposed to the public + * internet. + * + * @param {string} [containerGroup.ipAddress.dnsNameLabel] The Dns name label + * for the IP. + * + * @param {string} containerGroup.osType The operating system type required by + * the containers in the container group. Possible values include: 'Windows', + * 'Linux' + * + * @param {array} [containerGroup.volumes] The list of volumes that can be + * mounted by containers in this container group. + * + * @param {string} [containerGroup.location] The resource location. + * + * @param {object} [containerGroup.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, containerGroupName, containerGroup, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, containerGroupName, containerGroup, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Create or update container groups. + * + * Create or update container groups with specified configurations. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} containerGroup The properties of the container group to be + * created or updated. + * + * @param {array} containerGroup.containers The containers within the container + * group. + * + * @param {array} [containerGroup.imageRegistryCredentials] The image registry + * credentials by which the container group is created from. + * + * @param {string} [containerGroup.restartPolicy] Restart policy for all + * containers within the container group. + * - `Always` Always restart + * - `OnFailure` Restart on failure + * - `Never` Never restart + * . Possible values include: 'Always', 'OnFailure', 'Never' + * + * @param {object} [containerGroup.ipAddress] The IP address type of the + * container group. + * + * @param {array} containerGroup.ipAddress.ports The list of ports exposed on + * the container group. + * + * @param {string} [containerGroup.ipAddress.ip] The IP exposed to the public + * internet. + * + * @param {string} [containerGroup.ipAddress.dnsNameLabel] The Dns name label + * for the IP. + * + * @param {string} containerGroup.osType The operating system type required by + * the containers in the container group. Possible values include: 'Windows', + * 'Linux' + * + * @param {array} [containerGroup.volumes] The list of volumes that can be + * mounted by containers in this container group. + * + * @param {string} [containerGroup.location] The resource location. + * + * @param {object} [containerGroup.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ContainerGroup} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, containerGroupName, containerGroup, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, containerGroupName, containerGroup, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, containerGroupName, containerGroup, options, optionalCallback); + } + } + + /** + * @summary Update container groups. + * + * Updates container group tags with specified values. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} resource The container group resource with just the tags to + * be updated. + * + * @param {string} [resource.location] The resource location. + * + * @param {object} [resource.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, containerGroupName, resource, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, containerGroupName, resource, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Update container groups. + * + * Updates container group tags with specified values. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} resource The container group resource with just the tags to + * be updated. + * + * @param {string} [resource.location] The resource location. + * + * @param {object} [resource.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ContainerGroup} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, containerGroupName, resource, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, containerGroupName, resource, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, containerGroupName, resource, options, optionalCallback); + } + } + + /** + * @summary Delete the specified container group. + * + * Delete the specified container group in the specified subscription and + * resource group. The operation does not delete other resources provided by + * the user, such as volumes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, containerGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, containerGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Delete the specified container group. + * + * Delete the specified container group in the specified subscription and + * resource group. The operation does not delete other resources provided by + * the user, such as volumes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ContainerGroup} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, containerGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, containerGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, containerGroupName, options, optionalCallback); + } + } + + /** + * @summary Create or update container groups. + * + * Create or update container groups with specified configurations. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} containerGroup The properties of the container group to be + * created or updated. + * + * @param {array} containerGroup.containers The containers within the container + * group. + * + * @param {array} [containerGroup.imageRegistryCredentials] The image registry + * credentials by which the container group is created from. + * + * @param {string} [containerGroup.restartPolicy] Restart policy for all + * containers within the container group. + * - `Always` Always restart + * - `OnFailure` Restart on failure + * - `Never` Never restart + * . Possible values include: 'Always', 'OnFailure', 'Never' + * + * @param {object} [containerGroup.ipAddress] The IP address type of the + * container group. + * + * @param {array} containerGroup.ipAddress.ports The list of ports exposed on + * the container group. + * + * @param {string} [containerGroup.ipAddress.ip] The IP exposed to the public + * internet. + * + * @param {string} [containerGroup.ipAddress.dnsNameLabel] The Dns name label + * for the IP. + * + * @param {string} containerGroup.osType The operating system type required by + * the containers in the container group. Possible values include: 'Windows', + * 'Linux' + * + * @param {array} [containerGroup.volumes] The list of volumes that can be + * mounted by containers in this container group. + * + * @param {string} [containerGroup.location] The resource location. + * + * @param {object} [containerGroup.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, containerGroupName, containerGroup, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, containerGroupName, containerGroup, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Create or update container groups. + * + * Create or update container groups with specified configurations. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} containerGroup The properties of the container group to be + * created or updated. + * + * @param {array} containerGroup.containers The containers within the container + * group. + * + * @param {array} [containerGroup.imageRegistryCredentials] The image registry + * credentials by which the container group is created from. + * + * @param {string} [containerGroup.restartPolicy] Restart policy for all + * containers within the container group. + * - `Always` Always restart + * - `OnFailure` Restart on failure + * - `Never` Never restart + * . Possible values include: 'Always', 'OnFailure', 'Never' + * + * @param {object} [containerGroup.ipAddress] The IP address type of the + * container group. + * + * @param {array} containerGroup.ipAddress.ports The list of ports exposed on + * the container group. + * + * @param {string} [containerGroup.ipAddress.ip] The IP exposed to the public + * internet. + * + * @param {string} [containerGroup.ipAddress.dnsNameLabel] The Dns name label + * for the IP. + * + * @param {string} containerGroup.osType The operating system type required by + * the containers in the container group. Possible values include: 'Windows', + * 'Linux' + * + * @param {array} [containerGroup.volumes] The list of volumes that can be + * mounted by containers in this container group. + * + * @param {string} [containerGroup.location] The resource location. + * + * @param {object} [containerGroup.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ContainerGroup} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, containerGroupName, containerGroup, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, containerGroupName, containerGroup, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, containerGroupName, containerGroup, options, optionalCallback); + } + } + + /** + * @summary Get a list of container groups in the specified subscription. + * + * Get a list of container groups in the specified subscription. This operation + * returns properties of each container group including containers, image + * registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Get a list of container groups in the specified subscription. + * + * Get a list of container groups in the specified subscription. This operation + * returns properties of each container group including containers, image + * registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ContainerGroupListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary Get a list of container groups in the specified subscription and + * resource group. + * + * Get a list of container groups in a specified subscription and resource + * group. This operation returns properties of each container group including + * containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Get a list of container groups in the specified subscription and + * resource group. + * + * Get a list of container groups in a specified subscription and resource + * group. This operation returns properties of each container group including + * containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ContainerGroupListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ContainerGroups; diff --git a/lib/services/containerinstanceManagement/lib/lib/operations/containerLogs.js b/lib/services/containerinstanceManagement/lib/lib/operations/containerLogs.js new file mode 100644 index 0000000000..55b6891213 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/operations/containerLogs.js @@ -0,0 +1,299 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * @summary Get the logs for a specified container instance. + * + * Get the logs for a specified container instance in a specified resource + * group and container group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {string} containerName The name of the container instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.tail] The number of lines to show from the tail of + * the container instance log. If not provided, all available logs are shown up + * to 4mb. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Logs} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, containerGroupName, containerName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let tail = (options && options.tail !== undefined) ? options.tail : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (containerGroupName === null || containerGroupName === undefined || typeof containerGroupName.valueOf() !== 'string') { + throw new Error('containerGroupName cannot be null or undefined and it must be of type string.'); + } + if (containerName === null || containerName === undefined || typeof containerName.valueOf() !== 'string') { + throw new Error('containerName cannot be null or undefined and it must be of type string.'); + } + if (tail !== null && tail !== undefined && typeof tail !== 'number') { + throw new Error('tail must be of type number.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/logs'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{containerGroupName}', encodeURIComponent(containerGroupName)); + requestUrl = requestUrl.replace('{containerName}', encodeURIComponent(containerName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (tail !== null && tail !== undefined) { + queryParameters.push('tail=' + encodeURIComponent(tail.toString())); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Logs']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ContainerLogs. */ +class ContainerLogs { + /** + * Create a ContainerLogs. + * @param {ContainerInstanceManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + } + + /** + * @summary Get the logs for a specified container instance. + * + * Get the logs for a specified container instance in a specified resource + * group and container group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {string} containerName The name of the container instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.tail] The number of lines to show from the tail of + * the container instance log. If not provided, all available logs are shown up + * to 4mb. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, containerGroupName, containerName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, containerGroupName, containerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Get the logs for a specified container instance. + * + * Get the logs for a specified container instance in a specified resource + * group and container group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {string} containerName The name of the container instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.tail] The number of lines to show from the tail of + * the container instance log. If not provided, all available logs are shown up + * to 4mb. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Logs} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Logs} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, containerGroupName, containerName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, containerGroupName, containerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, containerGroupName, containerName, options, optionalCallback); + } + } + +} + +module.exports = ContainerLogs; diff --git a/lib/services/containerinstanceManagement/lib/lib/operations/index.d.ts b/lib/services/containerinstanceManagement/lib/lib/operations/index.d.ts new file mode 100644 index 0000000000..813dab4230 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/operations/index.d.ts @@ -0,0 +1,1099 @@ +/* + * 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 { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; +import * as models from '../models'; + + +/** + * @class + * ContainerGroups + * __NOTE__: An instance of this class is automatically created for an + * instance of the ContainerInstanceManagementClient. + */ +export interface ContainerGroups { + + + /** + * @summary Get a list of container groups in the specified subscription. + * + * Get a list of container groups in the specified subscription. This operation + * returns properties of each container group including containers, image + * registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Get a list of container groups in the specified subscription. + * + * Get a list of container groups in the specified subscription. This operation + * returns properties of each container group including containers, image + * registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ContainerGroupListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ContainerGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroupListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Get a list of container groups in the specified subscription and + * resource group. + * + * Get a list of container groups in a specified subscription and resource + * group. This operation returns properties of each container group including + * containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Get a list of container groups in the specified subscription and + * resource group. + * + * Get a list of container groups in a specified subscription and resource + * group. This operation returns properties of each container group including + * containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ContainerGroupListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ContainerGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroupListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Get the properties of the specified container group. + * + * Gets the properties of the specified container group in the specified + * subscription and resource group. The operation returns the properties of + * each container group including containers, image registry credentials, + * restart policy, IP address type, OS type, state, and volumes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, containerGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Get the properties of the specified container group. + * + * Gets the properties of the specified container group in the specified + * subscription and resource group. The operation returns the properties of + * each container group including containers, image registry credentials, + * restart policy, IP address type, OS type, state, and volumes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ContainerGroup} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ContainerGroup} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, containerGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, containerGroupName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, containerGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Create or update container groups. + * + * Create or update container groups with specified configurations. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} containerGroup The properties of the container group to be + * created or updated. + * + * @param {array} containerGroup.containers The containers within the container + * group. + * + * @param {array} [containerGroup.imageRegistryCredentials] The image registry + * credentials by which the container group is created from. + * + * @param {string} [containerGroup.restartPolicy] Restart policy for all + * containers within the container group. + * - `Always` Always restart + * - `OnFailure` Restart on failure + * - `Never` Never restart + * . Possible values include: 'Always', 'OnFailure', 'Never' + * + * @param {object} [containerGroup.ipAddress] The IP address type of the + * container group. + * + * @param {array} containerGroup.ipAddress.ports The list of ports exposed on + * the container group. + * + * @param {string} [containerGroup.ipAddress.ip] The IP exposed to the public + * internet. + * + * @param {string} [containerGroup.ipAddress.dnsNameLabel] The Dns name label + * for the IP. + * + * @param {string} containerGroup.osType The operating system type required by + * the containers in the container group. Possible values include: 'Windows', + * 'Linux' + * + * @param {array} [containerGroup.volumes] The list of volumes that can be + * mounted by containers in this container group. + * + * @param {string} [containerGroup.location] The resource location. + * + * @param {object} [containerGroup.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, containerGroupName: string, containerGroup: models.ContainerGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Create or update container groups. + * + * Create or update container groups with specified configurations. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} containerGroup The properties of the container group to be + * created or updated. + * + * @param {array} containerGroup.containers The containers within the container + * group. + * + * @param {array} [containerGroup.imageRegistryCredentials] The image registry + * credentials by which the container group is created from. + * + * @param {string} [containerGroup.restartPolicy] Restart policy for all + * containers within the container group. + * - `Always` Always restart + * - `OnFailure` Restart on failure + * - `Never` Never restart + * . Possible values include: 'Always', 'OnFailure', 'Never' + * + * @param {object} [containerGroup.ipAddress] The IP address type of the + * container group. + * + * @param {array} containerGroup.ipAddress.ports The list of ports exposed on + * the container group. + * + * @param {string} [containerGroup.ipAddress.ip] The IP exposed to the public + * internet. + * + * @param {string} [containerGroup.ipAddress.dnsNameLabel] The Dns name label + * for the IP. + * + * @param {string} containerGroup.osType The operating system type required by + * the containers in the container group. Possible values include: 'Windows', + * 'Linux' + * + * @param {array} [containerGroup.volumes] The list of volumes that can be + * mounted by containers in this container group. + * + * @param {string} [containerGroup.location] The resource location. + * + * @param {object} [containerGroup.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ContainerGroup} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ContainerGroup} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, containerGroupName: string, containerGroup: models.ContainerGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, containerGroupName: string, containerGroup: models.ContainerGroup, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, containerGroupName: string, containerGroup: models.ContainerGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Update container groups. + * + * Updates container group tags with specified values. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} resource The container group resource with just the tags to + * be updated. + * + * @param {string} [resource.location] The resource location. + * + * @param {object} [resource.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, containerGroupName: string, resource: models.Resource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Update container groups. + * + * Updates container group tags with specified values. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} resource The container group resource with just the tags to + * be updated. + * + * @param {string} [resource.location] The resource location. + * + * @param {object} [resource.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ContainerGroup} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ContainerGroup} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, containerGroupName: string, resource: models.Resource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, containerGroupName: string, resource: models.Resource, callback: ServiceCallback): void; + update(resourceGroupName: string, containerGroupName: string, resource: models.Resource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Delete the specified container group. + * + * Delete the specified container group in the specified subscription and + * resource group. The operation does not delete other resources provided by + * the user, such as volumes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, containerGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Delete the specified container group. + * + * Delete the specified container group in the specified subscription and + * resource group. The operation does not delete other resources provided by + * the user, such as volumes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ContainerGroup} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ContainerGroup} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, containerGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, containerGroupName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, containerGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Create or update container groups. + * + * Create or update container groups with specified configurations. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} containerGroup The properties of the container group to be + * created or updated. + * + * @param {array} containerGroup.containers The containers within the container + * group. + * + * @param {array} [containerGroup.imageRegistryCredentials] The image registry + * credentials by which the container group is created from. + * + * @param {string} [containerGroup.restartPolicy] Restart policy for all + * containers within the container group. + * - `Always` Always restart + * - `OnFailure` Restart on failure + * - `Never` Never restart + * . Possible values include: 'Always', 'OnFailure', 'Never' + * + * @param {object} [containerGroup.ipAddress] The IP address type of the + * container group. + * + * @param {array} containerGroup.ipAddress.ports The list of ports exposed on + * the container group. + * + * @param {string} [containerGroup.ipAddress.ip] The IP exposed to the public + * internet. + * + * @param {string} [containerGroup.ipAddress.dnsNameLabel] The Dns name label + * for the IP. + * + * @param {string} containerGroup.osType The operating system type required by + * the containers in the container group. Possible values include: 'Windows', + * 'Linux' + * + * @param {array} [containerGroup.volumes] The list of volumes that can be + * mounted by containers in this container group. + * + * @param {string} [containerGroup.location] The resource location. + * + * @param {object} [containerGroup.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, containerGroupName: string, containerGroup: models.ContainerGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Create or update container groups. + * + * Create or update container groups with specified configurations. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {object} containerGroup The properties of the container group to be + * created or updated. + * + * @param {array} containerGroup.containers The containers within the container + * group. + * + * @param {array} [containerGroup.imageRegistryCredentials] The image registry + * credentials by which the container group is created from. + * + * @param {string} [containerGroup.restartPolicy] Restart policy for all + * containers within the container group. + * - `Always` Always restart + * - `OnFailure` Restart on failure + * - `Never` Never restart + * . Possible values include: 'Always', 'OnFailure', 'Never' + * + * @param {object} [containerGroup.ipAddress] The IP address type of the + * container group. + * + * @param {array} containerGroup.ipAddress.ports The list of ports exposed on + * the container group. + * + * @param {string} [containerGroup.ipAddress.ip] The IP exposed to the public + * internet. + * + * @param {string} [containerGroup.ipAddress.dnsNameLabel] The Dns name label + * for the IP. + * + * @param {string} containerGroup.osType The operating system type required by + * the containers in the container group. Possible values include: 'Windows', + * 'Linux' + * + * @param {array} [containerGroup.volumes] The list of volumes that can be + * mounted by containers in this container group. + * + * @param {string} [containerGroup.location] The resource location. + * + * @param {object} [containerGroup.tags] The resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ContainerGroup} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ContainerGroup} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, containerGroupName: string, containerGroup: models.ContainerGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, containerGroupName: string, containerGroup: models.ContainerGroup, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, containerGroupName: string, containerGroup: models.ContainerGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Get a list of container groups in the specified subscription. + * + * Get a list of container groups in the specified subscription. This operation + * returns properties of each container group including containers, image + * registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Get a list of container groups in the specified subscription. + * + * Get a list of container groups in the specified subscription. This operation + * returns properties of each container group including containers, image + * registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ContainerGroupListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ContainerGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroupListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Get a list of container groups in the specified subscription and + * resource group. + * + * Get a list of container groups in a specified subscription and resource + * group. This operation returns properties of each container group including + * containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Get a list of container groups in the specified subscription and + * resource group. + * + * Get a list of container groups in a specified subscription and resource + * group. This operation returns properties of each container group including + * containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ContainerGroupListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ContainerGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerGroupListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the ContainerInstanceManagementClient. + */ +export interface Operations { + + + /** + * List the operations for Azure Container Instance service. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List the operations for Azure Container Instance service. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ContainerGroupUsage + * __NOTE__: An instance of this class is automatically created for an + * instance of the ContainerInstanceManagementClient. + */ +export interface ContainerGroupUsage { + + + /** + * Get the usage for a subscription + * + * @param {string} location The identifier for the physical azure location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the usage for a subscription + * + * @param {string} location The identifier for the physical azure location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(location: string, callback: ServiceCallback): void; + list(location: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ContainerLogs + * __NOTE__: An instance of this class is automatically created for an + * instance of the ContainerInstanceManagementClient. + */ +export interface ContainerLogs { + + + /** + * @summary Get the logs for a specified container instance. + * + * Get the logs for a specified container instance in a specified resource + * group and container group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {string} containerName The name of the container instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.tail] The number of lines to show from the tail of + * the container instance log. If not provided, all available logs are shown up + * to 4mb. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, containerGroupName: string, containerName: string, options?: { tail? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Get the logs for a specified container instance. + * + * Get the logs for a specified container instance in a specified resource + * group and container group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {string} containerName The name of the container instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.tail] The number of lines to show from the tail of + * the container instance log. If not provided, all available logs are shown up + * to 4mb. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Logs} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Logs} [result] - The deserialized result object if an error did not occur. + * See {@link Logs} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, containerGroupName: string, containerName: string, options?: { tail? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, containerGroupName: string, containerName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, containerGroupName: string, containerName: string, options: { tail? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * StartContainer + * __NOTE__: An instance of this class is automatically created for an + * instance of the ContainerInstanceManagementClient. + */ +export interface StartContainer { + + + /** + * @summary Starts the exec command for a specific container instance. + * + * Starts the exec command for a specified container instance in a specified + * resource group and container group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {string} containerName The name of the container instance. + * + * @param {object} containerExecRequest The request for the exec command. + * + * @param {string} [containerExecRequest.command] The command to be executed. + * + * @param {object} [containerExecRequest.terminalSize] The size of the + * terminal. + * + * @param {number} [containerExecRequest.terminalSize.row] The row size of the + * terminal + * + * @param {number} [containerExecRequest.terminalSize.column] The column size + * of the terminal + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + launchExecWithHttpOperationResponse(resourceGroupName: string, containerGroupName: string, containerName: string, containerExecRequest: models.ContainerExecRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Starts the exec command for a specific container instance. + * + * Starts the exec command for a specified container instance in a specified + * resource group and container group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {string} containerName The name of the container instance. + * + * @param {object} containerExecRequest The request for the exec command. + * + * @param {string} [containerExecRequest.command] The command to be executed. + * + * @param {object} [containerExecRequest.terminalSize] The size of the + * terminal. + * + * @param {number} [containerExecRequest.terminalSize.row] The row size of the + * terminal + * + * @param {number} [containerExecRequest.terminalSize.column] The column size + * of the terminal + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ContainerExecResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ContainerExecResponse} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerExecResponse} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + launchExec(resourceGroupName: string, containerGroupName: string, containerName: string, containerExecRequest: models.ContainerExecRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + launchExec(resourceGroupName: string, containerGroupName: string, containerName: string, containerExecRequest: models.ContainerExecRequest, callback: ServiceCallback): void; + launchExec(resourceGroupName: string, containerGroupName: string, containerName: string, containerExecRequest: models.ContainerExecRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/containerinstanceManagement/lib/lib/operations/index.js b/lib/services/containerinstanceManagement/lib/lib/operations/index.js new file mode 100644 index 0000000000..5c83ae4e33 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/operations/index.js @@ -0,0 +1,21 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +exports.ContainerGroups = require('./containerGroups'); +exports.Operations = require('./operations'); +exports.ContainerGroupUsage = require('./containerGroupUsage'); +exports.ContainerLogs = require('./containerLogs'); +exports.StartContainer = require('./startContainer'); diff --git a/lib/services/containerinstanceManagement/lib/lib/operations/operations.js b/lib/services/containerinstanceManagement/lib/lib/operations/operations.js new file mode 100644 index 0000000000..ccb47f1e4b --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/operations/operations.js @@ -0,0 +1,237 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * List the operations for Azure Container Instance service. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.ContainerInstance/operations'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Operations. */ +class Operations { + /** + * Create a Operations. + * @param {ContainerInstanceManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + } + + /** + * List the operations for Azure Container Instance service. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List the operations for Azure Container Instance service. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + +} + +module.exports = Operations; diff --git a/lib/services/containerinstanceManagement/lib/lib/operations/startContainer.js b/lib/services/containerinstanceManagement/lib/lib/operations/startContainer.js new file mode 100644 index 0000000000..173c58eaf3 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/lib/operations/startContainer.js @@ -0,0 +1,336 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * @summary Starts the exec command for a specific container instance. + * + * Starts the exec command for a specified container instance in a specified + * resource group and container group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {string} containerName The name of the container instance. + * + * @param {object} containerExecRequest The request for the exec command. + * + * @param {string} [containerExecRequest.command] The command to be executed. + * + * @param {object} [containerExecRequest.terminalSize] The size of the + * terminal. + * + * @param {number} [containerExecRequest.terminalSize.row] The row size of the + * terminal + * + * @param {number} [containerExecRequest.terminalSize.column] The column size + * of the terminal + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerExecResponse} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _launchExec(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (containerGroupName === null || containerGroupName === undefined || typeof containerGroupName.valueOf() !== 'string') { + throw new Error('containerGroupName cannot be null or undefined and it must be of type string.'); + } + if (containerName === null || containerName === undefined || typeof containerName.valueOf() !== 'string') { + throw new Error('containerName cannot be null or undefined and it must be of type string.'); + } + if (containerExecRequest === null || containerExecRequest === undefined) { + throw new Error('containerExecRequest cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{containerGroupName}', encodeURIComponent(containerGroupName)); + requestUrl = requestUrl.replace('{containerName}', encodeURIComponent(containerName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (containerExecRequest !== null && containerExecRequest !== undefined) { + let requestModelMapper = new client.models['ContainerExecRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, containerExecRequest, 'containerExecRequest'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(containerExecRequest, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ContainerExecResponse']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a StartContainer. */ +class StartContainer { + /** + * Create a StartContainer. + * @param {ContainerInstanceManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._launchExec = _launchExec; + } + + /** + * @summary Starts the exec command for a specific container instance. + * + * Starts the exec command for a specified container instance in a specified + * resource group and container group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {string} containerName The name of the container instance. + * + * @param {object} containerExecRequest The request for the exec command. + * + * @param {string} [containerExecRequest.command] The command to be executed. + * + * @param {object} [containerExecRequest.terminalSize] The size of the + * terminal. + * + * @param {number} [containerExecRequest.terminalSize.row] The row size of the + * terminal + * + * @param {number} [containerExecRequest.terminalSize.column] The column size + * of the terminal + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + launchExecWithHttpOperationResponse(resourceGroupName, containerGroupName, containerName, containerExecRequest, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._launchExec(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Starts the exec command for a specific container instance. + * + * Starts the exec command for a specified container instance in a specified + * resource group and container group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} containerGroupName The name of the container group. + * + * @param {string} containerName The name of the container instance. + * + * @param {object} containerExecRequest The request for the exec command. + * + * @param {string} [containerExecRequest.command] The command to be executed. + * + * @param {object} [containerExecRequest.terminalSize] The size of the + * terminal. + * + * @param {number} [containerExecRequest.terminalSize.row] The row size of the + * terminal + * + * @param {number} [containerExecRequest.terminalSize.column] The column size + * of the terminal + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ContainerExecResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerExecResponse} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + launchExec(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._launchExec(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._launchExec(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, optionalCallback); + } + } + +} + +module.exports = StartContainer; diff --git a/lib/services/containerinstanceManagement/lib/package.json b/lib/services/containerinstanceManagement/lib/package.json new file mode 100644 index 0000000000..1f2fcbe76c --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/package.json @@ -0,0 +1,22 @@ +{ + "name": "azure-arm-containerinstance", + "author": "Microsoft Corporation", + "description": "ContainerInstanceManagementClient Library with typescript type definitions for node", + "version": "", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ "node", "azure" ], + "license": "MIT", + "main": "./lib/containerInstanceManagementClient.js", + "types": "./lib/containerInstanceManagementClient.d.ts", + "homepage": "http://github.com/azure/azure-sdk-for-node", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "http://github.com/Azure/azure-sdk-for-node/issues" + } +}