/*
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 * Changes may cause incorrect behavior and will be lost if the code is
 * regenerated.
 */

'use strict';

const msRest = require('ms-rest');
const msRestAzure = require('ms-rest-azure');
const WebResource = msRest.WebResource;


/**
 * Create or update an operationalization cluster.
 *
 * @param {string} resourceGroupName Name of the resource group in which the
 * cluster is located.
 *
 * @param {string} clusterName The name of the cluster.
 *
 * @param {object} parameters Parameters supplied to create or update an
 * Operationalization cluster.
 *
 * @param {string} [parameters.description] The description of the cluster.
 *
 * @param {string} parameters.clusterType The cluster type. Possible values
 * include: 'ACS', 'Local'
 *
 * @param {object} [parameters.storageAccount] Storage Account properties.
 *
 * @param {string} [parameters.storageAccount.resourceId] ARM resource ID of
 * the Azure Storage Account to store CLI specific files. If not provided one
 * will be created. This cannot be changed once the cluster is created.
 *
 * @param {object} [parameters.containerRegistry] Container Registry
 * properties.
 *
 * @param {string} [parameters.containerRegistry.resourceId] ARM resource ID of
 * the Azure Container Registry used to store Docker images for web services in
 * the cluster. If not provided one will be created. This cannot be changed
 * once the cluster is created.
 *
 * @param {object} [parameters.containerService] Parameters for the Azure
 * Container Service cluster.
 *
 * @param {string} parameters.containerService.orchestratorType Type of
 * orchestrator. It cannot be changed once the cluster is created. Possible
 * values include: 'Kubernetes', 'None'
 *
 * @param {object} parameters.containerService.orchestratorProperties
 * Orchestrator specific properties
 *
 * @param {object}
 * parameters.containerService.orchestratorProperties.servicePrincipal The
 * Azure Service Principal used by Kubernetes
 *
 * @param {string}
 * parameters.containerService.orchestratorProperties.servicePrincipal.clientId
 * The service principal client ID
 *
 * @param {string}
 * parameters.containerService.orchestratorProperties.servicePrincipal.secret
 * The service principal secret. This is not returned in response of GET/PUT on
 * the resource. To see this please call listKeys.
 *
 * @param {array} [parameters.containerService.systemServices] The system
 * services deployed to the cluster
 *
 * @param {number} [parameters.containerService.masterCount] The number of
 * master nodes in the container service.
 *
 * @param {number} [parameters.containerService.agentCount] The number of agent
 * nodes in the Container Service. This can be changed to scale the cluster.
 *
 * @param {string} [parameters.containerService.agentVmSize] The Azure VM size
 * of the agent VM nodes. This cannot be changed once the cluster is created.
 * This list is non exhaustive; refer to
 * https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes for
 * the possible VM sizes. Possible values include: 'Standard_A0',
 * 'Standard_A1', 'Standard_A2', 'Standard_A3', 'Standard_A4', 'Standard_A5',
 * 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A9', 'Standard_A10',
 * 'Standard_A11', 'Standard_D1', 'Standard_D2', 'Standard_D3', 'Standard_D4',
 * 'Standard_D11', 'Standard_D12', 'Standard_D13', 'Standard_D14',
 * 'Standard_D1_v2', 'Standard_D2_v2', 'Standard_D3_v2', 'Standard_D4_v2',
 * 'Standard_D5_v2', 'Standard_D11_v2', 'Standard_D12_v2', 'Standard_D13_v2',
 * 'Standard_D14_v2', 'Standard_G1', 'Standard_G2', 'Standard_G3',
 * 'Standard_G4', 'Standard_G5', 'Standard_DS1', 'Standard_DS2',
 * 'Standard_DS3', 'Standard_DS4', 'Standard_DS11', 'Standard_DS12',
 * 'Standard_DS13', 'Standard_DS14', 'Standard_GS1', 'Standard_GS2',
 * 'Standard_GS3', 'Standard_GS4', 'Standard_GS5'
 *
 * @param {object} [parameters.appInsights] AppInsights configuration.
 *
 * @param {string} [parameters.appInsights.resourceId] ARM resource ID of the
 * App Insights.
 *
 * @param {object} [parameters.globalServiceConfiguration] Contains global
 * configuration for the web services in the cluster.
 *
 * @param {object} [parameters.globalServiceConfiguration.additionalProperties]
 * Unmatched properties from the message are deserialized this collection
 *
 * @param {string} [parameters.globalServiceConfiguration.etag] The
 * configuartion ETag for updates.
 *
 * @param {object} [parameters.globalServiceConfiguration.ssl] The SSL
 * configuration properties
 *
 * @param {string} [parameters.globalServiceConfiguration.ssl.status] SSL
 * status. Allowed values are Enabled and Disabled. Possible values include:
 * 'Enabled', 'Disabled'
 *
 * @param {string} [parameters.globalServiceConfiguration.ssl.cert] The SSL
 * cert data in PEM format encoded as base64 string
 *
 * @param {string} [parameters.globalServiceConfiguration.ssl.key] The SSL key
 * data in PEM format encoded as base64 string. This is not returned in
 * response of GET/PUT on the resource. To see this please call listKeys API.
 *
 * @param {string} [parameters.globalServiceConfiguration.ssl.cname] The CName
 * of the certificate.
 *
 * @param {object} [parameters.globalServiceConfiguration.serviceAuth] Optional
 * global authorization keys for all user services deployed in cluster. These
 * are used if the service does not have auth keys.
 *
 * @param {string}
 * parameters.globalServiceConfiguration.serviceAuth.primaryAuthKeyHash The
 * primary auth key hash. This is not returned in response of GET/PUT on the
 * resource.. To see this please call listKeys API.
 *
 * @param {string}
 * parameters.globalServiceConfiguration.serviceAuth.secondaryAuthKeyHash The
 * secondary auth key hash. This is not returned in response of GET/PUT on the
 * resource.. To see this please call listKeys API.
 *
 * @param {object} [parameters.globalServiceConfiguration.autoScale] The
 * auto-scale configuration
 *
 * @param {string} [parameters.globalServiceConfiguration.autoScale.status] If
 * auto-scale is enabled for all services. Each service can turn it off
 * individually. Possible values include: 'Enabled', 'Disabled'
 *
 * @param {number}
 * [parameters.globalServiceConfiguration.autoScale.minReplicas] The minimum
 * number of replicas for each service.
 *
 * @param {number}
 * [parameters.globalServiceConfiguration.autoScale.maxReplicas] The maximum
 * number of replicas for each service.
 *
 * @param {number}
 * [parameters.globalServiceConfiguration.autoScale.targetUtilization] The
 * target utilization.
 *
 * @param {number}
 * [parameters.globalServiceConfiguration.autoScale.refreshPeriodInSeconds]
 * Refresh period in seconds.
 *
 * @param {string} parameters.location Specifies the location of the resource.
 *
 * @param {object} [parameters.tags] Contains resource tags defined as
 * key/value pairs.
 *
 * @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 OperationalizationCluster} for more
 *                      information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _createOrUpdate(resourceGroupName, clusterName, 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.beginCreateOrUpdate(resourceGroupName, clusterName, 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['OperationalizationCluster']().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);
    });
  });
}

/**
 * Gets the operationalization cluster resource view. Note that the credentials
 * are not returned by this call. Call ListKeys to get them.
 *
 * @param {string} resourceGroupName Name of the resource group in which the
 * cluster is located.
 *
 * @param {string} clusterName The name of the cluster.
 *
 * @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 OperationalizationCluster} for more
 *                      information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _get(resourceGroupName, clusterName, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
      throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.');
    }
    if (this.client.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 (resourceGroupName !== null && resourceGroupName !== undefined) {
      if (resourceGroupName.length > 90)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90');
      }
      if (resourceGroupName.length < 1)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1');
      }
      if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/');
      }
    }
    if (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') {
      throw new Error('clusterName cannot be null or undefined and it must be of type string.');
    }
    if (clusterName !== null && clusterName !== undefined) {
      if (clusterName.length > 90)
      {
        throw new Error('"clusterName" should satisfy the constraint - "MaxLength": 90');
      }
      if (clusterName.length < 1)
      {
        throw new Error('"clusterName" should satisfy the constraint - "MinLength": 1');
      }
      if (clusterName.match(/^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$/) === null)
      {
        throw new Error('"clusterName" should satisfy the constraint - "Pattern": /^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$/');
      }
    }
    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.MachineLearningCompute/operationalizationClusters/{clusterName}';
  requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
  requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
  requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName));
  let queryParameters = [];
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if (this.client.generateClientRequestId) {
      httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponseWrapper']().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['OperationalizationCluster']().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);
  });
}

/**
 * The PATCH operation can be used to update only the tags for a cluster. Use
 * PUT operation to update other properties.
 *
 * @param {string} resourceGroupName Name of the resource group in which the
 * cluster is located.
 *
 * @param {string} clusterName The name of the cluster.
 *
 * @param {object} parameters The parameters supplied to patch the cluster.
 *
 * @param {object} [parameters.tags] Gets or sets a list of key value pairs
 * that describe the resource. These tags can be used in viewing and grouping
 * this resource (across resource groups). A maximum of 15 tags can be provided
 * for a resource. Each tag must have a key no greater in length than 128
 * characters and a value no greater in length than 256 characters.
 *
 * @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 OperationalizationCluster} for more
 *                      information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _update(resourceGroupName, clusterName, 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.');
  }
  // Validate
  try {
    if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
      throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.');
    }
    if (this.client.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 (resourceGroupName !== null && resourceGroupName !== undefined) {
      if (resourceGroupName.length > 90)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90');
      }
      if (resourceGroupName.length < 1)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1');
      }
      if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/');
      }
    }
    if (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') {
      throw new Error('clusterName cannot be null or undefined and it must be of type string.');
    }
    if (clusterName !== null && clusterName !== undefined) {
      if (clusterName.length > 90)
      {
        throw new Error('"clusterName" should satisfy the constraint - "MaxLength": 90');
      }
      if (clusterName.length < 1)
      {
        throw new Error('"clusterName" should satisfy the constraint - "MinLength": 1');
      }
      if (clusterName.match(/^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$/) === null)
      {
        throw new Error('"clusterName" should satisfy the constraint - "Pattern": /^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$/');
      }
    }
    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.MachineLearningCompute/operationalizationClusters/{clusterName}';
  requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
  requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
  requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName));
  let queryParameters = [];
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PATCH';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if (this.client.generateClientRequestId) {
      httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (parameters !== null && parameters !== undefined) {
      let requestModelMapper = new client.models['OperationalizationClusterUpdateParameters']().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) {
      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) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponseWrapper']().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['OperationalizationCluster']().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);
  });
}


/**
 * Deletes the specified cluster.
 *
 * @param {string} resourceGroupName Name of the resource group in which the
 * cluster is located.
 *
 * @param {string} clusterName The name of the cluster.
 *
 * @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.
 *
 *                      {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.
 */
