From a8313e8590ab17b629834ee70649a9533a574a32 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 14 Jun 2018 18:57:49 +0000 Subject: [PATCH 1/2] Generated from a58ad31ca0f190c08d519f0e57f0251b719de4c3 Udpating other fields to have better documentation --- .../containerInstanceManagementClient.d.ts | 3 +- .../lib/containerInstanceManagementClient.js | 3 +- .../lib/models/containerExecRequest.js | 2 +- .../lib/models/index.d.ts | 2 +- .../lib/operations/containerOperations.js | 606 ++++++++++++++++++ .../lib/operations/index.d.ts | 41 +- .../lib/operations/index.js | 3 +- 7 files changed, 627 insertions(+), 33 deletions(-) create mode 100644 lib/services/containerinstanceManagement/lib/operations/containerOperations.js diff --git a/lib/services/containerinstanceManagement/lib/containerInstanceManagementClient.d.ts b/lib/services/containerinstanceManagement/lib/containerInstanceManagementClient.d.ts index 312ef4d3e0..b27f8b1cda 100644 --- a/lib/services/containerinstanceManagement/lib/containerInstanceManagementClient.d.ts +++ b/lib/services/containerinstanceManagement/lib/containerInstanceManagementClient.d.ts @@ -59,8 +59,7 @@ export default class ContainerInstanceManagementClient extends AzureServiceClien containerGroups: operations.ContainerGroups; operations: operations.Operations; containerGroupUsage: operations.ContainerGroupUsage; - containerLogs: operations.ContainerLogs; - startContainer: operations.StartContainer; + containerOperations: operations.ContainerOperations; } export { ContainerInstanceManagementClient, models as ContainerInstanceManagementModels }; diff --git a/lib/services/containerinstanceManagement/lib/containerInstanceManagementClient.js b/lib/services/containerinstanceManagement/lib/containerInstanceManagementClient.js index 3e972eeefb..90895b54f7 100644 --- a/lib/services/containerinstanceManagement/lib/containerInstanceManagementClient.js +++ b/lib/services/containerinstanceManagement/lib/containerInstanceManagementClient.js @@ -75,8 +75,7 @@ class ContainerInstanceManagementClient extends ServiceClient { 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.containerOperations = new operations.ContainerOperations(this); this.models = models; msRest.addSerializationMixin(this); } diff --git a/lib/services/containerinstanceManagement/lib/models/containerExecRequest.js b/lib/services/containerinstanceManagement/lib/models/containerExecRequest.js index 0afee3f3cd..e8e9ad159c 100644 --- a/lib/services/containerinstanceManagement/lib/models/containerExecRequest.js +++ b/lib/services/containerinstanceManagement/lib/models/containerExecRequest.js @@ -13,7 +13,7 @@ const models = require('./index'); /** - * The start container exec request. + * The container exec request. * */ class ContainerExecRequest { diff --git a/lib/services/containerinstanceManagement/lib/models/index.d.ts b/lib/services/containerinstanceManagement/lib/models/index.d.ts index c255d09d6f..c21553b256 100644 --- a/lib/services/containerinstanceManagement/lib/models/index.d.ts +++ b/lib/services/containerinstanceManagement/lib/models/index.d.ts @@ -735,7 +735,7 @@ export interface ContainerExecRequestTerminalSize { * @class * Initializes a new instance of the ContainerExecRequest class. * @constructor - * The start container exec request. + * The container exec request. * * @member {string} [command] The command to be executed. * @member {object} [terminalSize] The size of the terminal. diff --git a/lib/services/containerinstanceManagement/lib/operations/containerOperations.js b/lib/services/containerinstanceManagement/lib/operations/containerOperations.js new file mode 100644 index 0000000000..8207f937f0 --- /dev/null +++ b/lib/services/containerinstanceManagement/lib/operations/containerOperations.js @@ -0,0 +1,606 @@ +/* + * 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 _listLogs(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); + }); +} + +/** + * @summary Executes a command in a specific container instance. + * + * Executes a command for a specific 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.rows] The row size of the + * terminal + * + * @param {number} [containerExecRequest.terminalSize.cols] 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 _exec(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 ContainerOperations. */ +class ContainerOperations { + /** + * Create a ContainerOperations. + * @param {ContainerInstanceManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listLogs = _listLogs; + this._exec = _exec; + } + + /** + * @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. + */ + listLogsWithHttpOperationResponse(resourceGroupName, containerGroupName, containerName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listLogs(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. + */ + listLogs(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._listLogs(resourceGroupName, containerGroupName, containerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listLogs(resourceGroupName, containerGroupName, containerName, options, optionalCallback); + } + } + + /** + * @summary Executes a command in a specific container instance. + * + * Executes a command for a specific 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.rows] The row size of the + * terminal + * + * @param {number} [containerExecRequest.terminalSize.cols] 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. + */ + execWithHttpOperationResponse(resourceGroupName, containerGroupName, containerName, containerExecRequest, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._exec(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 Executes a command in a specific container instance. + * + * Executes a command for a specific 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.rows] The row size of the + * terminal + * + * @param {number} [containerExecRequest.terminalSize.cols] 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. + */ + exec(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._exec(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._exec(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, optionalCallback); + } + } + +} + +module.exports = ContainerOperations; diff --git a/lib/services/containerinstanceManagement/lib/operations/index.d.ts b/lib/services/containerinstanceManagement/lib/operations/index.d.ts index bf50e555ff..55fe4a8c39 100644 --- a/lib/services/containerinstanceManagement/lib/operations/index.d.ts +++ b/lib/services/containerinstanceManagement/lib/operations/index.d.ts @@ -958,11 +958,11 @@ export interface ContainerGroupUsage { /** * @class - * ContainerLogs + * ContainerOperations * __NOTE__: An instance of this class is automatically created for an * instance of the ContainerInstanceManagementClient. */ -export interface ContainerLogs { +export interface ContainerOperations { /** @@ -992,7 +992,7 @@ export interface ContainerLogs { * * @reject {Error|ServiceError} - The error object. */ - listWithHttpOperationResponse(resourceGroupName: string, containerGroupName: string, containerName: string, options?: { tail? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + listLogsWithHttpOperationResponse(resourceGroupName: string, containerGroupName: string, containerName: string, options?: { tail? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; /** * @summary Get the logs for a specified container instance. @@ -1037,25 +1037,16 @@ export interface ContainerLogs { * * {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 { + listLogs(resourceGroupName: string, containerGroupName: string, containerName: string, options?: { tail? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listLogs(resourceGroupName: string, containerGroupName: string, containerName: string, callback: ServiceCallback): void; + listLogs(resourceGroupName: string, containerGroupName: string, containerName: string, options: { tail? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * @summary Starts the exec command for a specific container instance. + * @summary Executes a command in a specific container instance. * - * Starts the exec command for a specified container instance in a specified - * resource group and container group. + * Executes a command for a specific container instance in a specified resource + * group and container group. * * @param {string} resourceGroupName The name of the resource group. * @@ -1087,13 +1078,13 @@ export interface StartContainer { * * @reject {Error|ServiceError} - The error object. */ - launchExecWithHttpOperationResponse(resourceGroupName: string, containerGroupName: string, containerName: string, containerExecRequest: models.ContainerExecRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + execWithHttpOperationResponse(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. + * @summary Executes a command in a specific container instance. * - * Starts the exec command for a specified container instance in a specified - * resource group and container group. + * Executes a command for a specific container instance in a specified resource + * group and container group. * * @param {string} resourceGroupName The name of the resource group. * @@ -1141,7 +1132,7 @@ export interface StartContainer { * * {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; + exec(resourceGroupName: string, containerGroupName: string, containerName: string, containerExecRequest: models.ContainerExecRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + exec(resourceGroupName: string, containerGroupName: string, containerName: string, containerExecRequest: models.ContainerExecRequest, callback: ServiceCallback): void; + exec(resourceGroupName: string, containerGroupName: string, containerName: string, containerExecRequest: models.ContainerExecRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } diff --git a/lib/services/containerinstanceManagement/lib/operations/index.js b/lib/services/containerinstanceManagement/lib/operations/index.js index 5c83ae4e33..c8c6b7e67a 100644 --- a/lib/services/containerinstanceManagement/lib/operations/index.js +++ b/lib/services/containerinstanceManagement/lib/operations/index.js @@ -17,5 +17,4 @@ exports.ContainerGroups = require('./containerGroups'); exports.Operations = require('./operations'); exports.ContainerGroupUsage = require('./containerGroupUsage'); -exports.ContainerLogs = require('./containerLogs'); -exports.StartContainer = require('./startContainer'); +exports.ContainerOperations = require('./containerOperations'); From f5edc90b08cabda523f6ef73f0f2b6c690a8ffe2 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 14 Jun 2018 20:00:21 +0000 Subject: [PATCH 2/2] Generated from 57c26f8ddc6cce63febe8113dcf5a0c4e638c1ea Changing Container_Exec -> Conatiner_ExecuteCommand for better understanding --- .../lib/operations/containerOperations.js | 14 +++++++------- .../lib/operations/index.d.ts | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/services/containerinstanceManagement/lib/operations/containerOperations.js b/lib/services/containerinstanceManagement/lib/operations/containerOperations.js index 8207f937f0..47bd44d336 100644 --- a/lib/services/containerinstanceManagement/lib/operations/containerOperations.js +++ b/lib/services/containerinstanceManagement/lib/operations/containerOperations.js @@ -222,7 +222,7 @@ function _listLogs(resourceGroupName, containerGroupName, containerName, options * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _exec(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, callback) { +function _executeCommand(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -372,7 +372,7 @@ class ContainerOperations { constructor(client) { this.client = client; this._listLogs = _listLogs; - this._exec = _exec; + this._executeCommand = _executeCommand; } /** @@ -515,11 +515,11 @@ class ContainerOperations { * * @reject {Error} - The error object. */ - execWithHttpOperationResponse(resourceGroupName, containerGroupName, containerName, containerExecRequest, options) { + executeCommandWithHttpOperationResponse(resourceGroupName, containerGroupName, containerName, containerExecRequest, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._exec(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, (err, result, request, response) => { + self._executeCommand(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -581,7 +581,7 @@ class ContainerOperations { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - exec(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, optionalCallback) { + executeCommand(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -590,14 +590,14 @@ class ContainerOperations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._exec(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, (err, result, request, response) => { + self._executeCommand(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._exec(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, optionalCallback); + return self._executeCommand(resourceGroupName, containerGroupName, containerName, containerExecRequest, options, optionalCallback); } } diff --git a/lib/services/containerinstanceManagement/lib/operations/index.d.ts b/lib/services/containerinstanceManagement/lib/operations/index.d.ts index 55fe4a8c39..8c9c0df187 100644 --- a/lib/services/containerinstanceManagement/lib/operations/index.d.ts +++ b/lib/services/containerinstanceManagement/lib/operations/index.d.ts @@ -1078,7 +1078,7 @@ export interface ContainerOperations { * * @reject {Error|ServiceError} - The error object. */ - execWithHttpOperationResponse(resourceGroupName: string, containerGroupName: string, containerName: string, containerExecRequest: models.ContainerExecRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + executeCommandWithHttpOperationResponse(resourceGroupName: string, containerGroupName: string, containerName: string, containerExecRequest: models.ContainerExecRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * @summary Executes a command in a specific container instance. @@ -1132,7 +1132,7 @@ export interface ContainerOperations { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - exec(resourceGroupName: string, containerGroupName: string, containerName: string, containerExecRequest: models.ContainerExecRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - exec(resourceGroupName: string, containerGroupName: string, containerName: string, containerExecRequest: models.ContainerExecRequest, callback: ServiceCallback): void; - exec(resourceGroupName: string, containerGroupName: string, containerName: string, containerExecRequest: models.ContainerExecRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + executeCommand(resourceGroupName: string, containerGroupName: string, containerName: string, containerExecRequest: models.ContainerExecRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + executeCommand(resourceGroupName: string, containerGroupName: string, containerName: string, containerExecRequest: models.ContainerExecRequest, callback: ServiceCallback): void; + executeCommand(resourceGroupName: string, containerGroupName: string, containerName: string, containerExecRequest: models.ContainerExecRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; }