/*
 * 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;

/**
 * Updates a record set within a DNS zone.
 *
 * @param {string} resourceGroupName The name of the resource group. The name
 * is case insensitive.
 *
 * @param {string} zoneName The name of the DNS zone (without a terminating
 * dot).
 *
 * @param {string} relativeRecordSetName The name of the record set, relative
 * to the name of the zone.
 *
 * @param {string} recordType The type of DNS record in this record set.
 * Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
 * 'SOA', 'SRV', 'TXT'
 *
 * @param {object} parameters Parameters supplied to the Update operation.
 *
 * @param {string} [parameters.etag] The etag of the record set.
 *
 * @param {object} [parameters.metadata] The metadata attached to the record
 * set.
 *
 * @param {number} [parameters.tTL] The TTL (time-to-live) of the records in
 * the record set.
 *
 * @param {array} [parameters.aRecords] The list of A records in the record
 * set.
 *
 * @param {array} [parameters.aaaaRecords] The list of AAAA records in the
 * record set.
 *
 * @param {array} [parameters.mxRecords] The list of MX records in the record
 * set.
 *
 * @param {array} [parameters.nsRecords] The list of NS records in the record
 * set.
 *
 * @param {array} [parameters.ptrRecords] The list of PTR records in the record
 * set.
 *
 * @param {array} [parameters.srvRecords] The list of SRV records in the record
 * set.
 *
 * @param {array} [parameters.txtRecords] The list of TXT records in the record
 * set.
 *
 * @param {object} [parameters.cnameRecord] The CNAME record in the  record
 * set.
 *
 * @param {string} [parameters.cnameRecord.cname] The canonical name for this
 * CNAME record.
 *
 * @param {object} [parameters.soaRecord] The SOA record in the record set.
 *
 * @param {string} [parameters.soaRecord.host] The domain name of the
 * authoritative name server for this SOA record.
 *
 * @param {string} [parameters.soaRecord.email] The email contact for this SOA
 * record.
 *
 * @param {number} [parameters.soaRecord.serialNumber] The serial number for
 * this SOA record.
 *
 * @param {number} [parameters.soaRecord.refreshTime] The refresh value for
 * this SOA record.
 *
 * @param {number} [parameters.soaRecord.retryTime] The retry time for this SOA
 * record.
 *
 * @param {number} [parameters.soaRecord.expireTime] The expire time for this
 * SOA record.
 *
 * @param {number} [parameters.soaRecord.minimumTtl] The minimum value for this
 * SOA record. By convention this is used to determine the negative caching
 * duration.
 *
 * @param {array} [parameters.caaRecords] The list of CAA records in the record
 * set.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {string} [options.ifMatch] The etag of the record set. Omit this
 * value to always overwrite the current record set. Specify the last-seen etag
 * value to prevent accidentally overwritting concurrent changes.
 *
 * @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 RecordSet} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _update(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let ifMatch = (options && options.ifMatch !== undefined) ? options.ifMatch : undefined;
  // Validate
  try {
    if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') {
      throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.');
    }
    if (resourceGroupName !== null && resourceGroupName !== undefined) {
      if (resourceGroupName.length > 90)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90');
      }
      if (resourceGroupName.length < 1)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1');
      }
      if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/');
      }
    }
    if (zoneName === null || zoneName === undefined || typeof zoneName.valueOf() !== 'string') {
      throw new Error('zoneName cannot be null or undefined and it must be of type string.');
    }
    if (relativeRecordSetName === null || relativeRecordSetName === undefined || typeof relativeRecordSetName.valueOf() !== 'string') {
      throw new Error('relativeRecordSetName cannot be null or undefined and it must be of type string.');
    }
    if (recordType) {
      let allowedValues = [ 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT' ];
      if (!allowedValues.some( function(item) { return item === recordType; })) {
        throw new Error(recordType + ' is not a valid value. The valid values are: ' + allowedValues);
      }
    } else {
      throw new Error('recordType cannot be null or undefined.');
    }
    if (parameters === null || parameters === undefined) {
      throw new Error('parameters cannot be null or undefined.');
    }
    if (ifMatch !== null && ifMatch !== undefined && typeof ifMatch.valueOf() !== 'string') {
      throw new Error('ifMatch must be of type string.');
    }
    if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
      throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.');
    }
    if (this.client.apiVersion !== null && this.client.apiVersion !== undefined) {
      if (this.client.apiVersion.length < 1)
      {
        throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1');
      }
    }
    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.subscriptionId !== null && this.client.subscriptionId !== undefined) {
      if (this.client.subscriptionId.length < 1)
      {
        throw new Error('"this.client.subscriptionId" should satisfy the constraint - "MinLength": 1');
      }
    }
    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.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}';
  requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
  requestUrl = requestUrl.replace('{zoneName}', encodeURIComponent(zoneName));
  requestUrl = requestUrl.replace('{relativeRecordSetName}', relativeRecordSetName);
  requestUrl = requestUrl.replace('{recordType}', encodeURIComponent(recordType));
  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 = 'PATCH';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if (this.client.generateClientRequestId) {
      httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
  }
  if (ifMatch !== undefined && ifMatch !== null) {
    httpRequest.headers['If-Match'] = ifMatch;
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (parameters !== null && parameters !== undefined) {
      let requestModelMapper = new client.models['RecordSet']().mapper();
      requestModel = client.serialize(requestModelMapper, parameters, 'parameters');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(parameters, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          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['RecordSet']().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);
  });
}

/**
 * Creates or updates a record set within a DNS zone.
 *
 * @param {string} resourceGroupName The name of the resource group. The name
 * is case insensitive.
 *
 * @param {string} zoneName The name of the DNS zone (without a terminating
 * dot).
 *
 * @param {string} relativeRecordSetName The name of the record set, relative
 * to the name of the zone.
 *
 * @param {string} recordType The type of DNS record in this record set. Record
 * sets of type SOA can be updated but not created (they are created when the
 * DNS zone is created). Possible values include: 'A', 'AAAA', 'CAA', 'CNAME',
 * 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT'
 *
 * @param {object} parameters Parameters supplied to the CreateOrUpdate
 * operation.
 *
 * @param {string} [parameters.etag] The etag of the record set.
 *
 * @param {object} [parameters.metadata] The metadata attached to the record
 * set.
 *
 * @param {number} [parameters.tTL] The TTL (time-to-live) of the records in
 * the record set.
 *
 * @param {array} [parameters.aRecords] The list of A records in the record
 * set.
 *
 * @param {array} [parameters.aaaaRecords] The list of AAAA records in the
 * record set.
 *
 * @param {array} [parameters.mxRecords] The list of MX records in the record
 * set.
 *
 * @param {array} [parameters.nsRecords] The list of NS records in the record
 * set.
 *
 * @param {array} [parameters.ptrRecords] The list of PTR records in the record
 * set.
 *
 * @param {array} [parameters.srvRecords] The list of SRV records in the record
 * set.
 *
 * @param {array} [parameters.txtRecords] The list of TXT records in the record
 * set.
 *
 * @param {object} [parameters.cnameRecord] The CNAME record in the  record
 * set.
 *
 * @param {string} [parameters.cnameRecord.cname] The canonical name for this
 * CNAME record.
 *
 * @param {object} [parameters.soaRecord] The SOA record in the record set.
 *
 * @param {string} [parameters.soaRecord.host] The domain name of the
 * authoritative name server for this SOA record.
 *
 * @param {string} [parameters.soaRecord.email] The email contact for this SOA
 * record.
 *
 * @param {number} [parameters.soaRecord.serialNumber] The serial number for
 * this SOA record.
 *
 * @param {number} [parameters.soaRecord.refreshTime] The refresh value for
 * this SOA record.
 *
 * @param {number} [parameters.soaRecord.retryTime] The retry time for this SOA
 * record.
 *
 * @param {number} [parameters.soaRecord.expireTime] The expire time for this
 * SOA record.
 *
 * @param {number} [parameters.soaRecord.minimumTtl] The minimum value for this
 * SOA record. By convention this is used to determine the negative caching
 * duration.
 *
 * @param {array} [parameters.caaRecords] The list of CAA records in the record
 * set.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {string} [options.ifMatch] The etag of the record set. Omit this
 * value to always overwrite the current record set. Specify the last-seen etag
 * value to prevent accidentally overwritting any concurrent changes.
 *
 * @param {string} [options.ifNoneMatch] Set to '*' to allow a new record set
 * to be created, but to prevent updating an existing record set. Other values
 * will be ignored.
 *
 * @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 RecordSet} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _createOrUpdate(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let ifMatch = (options && options.ifMatch !== undefined) ? options.ifMatch : undefined;
  let ifNoneMatch = (options && options.ifNoneMatch !== undefined) ? options.ifNoneMatch : undefined;
  // Validate
  try {
    if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') {
      throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.');
    }
    if (resourceGroupName !== null && resourceGroupName !== undefined) {
      if (resourceGroupName.length > 90)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90');
      }
      if (resourceGroupName.length < 1)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1');
      }
      if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/');
      }
    }
    if (zoneName === null || zoneName === undefined || typeof zoneName.valueOf() !== 'string') {
      throw new Error('zoneName cannot be null or undefined and it must be of type string.');
    }
    if (relativeRecordSetName === null || relativeRecordSetName === undefined || typeof relativeRecordSetName.valueOf() !== 'string') {
      throw new Error('relativeRecordSetName cannot be null or undefined and it must be of type string.');
    }
    if (recordType) {
      let allowedValues = [ 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT' ];
      if (!allowedValues.some( function(item) { return item === recordType; })) {
        throw new Error(recordType + ' is not a valid value. The valid values are: ' + allowedValues);
      }
    } else {
      throw new Error('recordType cannot be null or undefined.');
    }
    if (parameters === null || parameters === undefined) {
      throw new Error('parameters cannot be null or undefined.');
    }
    if (ifMatch !== null && ifMatch !== undefined && typeof ifMatch.valueOf() !== 'string') {
      throw new Error('ifMatch must be of type string.');
    }
    if (ifNoneMatch !== null && ifNoneMatch !== undefined && typeof ifNoneMatch.valueOf() !== 'string') {
      throw new Error('ifNoneMatch must be of type string.');
    }
    if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
      throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.');
    }
    if (this.client.apiVersion !== null && this.client.apiVersion !== undefined) {
      if (this.client.apiVersion.length < 1)
      {
        throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1');
      }
    }
    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.subscriptionId !== null && this.client.subscriptionId !== undefined) {
      if (this.client.subscriptionId.length < 1)
      {
        throw new Error('"this.client.subscriptionId" should satisfy the constraint - "MinLength": 1');
      }
    }
    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.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}';
  requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
  requestUrl = requestUrl.replace('{zoneName}', encodeURIComponent(zoneName));
  requestUrl = requestUrl.replace('{relativeRecordSetName}', relativeRecordSetName);
  requestUrl = requestUrl.replace('{recordType}', encodeURIComponent(recordType));
  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 = '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 (ifMatch !== undefined && ifMatch !== null) {
    httpRequest.headers['If-Match'] = ifMatch;
  }
  if (ifNoneMatch !== undefined && ifNoneMatch !== null) {
    httpRequest.headers['If-None-Match'] = ifNoneMatch;
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (parameters !== null && parameters !== undefined) {
      let requestModelMapper = new client.models['RecordSet']().mapper();
      requestModel = client.serialize(requestModelMapper, parameters, 'parameters');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(parameters, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200 && statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          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['RecordSet']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['RecordSet']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError1.request = msRest.stripRequest(httpRequest);
        deserializationError1.response = msRest.stripResponse(response);
        return callback(deserializationError1);
      }
    }

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

/**
 * Deletes a record set from a DNS zone. This operation cannot be undone.
 *
 * @param {string} resourceGroupName The name of the resource group. The name
 * is case insensitive.
 *
 * @param {string} zoneName The name of the DNS zone (without a terminating
 * dot).
 *
 * @param {string} relativeRecordSetName The name of the record set, relative
 * to the name of the zone.
 *
 * @param {string} recordType The type of DNS record in this record set. Record
 * sets of type SOA cannot be deleted (they are deleted when the DNS zone is
 * deleted). Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS',
 * 'PTR', 'SOA', 'SRV', 'TXT'
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {string} [options.ifMatch] The etag of the record set. Omit this
 * value to always delete the current record set. Specify the last-seen etag
 * value to prevent accidentally deleting any concurrent changes.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {null} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteMethod(resourceGroupName, zoneName, relativeRecordSetName, recordType, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let ifMatch = (options && options.ifMatch !== undefined) ? options.ifMatch : undefined;
  // Validate
  try {
    if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') {
      throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.');
    }
    if (resourceGroupName !== null && resourceGroupName !== undefined) {
      if (resourceGroupName.length > 90)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90');
      }
      if (resourceGroupName.length < 1)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1');
      }
      if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/');
      }
    }
    if (zoneName === null || zoneName === undefined || typeof zoneName.valueOf() !== 'string') {
      throw new Error('zoneName cannot be null or undefined and it must be of type string.');
    }
    if (relativeRecordSetName === null || relativeRecordSetName === undefined || typeof relativeRecordSetName.valueOf() !== 'string') {
      throw new Error('relativeRecordSetName cannot be null or undefined and it must be of type string.');
    }
    if (recordType) {
      let allowedValues = [ 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT' ];
      if (!allowedValues.some( function(item) { return item === recordType; })) {
        throw new Error(recordType + ' is not a valid value. The valid values are: ' + allowedValues);
      }
    } else {
      throw new Error('recordType cannot be null or undefined.');
    }
    if (ifMatch !== null && ifMatch !== undefined && typeof ifMatch.valueOf() !== 'string') {
      throw new Error('ifMatch must be of type string.');
    }
    if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
      throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.');
    }
    if (this.client.apiVersion !== null && this.client.apiVersion !== undefined) {
      if (this.client.apiVersion.length < 1)
      {
        throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1');
      }
    }
    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.subscriptionId !== null && this.client.subscriptionId !== undefined) {
      if (this.client.subscriptionId.length < 1)
      {
        throw new Error('"this.client.subscriptionId" should satisfy the constraint - "MinLength": 1');
      }
    }
    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.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}';
  requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
  requestUrl = requestUrl.replace('{zoneName}', encodeURIComponent(zoneName));
  requestUrl = requestUrl.replace('{relativeRecordSetName}', relativeRecordSetName);
  requestUrl = requestUrl.replace('{recordType}', encodeURIComponent(recordType));
  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 = '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 (ifMatch !== undefined && ifMatch !== null) {
    httpRequest.headers['If-Match'] = ifMatch;
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200 && statusCode !== 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);
  });
}

/**
 * Gets a record set.
 *
 * @param {string} resourceGroupName The name of the resource group. The name
 * is case insensitive.
 *
 * @param {string} zoneName The name of the DNS zone (without a terminating
 * dot).
 *
 * @param {string} relativeRecordSetName The name of the record set, relative
 * to the name of the zone.
 *
 * @param {string} recordType The type of DNS record in this record set.
 * Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
 * 'SOA', 'SRV', 'TXT'
 *
 * @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 RecordSet} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _get(resourceGroupName, zoneName, relativeRecordSetName, recordType, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') {
      throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.');
    }
    if (resourceGroupName !== null && resourceGroupName !== undefined) {
      if (resourceGroupName.length > 90)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90');
      }
      if (resourceGroupName.length < 1)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1');
      }
      if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/');
      }
    }
    if (zoneName === null || zoneName === undefined || typeof zoneName.valueOf() !== 'string') {
      throw new Error('zoneName cannot be null or undefined and it must be of type string.');
    }
    if (relativeRecordSetName === null || relativeRecordSetName === undefined || typeof relativeRecordSetName.valueOf() !== 'string') {
      throw new Error('relativeRecordSetName cannot be null or undefined and it must be of type string.');
    }
    if (recordType) {
      let allowedValues = [ 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT' ];
      if (!allowedValues.some( function(item) { return item === recordType; })) {
        throw new Error(recordType + ' is not a valid value. The valid values are: ' + allowedValues);
      }
    } else {
      throw new Error('recordType cannot be null or undefined.');
    }
    if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
      throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.');
    }
    if (this.client.apiVersion !== null && this.client.apiVersion !== undefined) {
      if (this.client.apiVersion.length < 1)
      {
        throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1');
      }
    }
    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.subscriptionId !== null && this.client.subscriptionId !== undefined) {
      if (this.client.subscriptionId.length < 1)
      {
        throw new Error('"this.client.subscriptionId" should satisfy the constraint - "MinLength": 1');
      }
    }
    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.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}';
  requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
  requestUrl = requestUrl.replace('{zoneName}', encodeURIComponent(zoneName));
  requestUrl = requestUrl.replace('{relativeRecordSetName}', relativeRecordSetName);
  requestUrl = requestUrl.replace('{recordType}', encodeURIComponent(recordType));
  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['RecordSet']().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);
  });
}

/**
 * Lists the record sets of a specified type in a DNS zone.
 *
 * @param {string} resourceGroupName The name of the resource group. The name
 * is case insensitive.
 *
 * @param {string} zoneName The name of the DNS zone (without a terminating
 * dot).
 *
 * @param {string} recordType The type of record sets to enumerate. Possible
 * values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR', 'SOA',
 * 'SRV', 'TXT'
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {number} [options.top] The maximum number of record sets to return.
 * If not specified, returns up to 100 record sets.
 *
 * @param {string} [options.recordsetnamesuffix] The suffix label of the record
 * set name that has to be used to filter the record set enumerations. If this
 * parameter is specified, Enumeration will return only records that end with
 * .<recordSetNameSuffix>
 *
 * @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 RecordSetListResult} 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 _listByType(resourceGroupName, zoneName, recordType, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let top = (options && options.top !== undefined) ? options.top : undefined;
  let recordsetnamesuffix = (options && options.recordsetnamesuffix !== undefined) ? options.recordsetnamesuffix : undefined;
  // Validate
  try {
    if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') {
      throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.');
    }
    if (resourceGroupName !== null && resourceGroupName !== undefined) {
      if (resourceGroupName.length > 90)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90');
      }
      if (resourceGroupName.length < 1)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1');
      }
      if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/');
      }
    }
    if (zoneName === null || zoneName === undefined || typeof zoneName.valueOf() !== 'string') {
      throw new Error('zoneName cannot be null or undefined and it must be of type string.');
    }
    if (recordType) {
      let allowedValues = [ 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT' ];
      if (!allowedValues.some( function(item) { return item === recordType; })) {
        throw new Error(recordType + ' is not a valid value. The valid values are: ' + allowedValues);
      }
    } else {
      throw new Error('recordType cannot be null or undefined.');
    }
    if (top !== null && top !== undefined && typeof top !== 'number') {
      throw new Error('top must be of type number.');
    }
    if (recordsetnamesuffix !== null && recordsetnamesuffix !== undefined && typeof recordsetnamesuffix.valueOf() !== 'string') {
      throw new Error('recordsetnamesuffix must be of type string.');
    }
    if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
      throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.');
    }
    if (this.client.apiVersion !== null && this.client.apiVersion !== undefined) {
      if (this.client.apiVersion.length < 1)
      {
        throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1');
      }
    }
    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.subscriptionId !== null && this.client.subscriptionId !== undefined) {
      if (this.client.subscriptionId.length < 1)
      {
        throw new Error('"this.client.subscriptionId" should satisfy the constraint - "MinLength": 1');
      }
    }
    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.Network/dnsZones/{zoneName}/{recordType}';
  requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
  requestUrl = requestUrl.replace('{zoneName}', encodeURIComponent(zoneName));
  requestUrl = requestUrl.replace('{recordType}', encodeURIComponent(recordType));
  requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
  let queryParameters = [];
  if (top !== null && top !== undefined) {
    queryParameters.push('$top=' + encodeURIComponent(top.toString()));
  }
  if (recordsetnamesuffix !== null && recordsetnamesuffix !== undefined) {
    queryParameters.push('$recordsetnamesuffix=' + encodeURIComponent(recordsetnamesuffix));
  }
  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['RecordSetListResult']().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);
  });
}

/**
 * Lists all record sets in a DNS zone.
 *
 * @param {string} resourceGroupName The name of the resource group. The name
 * is case insensitive.
 *
 * @param {string} zoneName The name of the DNS zone (without a terminating
 * dot).
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {number} [options.top] The maximum number of record sets to return.
 * If not specified, returns up to 100 record sets.
 *
 * @param {string} [options.recordsetnamesuffix] The suffix label of the record
 * set name that has to be used to filter the record set enumerations. If this
 * parameter is specified, Enumeration will return only records that end with
 * .<recordSetNameSuffix>
 *
 * @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 RecordSetListResult} 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 _listByDnsZone(resourceGroupName, zoneName, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let top = (options && options.top !== undefined) ? options.top : undefined;
  let recordsetnamesuffix = (options && options.recordsetnamesuffix !== undefined) ? options.recordsetnamesuffix : undefined;
  // Validate
  try {
    if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') {
      throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.');
    }
    if (resourceGroupName !== null && resourceGroupName !== undefined) {
      if (resourceGroupName.length > 90)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90');
      }
      if (resourceGroupName.length < 1)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1');
      }
      if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/');
      }
    }
    if (zoneName === null || zoneName === undefined || typeof zoneName.valueOf() !== 'string') {
      throw new Error('zoneName cannot be null or undefined and it must be of type string.');
    }
    if (top !== null && top !== undefined && typeof top !== 'number') {
      throw new Error('top must be of type number.');
    }
    if (recordsetnamesuffix !== null && recordsetnamesuffix !== undefined && typeof recordsetnamesuffix.valueOf() !== 'string') {
      throw new Error('recordsetnamesuffix must be of type string.');
    }
    if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
      throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.');
    }
    if (this.client.apiVersion !== null && this.client.apiVersion !== undefined) {
      if (this.client.apiVersion.length < 1)
      {
        throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1');
      }
    }
    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.subscriptionId !== null && this.client.subscriptionId !== undefined) {
      if (this.client.subscriptionId.length < 1)
      {
        throw new Error('"this.client.subscriptionId" should satisfy the constraint - "MinLength": 1');
      }
    }
    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.Network/dnsZones/{zoneName}/recordsets';
  requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
  requestUrl = requestUrl.replace('{zoneName}', encodeURIComponent(zoneName));
  requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
  let queryParameters = [];
  if (top !== null && top !== undefined) {
    queryParameters.push('$top=' + encodeURIComponent(top.toString()));
  }
  if (recordsetnamesuffix !== null && recordsetnamesuffix !== undefined) {
    queryParameters.push('$recordsetnamesuffix=' + encodeURIComponent(recordsetnamesuffix));
  }
  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['RecordSetListResult']().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);
  });
}

/**
 * Lists all record sets in a DNS zone.
 *
 * @param {string} resourceGroupName The name of the resource group. The name
 * is case insensitive.
 *
 * @param {string} zoneName The name of the DNS zone (without a terminating
 * dot).
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {number} [options.top] The maximum number of record sets to return.
 * If not specified, returns up to 100 record sets.
 *
 * @param {string} [options.recordSetNameSuffix] The suffix label of the record
 * set name that has to be used to filter the record set enumerations. If this
 * parameter is specified, Enumeration will return only records that end with
 * .<recordSetNameSuffix>
 *
 * @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 RecordSetListResult} 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 _listAllByDnsZone(resourceGroupName, zoneName, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let top = (options && options.top !== undefined) ? options.top : undefined;
  let recordSetNameSuffix = (options && options.recordSetNameSuffix !== undefined) ? options.recordSetNameSuffix : undefined;
  // Validate
  try {
    if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') {
      throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.');
    }
    if (resourceGroupName !== null && resourceGroupName !== undefined) {
      if (resourceGroupName.length > 90)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90');
      }
      if (resourceGroupName.length < 1)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1');
      }
      if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null)
      {
        throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/');
      }
    }
    if (zoneName === null || zoneName === undefined || typeof zoneName.valueOf() !== 'string') {
      throw new Error('zoneName cannot be null or undefined and it must be of type string.');
    }
    if (top !== null && top !== undefined && typeof top !== 'number') {
      throw new Error('top must be of type number.');
    }
    if (recordSetNameSuffix !== null && recordSetNameSuffix !== undefined && typeof recordSetNameSuffix.valueOf() !== 'string') {
      throw new Error('recordSetNameSuffix must be of type string.');
    }
    if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') {
      throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.');
    }
    if (this.client.apiVersion !== null && this.client.apiVersion !== undefined) {
      if (this.client.apiVersion.length < 1)
      {
        throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1');
      }
    }
    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.subscriptionId !== null && this.client.subscriptionId !== undefined) {
      if (this.client.subscriptionId.length < 1)
      {
        throw new Error('"this.client.subscriptionId" should satisfy the constraint - "MinLength": 1');
      }
    }
    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.Network/dnsZones/{zoneName}/all';
  requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName));
  requestUrl = requestUrl.replace('{zoneName}', encodeURIComponent(zoneName));
  requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId));
  let queryParameters = [];
  if (top !== null && top !== undefined) {
    queryParameters.push('$top=' + encodeURIComponent(top.toString()));
  }
  if (recordSetNameSuffix !== null && recordSetNameSuffix !== undefined) {
    queryParameters.push('$recordsetnamesuffix=' + encodeURIComponent(recordSetNameSuffix));
  }
  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['RecordSetListResult']().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);
  });
}

/**
 * Lists the record sets of a specified type in a DNS zone.
 *
 * @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 RecordSetListResult} 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 _listByTypeNext(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['RecordSetListResult']().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);
  });
}

/**
 * Lists all record sets in a DNS zone.
 *
 * @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 RecordSetListResult} 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 _listByDnsZoneNext(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['RecordSetListResult']().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);
  });
}

/**
 * Lists all record sets in a DNS zone.
 *
 * @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 RecordSetListResult} 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 _listAllByDnsZoneNext(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['RecordSetListResult']().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 RecordSets. */