function _deleteMethod(resourceGroupName, clusterName, 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.beginDeleteMethod(resourceGroupName, clusterName, 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

      return callback(null, result, httpRequest, response);
    });
  });
}

/**
 * Gets the credentials for the specified cluster such as Storage, ACR and ACS
 * credentials. This is a long running operation because it fetches keys from
 * dependencies.
 *
 * @param {string} resourceGroupName Name of the resource group in which the
 * cluster is located.
 *
 * @param {string} clusterName The name of the cluster.
 *
 * @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 OperationalizationClusterCredentials} 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 _listKeys(resourceGroupName, clusterName, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
      throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.');
    }
    if (this.client.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 (resourceGroupName !== null && resourceGroupName !== undefined) {
      if (resourceGroupName.length > 90)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90');
      }
      if (resourceGroupName.length < 1)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1');
      }
      if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/');
      }
    }
    if (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') {
      throw new Error('clusterName cannot be null or undefined and it must be of type string.');
    }
    if (clusterName !== null && clusterName !== undefined) {
      if (clusterName.length > 90)
      {
        throw new Error('"clusterName" should satisfy the constraint - "MaxLength": 90');
      }
      if (clusterName.length < 1)
      {
        throw new Error('"clusterName" should satisfy the constraint - "MinLength": 1');
      }
      if (clusterName.match(/^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$/) === null)
      {
        throw new Error('"clusterName" should satisfy the constraint - "Pattern": /^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$/');
      }
    }
    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.MachineLearningCompute/operationalizationClusters/{clusterName}/listKeys';
  requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
  requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
  requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName));
  let queryParameters = [];
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if (this.client.generateClientRequestId) {
      httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  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['OperationalizationClusterCredentials']().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);
  });
}

/**
 * Checks if updates are available for system services in the cluster.
 *
 * @param {string} resourceGroupName Name of the resource group in which the
 * cluster is located.
 *
 * @param {string} clusterName The name of the cluster.
 *
 * @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 CheckSystemServicesUpdatesAvailableResponse}
 *                      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 _checkSystemServicesUpdatesAvailable(resourceGroupName, clusterName, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
      throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.');
    }
    if (this.client.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 (resourceGroupName !== null && resourceGroupName !== undefined) {
      if (resourceGroupName.length > 90)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90');
      }
      if (resourceGroupName.length < 1)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1');
      }
      if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/');
      }
    }
    if (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') {
      throw new Error('clusterName cannot be null or undefined and it must be of type string.');
    }
    if (clusterName !== null && clusterName !== undefined) {
      if (clusterName.length > 90)
      {
        throw new Error('"clusterName" should satisfy the constraint - "MaxLength": 90');
      }
      if (clusterName.length < 1)
      {
        throw new Error('"clusterName" should satisfy the constraint - "MinLength": 1');
      }
      if (clusterName.match(/^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$/) === null)
      {
        throw new Error('"clusterName" should satisfy the constraint - "Pattern": /^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$/');
      }
    }
    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.MachineLearningCompute/operationalizationClusters/{clusterName}/checkSystemServicesUpdatesAvailable';
  requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
  requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
  requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName));
  let queryParameters = [];
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if (this.client.generateClientRequestId) {
      httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  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['CheckSystemServicesUpdatesAvailableResponse']().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);
  });
}


/**
 * Updates system services in a cluster.
 *
 * @param {string} resourceGroupName Name of the resource group in which the
 * cluster is located.
 *
 * @param {string} clusterName The name of the cluster.
 *
 * @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 UpdateSystemServicesResponse} 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 _updateSystemServices(resourceGroupName, clusterName, 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.beginUpdateSystemServices(resourceGroupName, clusterName, 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['UpdateSystemServicesResponse']().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);
    });
  });
}

/**
 * Gets the clusters in the specified resource group.
 *
 * @param {string} resourceGroupName Name of the resource group in which the
 * cluster is located.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {string} [options.skiptoken] Continuation token for pagination.
 *
 * @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 PaginatedOperationalizationClustersList} for
 *                      more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _listByResourceGroup(resourceGroupName, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let skiptoken = (options && options.skiptoken !== undefined) ? options.skiptoken : undefined;
  // Validate
  try {
    if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
      throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.');
    }
    if (this.client.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 (resourceGroupName !== null && resourceGroupName !== undefined) {
      if (resourceGroupName.length > 90)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90');
      }
      if (resourceGroupName.length < 1)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1');
      }
      if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/');
      }
    }
    if (skiptoken !== null && skiptoken !== undefined && typeof skiptoken.valueOf() !== 'string') {
      throw new Error('skiptoken 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.MachineLearningCompute/operationalizationClusters';
  requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
  requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
  let queryParameters = [];
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (skiptoken !== null && skiptoken !== undefined) {
    queryParameters.push('$skiptoken=' + encodeURIComponent(skiptoken));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if (this.client.generateClientRequestId) {
      httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
          if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
          if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['CloudError']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['PaginatedOperationalizationClustersList']().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);
  });
}

/**
 * Gets the operationalization clusters in the specified subscription.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {string} [options.skiptoken] Continuation token for pagination.
 *
 * @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 PaginatedOperationalizationClustersList} 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 _listBySubscriptionId(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 skiptoken = (options && options.skiptoken !== undefined) ? options.skiptoken : undefined;
  // Validate
  try {
    if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
      throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.');
    }
    if (this.client.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 (skiptoken !== null && skiptoken !== undefined && typeof skiptoken.valueOf() !== 'string') {
      throw new Error('skiptoken must be of type string.');
    }
    if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') {
      throw new Error('this.client.acceptLanguage must be of type string.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningCompute/operationalizationClusters';
  requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
  let queryParameters = [];
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (skiptoken !== null && skiptoken !== undefined) {
    queryParameters.push('$skiptoken=' + encodeURIComponent(skiptoken));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if (this.client.generateClientRequestId) {
      httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
          if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
          if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['CloudError']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['PaginatedOperationalizationClustersList']().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);
  });
}

/**
 * Create or update an operationalization cluster.
 *
 * @param {string} resourceGroupName Name of the resource group in which the
 * cluster is located.
 *
 * @param {string} clusterName The name of the cluster.
 *
 * @param {object} parameters Parameters supplied to create or update an
 * Operationalization cluster.
 *
 * @param {string} [parameters.description] The description of the cluster.
 *
 * @param {string} parameters.clusterType The cluster type. Possible values
 * include: 'ACS', 'Local'
 *
 * @param {object} [parameters.storageAccount] Storage Account properties.
 *
 * @param {string} [parameters.storageAccount.resourceId] ARM resource ID of
 * the Azure Storage Account to store CLI specific files. If not provided one
 * will be created. This cannot be changed once the cluster is created.
 *
 * @param {object} [parameters.containerRegistry] Container Registry
 * properties.
 *
 * @param {string} [parameters.containerRegistry.resourceId] ARM resource ID of
 * the Azure Container Registry used to store Docker images for web services in
 * the cluster. If not provided one will be created. This cannot be changed
 * once the cluster is created.
 *
 * @param {object} [parameters.containerService] Parameters for the Azure
 * Container Service cluster.
 *
 * @param {string} parameters.containerService.orchestratorType Type of
 * orchestrator. It cannot be changed once the cluster is created. Possible
 * values include: 'Kubernetes', 'None'
 *
 * @param {object} parameters.containerService.orchestratorProperties
 * Orchestrator specific properties
 *
 * @param {object}
 * parameters.containerService.orchestratorProperties.servicePrincipal The
 * Azure Service Principal used by Kubernetes
 *
 * @param {string}
 * parameters.containerService.orchestratorProperties.servicePrincipal.clientId
 * The service principal client ID
 *
 * @param {string}
 * parameters.containerService.orchestratorProperties.servicePrincipal.secret
 * The service principal secret. This is not returned in response of GET/PUT on
 * the resource. To see this please call listKeys.
 *
 * @param {array} [parameters.containerService.systemServices] The system
 * services deployed to the cluster
 *
 * @param {number} [parameters.containerService.masterCount] The number of
 * master nodes in the container service.
 *
 * @param {number} [parameters.containerService.agentCount] The number of agent
 * nodes in the Container Service. This can be changed to scale the cluster.
 *
 * @param {string} [parameters.containerService.agentVmSize] The Azure VM size
 * of the agent VM nodes. This cannot be changed once the cluster is created.
 * This list is non exhaustive; refer to
 * https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes for
 * the possible VM sizes. Possible values include: 'Standard_A0',
 * 'Standard_A1', 'Standard_A2', 'Standard_A3', 'Standard_A4', 'Standard_A5',
 * 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A9', 'Standard_A10',
 * 'Standard_A11', 'Standard_D1', 'Standard_D2', 'Standard_D3', 'Standard_D4',
 * 'Standard_D11', 'Standard_D12', 'Standard_D13', 'Standard_D14',
 * 'Standard_D1_v2', 'Standard_D2_v2', 'Standard_D3_v2', 'Standard_D4_v2',
 * 'Standard_D5_v2', 'Standard_D11_v2', 'Standard_D12_v2', 'Standard_D13_v2',
 * 'Standard_D14_v2', 'Standard_G1', 'Standard_G2', 'Standard_G3',
 * 'Standard_G4', 'Standard_G5', 'Standard_DS1', 'Standard_DS2',
 * 'Standard_DS3', 'Standard_DS4', 'Standard_DS11', 'Standard_DS12',
 * 'Standard_DS13', 'Standard_DS14', 'Standard_GS1', 'Standard_GS2',
 * 'Standard_GS3', 'Standard_GS4', 'Standard_GS5'
 *
 * @param {object} [parameters.appInsights] AppInsights configuration.
 *
 * @param {string} [parameters.appInsights.resourceId] ARM resource ID of the
 * App Insights.
 *
 * @param {object} [parameters.globalServiceConfiguration] Contains global
 * configuration for the web services in the cluster.
 *
 * @param {object} [parameters.globalServiceConfiguration.additionalProperties]
 * Unmatched properties from the message are deserialized this collection
 *
 * @param {string} [parameters.globalServiceConfiguration.etag] The
 * configuartion ETag for updates.
 *
 * @param {object} [parameters.globalServiceConfiguration.ssl] The SSL
 * configuration properties
 *
 * @param {string} [parameters.globalServiceConfiguration.ssl.status] SSL
 * status. Allowed values are Enabled and Disabled. Possible values include:
 * 'Enabled', 'Disabled'
 *
 * @param {string} [parameters.globalServiceConfiguration.ssl.cert] The SSL
 * cert data in PEM format encoded as base64 string
 *
 * @param {string} [parameters.globalServiceConfiguration.ssl.key] The SSL key
 * data in PEM format encoded as base64 string. This is not returned in
 * response of GET/PUT on the resource. To see this please call listKeys API.
 *
 * @param {string} [parameters.globalServiceConfiguration.ssl.cname] The CName
 * of the certificate.
 *
 * @param {object} [parameters.globalServiceConfiguration.serviceAuth] Optional
 * global authorization keys for all user services deployed in cluster. These
 * are used if the service does not have auth keys.
 *
 * @param {string}
 * parameters.globalServiceConfiguration.serviceAuth.primaryAuthKeyHash The
 * primary auth key hash. This is not returned in response of GET/PUT on the
 * resource.. To see this please call listKeys API.
 *
 * @param {string}
 * parameters.globalServiceConfiguration.serviceAuth.secondaryAuthKeyHash The
 * secondary auth key hash. This is not returned in response of GET/PUT on the
 * resource.. To see this please call listKeys API.
 *
 * @param {object} [parameters.globalServiceConfiguration.autoScale] The
 * auto-scale configuration
 *
 * @param {string} [parameters.globalServiceConfiguration.autoScale.status] If
 * auto-scale is enabled for all services. Each service can turn it off
 * individually. Possible values include: 'Enabled', 'Disabled'
 *
 * @param {number}
 * [parameters.globalServiceConfiguration.autoScale.minReplicas] The minimum
 * number of replicas for each service.
 *
 * @param {number}
 * [parameters.globalServiceConfiguration.autoScale.maxReplicas] The maximum
 * number of replicas for each service.
 *
 * @param {number}
 * [parameters.globalServiceConfiguration.autoScale.targetUtilization] The
 * target utilization.
 *
 * @param {number}
 * [parameters.globalServiceConfiguration.autoScale.refreshPeriodInSeconds]
 * Refresh period in seconds.
 *
 * @param {string} parameters.location Specifies the location of the resource.
 *
 * @param {object} [parameters.tags] Contains resource tags defined as
 * key/value pairs.
 *
 * @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 OperationalizationCluster} for more
 *                      information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _beginCreateOrUpdate(resourceGroupName, clusterName, 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.');
  }
  // Validate
  try {
    if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
      throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.');
    }
    if (this.client.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 (resourceGroupName !== null && resourceGroupName !== undefined) {
      if (resourceGroupName.length > 90)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90');
      }
      if (resourceGroupName.length < 1)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1');
      }
      if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/');
      }
    }
    if (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') {
      throw new Error('clusterName cannot be null or undefined and it must be of type string.');
    }
    if (clusterName !== null && clusterName !== undefined) {
      if (clusterName.length > 90)
      {
        throw new Error('"clusterName" should satisfy the constraint - "MaxLength": 90');
      }
      if (clusterName.length < 1)
      {
        throw new Error('"clusterName" should satisfy the constraint - "MinLength": 1');
      }
      if (clusterName.match(/^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$/) === null)
      {
        throw new Error('"clusterName" should satisfy the constraint - "Pattern": /^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$/');
      }
    }
    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.MachineLearningCompute/operationalizationClusters/{clusterName}';
  requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
  requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
  requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName));
  let queryParameters = [];
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if (this.client.generateClientRequestId) {
      httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (parameters !== null && parameters !== undefined) {
      let requestModelMapper = new client.models['OperationalizationCluster']().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 !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponseWrapper']().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['OperationalizationCluster']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationalizationCluster']().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);
  });
}

/**
 * Deletes the specified cluster.
 *
 * @param {string} resourceGroupName Name of the resource group in which the
 * cluster is located.
 *
 * @param {string} clusterName The name of the cluster.
 *
 * @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.
 *
 *                      {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.
 */
