diff --git a/lib/services/containerservicesManagement/lib/operations/index.d.ts b/lib/services/containerservicesManagement/lib/operations/index.d.ts index 3e880972d2..7303cc6b41 100644 --- a/lib/services/containerservicesManagement/lib/operations/index.d.ts +++ b/lib/services/containerservicesManagement/lib/operations/index.d.ts @@ -3301,6 +3301,176 @@ export interface ManagedClusters { deleteMethod(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * @summary Reset Service Principal Profile of a managed cluster. + * + * Update the service principal Profile for a managed cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Reset Service + * Principal Profile operation for a Managed Cluster. + * + * @param {string} parameters.clientId The ID for the service principal. + * + * @param {string} [parameters.secret] The secret password associated with the + * service principal in plain text. + * + * @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. + */ + resetServicePrincipalProfileWithHttpOperationResponse(resourceGroupName: string, resourceName: string, parameters: models.ManagedClusterServicePrincipalProfile, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Reset Service Principal Profile of a managed cluster. + * + * Update the service principal Profile for a managed cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Reset Service + * Principal Profile operation for a Managed Cluster. + * + * @param {string} parameters.clientId The ID for the service principal. + * + * @param {string} [parameters.secret] The secret password associated with the + * service principal in plain text. + * + * @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 {ManagedCluster} - 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. + * + * {ManagedCluster} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedCluster} 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. + */ + resetServicePrincipalProfile(resourceGroupName: string, resourceName: string, parameters: models.ManagedClusterServicePrincipalProfile, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + resetServicePrincipalProfile(resourceGroupName: string, resourceName: string, parameters: models.ManagedClusterServicePrincipalProfile, callback: ServiceCallback): void; + resetServicePrincipalProfile(resourceGroupName: string, resourceName: string, parameters: models.ManagedClusterServicePrincipalProfile, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Reset AAD Profile of a managed cluster. + * + * Update the AAD Profile for a managed cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Reset AAD Profile + * operation for a Managed Cluster. + * + * @param {string} parameters.clientAppID The client AAD application ID. + * + * @param {string} parameters.serverAppID The server AAD application ID. + * + * @param {string} [parameters.serverAppSecret] The server AAD application + * secret. + * + * @param {string} [parameters.tenantID] The AAD tenant ID to use for + * authentication. If not specified, will use the tenant of the deployment + * subscription. + * + * @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. + */ + resetAADProfileWithHttpOperationResponse(resourceGroupName: string, resourceName: string, parameters: models.ManagedClusterAADProfile, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Reset AAD Profile of a managed cluster. + * + * Update the AAD Profile for a managed cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Reset AAD Profile + * operation for a Managed Cluster. + * + * @param {string} parameters.clientAppID The client AAD application ID. + * + * @param {string} parameters.serverAppID The server AAD application ID. + * + * @param {string} [parameters.serverAppSecret] The server AAD application + * secret. + * + * @param {string} [parameters.tenantID] The AAD tenant ID to use for + * authentication. If not specified, will use the tenant of the deployment + * subscription. + * + * @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 {ManagedCluster} - 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. + * + * {ManagedCluster} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedCluster} 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. + */ + resetAADProfile(resourceGroupName: string, resourceName: string, parameters: models.ManagedClusterAADProfile, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + resetAADProfile(resourceGroupName: string, resourceName: string, parameters: models.ManagedClusterAADProfile, callback: ServiceCallback): void; + resetAADProfile(resourceGroupName: string, resourceName: string, parameters: models.ManagedClusterAADProfile, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * @summary Creates or updates a managed cluster. * @@ -3671,6 +3841,176 @@ export interface ManagedClusters { beginDeleteMethod(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * @summary Reset Service Principal Profile of a managed cluster. + * + * Update the service principal Profile for a managed cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Reset Service + * Principal Profile operation for a Managed Cluster. + * + * @param {string} parameters.clientId The ID for the service principal. + * + * @param {string} [parameters.secret] The secret password associated with the + * service principal in plain text. + * + * @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. + */ + beginResetServicePrincipalProfileWithHttpOperationResponse(resourceGroupName: string, resourceName: string, parameters: models.ManagedClusterServicePrincipalProfile, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Reset Service Principal Profile of a managed cluster. + * + * Update the service principal Profile for a managed cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Reset Service + * Principal Profile operation for a Managed Cluster. + * + * @param {string} parameters.clientId The ID for the service principal. + * + * @param {string} [parameters.secret] The secret password associated with the + * service principal in plain text. + * + * @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 {ManagedCluster} - 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. + * + * {ManagedCluster} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedCluster} 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. + */ + beginResetServicePrincipalProfile(resourceGroupName: string, resourceName: string, parameters: models.ManagedClusterServicePrincipalProfile, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginResetServicePrincipalProfile(resourceGroupName: string, resourceName: string, parameters: models.ManagedClusterServicePrincipalProfile, callback: ServiceCallback): void; + beginResetServicePrincipalProfile(resourceGroupName: string, resourceName: string, parameters: models.ManagedClusterServicePrincipalProfile, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Reset AAD Profile of a managed cluster. + * + * Update the AAD Profile for a managed cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Reset AAD Profile + * operation for a Managed Cluster. + * + * @param {string} parameters.clientAppID The client AAD application ID. + * + * @param {string} parameters.serverAppID The server AAD application ID. + * + * @param {string} [parameters.serverAppSecret] The server AAD application + * secret. + * + * @param {string} [parameters.tenantID] The AAD tenant ID to use for + * authentication. If not specified, will use the tenant of the deployment + * subscription. + * + * @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. + */ + beginResetAADProfileWithHttpOperationResponse(resourceGroupName: string, resourceName: string, parameters: models.ManagedClusterAADProfile, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Reset AAD Profile of a managed cluster. + * + * Update the AAD Profile for a managed cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Reset AAD Profile + * operation for a Managed Cluster. + * + * @param {string} parameters.clientAppID The client AAD application ID. + * + * @param {string} parameters.serverAppID The server AAD application ID. + * + * @param {string} [parameters.serverAppSecret] The server AAD application + * secret. + * + * @param {string} [parameters.tenantID] The AAD tenant ID to use for + * authentication. If not specified, will use the tenant of the deployment + * subscription. + * + * @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 {ManagedCluster} - 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. + * + * {ManagedCluster} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedCluster} 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. + */ + beginResetAADProfile(resourceGroupName: string, resourceName: string, parameters: models.ManagedClusterAADProfile, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginResetAADProfile(resourceGroupName: string, resourceName: string, parameters: models.ManagedClusterAADProfile, callback: ServiceCallback): void; + beginResetAADProfile(resourceGroupName: string, resourceName: string, parameters: models.ManagedClusterAADProfile, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * @summary Gets a list of managed clusters in the specified subscription. * diff --git a/lib/services/containerservicesManagement/lib/operations/managedClusters.js b/lib/services/containerservicesManagement/lib/operations/managedClusters.js index f9f7e26f6b..1d5d555809 100644 --- a/lib/services/containerservicesManagement/lib/operations/managedClusters.js +++ b/lib/services/containerservicesManagement/lib/operations/managedClusters.js @@ -1346,6 +1346,188 @@ function _deleteMethod(resourceGroupName, resourceName, options, callback) { }); } + +/** + * @summary Reset Service Principal Profile of a managed cluster. + * + * Update the service principal Profile for a managed cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Reset Service + * Principal Profile operation for a Managed Cluster. + * + * @param {string} parameters.clientId The ID for the service principal. + * + * @param {string} [parameters.secret] The secret password associated with the + * service principal in plain text. + * + * @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 ManagedCluster} 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 _resetServicePrincipalProfile(resourceGroupName, resourceName, parameters, 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.beginResetServicePrincipalProfile(resourceGroupName, resourceName, parameters, 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['ManagedCluster']().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 Reset AAD Profile of a managed cluster. + * + * Update the AAD Profile for a managed cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Reset AAD Profile + * operation for a Managed Cluster. + * + * @param {string} parameters.clientAppID The client AAD application ID. + * + * @param {string} parameters.serverAppID The server AAD application ID. + * + * @param {string} [parameters.serverAppSecret] The server AAD application + * secret. + * + * @param {string} [parameters.tenantID] The AAD tenant ID to use for + * authentication. If not specified, will use the tenant of the deployment + * subscription. + * + * @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 ManagedCluster} 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 _resetAADProfile(resourceGroupName, resourceName, parameters, 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.beginResetAADProfile(resourceGroupName, resourceName, parameters, 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['ManagedCluster']().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 Creates or updates a managed cluster. * @@ -1906,13 +2088,21 @@ function _beginDeleteMethod(resourceGroupName, resourceName, options, callback) } /** - * @summary Gets a list of managed clusters in the specified subscription. + * @summary Reset Service Principal Profile of a managed cluster. * - * Gets a list of managed clusters in the specified subscription. The operation - * returns properties of each managed cluster. + * Update the service principal Profile for a managed cluster. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Reset Service + * Principal Profile operation for a Managed Cluster. + * + * @param {string} parameters.clientId The ID for the service principal. + * + * @param {string} [parameters.secret] The secret password associated with the + * service principal in plain text. * * @param {object} [options] Optional Parameters. * @@ -1926,14 +2116,13 @@ function _beginDeleteMethod(resourceGroupName, resourceName, options, callback) * {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 ManagedClusterListResult} for more - * information. + * See {@link ManagedCluster} 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) { +function _beginResetServicePrincipalProfile(resourceGroupName, resourceName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1943,10 +2132,20 @@ function _listNext(nextPageLink, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2018-08-01-preview'; // 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.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 (parameters === null || parameters === undefined) { + throw new Error('parameters 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.'); @@ -1956,12 +2155,20 @@ function _listNext(nextPageLink, options, callback) { } // Construct URL - let requestUrl = '{nextLink}'; - requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + 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 = 'GET'; + httpRequest.method = 'POST'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -1979,14 +2186,28 @@ function _listNext(nextPageLink, options, callback) { } } } - httpRequest.body = null; + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ManagedClusterServicePrincipalProfile']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, 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) { + if (statusCode !== 200 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -2021,7 +2242,7 @@ function _listNext(nextPageLink, options, callback) { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['ManagedClusterListResult']().mapper(); + let resultMapper = new client.models['ManagedCluster']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -2031,20 +2252,50 @@ function _listNext(nextPageLink, options, callback) { return callback(deserializationError); } } + // Deserialize Response + if (statusCode === 202) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedCluster']().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 Lists managed clusters in the specified subscription and resource - * group. + * @summary Reset AAD Profile of a managed cluster. * - * Lists managed clusters in the specified subscription and resource group. The - * operation returns properties of each managed cluster. + * Update the AAD Profile for a managed cluster. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Reset AAD Profile + * operation for a Managed Cluster. + * + * @param {string} parameters.clientAppID The client AAD application ID. + * + * @param {string} parameters.serverAppID The server AAD application ID. + * + * @param {string} [parameters.serverAppSecret] The server AAD application + * secret. + * + * @param {string} [parameters.tenantID] The AAD tenant ID to use for + * authentication. If not specified, will use the tenant of the deployment + * subscription. * * @param {object} [options] Optional Parameters. * @@ -2058,14 +2309,325 @@ function _listNext(nextPageLink, options, callback) { * {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 ManagedClusterListResult} for more - * information. + * See {@link ManagedCluster} 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) { +function _beginResetAADProfile(resourceGroupName, resourceName, parameters, 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 = '2018-08-01-preview'; + // 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 (parameters === null || parameters === undefined) { + throw new Error('parameters 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.ContainerService/managedClusters/{resourceName}/resetAADProfile'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + 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]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ManagedClusterAADProfile']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, 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 !== 202) { + 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['ManagedCluster']().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 === 202) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedCluster']().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 Gets a list of managed clusters in the specified subscription. + * + * Gets a list of managed clusters in the specified subscription. The operation + * returns properties of each managed cluster. + * + * @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 ManagedClusterListResult} 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['ManagedClusterListResult']().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 Lists managed clusters in the specified subscription and resource + * group. + * + * Lists managed clusters in the specified subscription and resource group. The + * operation returns properties of each managed cluster. + * + * @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 ManagedClusterListResult} 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') { @@ -2186,9 +2748,13 @@ class ManagedClusters { this._createOrUpdate = _createOrUpdate; this._updateTags = _updateTags; this._deleteMethod = _deleteMethod; + this._resetServicePrincipalProfile = _resetServicePrincipalProfile; + this._resetAADProfile = _resetAADProfile; this._beginCreateOrUpdate = _beginCreateOrUpdate; this._beginUpdateTags = _beginUpdateTags; this._beginDeleteMethod = _beginDeleteMethod; + this._beginResetServicePrincipalProfile = _beginResetServicePrincipalProfile; + this._beginResetAADProfile = _beginResetAADProfile; this._listNext = _listNext; this._listByResourceGroupNext = _listByResourceGroupNext; } @@ -3044,13 +3610,203 @@ class ManagedClusters { * @param {string} [parameters.aadProfile.serverAppSecret] The server AAD * application secret. * - * @param {string} [parameters.aadProfile.tenantID] The AAD tenant ID to use - * for authentication. If not specified, will use the tenant of the deployment - * subscription. + * @param {string} [parameters.aadProfile.tenantID] The AAD tenant ID to use + * for authentication. If not specified, will use the tenant of the deployment + * subscription. + * + * @param {string} parameters.location Resource location + * + * @param {object} [parameters.tags] 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 {ManagedCluster} - 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 ManagedCluster} 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, resourceName, parameters, 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, resourceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, resourceName, parameters, options, optionalCallback); + } + } + + /** + * @summary Updates tags on a managed cluster. + * + * Updates a managed cluster with the specified tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Update Managed Cluster + * Tags operation. + * + * @param {object} [parameters.tags] 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. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, resourceName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, resourceName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Updates tags on a managed cluster. + * + * Updates a managed cluster with the specified tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Update Managed Cluster + * Tags operation. + * + * @param {object} [parameters.tags] 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 {ManagedCluster} - 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 ManagedCluster} 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. + */ + updateTags(resourceGroupName, resourceName, parameters, 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._updateTags(resourceGroupName, resourceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, resourceName, parameters, options, optionalCallback); + } + } + + /** + * @summary Deletes a managed cluster. + * + * Deletes 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 {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, resourceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, resourceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes a managed cluster. + * + * Deletes the managed cluster with a specified resource group and name. * - * @param {string} parameters.location Resource location + * @param {string} resourceGroupName The name of the resource group. * - * @param {object} [parameters.tags] Resource tags + * @param {string} resourceName The name of the managed cluster resource. * * @param {object} [options] Optional Parameters. * @@ -3064,7 +3820,7 @@ class ManagedClusters { * * {Promise} A promise is returned * - * @resolve {ManagedCluster} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -3072,14 +3828,13 @@ class ManagedClusters { * * {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 ManagedCluster} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {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, resourceName, parameters, options, optionalCallback) { + deleteMethod(resourceGroupName, resourceName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3088,30 +3843,33 @@ class ManagedClusters { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, resourceName, parameters, options, (err, result, request, response) => { + self._deleteMethod(resourceGroupName, resourceName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._createOrUpdate(resourceGroupName, resourceName, parameters, options, optionalCallback); + return self._deleteMethod(resourceGroupName, resourceName, options, optionalCallback); } } /** - * @summary Updates tags on a managed cluster. + * @summary Reset Service Principal Profile of a managed cluster. * - * Updates a managed cluster with the specified tags. + * Update the service principal Profile for a managed cluster. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the managed cluster resource. * - * @param {object} parameters Parameters supplied to the Update Managed Cluster - * Tags operation. + * @param {object} parameters Parameters supplied to the Reset Service + * Principal Profile operation for a Managed Cluster. * - * @param {object} [parameters.tags] Resource tags. + * @param {string} parameters.clientId The ID for the service principal. + * + * @param {string} [parameters.secret] The secret password associated with the + * service principal in plain text. * * @param {object} [options] Optional Parameters. * @@ -3124,11 +3882,11 @@ class ManagedClusters { * * @reject {Error} - The error object. */ - updateTagsWithHttpOperationResponse(resourceGroupName, resourceName, parameters, options) { + resetServicePrincipalProfileWithHttpOperationResponse(resourceGroupName, resourceName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._updateTags(resourceGroupName, resourceName, parameters, options, (err, result, request, response) => { + self._resetServicePrincipalProfile(resourceGroupName, resourceName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -3139,18 +3897,21 @@ class ManagedClusters { } /** - * @summary Updates tags on a managed cluster. + * @summary Reset Service Principal Profile of a managed cluster. * - * Updates a managed cluster with the specified tags. + * Update the service principal Profile for a managed cluster. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the managed cluster resource. * - * @param {object} parameters Parameters supplied to the Update Managed Cluster - * Tags operation. + * @param {object} parameters Parameters supplied to the Reset Service + * Principal Profile operation for a Managed Cluster. * - * @param {object} [parameters.tags] Resource tags. + * @param {string} parameters.clientId The ID for the service principal. + * + * @param {string} [parameters.secret] The secret password associated with the + * service principal in plain text. * * @param {object} [options] Optional Parameters. * @@ -3179,7 +3940,7 @@ class ManagedClusters { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - updateTags(resourceGroupName, resourceName, parameters, options, optionalCallback) { + resetServicePrincipalProfile(resourceGroupName, resourceName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3188,26 +3949,40 @@ class ManagedClusters { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._updateTags(resourceGroupName, resourceName, parameters, options, (err, result, request, response) => { + self._resetServicePrincipalProfile(resourceGroupName, resourceName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._updateTags(resourceGroupName, resourceName, parameters, options, optionalCallback); + return self._resetServicePrincipalProfile(resourceGroupName, resourceName, parameters, options, optionalCallback); } } /** - * @summary Deletes a managed cluster. + * @summary Reset AAD Profile of a managed cluster. * - * Deletes the managed cluster with a specified resource group and name. + * Update the AAD Profile for a managed cluster. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the managed cluster resource. * + * @param {object} parameters Parameters supplied to the Reset AAD Profile + * operation for a Managed Cluster. + * + * @param {string} parameters.clientAppID The client AAD application ID. + * + * @param {string} parameters.serverAppID The server AAD application ID. + * + * @param {string} [parameters.serverAppSecret] The server AAD application + * secret. + * + * @param {string} [parameters.tenantID] The AAD tenant ID to use for + * authentication. If not specified, will use the tenant of the deployment + * subscription. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3215,15 +3990,15 @@ class ManagedClusters { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName, resourceName, options) { + resetAADProfileWithHttpOperationResponse(resourceGroupName, resourceName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, resourceName, options, (err, result, request, response) => { + self._resetAADProfile(resourceGroupName, resourceName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -3234,14 +4009,28 @@ class ManagedClusters { } /** - * @summary Deletes a managed cluster. + * @summary Reset AAD Profile of a managed cluster. * - * Deletes the managed cluster with a specified resource group and name. + * Update the AAD Profile for a managed cluster. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the managed cluster resource. * + * @param {object} parameters Parameters supplied to the Reset AAD Profile + * operation for a Managed Cluster. + * + * @param {string} parameters.clientAppID The client AAD application ID. + * + * @param {string} parameters.serverAppID The server AAD application ID. + * + * @param {string} [parameters.serverAppSecret] The server AAD application + * secret. + * + * @param {string} [parameters.tenantID] The AAD tenant ID to use for + * authentication. If not specified, will use the tenant of the deployment + * subscription. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3254,7 +4043,7 @@ class ManagedClusters { * * {Promise} A promise is returned * - * @resolve {null} - The deserialized result object. + * @resolve {ManagedCluster} - The deserialized result object. * * @reject {Error} - The error object. * @@ -3262,13 +4051,14 @@ class ManagedClusters { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedCluster} 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, resourceName, options, optionalCallback) { + resetAADProfile(resourceGroupName, resourceName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3277,14 +4067,14 @@ class ManagedClusters { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, resourceName, options, (err, result, request, response) => { + self._resetAADProfile(resourceGroupName, resourceName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._deleteMethod(resourceGroupName, resourceName, options, optionalCallback); + return self._resetAADProfile(resourceGroupName, resourceName, parameters, options, optionalCallback); } } @@ -3739,6 +4529,230 @@ class ManagedClusters { } } + /** + * @summary Reset Service Principal Profile of a managed cluster. + * + * Update the service principal Profile for a managed cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Reset Service + * Principal Profile operation for a Managed Cluster. + * + * @param {string} parameters.clientId The ID for the service principal. + * + * @param {string} [parameters.secret] The secret password associated with the + * service principal in plain text. + * + * @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. + */ + beginResetServicePrincipalProfileWithHttpOperationResponse(resourceGroupName, resourceName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginResetServicePrincipalProfile(resourceGroupName, resourceName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Reset Service Principal Profile of a managed cluster. + * + * Update the service principal Profile for a managed cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Reset Service + * Principal Profile operation for a Managed Cluster. + * + * @param {string} parameters.clientId The ID for the service principal. + * + * @param {string} [parameters.secret] The secret password associated with the + * service principal in plain text. + * + * @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 {ManagedCluster} - 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 ManagedCluster} 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. + */ + beginResetServicePrincipalProfile(resourceGroupName, resourceName, parameters, 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._beginResetServicePrincipalProfile(resourceGroupName, resourceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginResetServicePrincipalProfile(resourceGroupName, resourceName, parameters, options, optionalCallback); + } + } + + /** + * @summary Reset AAD Profile of a managed cluster. + * + * Update the AAD Profile for a managed cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Reset AAD Profile + * operation for a Managed Cluster. + * + * @param {string} parameters.clientAppID The client AAD application ID. + * + * @param {string} parameters.serverAppID The server AAD application ID. + * + * @param {string} [parameters.serverAppSecret] The server AAD application + * secret. + * + * @param {string} [parameters.tenantID] The AAD tenant ID to use for + * authentication. If not specified, will use the tenant of the deployment + * subscription. + * + * @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. + */ + beginResetAADProfileWithHttpOperationResponse(resourceGroupName, resourceName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginResetAADProfile(resourceGroupName, resourceName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Reset AAD Profile of a managed cluster. + * + * Update the AAD Profile for a managed cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the managed cluster resource. + * + * @param {object} parameters Parameters supplied to the Reset AAD Profile + * operation for a Managed Cluster. + * + * @param {string} parameters.clientAppID The client AAD application ID. + * + * @param {string} parameters.serverAppID The server AAD application ID. + * + * @param {string} [parameters.serverAppSecret] The server AAD application + * secret. + * + * @param {string} [parameters.tenantID] The AAD tenant ID to use for + * authentication. If not specified, will use the tenant of the deployment + * subscription. + * + * @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 {ManagedCluster} - 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 ManagedCluster} 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. + */ + beginResetAADProfile(resourceGroupName, resourceName, parameters, 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._beginResetAADProfile(resourceGroupName, resourceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginResetAADProfile(resourceGroupName, resourceName, parameters, options, optionalCallback); + } + } + /** * @summary Gets a list of managed clusters in the specified subscription. *