class RecordSets {
  /**
   * Create a RecordSets.
   * @param {DnsManagementClient} client Reference to the service client.
   */
  constructor(client) {
    this.client = client;
    this._update = _update;
    this._createOrUpdate = _createOrUpdate;
    this._deleteMethod = _deleteMethod;
    this._get = _get;
    this._listByType = _listByType;
    this._listByDnsZone = _listByDnsZone;
    this._listAllByDnsZone = _listAllByDnsZone;
    this._listByTypeNext = _listByTypeNext;
    this._listByDnsZoneNext = _listByDnsZoneNext;
    this._listAllByDnsZoneNext = _listAllByDnsZoneNext;
  }

  /**
   * Updates a record set within a DNS zone.
   *
   * @param {string} resourceGroupName The name of the resource group. The name
   * is case insensitive.
   *
   * @param {string} zoneName The name of the DNS zone (without a terminating
   * dot).
   *
   * @param {string} relativeRecordSetName The name of the record set, relative
   * to the name of the zone.
   *
   * @param {string} recordType The type of DNS record in this record set.
   * Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
   * 'SOA', 'SRV', 'TXT'
   *
   * @param {object} parameters Parameters supplied to the Update operation.
   *
   * @param {string} [parameters.etag] The etag of the record set.
   *
   * @param {object} [parameters.metadata] The metadata attached to the record
   * set.
   *
   * @param {number} [parameters.tTL] The TTL (time-to-live) of the records in
   * the record set.
   *
   * @param {array} [parameters.aRecords] The list of A records in the record
   * set.
   *
   * @param {array} [parameters.aaaaRecords] The list of AAAA records in the
   * record set.
   *
   * @param {array} [parameters.mxRecords] The list of MX records in the record
   * set.
   *
   * @param {array} [parameters.nsRecords] The list of NS records in the record
   * set.
   *
   * @param {array} [parameters.ptrRecords] The list of PTR records in the record
   * set.
   *
   * @param {array} [parameters.srvRecords] The list of SRV records in the record
   * set.
   *
   * @param {array} [parameters.txtRecords] The list of TXT records in the record
   * set.
   *
   * @param {object} [parameters.cnameRecord] The CNAME record in the  record
   * set.
   *
   * @param {string} [parameters.cnameRecord.cname] The canonical name for this
   * CNAME record.
   *
   * @param {object} [parameters.soaRecord] The SOA record in the record set.
   *
   * @param {string} [parameters.soaRecord.host] The domain name of the
   * authoritative name server for this SOA record.
   *
   * @param {string} [parameters.soaRecord.email] The email contact for this SOA
   * record.
   *
   * @param {number} [parameters.soaRecord.serialNumber] The serial number for
   * this SOA record.
   *
   * @param {number} [parameters.soaRecord.refreshTime] The refresh value for
   * this SOA record.
   *
   * @param {number} [parameters.soaRecord.retryTime] The retry time for this SOA
   * record.
   *
   * @param {number} [parameters.soaRecord.expireTime] The expire time for this
   * SOA record.
   *
   * @param {number} [parameters.soaRecord.minimumTtl] The minimum value for this
   * SOA record. By convention this is used to determine the negative caching
   * duration.
   *
   * @param {array} [parameters.caaRecords] The list of CAA records in the record
   * set.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {string} [options.ifMatch] The etag of the record set. Omit this
   * value to always overwrite the current record set. Specify the last-seen etag
   * value to prevent accidentally overwritting concurrent changes.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<RecordSet>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateWithHttpOperationResponse(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._update(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Updates a record set within a DNS zone.
   *
   * @param {string} resourceGroupName The name of the resource group. The name
   * is case insensitive.
   *
   * @param {string} zoneName The name of the DNS zone (without a terminating
   * dot).
   *
   * @param {string} relativeRecordSetName The name of the record set, relative
   * to the name of the zone.
   *
   * @param {string} recordType The type of DNS record in this record set.
   * Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
   * 'SOA', 'SRV', 'TXT'
   *
   * @param {object} parameters Parameters supplied to the Update operation.
   *
   * @param {string} [parameters.etag] The etag of the record set.
   *
   * @param {object} [parameters.metadata] The metadata attached to the record
   * set.
   *
   * @param {number} [parameters.tTL] The TTL (time-to-live) of the records in
   * the record set.
   *
   * @param {array} [parameters.aRecords] The list of A records in the record
   * set.
   *
   * @param {array} [parameters.aaaaRecords] The list of AAAA records in the
   * record set.
   *
   * @param {array} [parameters.mxRecords] The list of MX records in the record
   * set.
   *
   * @param {array} [parameters.nsRecords] The list of NS records in the record
   * set.
   *
   * @param {array} [parameters.ptrRecords] The list of PTR records in the record
   * set.
   *
   * @param {array} [parameters.srvRecords] The list of SRV records in the record
   * set.
   *
   * @param {array} [parameters.txtRecords] The list of TXT records in the record
   * set.
   *
   * @param {object} [parameters.cnameRecord] The CNAME record in the  record
   * set.
   *
   * @param {string} [parameters.cnameRecord.cname] The canonical name for this
   * CNAME record.
   *
   * @param {object} [parameters.soaRecord] The SOA record in the record set.
   *
   * @param {string} [parameters.soaRecord.host] The domain name of the
   * authoritative name server for this SOA record.
   *
   * @param {string} [parameters.soaRecord.email] The email contact for this SOA
   * record.
   *
   * @param {number} [parameters.soaRecord.serialNumber] The serial number for
   * this SOA record.
   *
   * @param {number} [parameters.soaRecord.refreshTime] The refresh value for
   * this SOA record.
   *
   * @param {number} [parameters.soaRecord.retryTime] The retry time for this SOA
   * record.
   *
   * @param {number} [parameters.soaRecord.expireTime] The expire time for this
   * SOA record.
   *
   * @param {number} [parameters.soaRecord.minimumTtl] The minimum value for this
   * SOA record. By convention this is used to determine the negative caching
   * duration.
   *
   * @param {array} [parameters.caaRecords] The list of CAA records in the record
   * set.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {string} [options.ifMatch] The etag of the record set. Omit this
   * value to always overwrite the current record set. Specify the last-seen etag
   * value to prevent accidentally overwritting concurrent changes.
   *
   * @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 {RecordSet} - 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 RecordSet} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  update(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._update(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._update(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, options, optionalCallback);
    }
  }

  /**
   * Creates or updates a record set within a DNS zone.
   *
   * @param {string} resourceGroupName The name of the resource group. The name
   * is case insensitive.
   *
   * @param {string} zoneName The name of the DNS zone (without a terminating
   * dot).
   *
   * @param {string} relativeRecordSetName The name of the record set, relative
   * to the name of the zone.
   *
   * @param {string} recordType The type of DNS record in this record set. Record
   * sets of type SOA can be updated but not created (they are created when the
   * DNS zone is created). Possible values include: 'A', 'AAAA', 'CAA', 'CNAME',
   * 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT'
   *
   * @param {object} parameters Parameters supplied to the CreateOrUpdate
   * operation.
   *
   * @param {string} [parameters.etag] The etag of the record set.
   *
   * @param {object} [parameters.metadata] The metadata attached to the record
   * set.
   *
   * @param {number} [parameters.tTL] The TTL (time-to-live) of the records in
   * the record set.
   *
   * @param {array} [parameters.aRecords] The list of A records in the record
   * set.
   *
   * @param {array} [parameters.aaaaRecords] The list of AAAA records in the
   * record set.
   *
   * @param {array} [parameters.mxRecords] The list of MX records in the record
   * set.
   *
   * @param {array} [parameters.nsRecords] The list of NS records in the record
   * set.
   *
   * @param {array} [parameters.ptrRecords] The list of PTR records in the record
   * set.
   *
   * @param {array} [parameters.srvRecords] The list of SRV records in the record
   * set.
   *
   * @param {array} [parameters.txtRecords] The list of TXT records in the record
   * set.
   *
   * @param {object} [parameters.cnameRecord] The CNAME record in the  record
   * set.
   *
   * @param {string} [parameters.cnameRecord.cname] The canonical name for this
   * CNAME record.
   *
   * @param {object} [parameters.soaRecord] The SOA record in the record set.
   *
   * @param {string} [parameters.soaRecord.host] The domain name of the
   * authoritative name server for this SOA record.
   *
   * @param {string} [parameters.soaRecord.email] The email contact for this SOA
   * record.
   *
   * @param {number} [parameters.soaRecord.serialNumber] The serial number for
   * this SOA record.
   *
   * @param {number} [parameters.soaRecord.refreshTime] The refresh value for
   * this SOA record.
   *
   * @param {number} [parameters.soaRecord.retryTime] The retry time for this SOA
   * record.
   *
   * @param {number} [parameters.soaRecord.expireTime] The expire time for this
   * SOA record.
   *
   * @param {number} [parameters.soaRecord.minimumTtl] The minimum value for this
   * SOA record. By convention this is used to determine the negative caching
   * duration.
   *
   * @param {array} [parameters.caaRecords] The list of CAA records in the record
   * set.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {string} [options.ifMatch] The etag of the record set. Omit this
   * value to always overwrite the current record set. Specify the last-seen etag
   * value to prevent accidentally overwritting any concurrent changes.
   *
   * @param {string} [options.ifNoneMatch] Set to '*' to allow a new record set
   * to be created, but to prevent updating an existing record set. Other values
   * will be ignored.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<RecordSet>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  createOrUpdateWithHttpOperationResponse(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._createOrUpdate(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Creates or updates a record set within a DNS zone.
   *
   * @param {string} resourceGroupName The name of the resource group. The name
   * is case insensitive.
   *
   * @param {string} zoneName The name of the DNS zone (without a terminating
   * dot).
   *
   * @param {string} relativeRecordSetName The name of the record set, relative
   * to the name of the zone.
   *
   * @param {string} recordType The type of DNS record in this record set. Record
   * sets of type SOA can be updated but not created (they are created when the
   * DNS zone is created). Possible values include: 'A', 'AAAA', 'CAA', 'CNAME',
   * 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT'
   *
   * @param {object} parameters Parameters supplied to the CreateOrUpdate
   * operation.
   *
   * @param {string} [parameters.etag] The etag of the record set.
   *
   * @param {object} [parameters.metadata] The metadata attached to the record
   * set.
   *
   * @param {number} [parameters.tTL] The TTL (time-to-live) of the records in
   * the record set.
   *
   * @param {array} [parameters.aRecords] The list of A records in the record
   * set.
   *
   * @param {array} [parameters.aaaaRecords] The list of AAAA records in the
   * record set.
   *
   * @param {array} [parameters.mxRecords] The list of MX records in the record
   * set.
   *
   * @param {array} [parameters.nsRecords] The list of NS records in the record
   * set.
   *
   * @param {array} [parameters.ptrRecords] The list of PTR records in the record
   * set.
   *
   * @param {array} [parameters.srvRecords] The list of SRV records in the record
   * set.
   *
   * @param {array} [parameters.txtRecords] The list of TXT records in the record
   * set.
   *
   * @param {object} [parameters.cnameRecord] The CNAME record in the  record
   * set.
   *
   * @param {string} [parameters.cnameRecord.cname] The canonical name for this
   * CNAME record.
   *
   * @param {object} [parameters.soaRecord] The SOA record in the record set.
   *
   * @param {string} [parameters.soaRecord.host] The domain name of the
   * authoritative name server for this SOA record.
   *
   * @param {string} [parameters.soaRecord.email] The email contact for this SOA
   * record.
   *
   * @param {number} [parameters.soaRecord.serialNumber] The serial number for
   * this SOA record.
   *
   * @param {number} [parameters.soaRecord.refreshTime] The refresh value for
   * this SOA record.
   *
   * @param {number} [parameters.soaRecord.retryTime] The retry time for this SOA
   * record.
   *
   * @param {number} [parameters.soaRecord.expireTime] The expire time for this
   * SOA record.
   *
   * @param {number} [parameters.soaRecord.minimumTtl] The minimum value for this
   * SOA record. By convention this is used to determine the negative caching
   * duration.
   *
   * @param {array} [parameters.caaRecords] The list of CAA records in the record
   * set.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {string} [options.ifMatch] The etag of the record set. Omit this
   * value to always overwrite the current record set. Specify the last-seen etag
   * value to prevent accidentally overwritting any concurrent changes.
   *
   * @param {string} [options.ifNoneMatch] Set to '*' to allow a new record set
   * to be created, but to prevent updating an existing record set. Other values
   * will be ignored.
   *
   * @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 {RecordSet} - 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 RecordSet} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  createOrUpdate(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._createOrUpdate(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._createOrUpdate(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, options, optionalCallback);
    }
  }

  /**
   * Deletes a record set from a DNS zone. This operation cannot be undone.
   *
   * @param {string} resourceGroupName The name of the resource group. The name
   * is case insensitive.
   *
   * @param {string} zoneName The name of the DNS zone (without a terminating
   * dot).
   *
   * @param {string} relativeRecordSetName The name of the record set, relative
   * to the name of the zone.
   *
   * @param {string} recordType The type of DNS record in this record set. Record
   * sets of type SOA cannot be deleted (they are deleted when the DNS zone is
   * deleted). Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS',
   * 'PTR', 'SOA', 'SRV', 'TXT'
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {string} [options.ifMatch] The etag of the record set. Omit this
   * value to always delete the current record set. Specify the last-seen etag
   * value to prevent accidentally deleting any concurrent changes.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<null>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteMethodWithHttpOperationResponse(resourceGroupName, zoneName, relativeRecordSetName, recordType, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteMethod(resourceGroupName, zoneName, relativeRecordSetName, recordType, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Deletes a record set from a DNS zone. This operation cannot be undone.
   *
   * @param {string} resourceGroupName The name of the resource group. The name
   * is case insensitive.
   *
   * @param {string} zoneName The name of the DNS zone (without a terminating
   * dot).
   *
   * @param {string} relativeRecordSetName The name of the record set, relative
   * to the name of the zone.
   *
   * @param {string} recordType The type of DNS record in this record set. Record
   * sets of type SOA cannot be deleted (they are deleted when the DNS zone is
   * deleted). Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS',
   * 'PTR', 'SOA', 'SRV', 'TXT'
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {string} [options.ifMatch] The etag of the record set. Omit this
   * value to always delete the current record set. Specify the last-seen etag
   * value to prevent accidentally deleting any concurrent changes.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {null} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {null} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteMethod(resourceGroupName, zoneName, relativeRecordSetName, recordType, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteMethod(resourceGroupName, zoneName, relativeRecordSetName, recordType, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteMethod(resourceGroupName, zoneName, relativeRecordSetName, recordType, options, optionalCallback);
    }
  }

  /**
   * Gets a record set.
   *
   * @param {string} resourceGroupName The name of the resource group. The name
   * is case insensitive.
   *
   * @param {string} zoneName The name of the DNS zone (without a terminating
   * dot).
   *
   * @param {string} relativeRecordSetName The name of the record set, relative
   * to the name of the zone.
   *
   * @param {string} recordType The type of DNS record in this record set.
   * Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
   * 'SOA', 'SRV', 'TXT'
   *
   * @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<RecordSet>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getWithHttpOperationResponse(resourceGroupName, zoneName, relativeRecordSetName, recordType, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._get(resourceGroupName, zoneName, relativeRecordSetName, recordType, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets a record set.
   *
   * @param {string} resourceGroupName The name of the resource group. The name
   * is case insensitive.
   *
   * @param {string} zoneName The name of the DNS zone (without a terminating
   * dot).
   *
   * @param {string} relativeRecordSetName The name of the record set, relative
   * to the name of the zone.
   *
   * @param {string} recordType The type of DNS record in this record set.
   * Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
   * 'SOA', 'SRV', 'TXT'
   *
   * @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 {RecordSet} - 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 RecordSet} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  get(resourceGroupName, zoneName, relativeRecordSetName, recordType, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._get(resourceGroupName, zoneName, relativeRecordSetName, recordType, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._get(resourceGroupName, zoneName, relativeRecordSetName, recordType, options, optionalCallback);
    }
  }

  /**
   * Lists the record sets of a specified type in a DNS zone.
   *
   * @param {string} resourceGroupName The name of the resource group. The name
   * is case insensitive.
   *
   * @param {string} zoneName The name of the DNS zone (without a terminating
   * dot).
   *
   * @param {string} recordType The type of record sets to enumerate. Possible
   * values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR', 'SOA',
   * 'SRV', 'TXT'
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.top] The maximum number of record sets to return.
   * If not specified, returns up to 100 record sets.
   *
   * @param {string} [options.recordsetnamesuffix] The suffix label of the record
   * set name that has to be used to filter the record set enumerations. If this
   * parameter is specified, Enumeration will return only records that end with
   * .<recordSetNameSuffix>
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<RecordSetListResult>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listByTypeWithHttpOperationResponse(resourceGroupName, zoneName, recordType, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listByType(resourceGroupName, zoneName, recordType, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Lists the record sets of a specified type in a DNS zone.
   *
   * @param {string} resourceGroupName The name of the resource group. The name
   * is case insensitive.
   *
   * @param {string} zoneName The name of the DNS zone (without a terminating
   * dot).
   *
   * @param {string} recordType The type of record sets to enumerate. Possible
   * values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR', 'SOA',
   * 'SRV', 'TXT'
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.top] The maximum number of record sets to return.
   * If not specified, returns up to 100 record sets.
   *
   * @param {string} [options.recordsetnamesuffix] The suffix label of the record
   * set name that has to be used to filter the record set enumerations. If this
   * parameter is specified, Enumeration will return only records that end with
   * .<recordSetNameSuffix>
   *
   * @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 {RecordSetListResult} - 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 RecordSetListResult} 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.
   */
  listByType(resourceGroupName, zoneName, recordType, 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._listByType(resourceGroupName, zoneName, recordType, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listByType(resourceGroupName, zoneName, recordType, options, optionalCallback);
    }
  }