function _beginDeleteMethod(resourceGroupName, clusterName, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
      throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.');
    }
    if (this.client.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 (resourceGroupName !== null && resourceGroupName !== undefined) {
      if (resourceGroupName.length > 90)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90');
      }
      if (resourceGroupName.length < 1)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1');
      }
      if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/');
      }
    }
    if (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') {
      throw new Error('clusterName cannot be null or undefined and it must be of type string.');
    }
    if (clusterName !== null && clusterName !== undefined) {
      if (clusterName.length > 90)
      {
        throw new Error('"clusterName" should satisfy the constraint - "MaxLength": 90');
      }
      if (clusterName.length < 1)
      {
        throw new Error('"clusterName" should satisfy the constraint - "MinLength": 1');
      }
      if (clusterName.match(/^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$/) === null)
      {
        throw new Error('"clusterName" should satisfy the constraint - "Pattern": /^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$/');
      }
    }
    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.MachineLearningCompute/operationalizationClusters/{clusterName}';
  requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
  requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
  requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName));
  let queryParameters = [];
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if (this.client.generateClientRequestId) {
      httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 202 && statusCode !== 204) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponseWrapper']().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;

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Updates system services in a cluster.
 *
 * @param {string} resourceGroupName Name of the resource group in which the
 * cluster is located.
 *
 * @param {string} clusterName The name of the cluster.
 *
 * @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 UpdateSystemServicesResponse} 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 _beginUpdateSystemServices(resourceGroupName, clusterName, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
      throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.');
    }
    if (this.client.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 (resourceGroupName !== null && resourceGroupName !== undefined) {
      if (resourceGroupName.length > 90)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90');
      }
      if (resourceGroupName.length < 1)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1');
      }
      if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/');
      }
    }
    if (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') {
      throw new Error('clusterName cannot be null or undefined and it must be of type string.');
    }
    if (clusterName !== null && clusterName !== undefined) {
      if (clusterName.length > 90)
      {
        throw new Error('"clusterName" should satisfy the constraint - "MaxLength": 90');
      }
      if (clusterName.length < 1)
      {
        throw new Error('"clusterName" should satisfy the constraint - "MinLength": 1');
      }
      if (clusterName.match(/^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$/) === null)
      {
        throw new Error('"clusterName" should satisfy the constraint - "Pattern": /^[a-zA-Z][-\w\._\(\)]+[a-zA-Z0-9]$/');
      }
    }
    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.MachineLearningCompute/operationalizationClusters/{clusterName}/updateSystemServices';
  requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
  requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
  requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName));
  let queryParameters = [];
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if (this.client.generateClientRequestId) {
      httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200 && statusCode !== 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['UpdateSystemServicesResponse']().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);
  });
}

