text: /*
   * Copyright (c) Microsoft Corporation. All rights reserved.
   * Licensed under the MIT License. See License.txt in the project root for
   * license information.
   *
   * Code generated by Microsoft (R) AutoRest Code Generator.
   * Changes may cause incorrect behavior and will be lost if the code is
   * regenerated.
   */
  
  'use strict';
  
  const msRest = require('ms-rest');
  const msRestAzure = require('ms-rest-azure');
  const WebResource = msRest.WebResource;
  
  
  /**
   * @summary Remove protection container mapping.
   *
   * The operation to delete or remove a protection container mapping.
   *
   * @param {string} resourceName The name of the recovery services vault.
   *
   * @param {string} resourceGroupName The name of the resource group where the
   * recovery services vault is present.
   *
   * @param {string} fabricName Fabric name.
   *
   * @param {string} protectionContainerName Protection container name.
   *
   * @param {string} mappingName Protection container mapping name.
   *
   * @param {object} removalInput Removal input.
   *
   * @param {object} [removalInput.properties] Configure protection input
   * properties.
   *
   * @param {object} [removalInput.properties.providerSpecificInput] Provider
   * specific input for unpairing.
   *
   * @param {string} [removalInput.properties.providerSpecificInput.instanceType]
   * The class type.
   *
   * @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(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, removalInput, 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(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, removalInput, 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);
      });
    });
  }
  
  /**
   * @summary Gets a protection container mapping/
   *
   * Gets the details of a protection container mapping.
   *
   * @param {string} resourceName The name of the recovery services vault.
   *
   * @param {string} resourceGroupName The name of the resource group where the
   * recovery services vault is present.
   *
   * @param {string} fabricName Fabric name.
   *
   * @param {string} protectionContainerName Protection container name.
   *
   * @param {string} mappingName Protection Container mapping name.
   *
   * @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 ProtectionContainerMapping} 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(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') {
        throw new Error('resourceName cannot be null or undefined and it must be of type string.');
      }
      if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') {
        throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.');
      }
      if (this.client.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 (fabricName === null || fabricName === undefined || typeof fabricName.valueOf() !== 'string') {
        throw new Error('fabricName cannot be null or undefined and it must be of type string.');
      }
      if (protectionContainerName === null || protectionContainerName === undefined || typeof protectionContainerName.valueOf() !== 'string') {
        throw new Error('protectionContainerName cannot be null or undefined and it must be of type string.');
      }
      if (mappingName === null || mappingName === undefined || typeof mappingName.valueOf() !== 'string') {
        throw new Error('mappingName cannot be null or undefined and it must be of type string.');
      }
      if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') {
        throw new Error('this.client.acceptLanguage must be of type string.');
      }
    } catch (error) {
      return callback(error);
    }
  
    // Construct URL
    let baseUrl = this.client.baseUri;
    let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}';
    requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName));
    requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
    requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
    requestUrl = requestUrl.replace('{fabricName}', encodeURIComponent(fabricName));
    requestUrl = requestUrl.replace('{protectionContainerName}', encodeURIComponent(protectionContainerName));
    requestUrl = requestUrl.replace('{mappingName}', encodeURIComponent(mappingName));
    let queryParameters = [];
    queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
    if (queryParameters.length > 0) {
      requestUrl += '?' + queryParameters.join('&');
    }
  
    // Create HTTP transport objects
    let httpRequest = new WebResource();
    httpRequest.method = 'GET';
    httpRequest.url = requestUrl;
    httpRequest.headers = {};
    // Set Headers
    httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
    if (this.client.generateClientRequestId) {
        httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
    }
    if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
      httpRequest.headers['accept-language'] = this.client.acceptLanguage;
    }
    if(options) {
      for(let headerName in options['customHeaders']) {
        if (options['customHeaders'].hasOwnProperty(headerName)) {
          httpRequest.headers[headerName] = options['customHeaders'][headerName];
        }
      }
    }
    httpRequest.body = null;
    // Send Request
    return client.pipeline(httpRequest, (err, response, responseBody) => {
      if (err) {
        return callback(err);
      }
      let statusCode = response.statusCode;
      if (statusCode !== 200) {
        let error = new Error(responseBody);
        error.statusCode = response.statusCode;
        error.request = msRest.stripRequest(httpRequest);
        error.response = msRest.stripResponse(response);
        if (responseBody === '') responseBody = null;
        let parsedErrorResponse;
        try {
          parsedErrorResponse = JSON.parse(responseBody);
          if (parsedErrorResponse) {
            if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
            if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
            if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
          }
          if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
            let resultMapper = new client.models['CloudError']().mapper();
            error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
          }
        } catch (defaultError) {
          error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                           `- "${responseBody}" for the default response.`;
          return callback(error);
        }
        return callback(error);
      }
      // Create Result
      let result = null;
      if (responseBody === '') responseBody = null;
      // Deserialize Response
      if (statusCode === 200) {
        let parsedResponse = null;
        try {
          parsedResponse = JSON.parse(responseBody);
          result = JSON.parse(responseBody);
          if (parsedResponse !== null && parsedResponse !== undefined) {
            let resultMapper = new client.models['ProtectionContainerMapping']().mapper();
            result = client.deserialize(resultMapper, parsedResponse, 'result');
          }
        } catch (error) {
          let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
          deserializationError.request = msRest.stripRequest(httpRequest);
          deserializationError.response = msRest.stripResponse(response);
          return callback(deserializationError);
        }
      }
  
      return callback(null, result, httpRequest, response);
    });
  }
  
  
  /**
   * @summary Create protection container mapping.
   *
   * The operation to create a protection container mapping.
   *
   * @param {string} resourceName The name of the recovery services vault.
   *
   * @param {string} resourceGroupName The name of the resource group where the
   * recovery services vault is present.
   *
   * @param {string} fabricName Fabric name.
   *
   * @param {string} protectionContainerName Protection container name.
   *
   * @param {string} mappingName Protection container mapping name.
   *
   * @param {object} creationInput Mapping creation input.
   *
   * @param {object} [creationInput.properties] Configure protection input
   * properties.
   *
   * @param {string} [creationInput.properties.targetProtectionContainerId] The
   * target unique protection container name.
   *
   * @param {string} [creationInput.properties.policyId] Applicable policy.
   *
   * @param {object} [creationInput.properties.providerSpecificInput] Provider
   * specific input for pairing.
   *
   * @param {string}
   * [creationInput.properties.providerSpecificInput.instanceType] The class
   * type.
   *
   * @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 ProtectionContainerMapping} 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 _create(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, creationInput, 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.beginCreate(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, creationInput, 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['ProtectionContainerMapping']().mapper();
            result = client.deserialize(resultMapper, parsedResponse, 'result');
          }
        } catch (error) {
          let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
          deserializationError.request = msRest.stripRequest(httpRequest);
          deserializationError.response = msRest.stripResponse(response);
          return callback(deserializationError);
        }
  
        return callback(null, result, httpRequest, response);
      });
    });
  }
  
  
  /**
   * @summary Purge protection container mapping.
   *
   * The operation to purge(force delete) a protection container mapping
   *
   * @param {string} resourceName The name of the recovery services vault.
   *
   * @param {string} resourceGroupName The name of the resource group where the
   * recovery services vault is present.
   *
   * @param {string} fabricName Fabric name.
   *
   * @param {string} protectionContainerName Protection container name.
   *
   * @param {string} mappingName Protection container mapping name.
   *
   * @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 _purge(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, 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.beginPurge(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, 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);
      });
    });
  }
  
  /**
   * @summary Gets the list of protection container mappings for a protection
   * container.
   *
   * Lists the protection container mappings for a protection container.
   *
   * @param {string} resourceName The name of the recovery services vault.
   *
   * @param {string} resourceGroupName The name of the resource group where the
   * recovery services vault is present.
   *
   * @param {string} fabricName Fabric name.
   *
   * @param {string} protectionContainerName Protection container name.
   *
   * @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 ProtectionContainerMappingCollection} 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 _listByReplicationProtectionContainers(resourceName, resourceGroupName, fabricName, protectionContainerName, 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') {
        throw new Error('resourceName cannot be null or undefined and it must be of type string.');
      }
      if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') {
        throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.');
      }
      if (this.client.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 (fabricName === null || fabricName === undefined || typeof fabricName.valueOf() !== 'string') {
        throw new Error('fabricName cannot be null or undefined and it must be of type string.');
      }
      if (protectionContainerName === null || protectionContainerName === undefined || typeof protectionContainerName.valueOf() !== 'string') {
        throw new Error('protectionContainerName cannot be null or undefined and it must be of type string.');
      }
      if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') {
        throw new Error('this.client.acceptLanguage must be of type string.');
      }
    } catch (error) {
      return callback(error);
    }
  
    // Construct URL
    let baseUrl = this.client.baseUri;
    let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings';
    requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName));
    requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
    requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
    requestUrl = requestUrl.replace('{fabricName}', encodeURIComponent(fabricName));
    requestUrl = requestUrl.replace('{protectionContainerName}', encodeURIComponent(protectionContainerName));
    let queryParameters = [];
    queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
    if (queryParameters.length > 0) {
      requestUrl += '?' + queryParameters.join('&');
    }
  
    // Create HTTP transport objects
    let httpRequest = new WebResource();
    httpRequest.method = 'GET';
    httpRequest.url = requestUrl;
    httpRequest.headers = {};
    // Set Headers
    httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
    if (this.client.generateClientRequestId) {
        httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
    }
    if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
      httpRequest.headers['accept-language'] = this.client.acceptLanguage;
    }
    if(options) {
      for(let headerName in options['customHeaders']) {
        if (options['customHeaders'].hasOwnProperty(headerName)) {
          httpRequest.headers[headerName] = options['customHeaders'][headerName];
        }
      }
    }
    httpRequest.body = null;
    // Send Request
    return client.pipeline(httpRequest, (err, response, responseBody) => {
      if (err) {
        return callback(err);
      }
      let statusCode = response.statusCode;
      if (statusCode !== 200) {
        let error = new Error(responseBody);
        error.statusCode = response.statusCode;
        error.request = msRest.stripRequest(httpRequest);
        error.response = msRest.stripResponse(response);
        if (responseBody === '') responseBody = null;
        let parsedErrorResponse;
        try {
          parsedErrorResponse = JSON.parse(responseBody);
          if (parsedErrorResponse) {
            if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
            if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
            if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
          }
          if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
            let resultMapper = new client.models['CloudError']().mapper();
            error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
          }
        } catch (defaultError) {
          error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                           `- "${responseBody}" for the default response.`;
          return callback(error);
        }
        return callback(error);
      }
      // Create Result
      let result = null;
      if (responseBody === '') responseBody = null;
      // Deserialize Response
      if (statusCode === 200) {
        let parsedResponse = null;
        try {
          parsedResponse = JSON.parse(responseBody);
          result = JSON.parse(responseBody);
          if (parsedResponse !== null && parsedResponse !== undefined) {
            let resultMapper = new client.models['ProtectionContainerMappingCollection']().mapper();
            result = client.deserialize(resultMapper, parsedResponse, 'result');
          }
        } catch (error) {
          let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
          deserializationError.request = msRest.stripRequest(httpRequest);
          deserializationError.response = msRest.stripResponse(response);
          return callback(deserializationError);
        }
      }
  
      return callback(null, result, httpRequest, response);
    });
  }
  
  /**
   * @summary Gets the list of all protection container mappings in a vault.
   *
   * Lists the protection container mappings in the vault.
   *
   * @param {string} resourceName The name of the recovery services vault.
   *
   * @param {string} resourceGroupName The name of the resource group where the
   * recovery services vault is present.
   *
   * @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 ProtectionContainerMappingCollection} for
   *                      more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  function _list(resourceName, resourceGroupName, options, callback) {
     /* jshint validthis: true */
    let client = this.client;
    if(!callback && typeof options === 'function') {
      callback = options;
      options = null;
    }
    if (!callback) {
      throw new Error('callback cannot be null.');
    }
    // Validate
    try {
      if (this.client.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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') {
        throw new Error('resourceName cannot be null or undefined and it must be of type string.');
      }
      if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') {
        throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.');
      }
      if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') {
        throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.');
      }
      if (this.client.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.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings';
    requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName));
    requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
    requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
    let queryParameters = [];
    queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
    if (queryParameters.length > 0) {
      requestUrl += '?' + queryParameters.join('&');
    }
  
    // Create HTTP transport objects
    let httpRequest = new WebResource();
    httpRequest.method = 'GET';
    httpRequest.url = requestUrl;
    httpRequest.headers = {};
    // Set Headers
    httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
    if (this.client.generateClientRequestId) {
        httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
    }
    if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
      httpRequest.headers['accept-language'] = this.client.acceptLanguage;
    }
    if(options) {
      for(let headerName in options['customHeaders']) {
        if (options['customHeaders'].hasOwnProperty(headerName)) {
          httpRequest.headers[headerName] = options['customHeaders'][headerName];
        }
      }
    }
    httpRequest.body = null;
    // Send Request
    return client.pipeline(httpRequest, (err, response, responseBody) => {
      if (err) {
        return callback(err);
      }
      let statusCode = response.statusCode;
      if (statusCode !== 200) {
        let error = new Error(responseBody);
        error.statusCode = response.statusCode;
        error.request = msRest.stripRequest(httpRequest);
        error.response = msRest.stripResponse(response);
        if (responseBody === '') responseBody = null;
        let parsedErrorResponse;
        try {
          parsedErrorResponse = JSON.parse(responseBody);
          if (parsedErrorResponse) {
            if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
            if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
            if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
          }
          if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
            let resultMapper = new client.models['CloudError']().mapper();
            error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
          }
        } catch (defaultError) {
          error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                           `- "${responseBody}" for the default response.`;
          return callback(error);
        }
        return callback(error);
      }
      // Create Result
      let result = null;
      if (responseBody === '') responseBody = null;
      // Deserialize Response
      if (statusCode === 200) {
        let parsedResponse = null;
        try {
          parsedResponse = JSON.parse(responseBody);
          result = JSON.parse(responseBody);
          if (parsedResponse !== null && parsedResponse !== undefined) {
            let resultMapper = new client.models['ProtectionContainerMappingCollection']().mapper();
            result = client.deserialize(resultMapper, parsedResponse, 'result');
          }
        } catch (error) {
          let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
          deserializationError.request = msRest.stripRequest(httpRequest);
          deserializationError.response = msRest.stripResponse(response);
          return callback(deserializationError);
        }
      }
  
      return callback(null, result, httpRequest, response);
    });
  }
  
  /**
   * @summary Remove protection container mapping.
   *
   * The operation to delete or remove a protection container mapping.
   *
   * @param {string} resourceName The name of the recovery services vault.
   *
   * @param {string} resourceGroupName The name of the resource group where the
   * recovery services vault is present.
   *
   * @param {string} fabricName Fabric name.
   *
   * @param {string} protectionContainerName Protection container name.
   *
   * @param {string} mappingName Protection container mapping name.
   *
   * @param {object} removalInput Removal input.
   *
   * @param {object} [removalInput.properties] Configure protection input
   * properties.
   *
   * @param {object} [removalInput.properties.providerSpecificInput] Provider
   * specific input for unpairing.
   *
   * @param {string} [removalInput.properties.providerSpecificInput.instanceType]
   * The class type.
   *
   * @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(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, removalInput, 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') {
        throw new Error('resourceName cannot be null or undefined and it must be of type string.');
      }
      if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') {
        throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.');
      }
      if (this.client.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 (fabricName === null || fabricName === undefined || typeof fabricName.valueOf() !== 'string') {
        throw new Error('fabricName cannot be null or undefined and it must be of type string.');
      }
      if (protectionContainerName === null || protectionContainerName === undefined || typeof protectionContainerName.valueOf() !== 'string') {
        throw new Error('protectionContainerName cannot be null or undefined and it must be of type string.');
      }
      if (mappingName === null || mappingName === undefined || typeof mappingName.valueOf() !== 'string') {
        throw new Error('mappingName cannot be null or undefined and it must be of type string.');
      }
      if (removalInput === null || removalInput === undefined) {
        throw new Error('removalInput 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove';
    requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName));
    requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
    requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
    requestUrl = requestUrl.replace('{fabricName}', encodeURIComponent(fabricName));
    requestUrl = requestUrl.replace('{protectionContainerName}', encodeURIComponent(protectionContainerName));
    requestUrl = requestUrl.replace('{mappingName}', encodeURIComponent(mappingName));
    let queryParameters = [];
    queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
    if (queryParameters.length > 0) {
      requestUrl += '?' + queryParameters.join('&');
    }
  
    // Create HTTP transport objects
    let httpRequest = new WebResource();
    httpRequest.method = 'POST';
    httpRequest.url = requestUrl;
    httpRequest.headers = {};
    // Set Headers
    httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
    if (this.client.generateClientRequestId) {
        httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
    }
    if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
      httpRequest.headers['accept-language'] = this.client.acceptLanguage;
    }
    if(options) {
      for(let headerName in options['customHeaders']) {
        if (options['customHeaders'].hasOwnProperty(headerName)) {
          httpRequest.headers[headerName] = options['customHeaders'][headerName];
        }
      }
    }
    // Serialize Request
    let requestContent = null;
    let requestModel = null;
    try {
      if (removalInput !== null && removalInput !== undefined) {
        let requestModelMapper = new client.models['RemoveProtectionContainerMappingInput']().mapper();
        requestModel = client.serialize(requestModelMapper, removalInput, 'removalInput');
        requestContent = JSON.stringify(requestModel);
      }
    } catch (error) {
      let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
          `payload - ${JSON.stringify(removalInput, 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 !== 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) {
            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;
  
      return callback(null, result, httpRequest, response);
    });
  }
  
  /**
   * @summary Create protection container mapping.
   *
   * The operation to create a protection container mapping.
   *
   * @param {string} resourceName The name of the recovery services vault.
   *
   * @param {string} resourceGroupName The name of the resource group where the
   * recovery services vault is present.
   *
   * @param {string} fabricName Fabric name.
   *
   * @param {string} protectionContainerName Protection container name.
   *
   * @param {string} mappingName Protection container mapping name.
   *
   * @param {object} creationInput Mapping creation input.
   *
   * @param {object} [creationInput.properties] Configure protection input
   * properties.
   *
   * @param {string} [creationInput.properties.targetProtectionContainerId] The
   * target unique protection container name.
   *
   * @param {string} [creationInput.properties.policyId] Applicable policy.
   *
   * @param {object} [creationInput.properties.providerSpecificInput] Provider
   * specific input for pairing.
   *
   * @param {string}
   * [creationInput.properties.providerSpecificInput.instanceType] The class
   * type.
   *
   * @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 ProtectionContainerMapping} 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 _beginCreate(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, creationInput, 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') {
        throw new Error('resourceName cannot be null or undefined and it must be of type string.');
      }
      if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') {
        throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.');
      }
      if (this.client.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 (fabricName === null || fabricName === undefined || typeof fabricName.valueOf() !== 'string') {
        throw new Error('fabricName cannot be null or undefined and it must be of type string.');
      }
      if (protectionContainerName === null || protectionContainerName === undefined || typeof protectionContainerName.valueOf() !== 'string') {
        throw new Error('protectionContainerName cannot be null or undefined and it must be of type string.');
      }
      if (mappingName === null || mappingName === undefined || typeof mappingName.valueOf() !== 'string') {
        throw new Error('mappingName cannot be null or undefined and it must be of type string.');
      }
      if (creationInput === null || creationInput === undefined) {
        throw new Error('creationInput 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}';
    requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName));
    requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
    requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
    requestUrl = requestUrl.replace('{fabricName}', encodeURIComponent(fabricName));
    requestUrl = requestUrl.replace('{protectionContainerName}', encodeURIComponent(protectionContainerName));
    requestUrl = requestUrl.replace('{mappingName}', encodeURIComponent(mappingName));
    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 (creationInput !== null && creationInput !== undefined) {
        let requestModelMapper = new client.models['CreateProtectionContainerMappingInput']().mapper();
        requestModel = client.serialize(requestModelMapper, creationInput, 'creationInput');
        requestContent = JSON.stringify(requestModel);
      }
    } catch (error) {
      let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
          `payload - ${JSON.stringify(creationInput, null, 2)}.`);
      return callback(serializationError);
    }
    httpRequest.body = requestContent;
    // Send Request
    return client.pipeline(httpRequest, (err, response, responseBody) => {
      if (err) {
        return callback(err);
      }
      let statusCode = response.statusCode;
      if (statusCode !== 200 && statusCode !== 202) {
        let error = new Error(responseBody);
        error.statusCode = response.statusCode;
        error.request = msRest.stripRequest(httpRequest);
        error.response = msRest.stripResponse(response);
        if (responseBody === '') responseBody = null;
        let parsedErrorResponse;
        try {
          parsedErrorResponse = JSON.parse(responseBody);
          if (parsedErrorResponse) {
            if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
            if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
            if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
          }
          if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
            let resultMapper = new client.models['CloudError']().mapper();
            error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
          }
        } catch (defaultError) {
          error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                           `- "${responseBody}" for the default response.`;
          return callback(error);
        }
        return callback(error);
      }
      // Create Result
      let result = null;
      if (responseBody === '') responseBody = null;
      // Deserialize Response
      if (statusCode === 200) {
        let parsedResponse = null;
        try {
          parsedResponse = JSON.parse(responseBody);
          result = JSON.parse(responseBody);
          if (parsedResponse !== null && parsedResponse !== undefined) {
            let resultMapper = new client.models['ProtectionContainerMapping']().mapper();
            result = client.deserialize(resultMapper, parsedResponse, 'result');
          }
        } catch (error) {
          let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
          deserializationError.request = msRest.stripRequest(httpRequest);
          deserializationError.response = msRest.stripResponse(response);
          return callback(deserializationError);
        }
      }
  
      return callback(null, result, httpRequest, response);
    });
  }
  
  /**
   * @summary Purge protection container mapping.
   *
   * The operation to purge(force delete) a protection container mapping
   *
   * @param {string} resourceName The name of the recovery services vault.
   *
   * @param {string} resourceGroupName The name of the resource group where the
   * recovery services vault is present.
   *
   * @param {string} fabricName Fabric name.
   *
   * @param {string} protectionContainerName Protection container name.
   *
   * @param {string} mappingName Protection container mapping name.
   *
   * @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 _beginPurge(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') {
        throw new Error('resourceName cannot be null or undefined and it must be of type string.');
      }
      if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') {
        throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.');
      }
      if (this.client.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 (fabricName === null || fabricName === undefined || typeof fabricName.valueOf() !== 'string') {
        throw new Error('fabricName cannot be null or undefined and it must be of type string.');
      }
      if (protectionContainerName === null || protectionContainerName === undefined || typeof protectionContainerName.valueOf() !== 'string') {
        throw new Error('protectionContainerName cannot be null or undefined and it must be of type string.');
      }
      if (mappingName === null || mappingName === undefined || typeof mappingName.valueOf() !== 'string') {
        throw new Error('mappingName cannot be null or undefined and it must be of type string.');
      }
      if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') {
        throw new Error('this.client.acceptLanguage must be of type string.');
      }
    } catch (error) {
      return callback(error);
    }
  
    // Construct URL
    let baseUrl = this.client.baseUri;
    let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}';
    requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName));
    requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
    requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
    requestUrl = requestUrl.replace('{fabricName}', encodeURIComponent(fabricName));
    requestUrl = requestUrl.replace('{protectionContainerName}', encodeURIComponent(protectionContainerName));
    requestUrl = requestUrl.replace('{mappingName}', encodeURIComponent(mappingName));
    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) {
            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;
  
      return callback(null, result, httpRequest, response);
    });
  }
  
  /**
   * @summary Gets the list of protection container mappings for a protection
   * container.
   *
   * Lists the protection container mappings for a protection container.
   *
   * @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 ProtectionContainerMappingCollection} 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 _listByReplicationProtectionContainersNext(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['ProtectionContainerMappingCollection']().mapper();
            result = client.deserialize(resultMapper, parsedResponse, 'result');
          }
        } catch (error) {
          let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
          deserializationError.request = msRest.stripRequest(httpRequest);
          deserializationError.response = msRest.stripResponse(response);
          return callback(deserializationError);
        }
      }
  
      return callback(null, result, httpRequest, response);
    });
  }
  
  /**
   * @summary Gets the list of all protection container mappings in a vault.
   *
   * Lists the protection container mappings in the vault.
   *
   * @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 ProtectionContainerMappingCollection} for
   *                      more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  function _listNext(nextPageLink, options, callback) {
     /* jshint validthis: true */
    let client = this.client;
    if(!callback && typeof options === 'function') {
      callback = options;
      options = null;
    }
    if (!callback) {
      throw new Error('callback cannot be null.');
    }
    // Validate
    try {
      if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') {
        throw new Error('nextPageLink cannot be null or undefined and it must be of type string.');
      }
      if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') {
        throw new Error('this.client.acceptLanguage must be of type string.');
      }
    } catch (error) {
      return callback(error);
    }
  
    // Construct URL
    let requestUrl = '{nextLink}';
    requestUrl = requestUrl.replace('{nextLink}', nextPageLink);
  
    // Create HTTP transport objects
    let httpRequest = new WebResource();
    httpRequest.method = 'GET';
    httpRequest.url = requestUrl;
    httpRequest.headers = {};
    // Set Headers
    httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
    if (this.client.generateClientRequestId) {
        httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
    }
    if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
      httpRequest.headers['accept-language'] = this.client.acceptLanguage;
    }
    if(options) {
      for(let headerName in options['customHeaders']) {
        if (options['customHeaders'].hasOwnProperty(headerName)) {
          httpRequest.headers[headerName] = options['customHeaders'][headerName];
        }
      }
    }
    httpRequest.body = null;
    // Send Request
    return client.pipeline(httpRequest, (err, response, responseBody) => {
      if (err) {
        return callback(err);
      }
      let statusCode = response.statusCode;
      if (statusCode !== 200) {
        let error = new Error(responseBody);
        error.statusCode = response.statusCode;
        error.request = msRest.stripRequest(httpRequest);
        error.response = msRest.stripResponse(response);
        if (responseBody === '') responseBody = null;
        let parsedErrorResponse;
        try {
          parsedErrorResponse = JSON.parse(responseBody);
          if (parsedErrorResponse) {
            if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
            if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
            if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
          }
          if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
            let resultMapper = new client.models['CloudError']().mapper();
            error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
          }
        } catch (defaultError) {
          error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                           `- "${responseBody}" for the default response.`;
          return callback(error);
        }
        return callback(error);
      }
      // Create Result
      let result = null;
      if (responseBody === '') responseBody = null;
      // Deserialize Response
      if (statusCode === 200) {
        let parsedResponse = null;
        try {
          parsedResponse = JSON.parse(responseBody);
          result = JSON.parse(responseBody);
          if (parsedResponse !== null && parsedResponse !== undefined) {
            let resultMapper = new client.models['ProtectionContainerMappingCollection']().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 ReplicationProtectionContainerMappings. */
  class ReplicationProtectionContainerMappings {
    /**
     * Create a ReplicationProtectionContainerMappings.
     * @param {SiteRecoveryManagementClient} client Reference to the service client.
     */
    constructor(client) {
      this.client = client;
      this._deleteMethod = _deleteMethod;
      this._get = _get;
      this._create = _create;
      this._purge = _purge;
      this._listByReplicationProtectionContainers = _listByReplicationProtectionContainers;
      this._list = _list;
      this._beginDeleteMethod = _beginDeleteMethod;
      this._beginCreate = _beginCreate;
      this._beginPurge = _beginPurge;
      this._listByReplicationProtectionContainersNext = _listByReplicationProtectionContainersNext;
      this._listNext = _listNext;
    }
  
    /**
     * @summary Remove protection container mapping.
     *
     * The operation to delete or remove a protection container mapping.
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @param {string} fabricName Fabric name.
     *
     * @param {string} protectionContainerName Protection container name.
     *
     * @param {string} mappingName Protection container mapping name.
     *
     * @param {object} removalInput Removal input.
     *
     * @param {object} [removalInput.properties] Configure protection input
     * properties.
     *
     * @param {object} [removalInput.properties.providerSpecificInput] Provider
     * specific input for unpairing.
     *
     * @param {string} [removalInput.properties.providerSpecificInput.instanceType]
     * The class type.
     *
     * @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(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, removalInput, options) {
      let client = this.client;
      let self = this;
      return new Promise((resolve, reject) => {
        self._deleteMethod(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, removalInput, options, (err, result, request, response) => {
          let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
          httpOperationResponse.body = result;
          if (err) { reject(err); }
          else { resolve(httpOperationResponse); }
          return;
        });
      });
    }
  
    /**
     * @summary Remove protection container mapping.
     *
     * The operation to delete or remove a protection container mapping.
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @param {string} fabricName Fabric name.
     *
     * @param {string} protectionContainerName Protection container name.
     *
     * @param {string} mappingName Protection container mapping name.
     *
     * @param {object} removalInput Removal input.
     *
     * @param {object} [removalInput.properties] Configure protection input
     * properties.
     *
     * @param {object} [removalInput.properties.providerSpecificInput] Provider
     * specific input for unpairing.
     *
     * @param {string} [removalInput.properties.providerSpecificInput.instanceType]
     * The class type.
     *
     * @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(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, removalInput, 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(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, removalInput, options, (err, result, request, response) => {
            if (err) { reject(err); }
            else { resolve(result); }
            return;
          });
        });
      } else {
        return self._deleteMethod(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, removalInput, options, optionalCallback);
      }
    }
  
    /**
     * @summary Gets a protection container mapping/
     *
     * Gets the details of a protection container mapping.
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @param {string} fabricName Fabric name.
     *
     * @param {string} protectionContainerName Protection container name.
     *
     * @param {string} mappingName Protection Container mapping name.
     *
     * @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<ProtectionContainerMapping>} - The deserialized result object.
     *
     * @reject {Error} - The error object.
     */
    getWithHttpOperationResponse(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, options) {
      let client = this.client;
      let self = this;
      return new Promise((resolve, reject) => {
        self._get(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, options, (err, result, request, response) => {
          let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
          httpOperationResponse.body = result;
          if (err) { reject(err); }
          else { resolve(httpOperationResponse); }
          return;
        });
      });
    }
  
    /**
     * @summary Gets a protection container mapping/
     *
     * Gets the details of a protection container mapping.
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @param {string} fabricName Fabric name.
     *
     * @param {string} protectionContainerName Protection container name.
     *
     * @param {string} mappingName Protection Container mapping name.
     *
     * @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 {ProtectionContainerMapping} - 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 ProtectionContainerMapping} 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(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, 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(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, options, (err, result, request, response) => {
            if (err) { reject(err); }
            else { resolve(result); }
            return;
          });
        });
      } else {
        return self._get(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, options, optionalCallback);
      }
    }
  
    /**
     * @summary Create protection container mapping.
     *
     * The operation to create a protection container mapping.
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @param {string} fabricName Fabric name.
     *
     * @param {string} protectionContainerName Protection container name.
     *
     * @param {string} mappingName Protection container mapping name.
     *
     * @param {object} creationInput Mapping creation input.
     *
     * @param {object} [creationInput.properties] Configure protection input
     * properties.
     *
     * @param {string} [creationInput.properties.targetProtectionContainerId] The
     * target unique protection container name.
     *
     * @param {string} [creationInput.properties.policyId] Applicable policy.
     *
     * @param {object} [creationInput.properties.providerSpecificInput] Provider
     * specific input for pairing.
     *
     * @param {string}
     * [creationInput.properties.providerSpecificInput.instanceType] The class
     * type.
     *
     * @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<ProtectionContainerMapping>} - The deserialized result object.
     *
     * @reject {Error} - The error object.
     */
    createWithHttpOperationResponse(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, creationInput, options) {
      let client = this.client;
      let self = this;
      return new Promise((resolve, reject) => {
        self._create(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, creationInput, options, (err, result, request, response) => {
          let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
          httpOperationResponse.body = result;
          if (err) { reject(err); }
          else { resolve(httpOperationResponse); }
          return;
        });
      });
    }
  
    /**
     * @summary Create protection container mapping.
     *
     * The operation to create a protection container mapping.
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @param {string} fabricName Fabric name.
     *
     * @param {string} protectionContainerName Protection container name.
     *
     * @param {string} mappingName Protection container mapping name.
     *
     * @param {object} creationInput Mapping creation input.
     *
     * @param {object} [creationInput.properties] Configure protection input
     * properties.
     *
     * @param {string} [creationInput.properties.targetProtectionContainerId] The
     * target unique protection container name.
     *
     * @param {string} [creationInput.properties.policyId] Applicable policy.
     *
     * @param {object} [creationInput.properties.providerSpecificInput] Provider
     * specific input for pairing.
     *
     * @param {string}
     * [creationInput.properties.providerSpecificInput.instanceType] The class
     * type.
     *
     * @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 {ProtectionContainerMapping} - 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 ProtectionContainerMapping} 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.
     */
    create(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, creationInput, 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._create(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, creationInput, options, (err, result, request, response) => {
            if (err) { reject(err); }
            else { resolve(result); }
            return;
          });
        });
      } else {
        return self._create(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, creationInput, options, optionalCallback);
      }
    }
  
    /**
     * @summary Purge protection container mapping.
     *
     * The operation to purge(force delete) a protection container mapping
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @param {string} fabricName Fabric name.
     *
     * @param {string} protectionContainerName Protection container name.
     *
     * @param {string} mappingName Protection container mapping name.
     *
     * @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.
     */
    purgeWithHttpOperationResponse(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, options) {
      let client = this.client;
      let self = this;
      return new Promise((resolve, reject) => {
        self._purge(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, options, (err, result, request, response) => {
          let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
          httpOperationResponse.body = result;
          if (err) { reject(err); }
          else { resolve(httpOperationResponse); }
          return;
        });
      });
    }
  
    /**
     * @summary Purge protection container mapping.
     *
     * The operation to purge(force delete) a protection container mapping
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @param {string} fabricName Fabric name.
     *
     * @param {string} protectionContainerName Protection container name.
     *
     * @param {string} mappingName Protection container mapping name.
     *
     * @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.
     */
    purge(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, 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._purge(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, options, (err, result, request, response) => {
            if (err) { reject(err); }
            else { resolve(result); }
            return;
          });
        });
      } else {
        return self._purge(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, options, optionalCallback);
      }
    }
  
    /**
     * @summary Gets the list of protection container mappings for a protection
     * container.
     *
     * Lists the protection container mappings for a protection container.
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @param {string} fabricName Fabric name.
     *
     * @param {string} protectionContainerName Protection container name.
     *
     * @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<ProtectionContainerMappingCollection>} - The deserialized result object.
     *
     * @reject {Error} - The error object.
     */
    listByReplicationProtectionContainersWithHttpOperationResponse(resourceName, resourceGroupName, fabricName, protectionContainerName, options) {
      let client = this.client;
      let self = this;
      return new Promise((resolve, reject) => {
        self._listByReplicationProtectionContainers(resourceName, resourceGroupName, fabricName, protectionContainerName, options, (err, result, request, response) => {
          let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
          httpOperationResponse.body = result;
          if (err) { reject(err); }
          else { resolve(httpOperationResponse); }
          return;
        });
      });
    }
  
    /**
     * @summary Gets the list of protection container mappings for a protection
     * container.
     *
     * Lists the protection container mappings for a protection container.
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @param {string} fabricName Fabric name.
     *
     * @param {string} protectionContainerName Protection container name.
     *
     * @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 {ProtectionContainerMappingCollection} - 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 ProtectionContainerMappingCollection} 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.
     */
    listByReplicationProtectionContainers(resourceName, resourceGroupName, fabricName, protectionContainerName, 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._listByReplicationProtectionContainers(resourceName, resourceGroupName, fabricName, protectionContainerName, options, (err, result, request, response) => {
            if (err) { reject(err); }
            else { resolve(result); }
            return;
          });
        });
      } else {
        return self._listByReplicationProtectionContainers(resourceName, resourceGroupName, fabricName, protectionContainerName, options, optionalCallback);
      }
    }
  
    /**
     * @summary Gets the list of all protection container mappings in a vault.
     *
     * Lists the protection container mappings in the vault.
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @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<ProtectionContainerMappingCollection>} - The deserialized result object.
     *
     * @reject {Error} - The error object.
     */
    listWithHttpOperationResponse(resourceName, resourceGroupName, options) {
      let client = this.client;
      let self = this;
      return new Promise((resolve, reject) => {
        self._list(resourceName, resourceGroupName, options, (err, result, request, response) => {
          let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
          httpOperationResponse.body = result;
          if (err) { reject(err); }
          else { resolve(httpOperationResponse); }
          return;
        });
      });
    }
  
    /**
     * @summary Gets the list of all protection container mappings in a vault.
     *
     * Lists the protection container mappings in the vault.
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @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 {ProtectionContainerMappingCollection} - 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 ProtectionContainerMappingCollection} for
     *                      more information.
     *
     *                      {object} [request]  - The HTTP Request object if an error did not occur.
     *
     *                      {stream} [response] - The HTTP Response stream if an error did not occur.
     */
    list(resourceName, 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._list(resourceName, resourceGroupName, options, (err, result, request, response) => {
            if (err) { reject(err); }
            else { resolve(result); }
            return;
          });
        });
      } else {
        return self._list(resourceName, resourceGroupName, options, optionalCallback);
      }
    }
  
    /**
     * @summary Remove protection container mapping.
     *
     * The operation to delete or remove a protection container mapping.
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @param {string} fabricName Fabric name.
     *
     * @param {string} protectionContainerName Protection container name.
     *
     * @param {string} mappingName Protection container mapping name.
     *
     * @param {object} removalInput Removal input.
     *
     * @param {object} [removalInput.properties] Configure protection input
     * properties.
     *
     * @param {object} [removalInput.properties.providerSpecificInput] Provider
     * specific input for unpairing.
     *
     * @param {string} [removalInput.properties.providerSpecificInput.instanceType]
     * The class type.
     *
     * @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(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, removalInput, options) {
      let client = this.client;
      let self = this;
      return new Promise((resolve, reject) => {
        self._beginDeleteMethod(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, removalInput, options, (err, result, request, response) => {
          let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
          httpOperationResponse.body = result;
          if (err) { reject(err); }
          else { resolve(httpOperationResponse); }
          return;
        });
      });
    }
  
    /**
     * @summary Remove protection container mapping.
     *
     * The operation to delete or remove a protection container mapping.
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @param {string} fabricName Fabric name.
     *
     * @param {string} protectionContainerName Protection container name.
     *
     * @param {string} mappingName Protection container mapping name.
     *
     * @param {object} removalInput Removal input.
     *
     * @param {object} [removalInput.properties] Configure protection input
     * properties.
     *
     * @param {object} [removalInput.properties.providerSpecificInput] Provider
     * specific input for unpairing.
     *
     * @param {string} [removalInput.properties.providerSpecificInput.instanceType]
     * The class type.
     *
     * @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(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, removalInput, 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(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, removalInput, options, (err, result, request, response) => {
            if (err) { reject(err); }
            else { resolve(result); }
            return;
          });
        });
      } else {
        return self._beginDeleteMethod(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, removalInput, options, optionalCallback);
      }
    }
  
    /**
     * @summary Create protection container mapping.
     *
     * The operation to create a protection container mapping.
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @param {string} fabricName Fabric name.
     *
     * @param {string} protectionContainerName Protection container name.
     *
     * @param {string} mappingName Protection container mapping name.
     *
     * @param {object} creationInput Mapping creation input.
     *
     * @param {object} [creationInput.properties] Configure protection input
     * properties.
     *
     * @param {string} [creationInput.properties.targetProtectionContainerId] The
     * target unique protection container name.
     *
     * @param {string} [creationInput.properties.policyId] Applicable policy.
     *
     * @param {object} [creationInput.properties.providerSpecificInput] Provider
     * specific input for pairing.
     *
     * @param {string}
     * [creationInput.properties.providerSpecificInput.instanceType] The class
     * type.
     *
     * @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<ProtectionContainerMapping>} - The deserialized result object.
     *
     * @reject {Error} - The error object.
     */
    beginCreateWithHttpOperationResponse(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, creationInput, options) {
      let client = this.client;
      let self = this;
      return new Promise((resolve, reject) => {
        self._beginCreate(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, creationInput, options, (err, result, request, response) => {
          let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
          httpOperationResponse.body = result;
          if (err) { reject(err); }
          else { resolve(httpOperationResponse); }
          return;
        });
      });
    }
  
    /**
     * @summary Create protection container mapping.
     *
     * The operation to create a protection container mapping.
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @param {string} fabricName Fabric name.
     *
     * @param {string} protectionContainerName Protection container name.
     *
     * @param {string} mappingName Protection container mapping name.
     *
     * @param {object} creationInput Mapping creation input.
     *
     * @param {object} [creationInput.properties] Configure protection input
     * properties.
     *
     * @param {string} [creationInput.properties.targetProtectionContainerId] The
     * target unique protection container name.
     *
     * @param {string} [creationInput.properties.policyId] Applicable policy.
     *
     * @param {object} [creationInput.properties.providerSpecificInput] Provider
     * specific input for pairing.
     *
     * @param {string}
     * [creationInput.properties.providerSpecificInput.instanceType] The class
     * type.
     *
     * @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 {ProtectionContainerMapping} - 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 ProtectionContainerMapping} 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.
     */
    beginCreate(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, creationInput, 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._beginCreate(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, creationInput, options, (err, result, request, response) => {
            if (err) { reject(err); }
            else { resolve(result); }
            return;
          });
        });
      } else {
        return self._beginCreate(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, creationInput, options, optionalCallback);
      }
    }
  
    /**
     * @summary Purge protection container mapping.
     *
     * The operation to purge(force delete) a protection container mapping
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @param {string} fabricName Fabric name.
     *
     * @param {string} protectionContainerName Protection container name.
     *
     * @param {string} mappingName Protection container mapping name.
     *
     * @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.
     */
    beginPurgeWithHttpOperationResponse(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, options) {
      let client = this.client;
      let self = this;
      return new Promise((resolve, reject) => {
        self._beginPurge(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, options, (err, result, request, response) => {
          let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
          httpOperationResponse.body = result;
          if (err) { reject(err); }
          else { resolve(httpOperationResponse); }
          return;
        });
      });
    }
  
    /**
     * @summary Purge protection container mapping.
     *
     * The operation to purge(force delete) a protection container mapping
     *
     * @param {string} resourceName The name of the recovery services vault.
     *
     * @param {string} resourceGroupName The name of the resource group where the
     * recovery services vault is present.
     *
     * @param {string} fabricName Fabric name.
     *
     * @param {string} protectionContainerName Protection container name.
     *
     * @param {string} mappingName Protection container mapping name.
     *
     * @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.
     */
    beginPurge(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, 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._beginPurge(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, options, (err, result, request, response) => {
            if (err) { reject(err); }
            else { resolve(result); }
            return;
          });
        });
      } else {
        return self._beginPurge(resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, options, optionalCallback);
      }
    }
  
    /**
     * @summary Gets the list of protection container mappings for a protection
     * container.
     *
     * Lists the protection container mappings for a protection container.
     *
     * @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<ProtectionContainerMappingCollection>} - The deserialized result object.
     *
     * @reject {Error} - The error object.
     */
    listByReplicationProtectionContainersNextWithHttpOperationResponse(nextPageLink, options) {
      let client = this.client;
      let self = this;
      return new Promise((resolve, reject) => {
        self._listByReplicationProtectionContainersNext(nextPageLink, options, (err, result, request, response) => {
          let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
          httpOperationResponse.body = result;
          if (err) { reject(err); }
          else { resolve(httpOperationResponse); }
          return;
        });
      });
    }
  
    /**
     * @summary Gets the list of protection container mappings for a protection
     * container.
     *
     * Lists the protection container mappings for a protection container.
     *
     * @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 {ProtectionContainerMappingCollection} - 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 ProtectionContainerMappingCollection} 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.
     */
    listByReplicationProtectionContainersNext(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._listByReplicationProtectionContainersNext(nextPageLink, options, (err, result, request, response) => {
            if (err) { reject(err); }
            else { resolve(result); }
            return;
          });
        });
      } else {
        return self._listByReplicationProtectionContainersNext(nextPageLink, options, optionalCallback);
      }
    }
  
    /**
     * @summary Gets the list of all protection container mappings in a vault.
     *
     * Lists the protection container mappings in the vault.
     *
     * @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<ProtectionContainerMappingCollection>} - The deserialized result object.
     *
     * @reject {Error} - The error object.
     */
    listNextWithHttpOperationResponse(nextPageLink, options) {
      let client = this.client;
      let self = this;
      return new Promise((resolve, reject) => {
        self._listNext(nextPageLink, options, (err, result, request, response) => {
          let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
          httpOperationResponse.body = result;
          if (err) { reject(err); }
          else { resolve(httpOperationResponse); }
          return;
        });
      });
    }
  
    /**
     * @summary Gets the list of all protection container mappings in a vault.
     *
     * Lists the protection container mappings in the vault.
     *
     * @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 {ProtectionContainerMappingCollection} - 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 ProtectionContainerMappingCollection} for
     *                      more information.
     *
     *                      {object} [request]  - The HTTP Request object if an error did not occur.
     *
     *                      {stream} [response] - The HTTP Response stream if an error did not occur.
     */
    listNext(nextPageLink, options, optionalCallback) {
      let client = this.client;
      let self = this;
      if (!optionalCallback && typeof options === 'function') {
        optionalCallback = options;
        options = null;
      }
      if (!optionalCallback) {
        return new Promise((resolve, reject) => {
          self._listNext(nextPageLink, options, (err, result, request, response) => {
            if (err) { reject(err); }
            else { resolve(result); }
            return;
          });
        });
      } else {
        return self._listNext(nextPageLink, options, optionalCallback);
      }
    }
  
  }
  
  module.exports = ReplicationProtectionContainerMappings;
  