  /**
   * Lists all record sets in a DNS zone.
   *
   * @param {string} resourceGroupName The name of the resource group. The name
   * is case insensitive.
   *
   * @param {string} zoneName The name of the DNS zone (without a terminating
   * dot).
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.top] The maximum number of record sets to return.
   * If not specified, returns up to 100 record sets.
   *
   * @param {string} [options.recordsetnamesuffix] The suffix label of the record
   * set name that has to be used to filter the record set enumerations. If this
   * parameter is specified, Enumeration will return only records that end with
   * .<recordSetNameSuffix>
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<RecordSetListResult>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listByDnsZoneWithHttpOperationResponse(resourceGroupName, zoneName, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listByDnsZone(resourceGroupName, zoneName, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Lists all record sets in a DNS zone.
   *
   * @param {string} resourceGroupName The name of the resource group. The name
   * is case insensitive.
   *
   * @param {string} zoneName The name of the DNS zone (without a terminating
   * dot).
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.top] The maximum number of record sets to return.
   * If not specified, returns up to 100 record sets.
   *
   * @param {string} [options.recordsetnamesuffix] The suffix label of the record
   * set name that has to be used to filter the record set enumerations. If this
   * parameter is specified, Enumeration will return only records that end with
   * .<recordSetNameSuffix>
   *
   * @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 {RecordSetListResult} - 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 RecordSetListResult} 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.
   */
  listByDnsZone(resourceGroupName, zoneName, 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._listByDnsZone(resourceGroupName, zoneName, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listByDnsZone(resourceGroupName, zoneName, options, optionalCallback);
    }
  }