/**
 * Gets the clusters in the specified resource group.
 *
 * @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 PaginatedOperationalizationClustersList} for
 *                      more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _listByResourceGroupNext(nextPageLink, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') {
      throw new Error('nextPageLink cannot be null or undefined and it must be of type string.');
    }
    if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') {
      throw new Error('this.client.acceptLanguage must be of type string.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let requestUrl = '{nextLink}';
  requestUrl = requestUrl.replace('{nextLink}', nextPageLink);

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if (this.client.generateClientRequestId) {
      httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
          if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
          if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['CloudError']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['PaginatedOperationalizationClustersList']().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);
  });
}

/**
 * Gets the operationalization clusters in the specified subscription.
 *
 * @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 PaginatedOperationalizationClustersList} 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 _listBySubscriptionIdNext(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['PaginatedOperationalizationClustersList']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/** Class representing a OperationalizationClusters. */
class OperationalizationClusters {
  /**
   * Create a OperationalizationClusters.
   * @param {MachineLearningComputeManagementClient} client Reference to the service client.
   */
  constructor(client) {
    this.client = client;
    this._createOrUpdate = _createOrUpdate;
    this._get = _get;
    this._update = _update;
    this._deleteMethod = _deleteMethod;
    this._listKeys = _listKeys;
    this._checkSystemServicesUpdatesAvailable = _checkSystemServicesUpdatesAvailable;
    this._updateSystemServices = _updateSystemServices;
    this._listByResourceGroup = _listByResourceGroup;
    this._listBySubscriptionId = _listBySubscriptionId;
    this._beginCreateOrUpdate = _beginCreateOrUpdate;
    this._beginDeleteMethod = _beginDeleteMethod;
    this._beginUpdateSystemServices = _beginUpdateSystemServices;
    this._listByResourceGroupNext = _listByResourceGroupNext;
    this._listBySubscriptionIdNext = _listBySubscriptionIdNext;
  }

