From 2ea4415a58185067e19ab8cbc3beec442cc17e4a Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 18 May 2018 02:17:57 +0000 Subject: [PATCH 1/3] Generated from 3c1665f522ece941d8c827b3e8ee539c2cdaf846 [AKS] add POST endpoint for fetching accessProfiles --- .../lib/operations/index.d.ts | 72 +++++ .../lib/operations/managedClusters.js | 254 ++++++++++++++++++ 2 files changed, 326 insertions(+) diff --git a/lib/services/containerservicesManagement/lib/operations/index.d.ts b/lib/services/containerservicesManagement/lib/operations/index.d.ts index a284856889..e355b2296a 100644 --- a/lib/services/containerservicesManagement/lib/operations/index.d.ts +++ b/lib/services/containerservicesManagement/lib/operations/index.d.ts @@ -1547,6 +1547,78 @@ export interface ManagedClusters { getUpgradeProfile(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * @summary Gets an access profile of a managed cluster. + * + * Gets the accessProfile for the specified role name of the managed cluster + * with a specified resource group and name. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {string} roleName The name of the role for managed cluster + * accessProfile resource. + * + * @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. + */ + listCredentialWithHttpOperationResponse(resourceGroupName: string, resourceName: string, roleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets an access profile of a managed cluster. + * + * Gets the accessProfile for the specified role name of the managed cluster + * with a specified resource group and name. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {string} roleName The name of the role for managed cluster + * accessProfile resource. + * + * @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 {ManagedClusterAccessProfile} - 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. + * + * {ManagedClusterAccessProfile} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedClusterAccessProfile} 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. + */ + listCredential(resourceGroupName: string, resourceName: string, roleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listCredential(resourceGroupName: string, resourceName: string, roleName: string, callback: ServiceCallback): void; + listCredential(resourceGroupName: string, resourceName: string, roleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * @summary Gets access profile of a managed cluster. * diff --git a/lib/services/containerservicesManagement/lib/operations/managedClusters.js b/lib/services/containerservicesManagement/lib/operations/managedClusters.js index 7e43c858b6..248ba4215b 100644 --- a/lib/services/containerservicesManagement/lib/operations/managedClusters.js +++ b/lib/services/containerservicesManagement/lib/operations/managedClusters.js @@ -438,6 +438,160 @@ function _getUpgradeProfile(resourceGroupName, resourceName, options, callback) }); } +/** + * @summary Gets an access profile of a managed cluster. + * + * Gets the accessProfile for the specified role name of the managed cluster + * with a specified resource group and name. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {string} roleName The name of the role for managed cluster + * accessProfile resource. + * + * @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 ManagedClusterAccessProfile} 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 _listCredential(resourceGroupName, resourceName, roleName, 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 apiVersion = '2017-08-31'; + // 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 (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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (roleName === null || roleName === undefined || typeof roleName.valueOf() !== 'string') { + throw new Error('roleName 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.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + requestUrl = requestUrl.replace('{roleName}', encodeURIComponent(roleName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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]; + } + } + } + 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['ManagedClusterAccessProfile']().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 Gets access profile of a managed cluster. * @@ -1569,6 +1723,7 @@ class ManagedClusters { this._list = _list; this._listByResourceGroup = _listByResourceGroup; this._getUpgradeProfile = _getUpgradeProfile; + this._listCredential = _listCredential; this._getAccessProfiles = _getAccessProfiles; this._get = _get; this._createOrUpdate = _createOrUpdate; @@ -1848,6 +2003,105 @@ class ManagedClusters { } } + /** + * @summary Gets an access profile of a managed cluster. + * + * Gets the accessProfile for the specified role name of the managed cluster + * with a specified resource group and name. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {string} roleName The name of the role for managed cluster + * accessProfile resource. + * + * @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. + */ + listCredentialWithHttpOperationResponse(resourceGroupName, resourceName, roleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listCredential(resourceGroupName, resourceName, roleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets an access profile of a managed cluster. + * + * Gets the accessProfile for the specified role name of the managed cluster + * with a specified resource group and name. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {string} roleName The name of the role for managed cluster + * accessProfile resource. + * + * @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 {ManagedClusterAccessProfile} - 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 ManagedClusterAccessProfile} 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. + */ + listCredential(resourceGroupName, resourceName, roleName, 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._listCredential(resourceGroupName, resourceName, roleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listCredential(resourceGroupName, resourceName, roleName, options, optionalCallback); + } + } + /** * @summary Gets access profile of a managed cluster. * From 7061136fba360bae11f19493c019ec5f4ec4b5d1 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 18 May 2018 17:48:28 +0000 Subject: [PATCH 2/3] Generated from a86af5dd1b974ecc3b58e95efc228497137d79a3 Mark GET endpoint for accessProfiles as deprecated --- .../lib/operations/index.d.ts | 6 ++---- .../lib/operations/managedClusters.js | 9 +++------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/services/containerservicesManagement/lib/operations/index.d.ts b/lib/services/containerservicesManagement/lib/operations/index.d.ts index e355b2296a..6a11169046 100644 --- a/lib/services/containerservicesManagement/lib/operations/index.d.ts +++ b/lib/services/containerservicesManagement/lib/operations/index.d.ts @@ -1484,8 +1484,7 @@ export interface ManagedClusters { /** * @summary Gets upgrade profile for a managed cluster. * - * Gets the details of the upgrade profile for a managed cluster with a - * specified resource group and name. + * Use ManagedClusters_ListCredential instead. * * @param {string} resourceGroupName The name of the resource group. * @@ -1507,8 +1506,7 @@ export interface ManagedClusters { /** * @summary Gets upgrade profile for a managed cluster. * - * Gets the details of the upgrade profile for a managed cluster with a - * specified resource group and name. + * Use ManagedClusters_ListCredential instead. * * @param {string} resourceGroupName The name of the resource group. * diff --git a/lib/services/containerservicesManagement/lib/operations/managedClusters.js b/lib/services/containerservicesManagement/lib/operations/managedClusters.js index 248ba4215b..67c26735e2 100644 --- a/lib/services/containerservicesManagement/lib/operations/managedClusters.js +++ b/lib/services/containerservicesManagement/lib/operations/managedClusters.js @@ -294,8 +294,7 @@ function _listByResourceGroup(resourceGroupName, options, callback) { /** * @summary Gets upgrade profile for a managed cluster. * - * Gets the details of the upgrade profile for a managed cluster with a - * specified resource group and name. + * Use ManagedClusters_ListCredential instead. * * @param {string} resourceGroupName The name of the resource group. * @@ -1913,8 +1912,7 @@ class ManagedClusters { /** * @summary Gets upgrade profile for a managed cluster. * - * Gets the details of the upgrade profile for a managed cluster with a - * specified resource group and name. + * Use ManagedClusters_ListCredential instead. * * @param {string} resourceGroupName The name of the resource group. * @@ -1948,8 +1946,7 @@ class ManagedClusters { /** * @summary Gets upgrade profile for a managed cluster. * - * Gets the details of the upgrade profile for a managed cluster with a - * specified resource group and name. + * Use ManagedClusters_ListCredential instead. * * @param {string} resourceGroupName The name of the resource group. * From 644f158fee153373e9138fdb062729265374abdc Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 18 May 2018 23:23:57 +0000 Subject: [PATCH 3/3] Generated from a69eb4b470374683c3bc4e86491aa60ae0a161ea Rename to GetAccessProfile --- .../lib/operations/index.d.ts | 20 ++++++------ .../lib/operations/managedClusters.js | 32 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/services/containerservicesManagement/lib/operations/index.d.ts b/lib/services/containerservicesManagement/lib/operations/index.d.ts index 6a11169046..b9cdced218 100644 --- a/lib/services/containerservicesManagement/lib/operations/index.d.ts +++ b/lib/services/containerservicesManagement/lib/operations/index.d.ts @@ -1484,7 +1484,8 @@ export interface ManagedClusters { /** * @summary Gets upgrade profile for a managed cluster. * - * Use ManagedClusters_ListCredential instead. + * Gets the details of the upgrade profile for a managed cluster with a + * specified resource group and name. * * @param {string} resourceGroupName The name of the resource group. * @@ -1506,7 +1507,8 @@ export interface ManagedClusters { /** * @summary Gets upgrade profile for a managed cluster. * - * Use ManagedClusters_ListCredential instead. + * Gets the details of the upgrade profile for a managed cluster with a + * specified resource group and name. * * @param {string} resourceGroupName The name of the resource group. * @@ -1569,7 +1571,7 @@ export interface ManagedClusters { * * @reject {Error|ServiceError} - The error object. */ - listCredentialWithHttpOperationResponse(resourceGroupName: string, resourceName: string, roleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getAccessProfileWithHttpOperationResponse(resourceGroupName: string, resourceName: string, roleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * @summary Gets an access profile of a managed cluster. @@ -1612,16 +1614,15 @@ export interface ManagedClusters { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listCredential(resourceGroupName: string, resourceName: string, roleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listCredential(resourceGroupName: string, resourceName: string, roleName: string, callback: ServiceCallback): void; - listCredential(resourceGroupName: string, resourceName: string, roleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getAccessProfile(resourceGroupName: string, resourceName: string, roleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getAccessProfile(resourceGroupName: string, resourceName: string, roleName: string, callback: ServiceCallback): void; + getAccessProfile(resourceGroupName: string, resourceName: string, roleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** * @summary Gets access profile of a managed cluster. * - * Gets the accessProfile for the specified role name of the managed cluster - * with a specified resource group and name. + * Use ManagedClusters_GetAccessProfile instead. * * @param {string} resourceGroupName The name of the resource group. * @@ -1646,8 +1647,7 @@ export interface ManagedClusters { /** * @summary Gets access profile of a managed cluster. * - * Gets the accessProfile for the specified role name of the managed cluster - * with a specified resource group and name. + * Use ManagedClusters_GetAccessProfile instead. * * @param {string} resourceGroupName The name of the resource group. * diff --git a/lib/services/containerservicesManagement/lib/operations/managedClusters.js b/lib/services/containerservicesManagement/lib/operations/managedClusters.js index 67c26735e2..f2b860ff21 100644 --- a/lib/services/containerservicesManagement/lib/operations/managedClusters.js +++ b/lib/services/containerservicesManagement/lib/operations/managedClusters.js @@ -294,7 +294,8 @@ function _listByResourceGroup(resourceGroupName, options, callback) { /** * @summary Gets upgrade profile for a managed cluster. * - * Use ManagedClusters_ListCredential instead. + * Gets the details of the upgrade profile for a managed cluster with a + * specified resource group and name. * * @param {string} resourceGroupName The name of the resource group. * @@ -469,7 +470,7 @@ function _getUpgradeProfile(resourceGroupName, resourceName, options, callback) * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _listCredential(resourceGroupName, resourceName, roleName, options, callback) { +function _getAccessProfile(resourceGroupName, resourceName, roleName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -594,8 +595,7 @@ function _listCredential(resourceGroupName, resourceName, roleName, options, cal /** * @summary Gets access profile of a managed cluster. * - * Gets the accessProfile for the specified role name of the managed cluster - * with a specified resource group and name. + * Use ManagedClusters_GetAccessProfile instead. * * @param {string} resourceGroupName The name of the resource group. * @@ -1722,7 +1722,7 @@ class ManagedClusters { this._list = _list; this._listByResourceGroup = _listByResourceGroup; this._getUpgradeProfile = _getUpgradeProfile; - this._listCredential = _listCredential; + this._getAccessProfile = _getAccessProfile; this._getAccessProfiles = _getAccessProfiles; this._get = _get; this._createOrUpdate = _createOrUpdate; @@ -1912,7 +1912,8 @@ class ManagedClusters { /** * @summary Gets upgrade profile for a managed cluster. * - * Use ManagedClusters_ListCredential instead. + * Gets the details of the upgrade profile for a managed cluster with a + * specified resource group and name. * * @param {string} resourceGroupName The name of the resource group. * @@ -1946,7 +1947,8 @@ class ManagedClusters { /** * @summary Gets upgrade profile for a managed cluster. * - * Use ManagedClusters_ListCredential instead. + * Gets the details of the upgrade profile for a managed cluster with a + * specified resource group and name. * * @param {string} resourceGroupName The name of the resource group. * @@ -2024,11 +2026,11 @@ class ManagedClusters { * * @reject {Error} - The error object. */ - listCredentialWithHttpOperationResponse(resourceGroupName, resourceName, roleName, options) { + getAccessProfileWithHttpOperationResponse(resourceGroupName, resourceName, roleName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listCredential(resourceGroupName, resourceName, roleName, options, (err, result, request, response) => { + self._getAccessProfile(resourceGroupName, resourceName, roleName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2079,7 +2081,7 @@ class ManagedClusters { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listCredential(resourceGroupName, resourceName, roleName, options, optionalCallback) { + getAccessProfile(resourceGroupName, resourceName, roleName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2088,22 +2090,21 @@ class ManagedClusters { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listCredential(resourceGroupName, resourceName, roleName, options, (err, result, request, response) => { + self._getAccessProfile(resourceGroupName, resourceName, roleName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listCredential(resourceGroupName, resourceName, roleName, options, optionalCallback); + return self._getAccessProfile(resourceGroupName, resourceName, roleName, options, optionalCallback); } } /** * @summary Gets access profile of a managed cluster. * - * Gets the accessProfile for the specified role name of the managed cluster - * with a specified resource group and name. + * Use ManagedClusters_GetAccessProfile instead. * * @param {string} resourceGroupName The name of the resource group. * @@ -2140,8 +2141,7 @@ class ManagedClusters { /** * @summary Gets access profile of a managed cluster. * - * Gets the accessProfile for the specified role name of the managed cluster - * with a specified resource group and name. + * Use ManagedClusters_GetAccessProfile instead. * * @param {string} resourceGroupName The name of the resource group. *