  /**
   * Lists all record sets in a DNS zone.
   *
   * @param {string} resourceGroupName The name of the resource group. The name
   * is case insensitive.
   *
   * @param {string} zoneName The name of the DNS zone (without a terminating
   * dot).
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.top] The maximum number of record sets to return.
   * If not specified, returns up to 100 record sets.
   *
   * @param {string} [options.recordSetNameSuffix] The suffix label of the record
   * set name that has to be used to filter the record set enumerations. If this
   * parameter is specified, Enumeration will return only records that end with
   * .<recordSetNameSuffix>
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<RecordSetListResult>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listAllByDnsZoneWithHttpOperationResponse(resourceGroupName, zoneName, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listAllByDnsZone(resourceGroupName, zoneName, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Lists all record sets in a DNS zone.
   *
   * @param {string} resourceGroupName The name of the resource group. The name
   * is case insensitive.
   *
   * @param {string} zoneName The name of the DNS zone (without a terminating
   * dot).
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.top] The maximum number of record sets to return.
   * If not specified, returns up to 100 record sets.
   *
   * @param {string} [options.recordSetNameSuffix] The suffix label of the record
   * set name that has to be used to filter the record set enumerations. If this
   * parameter is specified, Enumeration will return only records that end with
   * .<recordSetNameSuffix>
   *
   * @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 {RecordSetListResult} - 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 RecordSetListResult} 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.
   */
  listAllByDnsZone(resourceGroupName, zoneName, 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._listAllByDnsZone(resourceGroupName, zoneName, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listAllByDnsZone(resourceGroupName, zoneName, options, optionalCallback);
    }
  }