  /**
   * Create or update an operationalization cluster.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @param {object} parameters Parameters supplied to create or update an
   * Operationalization cluster.
   *
   * @param {string} [parameters.description] The description of the cluster.
   *
   * @param {string} parameters.clusterType The cluster type. Possible values
   * include: 'ACS', 'Local'
   *
   * @param {object} [parameters.storageAccount] Storage Account properties.
   *
   * @param {string} [parameters.storageAccount.resourceId] ARM resource ID of
   * the Azure Storage Account to store CLI specific files. If not provided one
   * will be created. This cannot be changed once the cluster is created.
   *
   * @param {object} [parameters.containerRegistry] Container Registry
   * properties.
   *
   * @param {string} [parameters.containerRegistry.resourceId] ARM resource ID of
   * the Azure Container Registry used to store Docker images for web services in
   * the cluster. If not provided one will be created. This cannot be changed
   * once the cluster is created.
   *
   * @param {object} [parameters.containerService] Parameters for the Azure
   * Container Service cluster.
   *
   * @param {string} parameters.containerService.orchestratorType Type of
   * orchestrator. It cannot be changed once the cluster is created. Possible
   * values include: 'Kubernetes', 'None'
   *
   * @param {object} parameters.containerService.orchestratorProperties
   * Orchestrator specific properties
   *
   * @param {object}
   * parameters.containerService.orchestratorProperties.servicePrincipal The
   * Azure Service Principal used by Kubernetes
   *
   * @param {string}
   * parameters.containerService.orchestratorProperties.servicePrincipal.clientId
   * The service principal client ID
   *
   * @param {string}
   * parameters.containerService.orchestratorProperties.servicePrincipal.secret
   * The service principal secret. This is not returned in response of GET/PUT on
   * the resource. To see this please call listKeys.
   *
   * @param {array} [parameters.containerService.systemServices] The system
   * services deployed to the cluster
   *
   * @param {number} [parameters.containerService.masterCount] The number of
   * master nodes in the container service.
   *
   * @param {number} [parameters.containerService.agentCount] The number of agent
   * nodes in the Container Service. This can be changed to scale the cluster.
   *
   * @param {string} [parameters.containerService.agentVmSize] The Azure VM size
   * of the agent VM nodes. This cannot be changed once the cluster is created.
   * This list is non exhaustive; refer to
   * https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes for
   * the possible VM sizes. Possible values include: 'Standard_A0',
   * 'Standard_A1', 'Standard_A2', 'Standard_A3', 'Standard_A4', 'Standard_A5',
   * 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A9', 'Standard_A10',
   * 'Standard_A11', 'Standard_D1', 'Standard_D2', 'Standard_D3', 'Standard_D4',
   * 'Standard_D11', 'Standard_D12', 'Standard_D13', 'Standard_D14',
   * 'Standard_D1_v2', 'Standard_D2_v2', 'Standard_D3_v2', 'Standard_D4_v2',
   * 'Standard_D5_v2', 'Standard_D11_v2', 'Standard_D12_v2', 'Standard_D13_v2',
   * 'Standard_D14_v2', 'Standard_G1', 'Standard_G2', 'Standard_G3',
   * 'Standard_G4', 'Standard_G5', 'Standard_DS1', 'Standard_DS2',
   * 'Standard_DS3', 'Standard_DS4', 'Standard_DS11', 'Standard_DS12',
   * 'Standard_DS13', 'Standard_DS14', 'Standard_GS1', 'Standard_GS2',
   * 'Standard_GS3', 'Standard_GS4', 'Standard_GS5'
   *
   * @param {object} [parameters.appInsights] AppInsights configuration.
   *
   * @param {string} [parameters.appInsights.resourceId] ARM resource ID of the
   * App Insights.
   *
   * @param {object} [parameters.globalServiceConfiguration] Contains global
   * configuration for the web services in the cluster.
   *
   * @param {object} [parameters.globalServiceConfiguration.additionalProperties]
   * Unmatched properties from the message are deserialized this collection
   *
   * @param {string} [parameters.globalServiceConfiguration.etag] The
   * configuartion ETag for updates.
   *
   * @param {object} [parameters.globalServiceConfiguration.ssl] The SSL
   * configuration properties
   *
   * @param {string} [parameters.globalServiceConfiguration.ssl.status] SSL
   * status. Allowed values are Enabled and Disabled. Possible values include:
   * 'Enabled', 'Disabled'
   *
   * @param {string} [parameters.globalServiceConfiguration.ssl.cert] The SSL
   * cert data in PEM format encoded as base64 string
   *
   * @param {string} [parameters.globalServiceConfiguration.ssl.key] The SSL key
   * data in PEM format encoded as base64 string. This is not returned in
   * response of GET/PUT on the resource. To see this please call listKeys API.
   *
   * @param {string} [parameters.globalServiceConfiguration.ssl.cname] The CName
   * of the certificate.
   *
   * @param {object} [parameters.globalServiceConfiguration.serviceAuth] Optional
   * global authorization keys for all user services deployed in cluster. These
   * are used if the service does not have auth keys.
   *
   * @param {string}
   * parameters.globalServiceConfiguration.serviceAuth.primaryAuthKeyHash The
   * primary auth key hash. This is not returned in response of GET/PUT on the
   * resource.. To see this please call listKeys API.
   *
   * @param {string}
   * parameters.globalServiceConfiguration.serviceAuth.secondaryAuthKeyHash The
   * secondary auth key hash. This is not returned in response of GET/PUT on the
   * resource.. To see this please call listKeys API.
   *
   * @param {object} [parameters.globalServiceConfiguration.autoScale] The
   * auto-scale configuration
   *
   * @param {string} [parameters.globalServiceConfiguration.autoScale.status] If
   * auto-scale is enabled for all services. Each service can turn it off
   * individually. Possible values include: 'Enabled', 'Disabled'
   *
   * @param {number}
   * [parameters.globalServiceConfiguration.autoScale.minReplicas] The minimum
   * number of replicas for each service.
   *
   * @param {number}
   * [parameters.globalServiceConfiguration.autoScale.maxReplicas] The maximum
   * number of replicas for each service.
   *
   * @param {number}
   * [parameters.globalServiceConfiguration.autoScale.targetUtilization] The
   * target utilization.
   *
   * @param {number}
   * [parameters.globalServiceConfiguration.autoScale.refreshPeriodInSeconds]
   * Refresh period in seconds.
   *
   * @param {string} parameters.location Specifies the location of the resource.
   *
   * @param {object} [parameters.tags] Contains resource tags defined as
   * key/value pairs.
   *
   * @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<OperationalizationCluster>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  createOrUpdateWithHttpOperationResponse(resourceGroupName, clusterName, parameters, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._createOrUpdate(resourceGroupName, clusterName, parameters, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Create or update an operationalization cluster.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @param {object} parameters Parameters supplied to create or update an
   * Operationalization cluster.
   *
   * @param {string} [parameters.description] The description of the cluster.
   *
   * @param {string} parameters.clusterType The cluster type. Possible values
   * include: 'ACS', 'Local'
   *
   * @param {object} [parameters.storageAccount] Storage Account properties.
   *
   * @param {string} [parameters.storageAccount.resourceId] ARM resource ID of
   * the Azure Storage Account to store CLI specific files. If not provided one
   * will be created. This cannot be changed once the cluster is created.
   *
   * @param {object} [parameters.containerRegistry] Container Registry
   * properties.
   *
   * @param {string} [parameters.containerRegistry.resourceId] ARM resource ID of
   * the Azure Container Registry used to store Docker images for web services in
   * the cluster. If not provided one will be created. This cannot be changed
   * once the cluster is created.
   *
   * @param {object} [parameters.containerService] Parameters for the Azure
   * Container Service cluster.
   *
   * @param {string} parameters.containerService.orchestratorType Type of
   * orchestrator. It cannot be changed once the cluster is created. Possible
   * values include: 'Kubernetes', 'None'
   *
   * @param {object} parameters.containerService.orchestratorProperties
   * Orchestrator specific properties
   *
   * @param {object}
   * parameters.containerService.orchestratorProperties.servicePrincipal The
   * Azure Service Principal used by Kubernetes
   *
   * @param {string}
   * parameters.containerService.orchestratorProperties.servicePrincipal.clientId
   * The service principal client ID
   *
   * @param {string}
   * parameters.containerService.orchestratorProperties.servicePrincipal.secret
   * The service principal secret. This is not returned in response of GET/PUT on
   * the resource. To see this please call listKeys.
   *
   * @param {array} [parameters.containerService.systemServices] The system
   * services deployed to the cluster
   *
   * @param {number} [parameters.containerService.masterCount] The number of
   * master nodes in the container service.
   *
   * @param {number} [parameters.containerService.agentCount] The number of agent
   * nodes in the Container Service. This can be changed to scale the cluster.
   *
   * @param {string} [parameters.containerService.agentVmSize] The Azure VM size
   * of the agent VM nodes. This cannot be changed once the cluster is created.
   * This list is non exhaustive; refer to
   * https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes for
   * the possible VM sizes. Possible values include: 'Standard_A0',
   * 'Standard_A1', 'Standard_A2', 'Standard_A3', 'Standard_A4', 'Standard_A5',
   * 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A9', 'Standard_A10',
   * 'Standard_A11', 'Standard_D1', 'Standard_D2', 'Standard_D3', 'Standard_D4',
   * 'Standard_D11', 'Standard_D12', 'Standard_D13', 'Standard_D14',
   * 'Standard_D1_v2', 'Standard_D2_v2', 'Standard_D3_v2', 'Standard_D4_v2',
   * 'Standard_D5_v2', 'Standard_D11_v2', 'Standard_D12_v2', 'Standard_D13_v2',
   * 'Standard_D14_v2', 'Standard_G1', 'Standard_G2', 'Standard_G3',
   * 'Standard_G4', 'Standard_G5', 'Standard_DS1', 'Standard_DS2',
   * 'Standard_DS3', 'Standard_DS4', 'Standard_DS11', 'Standard_DS12',
   * 'Standard_DS13', 'Standard_DS14', 'Standard_GS1', 'Standard_GS2',
   * 'Standard_GS3', 'Standard_GS4', 'Standard_GS5'
   *
   * @param {object} [parameters.appInsights] AppInsights configuration.
   *
   * @param {string} [parameters.appInsights.resourceId] ARM resource ID of the
   * App Insights.
   *
   * @param {object} [parameters.globalServiceConfiguration] Contains global
   * configuration for the web services in the cluster.
   *
   * @param {object} [parameters.globalServiceConfiguration.additionalProperties]
   * Unmatched properties from the message are deserialized this collection
   *
   * @param {string} [parameters.globalServiceConfiguration.etag] The
   * configuartion ETag for updates.
   *
   * @param {object} [parameters.globalServiceConfiguration.ssl] The SSL
   * configuration properties
   *
   * @param {string} [parameters.globalServiceConfiguration.ssl.status] SSL
   * status. Allowed values are Enabled and Disabled. Possible values include:
   * 'Enabled', 'Disabled'
   *
   * @param {string} [parameters.globalServiceConfiguration.ssl.cert] The SSL
   * cert data in PEM format encoded as base64 string
   *
   * @param {string} [parameters.globalServiceConfiguration.ssl.key] The SSL key
   * data in PEM format encoded as base64 string. This is not returned in
   * response of GET/PUT on the resource. To see this please call listKeys API.
   *
   * @param {string} [parameters.globalServiceConfiguration.ssl.cname] The CName
   * of the certificate.
   *
   * @param {object} [parameters.globalServiceConfiguration.serviceAuth] Optional
   * global authorization keys for all user services deployed in cluster. These
   * are used if the service does not have auth keys.
   *
   * @param {string}
   * parameters.globalServiceConfiguration.serviceAuth.primaryAuthKeyHash The
   * primary auth key hash. This is not returned in response of GET/PUT on the
   * resource.. To see this please call listKeys API.
   *
   * @param {string}
   * parameters.globalServiceConfiguration.serviceAuth.secondaryAuthKeyHash The
   * secondary auth key hash. This is not returned in response of GET/PUT on the
   * resource.. To see this please call listKeys API.
   *
   * @param {object} [parameters.globalServiceConfiguration.autoScale] The
   * auto-scale configuration
   *
   * @param {string} [parameters.globalServiceConfiguration.autoScale.status] If
   * auto-scale is enabled for all services. Each service can turn it off
   * individually. Possible values include: 'Enabled', 'Disabled'
   *
   * @param {number}
   * [parameters.globalServiceConfiguration.autoScale.minReplicas] The minimum
   * number of replicas for each service.
   *
   * @param {number}
   * [parameters.globalServiceConfiguration.autoScale.maxReplicas] The maximum
   * number of replicas for each service.
   *
   * @param {number}
   * [parameters.globalServiceConfiguration.autoScale.targetUtilization] The
   * target utilization.
   *
   * @param {number}
   * [parameters.globalServiceConfiguration.autoScale.refreshPeriodInSeconds]
   * Refresh period in seconds.
   *
   * @param {string} parameters.location Specifies the location of the resource.
   *
   * @param {object} [parameters.tags] Contains resource tags defined as
   * key/value pairs.
   *
   * @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 {OperationalizationCluster} - 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 OperationalizationCluster} 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, clusterName, 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, clusterName, parameters, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._createOrUpdate(resourceGroupName, clusterName, parameters, options, optionalCallback);
    }
  }

  /**
   * Gets the operationalization cluster resource view. Note that the credentials
   * are not returned by this call. Call ListKeys to get them.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @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<OperationalizationCluster>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getWithHttpOperationResponse(resourceGroupName, clusterName, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._get(resourceGroupName, clusterName, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets the operationalization cluster resource view. Note that the credentials
   * are not returned by this call. Call ListKeys to get them.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @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 {OperationalizationCluster} - 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 OperationalizationCluster} for more
   *                      information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  get(resourceGroupName, clusterName, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._get(resourceGroupName, clusterName, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._get(resourceGroupName, clusterName, options, optionalCallback);
    }
  }

  /**
   * The PATCH operation can be used to update only the tags for a cluster. Use
   * PUT operation to update other properties.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @param {object} parameters The parameters supplied to patch the cluster.
   *
   * @param {object} [parameters.tags] Gets or sets a list of key value pairs
   * that describe the resource. These tags can be used in viewing and grouping
   * this resource (across resource groups). A maximum of 15 tags can be provided
   * for a resource. Each tag must have a key no greater in length than 128
   * characters and a value no greater in length than 256 characters.
   *
   * @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<OperationalizationCluster>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateWithHttpOperationResponse(resourceGroupName, clusterName, parameters, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._update(resourceGroupName, clusterName, parameters, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * The PATCH operation can be used to update only the tags for a cluster. Use
   * PUT operation to update other properties.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @param {object} parameters The parameters supplied to patch the cluster.
   *
   * @param {object} [parameters.tags] Gets or sets a list of key value pairs
   * that describe the resource. These tags can be used in viewing and grouping
   * this resource (across resource groups). A maximum of 15 tags can be provided
   * for a resource. Each tag must have a key no greater in length than 128
   * characters and a value no greater in length than 256 characters.
   *
   * @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 {OperationalizationCluster} - 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 OperationalizationCluster} for more
   *                      information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  update(resourceGroupName, clusterName, 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._update(resourceGroupName, clusterName, parameters, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._update(resourceGroupName, clusterName, parameters, options, optionalCallback);
    }
  }

  /**
   * Deletes the specified cluster.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @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<null>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteMethodWithHttpOperationResponse(resourceGroupName, clusterName, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteMethod(resourceGroupName, clusterName, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Deletes the specified cluster.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @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 {null} - 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.
   *
   *                      {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.
   */
  deleteMethod(resourceGroupName, clusterName, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteMethod(resourceGroupName, clusterName, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteMethod(resourceGroupName, clusterName, options, optionalCallback);
    }
  }

  /**
   * Gets the credentials for the specified cluster such as Storage, ACR and ACS
   * credentials. This is a long running operation because it fetches keys from
   * dependencies.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @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<OperationalizationClusterCredentials>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listKeysWithHttpOperationResponse(resourceGroupName, clusterName, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listKeys(resourceGroupName, clusterName, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets the credentials for the specified cluster such as Storage, ACR and ACS
   * credentials. This is a long running operation because it fetches keys from
   * dependencies.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @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 {OperationalizationClusterCredentials} - 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 OperationalizationClusterCredentials} 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.
   */
  listKeys(resourceGroupName, clusterName, 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._listKeys(resourceGroupName, clusterName, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listKeys(resourceGroupName, clusterName, options, optionalCallback);
    }
  }

  /**
   * Checks if updates are available for system services in the cluster.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @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<CheckSystemServicesUpdatesAvailableResponse>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  checkSystemServicesUpdatesAvailableWithHttpOperationResponse(resourceGroupName, clusterName, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._checkSystemServicesUpdatesAvailable(resourceGroupName, clusterName, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Checks if updates are available for system services in the cluster.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @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 {CheckSystemServicesUpdatesAvailableResponse} - 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 CheckSystemServicesUpdatesAvailableResponse}
   *                      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.
   */
  checkSystemServicesUpdatesAvailable(resourceGroupName, clusterName, 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._checkSystemServicesUpdatesAvailable(resourceGroupName, clusterName, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._checkSystemServicesUpdatesAvailable(resourceGroupName, clusterName, options, optionalCallback);
    }
  }

  /**
   * Updates system services in a cluster.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @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<UpdateSystemServicesResponse>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateSystemServicesWithHttpOperationResponse(resourceGroupName, clusterName, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updateSystemServices(resourceGroupName, clusterName, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Updates system services in a cluster.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @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 {UpdateSystemServicesResponse} - 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 UpdateSystemServicesResponse} 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.
   */
  updateSystemServices(resourceGroupName, clusterName, 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._updateSystemServices(resourceGroupName, clusterName, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updateSystemServices(resourceGroupName, clusterName, options, optionalCallback);
    }
  }

  /**
   * Gets the clusters in the specified resource group.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {string} [options.skiptoken] Continuation token for pagination.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<PaginatedOperationalizationClustersList>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets the clusters in the specified resource group.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {string} [options.skiptoken] Continuation token for pagination.
   *
   * @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 {PaginatedOperationalizationClustersList} - 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 PaginatedOperationalizationClustersList} for
   *                      more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  listByResourceGroup(resourceGroupName, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listByResourceGroup(resourceGroupName, options, optionalCallback);
    }
  }

  /**
   * Gets the operationalization clusters in the specified subscription.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {string} [options.skiptoken] Continuation token for pagination.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<PaginatedOperationalizationClustersList>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listBySubscriptionIdWithHttpOperationResponse(options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listBySubscriptionId(options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets the operationalization clusters in the specified subscription.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {string} [options.skiptoken] Continuation token for pagination.
   *
   * @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 {PaginatedOperationalizationClustersList} - 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 PaginatedOperationalizationClustersList} 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.
   */
  listBySubscriptionId(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._listBySubscriptionId(options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listBySubscriptionId(options, optionalCallback);
    }
  }