  /**
   * Lists the record sets of a specified type in a DNS zone.
   *
   * @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<RecordSetListResult>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listByTypeNextWithHttpOperationResponse(nextPageLink, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listByTypeNext(nextPageLink, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Lists the record sets of a specified type in a DNS zone.
   *
   * @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 {RecordSetListResult} - 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 RecordSetListResult} 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.
   */
  listByTypeNext(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._listByTypeNext(nextPageLink, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listByTypeNext(nextPageLink, options, optionalCallback);
    }
  }

  /**
   * Lists all record sets in a DNS zone.
   *
   * @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<RecordSetListResult>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listByDnsZoneNextWithHttpOperationResponse(nextPageLink, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listByDnsZoneNext(nextPageLink, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Lists all record sets in a DNS zone.
   *
   * @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 {RecordSetListResult} - 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 RecordSetListResult} 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.
   */
  listByDnsZoneNext(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._listByDnsZoneNext(nextPageLink, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listByDnsZoneNext(nextPageLink, options, optionalCallback);
    }
  }

  /**
   * Lists all record sets in a DNS zone.
   *
   * @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<RecordSetListResult>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listAllByDnsZoneNextWithHttpOperationResponse(nextPageLink, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listAllByDnsZoneNext(nextPageLink, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Lists all record sets in a DNS zone.
   *
   * @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 {RecordSetListResult} - 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 RecordSetListResult} 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.
   */
  listAllByDnsZoneNext(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._listAllByDnsZoneNext(nextPageLink, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listAllByDnsZoneNext(nextPageLink, options, optionalCallback);
    }
  }

}

module.exports = RecordSets;