  /**
   * Create or update an operationalization cluster.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @param {object} parameters Parameters supplied to create or update an
   * Operationalization cluster.
   *
   * @param {string} [parameters.description] The description of the cluster.
   *
   * @param {string} parameters.clusterType The cluster type. Possible values
   * include: 'ACS', 'Local'
   *
   * @param {object} [parameters.storageAccount] Storage Account properties.
   *
   * @param {string} [parameters.storageAccount.resourceId] ARM resource ID of
   * the Azure Storage Account to store CLI specific files. If not provided one
   * will be created. This cannot be changed once the cluster is created.
   *
   * @param {object} [parameters.containerRegistry] Container Registry
   * properties.
   *
   * @param {string} [parameters.containerRegistry.resourceId] ARM resource ID of
   * the Azure Container Registry used to store Docker images for web services in
   * the cluster. If not provided one will be created. This cannot be changed
   * once the cluster is created.
   *
   * @param {object} [parameters.containerService] Parameters for the Azure
   * Container Service cluster.
   *
   * @param {string} parameters.containerService.orchestratorType Type of
   * orchestrator. It cannot be changed once the cluster is created. Possible
   * values include: 'Kubernetes', 'None'
   *
   * @param {object} parameters.containerService.orchestratorProperties
   * Orchestrator specific properties
   *
   * @param {object}
   * parameters.containerService.orchestratorProperties.servicePrincipal The
   * Azure Service Principal used by Kubernetes
   *
   * @param {string}
   * parameters.containerService.orchestratorProperties.servicePrincipal.clientId
   * The service principal client ID
   *
   * @param {string}
   * parameters.containerService.orchestratorProperties.servicePrincipal.secret
   * The service principal secret. This is not returned in response of GET/PUT on
   * the resource. To see this please call listKeys.
   *
   * @param {array} [parameters.containerService.systemServices] The system
   * services deployed to the cluster
   *
   * @param {number} [parameters.containerService.masterCount] The number of
   * master nodes in the container service.
   *
   * @param {number} [parameters.containerService.agentCount] The number of agent
   * nodes in the Container Service. This can be changed to scale the cluster.
   *
   * @param {string} [parameters.containerService.agentVmSize] The Azure VM size
   * of the agent VM nodes. This cannot be changed once the cluster is created.
   * This list is non exhaustive; refer to
   * https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes for
   * the possible VM sizes. Possible values include: 'Standard_A0',
   * 'Standard_A1', 'Standard_A2', 'Standard_A3', 'Standard_A4', 'Standard_A5',
   * 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A9', 'Standard_A10',
   * 'Standard_A11', 'Standard_D1', 'Standard_D2', 'Standard_D3', 'Standard_D4',
   * 'Standard_D11', 'Standard_D12', 'Standard_D13', 'Standard_D14',
   * 'Standard_D1_v2', 'Standard_D2_v2', 'Standard_D3_v2', 'Standard_D4_v2',
   * 'Standard_D5_v2', 'Standard_D11_v2', 'Standard_D12_v2', 'Standard_D13_v2',
   * 'Standard_D14_v2', 'Standard_G1', 'Standard_G2', 'Standard_G3',
   * 'Standard_G4', 'Standard_G5', 'Standard_DS1', 'Standard_DS2',
   * 'Standard_DS3', 'Standard_DS4', 'Standard_DS11', 'Standard_DS12',
   * 'Standard_DS13', 'Standard_DS14', 'Standard_GS1', 'Standard_GS2',
   * 'Standard_GS3', 'Standard_GS4', 'Standard_GS5'
   *
   * @param {object} [parameters.appInsights] AppInsights configuration.
   *
   * @param {string} [parameters.appInsights.resourceId] ARM resource ID of the
   * App Insights.
   *
   * @param {object} [parameters.globalServiceConfiguration] Contains global
   * configuration for the web services in the cluster.
   *
   * @param {object} [parameters.globalServiceConfiguration.additionalProperties]
   * Unmatched properties from the message are deserialized this collection
   *
   * @param {string} [parameters.globalServiceConfiguration.etag] The
   * configuartion ETag for updates.
   *
   * @param {object} [parameters.globalServiceConfiguration.ssl] The SSL
   * configuration properties
   *
   * @param {string} [parameters.globalServiceConfiguration.ssl.status] SSL
   * status. Allowed values are Enabled and Disabled. Possible values include:
   * 'Enabled', 'Disabled'
   *
   * @param {string} [parameters.globalServiceConfiguration.ssl.cert] The SSL
   * cert data in PEM format encoded as base64 string
   *
   * @param {string} [parameters.globalServiceConfiguration.ssl.key] The SSL key
   * data in PEM format encoded as base64 string. This is not returned in
   * response of GET/PUT on the resource. To see this please call listKeys API.
   *
   * @param {string} [parameters.globalServiceConfiguration.ssl.cname] The CName
   * of the certificate.
   *
   * @param {object} [parameters.globalServiceConfiguration.serviceAuth] Optional
   * global authorization keys for all user services deployed in cluster. These
   * are used if the service does not have auth keys.
   *
   * @param {string}
   * parameters.globalServiceConfiguration.serviceAuth.primaryAuthKeyHash The
   * primary auth key hash. This is not returned in response of GET/PUT on the
   * resource.. To see this please call listKeys API.
   *
   * @param {string}
   * parameters.globalServiceConfiguration.serviceAuth.secondaryAuthKeyHash The
   * secondary auth key hash. This is not returned in response of GET/PUT on the
   * resource.. To see this please call listKeys API.
   *
   * @param {object} [parameters.globalServiceConfiguration.autoScale] The
   * auto-scale configuration
   *
   * @param {string} [parameters.globalServiceConfiguration.autoScale.status] If
   * auto-scale is enabled for all services. Each service can turn it off
   * individually. Possible values include: 'Enabled', 'Disabled'
   *
   * @param {number}
   * [parameters.globalServiceConfiguration.autoScale.minReplicas] The minimum
   * number of replicas for each service.
   *
   * @param {number}
   * [parameters.globalServiceConfiguration.autoScale.maxReplicas] The maximum
   * number of replicas for each service.
   *
   * @param {number}
   * [parameters.globalServiceConfiguration.autoScale.targetUtilization] The
   * target utilization.
   *
   * @param {number}
   * [parameters.globalServiceConfiguration.autoScale.refreshPeriodInSeconds]
   * Refresh period in seconds.
   *
   * @param {string} parameters.location Specifies the location of the resource.
   *
   * @param {object} [parameters.tags] Contains resource tags defined as
   * key/value pairs.
   *
   * @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<OperationalizationCluster>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, clusterName, parameters, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._beginCreateOrUpdate(resourceGroupName, clusterName, parameters, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Create or update an operationalization cluster.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @param {object} parameters Parameters supplied to create or update an
   * Operationalization cluster.
   *
   * @param {string} [parameters.description] The description of the cluster.
   *
   * @param {string} parameters.clusterType The cluster type. Possible values
   * include: 'ACS', 'Local'
   *
   * @param {object} [parameters.storageAccount] Storage Account properties.
   *
   * @param {string} [parameters.storageAccount.resourceId] ARM resource ID of
   * the Azure Storage Account to store CLI specific files. If not provided one
   * will be created. This cannot be changed once the cluster is created.
   *
   * @param {object} [parameters.containerRegistry] Container Registry
   * properties.
   *
   * @param {string} [parameters.containerRegistry.resourceId] ARM resource ID of
   * the Azure Container Registry used to store Docker images for web services in
   * the cluster. If not provided one will be created. This cannot be changed
   * once the cluster is created.
   *
   * @param {object} [parameters.containerService] Parameters for the Azure
   * Container Service cluster.
   *
   * @param {string} parameters.containerService.orchestratorType Type of
   * orchestrator. It cannot be changed once the cluster is created. Possible
   * values include: 'Kubernetes', 'None'
   *
   * @param {object} parameters.containerService.orchestratorProperties
   * Orchestrator specific properties
   *
   * @param {object}
   * parameters.containerService.orchestratorProperties.servicePrincipal The
   * Azure Service Principal used by Kubernetes
   *
   * @param {string}
   * parameters.containerService.orchestratorProperties.servicePrincipal.clientId
   * The service principal client ID
   *
   * @param {string}
   * parameters.containerService.orchestratorProperties.servicePrincipal.secret
   * The service principal secret. This is not returned in response of GET/PUT on
   * the resource. To see this please call listKeys.
   *
   * @param {array} [parameters.containerService.systemServices] The system
   * services deployed to the cluster
   *
   * @param {number} [parameters.containerService.masterCount] The number of
   * master nodes in the container service.
   *
   * @param {number} [parameters.containerService.agentCount] The number of agent
   * nodes in the Container Service. This can be changed to scale the cluster.
   *
   * @param {string} [parameters.containerService.agentVmSize] The Azure VM size
   * of the agent VM nodes. This cannot be changed once the cluster is created.
   * This list is non exhaustive; refer to
   * https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes for
   * the possible VM sizes. Possible values include: 'Standard_A0',
   * 'Standard_A1', 'Standard_A2', 'Standard_A3', 'Standard_A4', 'Standard_A5',
   * 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A9', 'Standard_A10',
   * 'Standard_A11', 'Standard_D1', 'Standard_D2', 'Standard_D3', 'Standard_D4',
   * 'Standard_D11', 'Standard_D12', 'Standard_D13', 'Standard_D14',
   * 'Standard_D1_v2', 'Standard_D2_v2', 'Standard_D3_v2', 'Standard_D4_v2',
   * 'Standard_D5_v2', 'Standard_D11_v2', 'Standard_D12_v2', 'Standard_D13_v2',
   * 'Standard_D14_v2', 'Standard_G1', 'Standard_G2', 'Standard_G3',
   * 'Standard_G4', 'Standard_G5', 'Standard_DS1', 'Standard_DS2',
   * 'Standard_DS3', 'Standard_DS4', 'Standard_DS11', 'Standard_DS12',
   * 'Standard_DS13', 'Standard_DS14', 'Standard_GS1', 'Standard_GS2',
   * 'Standard_GS3', 'Standard_GS4', 'Standard_GS5'
   *
   * @param {object} [parameters.appInsights] AppInsights configuration.
   *
   * @param {string} [parameters.appInsights.resourceId] ARM resource ID of the
   * App Insights.
   *
   * @param {object} [parameters.globalServiceConfiguration] Contains global
   * configuration for the web services in the cluster.
   *
   * @param {object} [parameters.globalServiceConfiguration.additionalProperties]
   * Unmatched properties from the message are deserialized this collection
   *
   * @param {string} [parameters.globalServiceConfiguration.etag] The
   * configuartion ETag for updates.
   *
   * @param {object} [parameters.globalServiceConfiguration.ssl] The SSL
   * configuration properties
   *
   * @param {string} [parameters.globalServiceConfiguration.ssl.status] SSL
   * status. Allowed values are Enabled and Disabled. Possible values include:
   * 'Enabled', 'Disabled'
   *
   * @param {string} [parameters.globalServiceConfiguration.ssl.cert] The SSL
   * cert data in PEM format encoded as base64 string
   *
   * @param {string} [parameters.globalServiceConfiguration.ssl.key] The SSL key
   * data in PEM format encoded as base64 string. This is not returned in
   * response of GET/PUT on the resource. To see this please call listKeys API.
   *
   * @param {string} [parameters.globalServiceConfiguration.ssl.cname] The CName
   * of the certificate.
   *
   * @param {object} [parameters.globalServiceConfiguration.serviceAuth] Optional
   * global authorization keys for all user services deployed in cluster. These
   * are used if the service does not have auth keys.
   *
   * @param {string}
   * parameters.globalServiceConfiguration.serviceAuth.primaryAuthKeyHash The
   * primary auth key hash. This is not returned in response of GET/PUT on the
   * resource.. To see this please call listKeys API.
   *
   * @param {string}
   * parameters.globalServiceConfiguration.serviceAuth.secondaryAuthKeyHash The
   * secondary auth key hash. This is not returned in response of GET/PUT on the
   * resource.. To see this please call listKeys API.
   *
   * @param {object} [parameters.globalServiceConfiguration.autoScale] The
   * auto-scale configuration
   *
   * @param {string} [parameters.globalServiceConfiguration.autoScale.status] If
   * auto-scale is enabled for all services. Each service can turn it off
   * individually. Possible values include: 'Enabled', 'Disabled'
   *
   * @param {number}
   * [parameters.globalServiceConfiguration.autoScale.minReplicas] The minimum
   * number of replicas for each service.
   *
   * @param {number}
   * [parameters.globalServiceConfiguration.autoScale.maxReplicas] The maximum
   * number of replicas for each service.
   *
   * @param {number}
   * [parameters.globalServiceConfiguration.autoScale.targetUtilization] The
   * target utilization.
   *
   * @param {number}
   * [parameters.globalServiceConfiguration.autoScale.refreshPeriodInSeconds]
   * Refresh period in seconds.
   *
   * @param {string} parameters.location Specifies the location of the resource.
   *
   * @param {object} [parameters.tags] Contains resource tags defined as
   * key/value pairs.
   *
   * @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 {OperationalizationCluster} - 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 OperationalizationCluster} for more
   *                      information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  beginCreateOrUpdate(resourceGroupName, clusterName, 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._beginCreateOrUpdate(resourceGroupName, clusterName, parameters, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._beginCreateOrUpdate(resourceGroupName, clusterName, parameters, options, optionalCallback);
    }
  }

  /**
   * Deletes the specified cluster.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @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<null>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  beginDeleteMethodWithHttpOperationResponse(resourceGroupName, clusterName, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._beginDeleteMethod(resourceGroupName, clusterName, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Deletes the specified cluster.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @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 {null} - 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.
   *
   *                      {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.
   */
  beginDeleteMethod(resourceGroupName, clusterName, 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._beginDeleteMethod(resourceGroupName, clusterName, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._beginDeleteMethod(resourceGroupName, clusterName, options, optionalCallback);
    }
  }

  /**
   * Updates system services in a cluster.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @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<UpdateSystemServicesResponse>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  beginUpdateSystemServicesWithHttpOperationResponse(resourceGroupName, clusterName, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._beginUpdateSystemServices(resourceGroupName, clusterName, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Updates system services in a cluster.
   *
   * @param {string} resourceGroupName Name of the resource group in which the
   * cluster is located.
   *
   * @param {string} clusterName The name of the cluster.
   *
   * @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 {UpdateSystemServicesResponse} - 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 UpdateSystemServicesResponse} 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.
   */
  beginUpdateSystemServices(resourceGroupName, clusterName, 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._beginUpdateSystemServices(resourceGroupName, clusterName, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._beginUpdateSystemServices(resourceGroupName, clusterName, options, optionalCallback);
    }
  }

  /**
   * Gets the clusters in the specified resource group.
   *
   * @param {string} nextPageLink The NextLink from the previous successful call
   * to List operation.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<PaginatedOperationalizationClustersList>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets the clusters in the specified resource group.
   *
   * @param {string} nextPageLink The NextLink from the previous successful call
   * to List operation.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {PaginatedOperationalizationClustersList} - 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 PaginatedOperationalizationClustersList} for
   *                      more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  listByResourceGroupNext(nextPageLink, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listByResourceGroupNext(nextPageLink, options, optionalCallback);
    }
  }

  /**
   * Gets the operationalization clusters in the specified subscription.
   *
   * @param {string} nextPageLink The NextLink from the previous successful call
   * to List operation.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<PaginatedOperationalizationClustersList>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listBySubscriptionIdNextWithHttpOperationResponse(nextPageLink, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listBySubscriptionIdNext(nextPageLink, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets the operationalization clusters in the specified subscription.
   *
   * @param {string} nextPageLink The NextLink from the previous successful call
   * to List operation.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {PaginatedOperationalizationClustersList} - 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 PaginatedOperationalizationClustersList} 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.
   */
  listBySubscriptionIdNext(nextPageLink, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._listBySubscriptionIdNext(nextPageLink, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listBySubscriptionIdNext(nextPageLink, options, optionalCallback);
    }
  }

}

module.exports = OperationalizationClusters;
