text:
'use strict';

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

/**
 * @summary Deletes the specified Task file from the Compute Node where the
 * Task ran.
 *
 * @param {string} jobId The ID of the Job that contains the Task.
 *
 * @param {string} taskId The ID of the Task whose file you want to delete.
 *
 * @param {string} filePath The path to the Task file or directory that you
 * want to delete.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {boolean} [options.recursive] Whether to delete children of a
 * directory. If the filePath parameter represents a directory instead of a
 * file, you can set recursive to true to delete the directory and all of the
 * files and subdirectories in it. If recursive is false then the directory
 * must be empty or deletion will fail.
 *
 * @param {object} [options.fileDeleteFromTaskOptions] Additional parameters
 * for the operation
 *
 * @param {number} [options.fileDeleteFromTaskOptions.timeout] The maximum time
 * that the server can spend processing the request, in seconds. The default is
 * 30 seconds.
 *
 * @param {uuid} [options.fileDeleteFromTaskOptions.clientRequestId] The
 * caller-generated request identity, in the form of a GUID with no decoration
 * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
 *
 * @param {boolean} [options.fileDeleteFromTaskOptions.returnClientRequestId]
 * Whether the server should return the client-request-id in the response.
 *
 * @param {date} [options.fileDeleteFromTaskOptions.ocpDate] The time the
 * request was issued. Client libraries typically set this to the current
 * system clock time; set it explicitly if you are calling the REST API
 * directly.
 *
 * @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 _deleteFromTask(jobId, taskId, filePath, 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 recursive = (options && options.recursive !== undefined) ? options.recursive : undefined;
  let fileDeleteFromTaskOptions = (options && options.fileDeleteFromTaskOptions !== undefined) ? options.fileDeleteFromTaskOptions : undefined;
  // Validate
  try {
    if (this.client.batchUrl === null || this.client.batchUrl === undefined || typeof this.client.batchUrl.valueOf() !== 'string') {
      throw new Error('this.client.batchUrl cannot be null or undefined and it must be of type string.');
    }
    if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string') {
      throw new Error('jobId cannot be null or undefined and it must be of type string.');
    }
    if (taskId === null || taskId === undefined || typeof taskId.valueOf() !== 'string') {
      throw new Error('taskId cannot be null or undefined and it must be of type string.');
    }
    if (filePath === null || filePath === undefined || typeof filePath.valueOf() !== 'string') {
      throw new Error('filePath cannot be null or undefined and it must be of type string.');
    }
    if (recursive !== null && recursive !== undefined && typeof recursive !== 'boolean') {
      throw new Error('recursive must be of type boolean.');
    }
    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.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);
  }
  let timeout;
  let clientRequestId;
  let returnClientRequestId;
  let ocpDate;
  try {
    if (fileDeleteFromTaskOptions !== null && fileDeleteFromTaskOptions !== undefined) {
      timeout = fileDeleteFromTaskOptions.timeout;
      if (timeout !== null && timeout !== undefined && typeof timeout !== 'number') {
        throw new Error('timeout must be of type number.');
      }
    }
    if (fileDeleteFromTaskOptions !== null && fileDeleteFromTaskOptions !== undefined) {
      clientRequestId = fileDeleteFromTaskOptions.clientRequestId;
      if (clientRequestId !== null && clientRequestId !== undefined && !(typeof clientRequestId.valueOf() === 'string' && msRest.isValidUuid(clientRequestId))) {
        throw new Error('clientRequestId must be of type string and must be a valid uuid.');
      }
    }
    if (fileDeleteFromTaskOptions !== null && fileDeleteFromTaskOptions !== undefined) {
      returnClientRequestId = fileDeleteFromTaskOptions.returnClientRequestId;
      if (returnClientRequestId !== null && returnClientRequestId !== undefined && typeof returnClientRequestId !== 'boolean') {
        throw new Error('returnClientRequestId must be of type boolean.');
      }
    }
    if (fileDeleteFromTaskOptions !== null && fileDeleteFromTaskOptions !== undefined) {
      ocpDate = fileDeleteFromTaskOptions.ocpDate;
      if (ocpDate && !(ocpDate instanceof Date ||
          (typeof ocpDate.valueOf() === 'string' && !isNaN(Date.parse(ocpDate))))) {
            throw new Error('ocpDate must be of type date.');
          }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'jobs/{jobId}/tasks/{taskId}/files/{filePath}';
  requestUrl = requestUrl.replace('{batchUrl}', this.client.batchUrl);
  requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId));
  requestUrl = requestUrl.replace('{taskId}', encodeURIComponent(taskId));
  requestUrl = requestUrl.replace('{filePath}', encodeURIComponent(filePath));
  let queryParameters = [];
  if (recursive !== null && recursive !== undefined) {
    queryParameters.push('recursive=' + encodeURIComponent(recursive.toString()));
  }
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (timeout !== null && timeout !== undefined) {
    queryParameters.push('timeout=' + encodeURIComponent(timeout.toString()));
  }
  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['client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if (clientRequestId !== undefined && clientRequestId !== null) {
    httpRequest.headers['client-request-id'] = clientRequestId.toString();
  }
  if (returnClientRequestId !== undefined && returnClientRequestId !== null) {
    httpRequest.headers['return-client-request-id'] = returnClientRequestId.toString();
  }
  if (ocpDate !== undefined && ocpDate !== null) {
    httpRequest.headers['ocp-date'] = ocpDate.toUTCString();
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['BatchError']().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);
  });
}

/**
 * Returns the content of the specified Task file.
 *
 * @param {string} jobId The ID of the Job that contains the Task.
 *
 * @param {string} taskId The ID of the Task whose file you want to retrieve.
 *
 * @param {string} filePath The path to the Task file that you want to get the
 * content of.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.fileGetFromTaskOptions] Additional parameters for
 * the operation
 *
 * @param {number} [options.fileGetFromTaskOptions.timeout] The maximum time
 * that the server can spend processing the request, in seconds. The default is
 * 30 seconds.
 *
 * @param {uuid} [options.fileGetFromTaskOptions.clientRequestId] The
 * caller-generated request identity, in the form of a GUID with no decoration
 * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
 *
 * @param {boolean} [options.fileGetFromTaskOptions.returnClientRequestId]
 * Whether the server should return the client-request-id in the response.
 *
 * @param {date} [options.fileGetFromTaskOptions.ocpDate] The time the request
 * was issued. Client libraries typically set this to the current system clock
 * time; set it explicitly if you are calling the REST API directly.
 *
 * @param {string} [options.fileGetFromTaskOptions.ocpRange] The byte range to
 * be retrieved. The default is to retrieve the entire file. The format is
 * bytes=startRange-endRange.
 *
 * @param {date} [options.fileGetFromTaskOptions.ifModifiedSince] A timestamp
 * indicating the last modified time of the resource known to the client. The
 * operation will be performed only if the resource on the service has been
 * modified since the specified time.
 *
 * @param {date} [options.fileGetFromTaskOptions.ifUnmodifiedSince] A timestamp
 * indicating the last modified time of the resource known to the client. The
 * operation will be performed only if the resource on the service has not been
 * modified since the specified time.
 *
 * @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.
 *
 *                      {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 _getFromTask(jobId, taskId, filePath, 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 fileGetFromTaskOptions = (options && options.fileGetFromTaskOptions !== undefined) ? options.fileGetFromTaskOptions : undefined;
  // Validate
  try {
    if (this.client.batchUrl === null || this.client.batchUrl === undefined || typeof this.client.batchUrl.valueOf() !== 'string') {
      throw new Error('this.client.batchUrl cannot be null or undefined and it must be of type string.');
    }
    if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string') {
      throw new Error('jobId cannot be null or undefined and it must be of type string.');
    }
    if (taskId === null || taskId === undefined || typeof taskId.valueOf() !== 'string') {
      throw new Error('taskId cannot be null or undefined and it must be of type string.');
    }
    if (filePath === null || filePath === undefined || typeof filePath.valueOf() !== 'string') {
      throw new Error('filePath cannot be null or undefined and it 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.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);
  }
  let timeout;
  let clientRequestId;
  let returnClientRequestId;
  let ocpDate;
  let ocpRange;
  let ifModifiedSince;
  let ifUnmodifiedSince;
  try {
    if (fileGetFromTaskOptions !== null && fileGetFromTaskOptions !== undefined) {
      timeout = fileGetFromTaskOptions.timeout;
      if (timeout !== null && timeout !== undefined && typeof timeout !== 'number') {
        throw new Error('timeout must be of type number.');
      }
    }
    if (fileGetFromTaskOptions !== null && fileGetFromTaskOptions !== undefined) {
      clientRequestId = fileGetFromTaskOptions.clientRequestId;
      if (clientRequestId !== null && clientRequestId !== undefined && !(typeof clientRequestId.valueOf() === 'string' && msRest.isValidUuid(clientRequestId))) {
        throw new Error('clientRequestId must be of type string and must be a valid uuid.');
      }
    }
    if (fileGetFromTaskOptions !== null && fileGetFromTaskOptions !== undefined) {
      returnClientRequestId = fileGetFromTaskOptions.returnClientRequestId;
      if (returnClientRequestId !== null && returnClientRequestId !== undefined && typeof returnClientRequestId !== 'boolean') {
        throw new Error('returnClientRequestId must be of type boolean.');
      }
    }
    if (fileGetFromTaskOptions !== null && fileGetFromTaskOptions !== undefined) {
      ocpDate = fileGetFromTaskOptions.ocpDate;
      if (ocpDate && !(ocpDate instanceof Date ||
          (typeof ocpDate.valueOf() === 'string' && !isNaN(Date.parse(ocpDate))))) {
            throw new Error('ocpDate must be of type date.');
          }
    }
    if (fileGetFromTaskOptions !== null && fileGetFromTaskOptions !== undefined) {
      ocpRange = fileGetFromTaskOptions.ocpRange;
      if (ocpRange !== null && ocpRange !== undefined && typeof ocpRange.valueOf() !== 'string') {
        throw new Error('ocpRange must be of type string.');
      }
    }
    if (fileGetFromTaskOptions !== null && fileGetFromTaskOptions !== undefined) {
      ifModifiedSince = fileGetFromTaskOptions.ifModifiedSince;
      if (ifModifiedSince && !(ifModifiedSince instanceof Date ||
          (typeof ifModifiedSince.valueOf() === 'string' && !isNaN(Date.parse(ifModifiedSince))))) {
            throw new Error('ifModifiedSince must be of type date.');
          }
    }
    if (fileGetFromTaskOptions !== null && fileGetFromTaskOptions !== undefined) {
      ifUnmodifiedSince = fileGetFromTaskOptions.ifUnmodifiedSince;
      if (ifUnmodifiedSince && !(ifUnmodifiedSince instanceof Date ||
          (typeof ifUnmodifiedSince.valueOf() === 'string' && !isNaN(Date.parse(ifUnmodifiedSince))))) {
            throw new Error('ifUnmodifiedSince must be of type date.');
          }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'jobs/{jobId}/tasks/{taskId}/files/{filePath}';
  requestUrl = requestUrl.replace('{batchUrl}', this.client.batchUrl);
  requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId));
  requestUrl = requestUrl.replace('{taskId}', encodeURIComponent(taskId));
  requestUrl = requestUrl.replace('{filePath}', encodeURIComponent(filePath));
  let queryParameters = [];
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (timeout !== null && timeout !== undefined) {
    queryParameters.push('timeout=' + encodeURIComponent(timeout.toString()));
  }
  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['client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if (clientRequestId !== undefined && clientRequestId !== null) {
    httpRequest.headers['client-request-id'] = clientRequestId.toString();
  }
  if (returnClientRequestId !== undefined && returnClientRequestId !== null) {
    httpRequest.headers['return-client-request-id'] = returnClientRequestId.toString();
  }
  if (ocpDate !== undefined && ocpDate !== null) {
    httpRequest.headers['ocp-date'] = ocpDate.toUTCString();
  }
  if (ocpRange !== undefined && ocpRange !== null) {
    httpRequest.headers['ocp-range'] = ocpRange;
  }
  if (ifModifiedSince !== undefined && ifModifiedSince !== null) {
    httpRequest.headers['If-Modified-Since'] = ifModifiedSince.toUTCString();
  }
  if (ifUnmodifiedSince !== undefined && ifUnmodifiedSince !== null) {
    httpRequest.headers['If-Unmodified-Since'] = ifUnmodifiedSince.toUTCString();
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  httpRequest.streamedResponse = true;
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }

    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(`Unexpected status code: ${statusCode}`);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        if (responseBody !== undefined) parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['BatchError']().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 = response;
    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets the properties of the specified Task file.
 *
 * @param {string} jobId The ID of the Job that contains the Task.
 *
 * @param {string} taskId The ID of the Task whose file you want to get the
 * properties of.
 *
 * @param {string} filePath The path to the Task file that you want to get the
 * properties of.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.fileGetPropertiesFromTaskOptions] Additional
 * parameters for the operation
 *
 * @param {number} [options.fileGetPropertiesFromTaskOptions.timeout] The
 * maximum time that the server can spend processing the request, in seconds.
 * The default is 30 seconds.
 *
 * @param {uuid} [options.fileGetPropertiesFromTaskOptions.clientRequestId] The
 * caller-generated request identity, in the form of a GUID with no decoration
 * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
 *
 * @param {boolean}
 * [options.fileGetPropertiesFromTaskOptions.returnClientRequestId] Whether the
 * server should return the client-request-id in the response.
 *
 * @param {date} [options.fileGetPropertiesFromTaskOptions.ocpDate] The time
 * the request was issued. Client libraries typically set this to the current
 * system clock time; set it explicitly if you are calling the REST API
 * directly.
 *
 * @param {date} [options.fileGetPropertiesFromTaskOptions.ifModifiedSince] A
 * timestamp indicating the last modified time of the resource known to the
 * client. The operation will be performed only if the resource on the service
 * has been modified since the specified time.
 *
 * @param {date} [options.fileGetPropertiesFromTaskOptions.ifUnmodifiedSince] A
 * timestamp indicating the last modified time of the resource known to the
 * client. The operation will be performed only if the resource on the service
 * has not been modified since the specified time.
 *
 * @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 _getPropertiesFromTask(jobId, taskId, filePath, 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 fileGetPropertiesFromTaskOptions = (options && options.fileGetPropertiesFromTaskOptions !== undefined) ? options.fileGetPropertiesFromTaskOptions : undefined;
  // Validate
  try {
    if (this.client.batchUrl === null || this.client.batchUrl === undefined || typeof this.client.batchUrl.valueOf() !== 'string') {
      throw new Error('this.client.batchUrl cannot be null or undefined and it must be of type string.');
    }
    if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string') {
      throw new Error('jobId cannot be null or undefined and it must be of type string.');
    }
    if (taskId === null || taskId === undefined || typeof taskId.valueOf() !== 'string') {
      throw new Error('taskId cannot be null or undefined and it must be of type string.');
    }
    if (filePath === null || filePath === undefined || typeof filePath.valueOf() !== 'string') {
      throw new Error('filePath cannot be null or undefined and it 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.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);
  }
  let timeout;
  let clientRequestId;
  let returnClientRequestId;
  let ocpDate;
  let ifModifiedSince;
  let ifUnmodifiedSince;
  try {
    if (fileGetPropertiesFromTaskOptions !== null && fileGetPropertiesFromTaskOptions !== undefined) {
      timeout = fileGetPropertiesFromTaskOptions.timeout;
      if (timeout !== null && timeout !== undefined && typeof timeout !== 'number') {
        throw new Error('timeout must be of type number.');
      }
    }
    if (fileGetPropertiesFromTaskOptions !== null && fileGetPropertiesFromTaskOptions !== undefined) {
      clientRequestId = fileGetPropertiesFromTaskOptions.clientRequestId;
      if (clientRequestId !== null && clientRequestId !== undefined && !(typeof clientRequestId.valueOf() === 'string' && msRest.isValidUuid(clientRequestId))) {
        throw new Error('clientRequestId must be of type string and must be a valid uuid.');
      }
    }
    if (fileGetPropertiesFromTaskOptions !== null && fileGetPropertiesFromTaskOptions !== undefined) {
      returnClientRequestId = fileGetPropertiesFromTaskOptions.returnClientRequestId;
      if (returnClientRequestId !== null && returnClientRequestId !== undefined && typeof returnClientRequestId !== 'boolean') {
        throw new Error('returnClientRequestId must be of type boolean.');
      }
    }
    if (fileGetPropertiesFromTaskOptions !== null && fileGetPropertiesFromTaskOptions !== undefined) {
      ocpDate = fileGetPropertiesFromTaskOptions.ocpDate;
      if (ocpDate && !(ocpDate instanceof Date ||
          (typeof ocpDate.valueOf() === 'string' && !isNaN(Date.parse(ocpDate))))) {
            throw new Error('ocpDate must be of type date.');
          }
    }
    if (fileGetPropertiesFromTaskOptions !== null && fileGetPropertiesFromTaskOptions !== undefined) {
      ifModifiedSince = fileGetPropertiesFromTaskOptions.ifModifiedSince;
      if (ifModifiedSince && !(ifModifiedSince instanceof Date ||
          (typeof ifModifiedSince.valueOf() === 'string' && !isNaN(Date.parse(ifModifiedSince))))) {
            throw new Error('ifModifiedSince must be of type date.');
          }
    }
    if (fileGetPropertiesFromTaskOptions !== null && fileGetPropertiesFromTaskOptions !== undefined) {
      ifUnmodifiedSince = fileGetPropertiesFromTaskOptions.ifUnmodifiedSince;
      if (ifUnmodifiedSince && !(ifUnmodifiedSince instanceof Date ||
          (typeof ifUnmodifiedSince.valueOf() === 'string' && !isNaN(Date.parse(ifUnmodifiedSince))))) {
            throw new Error('ifUnmodifiedSince must be of type date.');
          }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'jobs/{jobId}/tasks/{taskId}/files/{filePath}';
  requestUrl = requestUrl.replace('{batchUrl}', this.client.batchUrl);
  requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId));
  requestUrl = requestUrl.replace('{taskId}', encodeURIComponent(taskId));
  requestUrl = requestUrl.replace('{filePath}', encodeURIComponent(filePath));
  let queryParameters = [];
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (timeout !== null && timeout !== undefined) {
    queryParameters.push('timeout=' + encodeURIComponent(timeout.toString()));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'HEAD';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if (this.client.generateClientRequestId) {
      httpRequest.headers['client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if (clientRequestId !== undefined && clientRequestId !== null) {
    httpRequest.headers['client-request-id'] = clientRequestId.toString();
  }
  if (returnClientRequestId !== undefined && returnClientRequestId !== null) {
    httpRequest.headers['return-client-request-id'] = returnClientRequestId.toString();
  }
  if (ocpDate !== undefined && ocpDate !== null) {
    httpRequest.headers['ocp-date'] = ocpDate.toUTCString();
  }
  if (ifModifiedSince !== undefined && ifModifiedSince !== null) {
    httpRequest.headers['If-Modified-Since'] = ifModifiedSince.toUTCString();
  }
  if (ifUnmodifiedSince !== undefined && ifUnmodifiedSince !== null) {
    httpRequest.headers['If-Unmodified-Since'] = ifUnmodifiedSince.toUTCString();
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['BatchError']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;

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

/**
 * @summary Deletes the specified file from the Compute Node.
 *
 * @param {string} poolId The ID of the Pool that contains the Compute Node.
 *
 * @param {string} nodeId The ID of the Compute Node from which you want to
 * delete the file.
 *
 * @param {string} filePath The path to the file or directory that you want to
 * delete.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {boolean} [options.recursive] Whether to delete children of a
 * directory. If the filePath parameter represents a directory instead of a
 * file, you can set recursive to true to delete the directory and all of the
 * files and subdirectories in it. If recursive is false then the directory
 * must be empty or deletion will fail.
 *
 * @param {object} [options.fileDeleteFromComputeNodeOptions] Additional
 * parameters for the operation
 *
 * @param {number} [options.fileDeleteFromComputeNodeOptions.timeout] The
 * maximum time that the server can spend processing the request, in seconds.
 * The default is 30 seconds.
 *
 * @param {uuid} [options.fileDeleteFromComputeNodeOptions.clientRequestId] The
 * caller-generated request identity, in the form of a GUID with no decoration
 * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
 *
 * @param {boolean}
 * [options.fileDeleteFromComputeNodeOptions.returnClientRequestId] Whether the
 * server should return the client-request-id in the response.
 *
 * @param {date} [options.fileDeleteFromComputeNodeOptions.ocpDate] The time
 * the request was issued. Client libraries typically set this to the current
 * system clock time; set it explicitly if you are calling the REST API
 * directly.
 *
 * @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 _deleteFromComputeNode(poolId, nodeId, filePath, 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 recursive = (options && options.recursive !== undefined) ? options.recursive : undefined;
  let fileDeleteFromComputeNodeOptions = (options && options.fileDeleteFromComputeNodeOptions !== undefined) ? options.fileDeleteFromComputeNodeOptions : undefined;
  // Validate
  try {
    if (this.client.batchUrl === null || this.client.batchUrl === undefined || typeof this.client.batchUrl.valueOf() !== 'string') {
      throw new Error('this.client.batchUrl cannot be null or undefined and it must be of type string.');
    }
    if (poolId === null || poolId === undefined || typeof poolId.valueOf() !== 'string') {
      throw new Error('poolId cannot be null or undefined and it must be of type string.');
    }
    if (nodeId === null || nodeId === undefined || typeof nodeId.valueOf() !== 'string') {
      throw new Error('nodeId cannot be null or undefined and it must be of type string.');
    }
    if (filePath === null || filePath === undefined || typeof filePath.valueOf() !== 'string') {
      throw new Error('filePath cannot be null or undefined and it must be of type string.');
    }
    if (recursive !== null && recursive !== undefined && typeof recursive !== 'boolean') {
      throw new Error('recursive must be of type boolean.');
    }
    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.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);
  }
  let timeout;
  let clientRequestId;
  let returnClientRequestId;
  let ocpDate;
  try {
    if (fileDeleteFromComputeNodeOptions !== null && fileDeleteFromComputeNodeOptions !== undefined) {
      timeout = fileDeleteFromComputeNodeOptions.timeout;
      if (timeout !== null && timeout !== undefined && typeof timeout !== 'number') {
        throw new Error('timeout must be of type number.');
      }
    }
    if (fileDeleteFromComputeNodeOptions !== null && fileDeleteFromComputeNodeOptions !== undefined) {
      clientRequestId = fileDeleteFromComputeNodeOptions.clientRequestId;
      if (clientRequestId !== null && clientRequestId !== undefined && !(typeof clientRequestId.valueOf() === 'string' && msRest.isValidUuid(clientRequestId))) {
        throw new Error('clientRequestId must be of type string and must be a valid uuid.');
      }
    }
    if (fileDeleteFromComputeNodeOptions !== null && fileDeleteFromComputeNodeOptions !== undefined) {
      returnClientRequestId = fileDeleteFromComputeNodeOptions.returnClientRequestId;
      if (returnClientRequestId !== null && returnClientRequestId !== undefined && typeof returnClientRequestId !== 'boolean') {
        throw new Error('returnClientRequestId must be of type boolean.');
      }
    }
    if (fileDeleteFromComputeNodeOptions !== null && fileDeleteFromComputeNodeOptions !== undefined) {
      ocpDate = fileDeleteFromComputeNodeOptions.ocpDate;
      if (ocpDate && !(ocpDate instanceof Date ||
          (typeof ocpDate.valueOf() === 'string' && !isNaN(Date.parse(ocpDate))))) {
            throw new Error('ocpDate must be of type date.');
          }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'pools/{poolId}/nodes/{nodeId}/files/{filePath}';
  requestUrl = requestUrl.replace('{batchUrl}', this.client.batchUrl);
  requestUrl = requestUrl.replace('{poolId}', encodeURIComponent(poolId));
  requestUrl = requestUrl.replace('{nodeId}', encodeURIComponent(nodeId));
  requestUrl = requestUrl.replace('{filePath}', encodeURIComponent(filePath));
  let queryParameters = [];
  if (recursive !== null && recursive !== undefined) {
    queryParameters.push('recursive=' + encodeURIComponent(recursive.toString()));
  }
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (timeout !== null && timeout !== undefined) {
    queryParameters.push('timeout=' + encodeURIComponent(timeout.toString()));
  }
  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['client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if (clientRequestId !== undefined && clientRequestId !== null) {
    httpRequest.headers['client-request-id'] = clientRequestId.toString();
  }
  if (returnClientRequestId !== undefined && returnClientRequestId !== null) {
    httpRequest.headers['return-client-request-id'] = returnClientRequestId.toString();
  }
  if (ocpDate !== undefined && ocpDate !== null) {
    httpRequest.headers['ocp-date'] = ocpDate.toUTCString();
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['BatchError']().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);
  });
}

/**
 * Returns the content of the specified Compute Node file.
 *
 * @param {string} poolId The ID of the Pool that contains the Compute Node.
 *
 * @param {string} nodeId The ID of the Compute Node that contains the file.
 *
 * @param {string} filePath The path to the Compute Node file that you want to
 * get the content of.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.fileGetFromComputeNodeOptions] Additional
 * parameters for the operation
 *
 * @param {number} [options.fileGetFromComputeNodeOptions.timeout] The maximum
 * time that the server can spend processing the request, in seconds. The
 * default is 30 seconds.
 *
 * @param {uuid} [options.fileGetFromComputeNodeOptions.clientRequestId] The
 * caller-generated request identity, in the form of a GUID with no decoration
 * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
 *
 * @param {boolean}
 * [options.fileGetFromComputeNodeOptions.returnClientRequestId] Whether the
 * server should return the client-request-id in the response.
 *
 * @param {date} [options.fileGetFromComputeNodeOptions.ocpDate] The time the
 * request was issued. Client libraries typically set this to the current
 * system clock time; set it explicitly if you are calling the REST API
 * directly.
 *
 * @param {string} [options.fileGetFromComputeNodeOptions.ocpRange] The byte
 * range to be retrieved. The default is to retrieve the entire file. The
 * format is bytes=startRange-endRange.
 *
 * @param {date} [options.fileGetFromComputeNodeOptions.ifModifiedSince] A
 * timestamp indicating the last modified time of the resource known to the
 * client. The operation will be performed only if the resource on the service
 * has been modified since the specified time.
 *
 * @param {date} [options.fileGetFromComputeNodeOptions.ifUnmodifiedSince] A
 * timestamp indicating the last modified time of the resource known to the
 * client. The operation will be performed only if the resource on the service
 * has not been modified since the specified time.
 *
 * @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.
 *
 *                      {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 _getFromComputeNode(poolId, nodeId, filePath, 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 fileGetFromComputeNodeOptions = (options && options.fileGetFromComputeNodeOptions !== undefined) ? options.fileGetFromComputeNodeOptions : undefined;
  // Validate
  try {
    if (this.client.batchUrl === null || this.client.batchUrl === undefined || typeof this.client.batchUrl.valueOf() !== 'string') {
      throw new Error('this.client.batchUrl cannot be null or undefined and it must be of type string.');
    }
    if (poolId === null || poolId === undefined || typeof poolId.valueOf() !== 'string') {
      throw new Error('poolId cannot be null or undefined and it must be of type string.');
    }
    if (nodeId === null || nodeId === undefined || typeof nodeId.valueOf() !== 'string') {
      throw new Error('nodeId cannot be null or undefined and it must be of type string.');
    }
    if (filePath === null || filePath === undefined || typeof filePath.valueOf() !== 'string') {
      throw new Error('filePath cannot be null or undefined and it 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.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);
  }
  let timeout;
  let clientRequestId;
  let returnClientRequestId;
  let ocpDate;
  let ocpRange;
  let ifModifiedSince;
  let ifUnmodifiedSince;
  try {
    if (fileGetFromComputeNodeOptions !== null && fileGetFromComputeNodeOptions !== undefined) {
      timeout = fileGetFromComputeNodeOptions.timeout;
      if (timeout !== null && timeout !== undefined && typeof timeout !== 'number') {
        throw new Error('timeout must be of type number.');
      }
    }
    if (fileGetFromComputeNodeOptions !== null && fileGetFromComputeNodeOptions !== undefined) {
      clientRequestId = fileGetFromComputeNodeOptions.clientRequestId;
      if (clientRequestId !== null && clientRequestId !== undefined && !(typeof clientRequestId.valueOf() === 'string' && msRest.isValidUuid(clientRequestId))) {
        throw new Error('clientRequestId must be of type string and must be a valid uuid.');
      }
    }
    if (fileGetFromComputeNodeOptions !== null && fileGetFromComputeNodeOptions !== undefined) {
      returnClientRequestId = fileGetFromComputeNodeOptions.returnClientRequestId;
      if (returnClientRequestId !== null && returnClientRequestId !== undefined && typeof returnClientRequestId !== 'boolean') {
        throw new Error('returnClientRequestId must be of type boolean.');
      }
    }
    if (fileGetFromComputeNodeOptions !== null && fileGetFromComputeNodeOptions !== undefined) {
      ocpDate = fileGetFromComputeNodeOptions.ocpDate;
      if (ocpDate && !(ocpDate instanceof Date ||
          (typeof ocpDate.valueOf() === 'string' && !isNaN(Date.parse(ocpDate))))) {
            throw new Error('ocpDate must be of type date.');
          }
    }
    if (fileGetFromComputeNodeOptions !== null && fileGetFromComputeNodeOptions !== undefined) {
      ocpRange = fileGetFromComputeNodeOptions.ocpRange;
      if (ocpRange !== null && ocpRange !== undefined && typeof ocpRange.valueOf() !== 'string') {
        throw new Error('ocpRange must be of type string.');
      }
    }
    if (fileGetFromComputeNodeOptions !== null && fileGetFromComputeNodeOptions !== undefined) {
      ifModifiedSince = fileGetFromComputeNodeOptions.ifModifiedSince;
      if (ifModifiedSince && !(ifModifiedSince instanceof Date ||
          (typeof ifModifiedSince.valueOf() === 'string' && !isNaN(Date.parse(ifModifiedSince))))) {
            throw new Error('ifModifiedSince must be of type date.');
          }
    }
    if (fileGetFromComputeNodeOptions !== null && fileGetFromComputeNodeOptions !== undefined) {
      ifUnmodifiedSince = fileGetFromComputeNodeOptions.ifUnmodifiedSince;
      if (ifUnmodifiedSince && !(ifUnmodifiedSince instanceof Date ||
          (typeof ifUnmodifiedSince.valueOf() === 'string' && !isNaN(Date.parse(ifUnmodifiedSince))))) {
            throw new Error('ifUnmodifiedSince must be of type date.');
          }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'pools/{poolId}/nodes/{nodeId}/files/{filePath}';
  requestUrl = requestUrl.replace('{batchUrl}', this.client.batchUrl);
  requestUrl = requestUrl.replace('{poolId}', encodeURIComponent(poolId));
  requestUrl = requestUrl.replace('{nodeId}', encodeURIComponent(nodeId));
  requestUrl = requestUrl.replace('{filePath}', encodeURIComponent(filePath));
  let queryParameters = [];
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (timeout !== null && timeout !== undefined) {
    queryParameters.push('timeout=' + encodeURIComponent(timeout.toString()));
  }
  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['client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if (clientRequestId !== undefined && clientRequestId !== null) {
    httpRequest.headers['client-request-id'] = clientRequestId.toString();
  }
  if (returnClientRequestId !== undefined && returnClientRequestId !== null) {
    httpRequest.headers['return-client-request-id'] = returnClientRequestId.toString();
  }
  if (ocpDate !== undefined && ocpDate !== null) {
    httpRequest.headers['ocp-date'] = ocpDate.toUTCString();
  }
  if (ocpRange !== undefined && ocpRange !== null) {
    httpRequest.headers['ocp-range'] = ocpRange;
  }
  if (ifModifiedSince !== undefined && ifModifiedSince !== null) {
    httpRequest.headers['If-Modified-Since'] = ifModifiedSince.toUTCString();
  }
  if (ifUnmodifiedSince !== undefined && ifUnmodifiedSince !== null) {
    httpRequest.headers['If-Unmodified-Since'] = ifUnmodifiedSince.toUTCString();
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  httpRequest.streamedResponse = true;
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }

    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(`Unexpected status code: ${statusCode}`);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        if (responseBody !== undefined) parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['BatchError']().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 = response;
    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets the properties of the specified Compute Node file.
 *
 * @param {string} poolId The ID of the Pool that contains the Compute Node.
 *
 * @param {string} nodeId The ID of the Compute Node that contains the file.
 *
 * @param {string} filePath The path to the Compute Node file that you want to
 * get the properties of.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.fileGetPropertiesFromComputeNodeOptions] Additional
 * parameters for the operation
 *
 * @param {number} [options.fileGetPropertiesFromComputeNodeOptions.timeout]
 * The maximum time that the server can spend processing the request, in
 * seconds. The default is 30 seconds.
 *
 * @param {uuid}
 * [options.fileGetPropertiesFromComputeNodeOptions.clientRequestId] The
 * caller-generated request identity, in the form of a GUID with no decoration
 * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
 *
 * @param {boolean}
 * [options.fileGetPropertiesFromComputeNodeOptions.returnClientRequestId]
 * Whether the server should return the client-request-id in the response.
 *
 * @param {date} [options.fileGetPropertiesFromComputeNodeOptions.ocpDate] The
 * time the request was issued. Client libraries typically set this to the
 * current system clock time; set it explicitly if you are calling the REST API
 * directly.
 *
 * @param {date}
 * [options.fileGetPropertiesFromComputeNodeOptions.ifModifiedSince] A
 * timestamp indicating the last modified time of the resource known to the
 * client. The operation will be performed only if the resource on the service
 * has been modified since the specified time.
 *
 * @param {date}
 * [options.fileGetPropertiesFromComputeNodeOptions.ifUnmodifiedSince] A
 * timestamp indicating the last modified time of the resource known to the
 * client. The operation will be performed only if the resource on the service
 * has not been modified since the specified time.
 *
 * @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 _getPropertiesFromComputeNode(poolId, nodeId, filePath, 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 fileGetPropertiesFromComputeNodeOptions = (options && options.fileGetPropertiesFromComputeNodeOptions !== undefined) ? options.fileGetPropertiesFromComputeNodeOptions : undefined;
  // Validate
  try {
    if (this.client.batchUrl === null || this.client.batchUrl === undefined || typeof this.client.batchUrl.valueOf() !== 'string') {
      throw new Error('this.client.batchUrl cannot be null or undefined and it must be of type string.');
    }
    if (poolId === null || poolId === undefined || typeof poolId.valueOf() !== 'string') {
      throw new Error('poolId cannot be null or undefined and it must be of type string.');
    }
    if (nodeId === null || nodeId === undefined || typeof nodeId.valueOf() !== 'string') {
      throw new Error('nodeId cannot be null or undefined and it must be of type string.');
    }
    if (filePath === null || filePath === undefined || typeof filePath.valueOf() !== 'string') {
      throw new Error('filePath cannot be null or undefined and it 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.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);
  }
  let timeout;
  let clientRequestId;
  let returnClientRequestId;
  let ocpDate;
  let ifModifiedSince;
  let ifUnmodifiedSince;
  try {
    if (fileGetPropertiesFromComputeNodeOptions !== null && fileGetPropertiesFromComputeNodeOptions !== undefined) {
      timeout = fileGetPropertiesFromComputeNodeOptions.timeout;
      if (timeout !== null && timeout !== undefined && typeof timeout !== 'number') {
        throw new Error('timeout must be of type number.');
      }
    }
    if (fileGetPropertiesFromComputeNodeOptions !== null && fileGetPropertiesFromComputeNodeOptions !== undefined) {
      clientRequestId = fileGetPropertiesFromComputeNodeOptions.clientRequestId;
      if (clientRequestId !== null && clientRequestId !== undefined && !(typeof clientRequestId.valueOf() === 'string' && msRest.isValidUuid(clientRequestId))) {
        throw new Error('clientRequestId must be of type string and must be a valid uuid.');
      }
    }
    if (fileGetPropertiesFromComputeNodeOptions !== null && fileGetPropertiesFromComputeNodeOptions !== undefined) {
      returnClientRequestId = fileGetPropertiesFromComputeNodeOptions.returnClientRequestId;
      if (returnClientRequestId !== null && returnClientRequestId !== undefined && typeof returnClientRequestId !== 'boolean') {
        throw new Error('returnClientRequestId must be of type boolean.');
      }
    }
    if (fileGetPropertiesFromComputeNodeOptions !== null && fileGetPropertiesFromComputeNodeOptions !== undefined) {
      ocpDate = fileGetPropertiesFromComputeNodeOptions.ocpDate;
      if (ocpDate && !(ocpDate instanceof Date ||
          (typeof ocpDate.valueOf() === 'string' && !isNaN(Date.parse(ocpDate))))) {
            throw new Error('ocpDate must be of type date.');
          }
    }
    if (fileGetPropertiesFromComputeNodeOptions !== null && fileGetPropertiesFromComputeNodeOptions !== undefined) {
      ifModifiedSince = fileGetPropertiesFromComputeNodeOptions.ifModifiedSince;
      if (ifModifiedSince && !(ifModifiedSince instanceof Date ||
          (typeof ifModifiedSince.valueOf() === 'string' && !isNaN(Date.parse(ifModifiedSince))))) {
            throw new Error('ifModifiedSince must be of type date.');
          }
    }
    if (fileGetPropertiesFromComputeNodeOptions !== null && fileGetPropertiesFromComputeNodeOptions !== undefined) {
      ifUnmodifiedSince = fileGetPropertiesFromComputeNodeOptions.ifUnmodifiedSince;
      if (ifUnmodifiedSince && !(ifUnmodifiedSince instanceof Date ||
          (typeof ifUnmodifiedSince.valueOf() === 'string' && !isNaN(Date.parse(ifUnmodifiedSince))))) {
            throw new Error('ifUnmodifiedSince must be of type date.');
          }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'pools/{poolId}/nodes/{nodeId}/files/{filePath}';
  requestUrl = requestUrl.replace('{batchUrl}', this.client.batchUrl);
  requestUrl = requestUrl.replace('{poolId}', encodeURIComponent(poolId));
  requestUrl = requestUrl.replace('{nodeId}', encodeURIComponent(nodeId));
  requestUrl = requestUrl.replace('{filePath}', encodeURIComponent(filePath));
  let queryParameters = [];
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (timeout !== null && timeout !== undefined) {
    queryParameters.push('timeout=' + encodeURIComponent(timeout.toString()));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'HEAD';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if (this.client.generateClientRequestId) {
      httpRequest.headers['client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if (clientRequestId !== undefined && clientRequestId !== null) {
    httpRequest.headers['client-request-id'] = clientRequestId.toString();
  }
  if (returnClientRequestId !== undefined && returnClientRequestId !== null) {
    httpRequest.headers['return-client-request-id'] = returnClientRequestId.toString();
  }
  if (ocpDate !== undefined && ocpDate !== null) {
    httpRequest.headers['ocp-date'] = ocpDate.toUTCString();
  }
  if (ifModifiedSince !== undefined && ifModifiedSince !== null) {
    httpRequest.headers['If-Modified-Since'] = ifModifiedSince.toUTCString();
  }
  if (ifUnmodifiedSince !== undefined && ifUnmodifiedSince !== null) {
    httpRequest.headers['If-Unmodified-Since'] = ifUnmodifiedSince.toUTCString();
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['BatchError']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;

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

/**
 * @summary Lists the files in a Task's directory on its Compute Node.
 *
 * @param {string} jobId The ID of the Job that contains the Task.
 *
 * @param {string} taskId The ID of the Task whose files you want to list.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {boolean} [options.recursive] Whether to list children of the Task
 * directory. This parameter can be used in combination with the filter
 * parameter to list specific type of files.
 *
 * @param {object} [options.fileListFromTaskOptions] Additional parameters for
 * the operation
 *
 * @param {string} [options.fileListFromTaskOptions.filter] An OData $filter
 * clause. For more information on constructing this filter, see
 * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-task-files.
 *
 * @param {number} [options.fileListFromTaskOptions.maxResults] The maximum
 * number of items to return in the response. A maximum of 1000 files can be
 * returned.
 *
 * @param {number} [options.fileListFromTaskOptions.timeout] The maximum time
 * that the server can spend processing the request, in seconds. The default is
 * 30 seconds.
 *
 * @param {uuid} [options.fileListFromTaskOptions.clientRequestId] The
 * caller-generated request identity, in the form of a GUID with no decoration
 * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
 *
 * @param {boolean} [options.fileListFromTaskOptions.returnClientRequestId]
 * Whether the server should return the client-request-id in the response.
 *
 * @param {date} [options.fileListFromTaskOptions.ocpDate] The time the request
 * was issued. Client libraries typically set this to the current system clock
 * time; set it explicitly if you are calling the REST API directly.
 *
 * @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 NodeFileListResult} 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 _listFromTask(jobId, taskId, 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 recursive = (options && options.recursive !== undefined) ? options.recursive : undefined;
  let fileListFromTaskOptions = (options && options.fileListFromTaskOptions !== undefined) ? options.fileListFromTaskOptions : undefined;
  // Validate
  try {
    if (this.client.batchUrl === null || this.client.batchUrl === undefined || typeof this.client.batchUrl.valueOf() !== 'string') {
      throw new Error('this.client.batchUrl cannot be null or undefined and it must be of type string.');
    }
    if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string') {
      throw new Error('jobId cannot be null or undefined and it must be of type string.');
    }
    if (taskId === null || taskId === undefined || typeof taskId.valueOf() !== 'string') {
      throw new Error('taskId cannot be null or undefined and it must be of type string.');
    }
    if (recursive !== null && recursive !== undefined && typeof recursive !== 'boolean') {
      throw new Error('recursive must be of type boolean.');
    }
    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.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);
  }
  let filter;
  let maxResults;
  let timeout;
  let clientRequestId;
  let returnClientRequestId;
  let ocpDate;
  try {
    if (fileListFromTaskOptions !== null && fileListFromTaskOptions !== undefined) {
      filter = fileListFromTaskOptions.filter;
      if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') {
        throw new Error('filter must be of type string.');
      }
    }
    if (fileListFromTaskOptions !== null && fileListFromTaskOptions !== undefined) {
      maxResults = fileListFromTaskOptions.maxResults;
      if (maxResults !== null && maxResults !== undefined && typeof maxResults !== 'number') {
        throw new Error('maxResults must be of type number.');
      }
    }
    if (fileListFromTaskOptions !== null && fileListFromTaskOptions !== undefined) {
      timeout = fileListFromTaskOptions.timeout;
      if (timeout !== null && timeout !== undefined && typeof timeout !== 'number') {
        throw new Error('timeout must be of type number.');
      }
    }
    if (fileListFromTaskOptions !== null && fileListFromTaskOptions !== undefined) {
      clientRequestId = fileListFromTaskOptions.clientRequestId;
      if (clientRequestId !== null && clientRequestId !== undefined && !(typeof clientRequestId.valueOf() === 'string' && msRest.isValidUuid(clientRequestId))) {
        throw new Error('clientRequestId must be of type string and must be a valid uuid.');
      }
    }
    if (fileListFromTaskOptions !== null && fileListFromTaskOptions !== undefined) {
      returnClientRequestId = fileListFromTaskOptions.returnClientRequestId;
      if (returnClientRequestId !== null && returnClientRequestId !== undefined && typeof returnClientRequestId !== 'boolean') {
        throw new Error('returnClientRequestId must be of type boolean.');
      }
    }
    if (fileListFromTaskOptions !== null && fileListFromTaskOptions !== undefined) {
      ocpDate = fileListFromTaskOptions.ocpDate;
      if (ocpDate && !(ocpDate instanceof Date ||
          (typeof ocpDate.valueOf() === 'string' && !isNaN(Date.parse(ocpDate))))) {
            throw new Error('ocpDate must be of type date.');
          }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'jobs/{jobId}/tasks/{taskId}/files';
  requestUrl = requestUrl.replace('{batchUrl}', this.client.batchUrl);
  requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId));
  requestUrl = requestUrl.replace('{taskId}', encodeURIComponent(taskId));
  let queryParameters = [];
  if (recursive !== null && recursive !== undefined) {
    queryParameters.push('recursive=' + encodeURIComponent(recursive.toString()));
  }
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (filter !== null && filter !== undefined) {
    queryParameters.push('$filter=' + encodeURIComponent(filter));
  }
  if (maxResults !== null && maxResults !== undefined) {
    queryParameters.push('maxresults=' + encodeURIComponent(maxResults.toString()));
  }
  if (timeout !== null && timeout !== undefined) {
    queryParameters.push('timeout=' + encodeURIComponent(timeout.toString()));
  }
  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['client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if (clientRequestId !== undefined && clientRequestId !== null) {
    httpRequest.headers['client-request-id'] = clientRequestId.toString();
  }
  if (returnClientRequestId !== undefined && returnClientRequestId !== null) {
    httpRequest.headers['return-client-request-id'] = returnClientRequestId.toString();
  }
  if (ocpDate !== undefined && ocpDate !== null) {
    httpRequest.headers['ocp-date'] = ocpDate.toUTCString();
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['BatchError']().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['NodeFileListResult']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

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

/**
 * @summary Lists all of the files in Task directories on the specified Compute
 * Node.
 *
 * @param {string} poolId The ID of the Pool that contains the Compute Node.
 *
 * @param {string} nodeId The ID of the Compute Node whose files you want to
 * list.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {boolean} [options.recursive] Whether to list children of a
 * directory.
 *
 * @param {object} [options.fileListFromComputeNodeOptions] Additional
 * parameters for the operation
 *
 * @param {string} [options.fileListFromComputeNodeOptions.filter] An OData
 * $filter clause. For more information on constructing this filter, see
 * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-compute-node-files.
 *
 * @param {number} [options.fileListFromComputeNodeOptions.maxResults] The
 * maximum number of items to return in the response. A maximum of 1000 files
 * can be returned.
 *
 * @param {number} [options.fileListFromComputeNodeOptions.timeout] The maximum
 * time that the server can spend processing the request, in seconds. The
 * default is 30 seconds.
 *
 * @param {uuid} [options.fileListFromComputeNodeOptions.clientRequestId] The
 * caller-generated request identity, in the form of a GUID with no decoration
 * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
 *
 * @param {boolean}
 * [options.fileListFromComputeNodeOptions.returnClientRequestId] Whether the
 * server should return the client-request-id in the response.
 *
 * @param {date} [options.fileListFromComputeNodeOptions.ocpDate] The time the
 * request was issued. Client libraries typically set this to the current
 * system clock time; set it explicitly if you are calling the REST API
 * directly.
 *
 * @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 NodeFileListResult} 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 _listFromComputeNode(poolId, nodeId, 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 recursive = (options && options.recursive !== undefined) ? options.recursive : undefined;
  let fileListFromComputeNodeOptions = (options && options.fileListFromComputeNodeOptions !== undefined) ? options.fileListFromComputeNodeOptions : undefined;
  // Validate
  try {
    if (this.client.batchUrl === null || this.client.batchUrl === undefined || typeof this.client.batchUrl.valueOf() !== 'string') {
      throw new Error('this.client.batchUrl cannot be null or undefined and it must be of type string.');
    }
    if (poolId === null || poolId === undefined || typeof poolId.valueOf() !== 'string') {
      throw new Error('poolId cannot be null or undefined and it must be of type string.');
    }
    if (nodeId === null || nodeId === undefined || typeof nodeId.valueOf() !== 'string') {
      throw new Error('nodeId cannot be null or undefined and it must be of type string.');
    }
    if (recursive !== null && recursive !== undefined && typeof recursive !== 'boolean') {
      throw new Error('recursive must be of type boolean.');
    }
    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.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);
  }
  let filter;
  let maxResults;
  let timeout;
  let clientRequestId;
  let returnClientRequestId;
  let ocpDate;
  try {
    if (fileListFromComputeNodeOptions !== null && fileListFromComputeNodeOptions !== undefined) {
      filter = fileListFromComputeNodeOptions.filter;
      if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') {
        throw new Error('filter must be of type string.');
      }
    }
    if (fileListFromComputeNodeOptions !== null && fileListFromComputeNodeOptions !== undefined) {
      maxResults = fileListFromComputeNodeOptions.maxResults;
      if (maxResults !== null && maxResults !== undefined && typeof maxResults !== 'number') {
        throw new Error('maxResults must be of type number.');
      }
    }
    if (fileListFromComputeNodeOptions !== null && fileListFromComputeNodeOptions !== undefined) {
      timeout = fileListFromComputeNodeOptions.timeout;
      if (timeout !== null && timeout !== undefined && typeof timeout !== 'number') {
        throw new Error('timeout must be of type number.');
      }
    }
    if (fileListFromComputeNodeOptions !== null && fileListFromComputeNodeOptions !== undefined) {
      clientRequestId = fileListFromComputeNodeOptions.clientRequestId;
      if (clientRequestId !== null && clientRequestId !== undefined && !(typeof clientRequestId.valueOf() === 'string' && msRest.isValidUuid(clientRequestId))) {
        throw new Error('clientRequestId must be of type string and must be a valid uuid.');
      }
    }
    if (fileListFromComputeNodeOptions !== null && fileListFromComputeNodeOptions !== undefined) {
      returnClientRequestId = fileListFromComputeNodeOptions.returnClientRequestId;
      if (returnClientRequestId !== null && returnClientRequestId !== undefined && typeof returnClientRequestId !== 'boolean') {
        throw new Error('returnClientRequestId must be of type boolean.');
      }
    }
    if (fileListFromComputeNodeOptions !== null && fileListFromComputeNodeOptions !== undefined) {
      ocpDate = fileListFromComputeNodeOptions.ocpDate;
      if (ocpDate && !(ocpDate instanceof Date ||
          (typeof ocpDate.valueOf() === 'string' && !isNaN(Date.parse(ocpDate))))) {
            throw new Error('ocpDate must be of type date.');
          }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'pools/{poolId}/nodes/{nodeId}/files';
  requestUrl = requestUrl.replace('{batchUrl}', this.client.batchUrl);
  requestUrl = requestUrl.replace('{poolId}', encodeURIComponent(poolId));
  requestUrl = requestUrl.replace('{nodeId}', encodeURIComponent(nodeId));
  let queryParameters = [];
  if (recursive !== null && recursive !== undefined) {
    queryParameters.push('recursive=' + encodeURIComponent(recursive.toString()));
  }
  queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
  if (filter !== null && filter !== undefined) {
    queryParameters.push('$filter=' + encodeURIComponent(filter));
  }
  if (maxResults !== null && maxResults !== undefined) {
    queryParameters.push('maxresults=' + encodeURIComponent(maxResults.toString()));
  }
  if (timeout !== null && timeout !== undefined) {
    queryParameters.push('timeout=' + encodeURIComponent(timeout.toString()));
  }
  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['client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if (clientRequestId !== undefined && clientRequestId !== null) {
    httpRequest.headers['client-request-id'] = clientRequestId.toString();
  }
  if (returnClientRequestId !== undefined && returnClientRequestId !== null) {
    httpRequest.headers['return-client-request-id'] = returnClientRequestId.toString();
  }
  if (ocpDate !== undefined && ocpDate !== null) {
    httpRequest.headers['ocp-date'] = ocpDate.toUTCString();
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['BatchError']().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['NodeFileListResult']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

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

/**
 * @summary Lists the files in a Task's directory on its Compute Node.
 *
 * @param {string} nextPageLink The NextLink from the previous successful call
 * to List operation.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.fileListFromTaskNextOptions] Additional parameters
 * for the operation
 *
 * @param {uuid} [options.fileListFromTaskNextOptions.clientRequestId] The
 * caller-generated request identity, in the form of a GUID with no decoration
 * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
 *
 * @param {boolean} [options.fileListFromTaskNextOptions.returnClientRequestId]
 * Whether the server should return the client-request-id in the response.
 *
 * @param {date} [options.fileListFromTaskNextOptions.ocpDate] The time the
 * request was issued. Client libraries typically set this to the current
 * system clock time; set it explicitly if you are calling the REST API
 * directly.
 *
 * @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 NodeFileListResult} 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 _listFromTaskNext(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.');
  }
  let fileListFromTaskNextOptions = (options && options.fileListFromTaskNextOptions !== undefined) ? options.fileListFromTaskNextOptions : undefined;
  // 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);
  }
  let clientRequestId;
  let returnClientRequestId;
  let ocpDate;
  try {
    if (fileListFromTaskNextOptions !== null && fileListFromTaskNextOptions !== undefined) {
      clientRequestId = fileListFromTaskNextOptions.clientRequestId;
      if (clientRequestId !== null && clientRequestId !== undefined && !(typeof clientRequestId.valueOf() === 'string' && msRest.isValidUuid(clientRequestId))) {
        throw new Error('clientRequestId must be of type string and must be a valid uuid.');
      }
    }
    if (fileListFromTaskNextOptions !== null && fileListFromTaskNextOptions !== undefined) {
      returnClientRequestId = fileListFromTaskNextOptions.returnClientRequestId;
      if (returnClientRequestId !== null && returnClientRequestId !== undefined && typeof returnClientRequestId !== 'boolean') {
        throw new Error('returnClientRequestId must be of type boolean.');
      }
    }
    if (fileListFromTaskNextOptions !== null && fileListFromTaskNextOptions !== undefined) {
      ocpDate = fileListFromTaskNextOptions.ocpDate;
      if (ocpDate && !(ocpDate instanceof Date ||
          (typeof ocpDate.valueOf() === 'string' && !isNaN(Date.parse(ocpDate))))) {
            throw new Error('ocpDate must be of type date.');
          }
    }
  } 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['client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if (clientRequestId !== undefined && clientRequestId !== null) {
    httpRequest.headers['client-request-id'] = clientRequestId.toString();
  }
  if (returnClientRequestId !== undefined && returnClientRequestId !== null) {
    httpRequest.headers['return-client-request-id'] = returnClientRequestId.toString();
  }
  if (ocpDate !== undefined && ocpDate !== null) {
    httpRequest.headers['ocp-date'] = ocpDate.toUTCString();
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['BatchError']().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['NodeFileListResult']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

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

/**
 * @summary Lists all of the files in Task directories on the specified Compute
 * Node.
 *
 * @param {string} nextPageLink The NextLink from the previous successful call
 * to List operation.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.fileListFromComputeNodeNextOptions] Additional
 * parameters for the operation
 *
 * @param {uuid} [options.fileListFromComputeNodeNextOptions.clientRequestId]
 * The caller-generated request identity, in the form of a GUID with no
 * decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
 *
 * @param {boolean}
 * [options.fileListFromComputeNodeNextOptions.returnClientRequestId] Whether
 * the server should return the client-request-id in the response.
 *
 * @param {date} [options.fileListFromComputeNodeNextOptions.ocpDate] The time
 * the request was issued. Client libraries typically set this to the current
 * system clock time; set it explicitly if you are calling the REST API
 * directly.
 *
 * @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 NodeFileListResult} 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 _listFromComputeNodeNext(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.');
  }
  let fileListFromComputeNodeNextOptions = (options && options.fileListFromComputeNodeNextOptions !== undefined) ? options.fileListFromComputeNodeNextOptions : undefined;
  // 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);
  }
  let clientRequestId;
  let returnClientRequestId;
  let ocpDate;
  try {
    if (fileListFromComputeNodeNextOptions !== null && fileListFromComputeNodeNextOptions !== undefined) {
      clientRequestId = fileListFromComputeNodeNextOptions.clientRequestId;
      if (clientRequestId !== null && clientRequestId !== undefined && !(typeof clientRequestId.valueOf() === 'string' && msRest.isValidUuid(clientRequestId))) {
        throw new Error('clientRequestId must be of type string and must be a valid uuid.');
      }
    }
    if (fileListFromComputeNodeNextOptions !== null && fileListFromComputeNodeNextOptions !== undefined) {
      returnClientRequestId = fileListFromComputeNodeNextOptions.returnClientRequestId;
      if (returnClientRequestId !== null && returnClientRequestId !== undefined && typeof returnClientRequestId !== 'boolean') {
        throw new Error('returnClientRequestId must be of type boolean.');
      }
    }
    if (fileListFromComputeNodeNextOptions !== null && fileListFromComputeNodeNextOptions !== undefined) {
      ocpDate = fileListFromComputeNodeNextOptions.ocpDate;
      if (ocpDate && !(ocpDate instanceof Date ||
          (typeof ocpDate.valueOf() === 'string' && !isNaN(Date.parse(ocpDate))))) {
            throw new Error('ocpDate must be of type date.');
          }
    }
  } 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['client-request-id'] = msRestAzure.generateUuid();
  }
  if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
    httpRequest.headers['accept-language'] = this.client.acceptLanguage;
  }
  if (clientRequestId !== undefined && clientRequestId !== null) {
    httpRequest.headers['client-request-id'] = clientRequestId.toString();
  }
  if (returnClientRequestId !== undefined && returnClientRequestId !== null) {
    httpRequest.headers['return-client-request-id'] = returnClientRequestId.toString();
  }
  if (ocpDate !== undefined && ocpDate !== null) {
    httpRequest.headers['ocp-date'] = ocpDate.toUTCString();
  }
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['BatchError']().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['NodeFileListResult']().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 File. */
class File {
  /**
   * Create a File.
   * @param {BatchServiceClient} client Reference to the service client.
   */
  constructor(client) {
    this.client = client;
    this._deleteFromTask = _deleteFromTask;
    this._getFromTask = _getFromTask;
    this._getPropertiesFromTask = _getPropertiesFromTask;
    this._deleteFromComputeNode = _deleteFromComputeNode;
    this._getFromComputeNode = _getFromComputeNode;
    this._getPropertiesFromComputeNode = _getPropertiesFromComputeNode;
    this._listFromTask = _listFromTask;
    this._listFromComputeNode = _listFromComputeNode;
    this._listFromTaskNext = _listFromTaskNext;
    this._listFromComputeNodeNext = _listFromComputeNodeNext;
  }

  /**
   * @summary Deletes the specified Task file from the Compute Node where the
   * Task ran.
   *
   * @param {string} jobId The ID of the Job that contains the Task.
   *
   * @param {string} taskId The ID of the Task whose file you want to delete.
   *
   * @param {string} filePath The path to the Task file or directory that you
   * want to delete.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {boolean} [options.recursive] Whether to delete children of a
   * directory. If the filePath parameter represents a directory instead of a
   * file, you can set recursive to true to delete the directory and all of the
   * files and subdirectories in it. If recursive is false then the directory
   * must be empty or deletion will fail.
   *
   * @param {object} [options.fileDeleteFromTaskOptions] Additional parameters
   * for the operation
   *
   * @param {number} [options.fileDeleteFromTaskOptions.timeout] The maximum time
   * that the server can spend processing the request, in seconds. The default is
   * 30 seconds.
   *
   * @param {uuid} [options.fileDeleteFromTaskOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean} [options.fileDeleteFromTaskOptions.returnClientRequestId]
   * Whether the server should return the client-request-id in the response.
   *
   * @param {date} [options.fileDeleteFromTaskOptions.ocpDate] The time the
   * request was issued. Client libraries typically set this to the current
   * system clock time; set it explicitly if you are calling the REST API
   * directly.
   *
   * @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.
   */
  deleteFromTaskWithHttpOperationResponse(jobId, taskId, filePath, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteFromTask(jobId, taskId, filePath, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Deletes the specified Task file from the Compute Node where the
   * Task ran.
   *
   * @param {string} jobId The ID of the Job that contains the Task.
   *
   * @param {string} taskId The ID of the Task whose file you want to delete.
   *
   * @param {string} filePath The path to the Task file or directory that you
   * want to delete.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {boolean} [options.recursive] Whether to delete children of a
   * directory. If the filePath parameter represents a directory instead of a
   * file, you can set recursive to true to delete the directory and all of the
   * files and subdirectories in it. If recursive is false then the directory
   * must be empty or deletion will fail.
   *
   * @param {object} [options.fileDeleteFromTaskOptions] Additional parameters
   * for the operation
   *
   * @param {number} [options.fileDeleteFromTaskOptions.timeout] The maximum time
   * that the server can spend processing the request, in seconds. The default is
   * 30 seconds.
   *
   * @param {uuid} [options.fileDeleteFromTaskOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean} [options.fileDeleteFromTaskOptions.returnClientRequestId]
   * Whether the server should return the client-request-id in the response.
   *
   * @param {date} [options.fileDeleteFromTaskOptions.ocpDate] The time the
   * request was issued. Client libraries typically set this to the current
   * system clock time; set it explicitly if you are calling the REST API
   * directly.
   *
   * @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.
   */
  deleteFromTask(jobId, taskId, filePath, 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._deleteFromTask(jobId, taskId, filePath, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteFromTask(jobId, taskId, filePath, options, optionalCallback);
    }
  }

  /**
   * Returns the content of the specified Task file.
   *
   * @param {string} jobId The ID of the Job that contains the Task.
   *
   * @param {string} taskId The ID of the Task whose file you want to retrieve.
   *
   * @param {string} filePath The path to the Task file that you want to get the
   * content of.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.fileGetFromTaskOptions] Additional parameters for
   * the operation
   *
   * @param {number} [options.fileGetFromTaskOptions.timeout] The maximum time
   * that the server can spend processing the request, in seconds. The default is
   * 30 seconds.
   *
   * @param {uuid} [options.fileGetFromTaskOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean} [options.fileGetFromTaskOptions.returnClientRequestId]
   * Whether the server should return the client-request-id in the response.
   *
   * @param {date} [options.fileGetFromTaskOptions.ocpDate] The time the request
   * was issued. Client libraries typically set this to the current system clock
   * time; set it explicitly if you are calling the REST API directly.
   *
   * @param {string} [options.fileGetFromTaskOptions.ocpRange] The byte range to
   * be retrieved. The default is to retrieve the entire file. The format is
   * bytes=startRange-endRange.
   *
   * @param {date} [options.fileGetFromTaskOptions.ifModifiedSince] A timestamp
   * indicating the last modified time of the resource known to the client. The
   * operation will be performed only if the resource on the service has been
   * modified since the specified time.
   *
   * @param {date} [options.fileGetFromTaskOptions.ifUnmodifiedSince] A timestamp
   * indicating the last modified time of the resource known to the client. The
   * operation will be performed only if the resource on the service has not been
   * modified since the specified time.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Object>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getFromTaskWithHttpOperationResponse(jobId, taskId, filePath, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getFromTask(jobId, taskId, filePath, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Returns the content of the specified Task file.
   *
   * @param {string} jobId The ID of the Job that contains the Task.
   *
   * @param {string} taskId The ID of the Task whose file you want to retrieve.
   *
   * @param {string} filePath The path to the Task file that you want to get the
   * content of.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.fileGetFromTaskOptions] Additional parameters for
   * the operation
   *
   * @param {number} [options.fileGetFromTaskOptions.timeout] The maximum time
   * that the server can spend processing the request, in seconds. The default is
   * 30 seconds.
   *
   * @param {uuid} [options.fileGetFromTaskOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean} [options.fileGetFromTaskOptions.returnClientRequestId]
   * Whether the server should return the client-request-id in the response.
   *
   * @param {date} [options.fileGetFromTaskOptions.ocpDate] The time the request
   * was issued. Client libraries typically set this to the current system clock
   * time; set it explicitly if you are calling the REST API directly.
   *
   * @param {string} [options.fileGetFromTaskOptions.ocpRange] The byte range to
   * be retrieved. The default is to retrieve the entire file. The format is
   * bytes=startRange-endRange.
   *
   * @param {date} [options.fileGetFromTaskOptions.ifModifiedSince] A timestamp
   * indicating the last modified time of the resource known to the client. The
   * operation will be performed only if the resource on the service has been
   * modified since the specified time.
   *
   * @param {date} [options.fileGetFromTaskOptions.ifUnmodifiedSince] A timestamp
   * indicating the last modified time of the resource known to the client. The
   * operation will be performed only if the resource on the service has not been
   * modified since the specified time.
   *
   * @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 {Object} - 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.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getFromTask(jobId, taskId, filePath, 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._getFromTask(jobId, taskId, filePath, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getFromTask(jobId, taskId, filePath, options, optionalCallback);
    }
  }

  /**
   * Gets the properties of the specified Task file.
   *
   * @param {string} jobId The ID of the Job that contains the Task.
   *
   * @param {string} taskId The ID of the Task whose file you want to get the
   * properties of.
   *
   * @param {string} filePath The path to the Task file that you want to get the
   * properties of.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.fileGetPropertiesFromTaskOptions] Additional
   * parameters for the operation
   *
   * @param {number} [options.fileGetPropertiesFromTaskOptions.timeout] The
   * maximum time that the server can spend processing the request, in seconds.
   * The default is 30 seconds.
   *
   * @param {uuid} [options.fileGetPropertiesFromTaskOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean}
   * [options.fileGetPropertiesFromTaskOptions.returnClientRequestId] Whether the
   * server should return the client-request-id in the response.
   *
   * @param {date} [options.fileGetPropertiesFromTaskOptions.ocpDate] The time
   * the request was issued. Client libraries typically set this to the current
   * system clock time; set it explicitly if you are calling the REST API
   * directly.
   *
   * @param {date} [options.fileGetPropertiesFromTaskOptions.ifModifiedSince] A
   * timestamp indicating the last modified time of the resource known to the
   * client. The operation will be performed only if the resource on the service
   * has been modified since the specified time.
   *
   * @param {date} [options.fileGetPropertiesFromTaskOptions.ifUnmodifiedSince] A
   * timestamp indicating the last modified time of the resource known to the
   * client. The operation will be performed only if the resource on the service
   * has not been modified since the specified time.
   *
   * @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.
   */
  getPropertiesFromTaskWithHttpOperationResponse(jobId, taskId, filePath, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getPropertiesFromTask(jobId, taskId, filePath, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets the properties of the specified Task file.
   *
   * @param {string} jobId The ID of the Job that contains the Task.
   *
   * @param {string} taskId The ID of the Task whose file you want to get the
   * properties of.
   *
   * @param {string} filePath The path to the Task file that you want to get the
   * properties of.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.fileGetPropertiesFromTaskOptions] Additional
   * parameters for the operation
   *
   * @param {number} [options.fileGetPropertiesFromTaskOptions.timeout] The
   * maximum time that the server can spend processing the request, in seconds.
   * The default is 30 seconds.
   *
   * @param {uuid} [options.fileGetPropertiesFromTaskOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean}
   * [options.fileGetPropertiesFromTaskOptions.returnClientRequestId] Whether the
   * server should return the client-request-id in the response.
   *
   * @param {date} [options.fileGetPropertiesFromTaskOptions.ocpDate] The time
   * the request was issued. Client libraries typically set this to the current
   * system clock time; set it explicitly if you are calling the REST API
   * directly.
   *
   * @param {date} [options.fileGetPropertiesFromTaskOptions.ifModifiedSince] A
   * timestamp indicating the last modified time of the resource known to the
   * client. The operation will be performed only if the resource on the service
   * has been modified since the specified time.
   *
   * @param {date} [options.fileGetPropertiesFromTaskOptions.ifUnmodifiedSince] A
   * timestamp indicating the last modified time of the resource known to the
   * client. The operation will be performed only if the resource on the service
   * has not been modified since the specified time.
   *
   * @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.
   */
  getPropertiesFromTask(jobId, taskId, filePath, 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._getPropertiesFromTask(jobId, taskId, filePath, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getPropertiesFromTask(jobId, taskId, filePath, options, optionalCallback);
    }
  }

  /**
   * @summary Deletes the specified file from the Compute Node.
   *
   * @param {string} poolId The ID of the Pool that contains the Compute Node.
   *
   * @param {string} nodeId The ID of the Compute Node from which you want to
   * delete the file.
   *
   * @param {string} filePath The path to the file or directory that you want to
   * delete.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {boolean} [options.recursive] Whether to delete children of a
   * directory. If the filePath parameter represents a directory instead of a
   * file, you can set recursive to true to delete the directory and all of the
   * files and subdirectories in it. If recursive is false then the directory
   * must be empty or deletion will fail.
   *
   * @param {object} [options.fileDeleteFromComputeNodeOptions] Additional
   * parameters for the operation
   *
   * @param {number} [options.fileDeleteFromComputeNodeOptions.timeout] The
   * maximum time that the server can spend processing the request, in seconds.
   * The default is 30 seconds.
   *
   * @param {uuid} [options.fileDeleteFromComputeNodeOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean}
   * [options.fileDeleteFromComputeNodeOptions.returnClientRequestId] Whether the
   * server should return the client-request-id in the response.
   *
   * @param {date} [options.fileDeleteFromComputeNodeOptions.ocpDate] The time
   * the request was issued. Client libraries typically set this to the current
   * system clock time; set it explicitly if you are calling the REST API
   * directly.
   *
   * @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.
   */
  deleteFromComputeNodeWithHttpOperationResponse(poolId, nodeId, filePath, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteFromComputeNode(poolId, nodeId, filePath, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Deletes the specified file from the Compute Node.
   *
   * @param {string} poolId The ID of the Pool that contains the Compute Node.
   *
   * @param {string} nodeId The ID of the Compute Node from which you want to
   * delete the file.
   *
   * @param {string} filePath The path to the file or directory that you want to
   * delete.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {boolean} [options.recursive] Whether to delete children of a
   * directory. If the filePath parameter represents a directory instead of a
   * file, you can set recursive to true to delete the directory and all of the
   * files and subdirectories in it. If recursive is false then the directory
   * must be empty or deletion will fail.
   *
   * @param {object} [options.fileDeleteFromComputeNodeOptions] Additional
   * parameters for the operation
   *
   * @param {number} [options.fileDeleteFromComputeNodeOptions.timeout] The
   * maximum time that the server can spend processing the request, in seconds.
   * The default is 30 seconds.
   *
   * @param {uuid} [options.fileDeleteFromComputeNodeOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean}
   * [options.fileDeleteFromComputeNodeOptions.returnClientRequestId] Whether the
   * server should return the client-request-id in the response.
   *
   * @param {date} [options.fileDeleteFromComputeNodeOptions.ocpDate] The time
   * the request was issued. Client libraries typically set this to the current
   * system clock time; set it explicitly if you are calling the REST API
   * directly.
   *
   * @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.
   */
  deleteFromComputeNode(poolId, nodeId, filePath, 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._deleteFromComputeNode(poolId, nodeId, filePath, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteFromComputeNode(poolId, nodeId, filePath, options, optionalCallback);
    }
  }

  /**
   * Returns the content of the specified Compute Node file.
   *
   * @param {string} poolId The ID of the Pool that contains the Compute Node.
   *
   * @param {string} nodeId The ID of the Compute Node that contains the file.
   *
   * @param {string} filePath The path to the Compute Node file that you want to
   * get the content of.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.fileGetFromComputeNodeOptions] Additional
   * parameters for the operation
   *
   * @param {number} [options.fileGetFromComputeNodeOptions.timeout] The maximum
   * time that the server can spend processing the request, in seconds. The
   * default is 30 seconds.
   *
   * @param {uuid} [options.fileGetFromComputeNodeOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean}
   * [options.fileGetFromComputeNodeOptions.returnClientRequestId] Whether the
   * server should return the client-request-id in the response.
   *
   * @param {date} [options.fileGetFromComputeNodeOptions.ocpDate] The time the
   * request was issued. Client libraries typically set this to the current
   * system clock time; set it explicitly if you are calling the REST API
   * directly.
   *
   * @param {string} [options.fileGetFromComputeNodeOptions.ocpRange] The byte
   * range to be retrieved. The default is to retrieve the entire file. The
   * format is bytes=startRange-endRange.
   *
   * @param {date} [options.fileGetFromComputeNodeOptions.ifModifiedSince] A
   * timestamp indicating the last modified time of the resource known to the
   * client. The operation will be performed only if the resource on the service
   * has been modified since the specified time.
   *
   * @param {date} [options.fileGetFromComputeNodeOptions.ifUnmodifiedSince] A
   * timestamp indicating the last modified time of the resource known to the
   * client. The operation will be performed only if the resource on the service
   * has not been modified since the specified time.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Object>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getFromComputeNodeWithHttpOperationResponse(poolId, nodeId, filePath, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getFromComputeNode(poolId, nodeId, filePath, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Returns the content of the specified Compute Node file.
   *
   * @param {string} poolId The ID of the Pool that contains the Compute Node.
   *
   * @param {string} nodeId The ID of the Compute Node that contains the file.
   *
   * @param {string} filePath The path to the Compute Node file that you want to
   * get the content of.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.fileGetFromComputeNodeOptions] Additional
   * parameters for the operation
   *
   * @param {number} [options.fileGetFromComputeNodeOptions.timeout] The maximum
   * time that the server can spend processing the request, in seconds. The
   * default is 30 seconds.
   *
   * @param {uuid} [options.fileGetFromComputeNodeOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean}
   * [options.fileGetFromComputeNodeOptions.returnClientRequestId] Whether the
   * server should return the client-request-id in the response.
   *
   * @param {date} [options.fileGetFromComputeNodeOptions.ocpDate] The time the
   * request was issued. Client libraries typically set this to the current
   * system clock time; set it explicitly if you are calling the REST API
   * directly.
   *
   * @param {string} [options.fileGetFromComputeNodeOptions.ocpRange] The byte
   * range to be retrieved. The default is to retrieve the entire file. The
   * format is bytes=startRange-endRange.
   *
   * @param {date} [options.fileGetFromComputeNodeOptions.ifModifiedSince] A
   * timestamp indicating the last modified time of the resource known to the
   * client. The operation will be performed only if the resource on the service
   * has been modified since the specified time.
   *
   * @param {date} [options.fileGetFromComputeNodeOptions.ifUnmodifiedSince] A
   * timestamp indicating the last modified time of the resource known to the
   * client. The operation will be performed only if the resource on the service
   * has not been modified since the specified time.
   *
   * @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 {Object} - 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.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getFromComputeNode(poolId, nodeId, filePath, 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._getFromComputeNode(poolId, nodeId, filePath, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getFromComputeNode(poolId, nodeId, filePath, options, optionalCallback);
    }
  }

  /**
   * Gets the properties of the specified Compute Node file.
   *
   * @param {string} poolId The ID of the Pool that contains the Compute Node.
   *
   * @param {string} nodeId The ID of the Compute Node that contains the file.
   *
   * @param {string} filePath The path to the Compute Node file that you want to
   * get the properties of.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.fileGetPropertiesFromComputeNodeOptions] Additional
   * parameters for the operation
   *
   * @param {number} [options.fileGetPropertiesFromComputeNodeOptions.timeout]
   * The maximum time that the server can spend processing the request, in
   * seconds. The default is 30 seconds.
   *
   * @param {uuid}
   * [options.fileGetPropertiesFromComputeNodeOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean}
   * [options.fileGetPropertiesFromComputeNodeOptions.returnClientRequestId]
   * Whether the server should return the client-request-id in the response.
   *
   * @param {date} [options.fileGetPropertiesFromComputeNodeOptions.ocpDate] The
   * time the request was issued. Client libraries typically set this to the
   * current system clock time; set it explicitly if you are calling the REST API
   * directly.
   *
   * @param {date}
   * [options.fileGetPropertiesFromComputeNodeOptions.ifModifiedSince] A
   * timestamp indicating the last modified time of the resource known to the
   * client. The operation will be performed only if the resource on the service
   * has been modified since the specified time.
   *
   * @param {date}
   * [options.fileGetPropertiesFromComputeNodeOptions.ifUnmodifiedSince] A
   * timestamp indicating the last modified time of the resource known to the
   * client. The operation will be performed only if the resource on the service
   * has not been modified since the specified time.
   *
   * @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.
   */
  getPropertiesFromComputeNodeWithHttpOperationResponse(poolId, nodeId, filePath, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getPropertiesFromComputeNode(poolId, nodeId, filePath, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets the properties of the specified Compute Node file.
   *
   * @param {string} poolId The ID of the Pool that contains the Compute Node.
   *
   * @param {string} nodeId The ID of the Compute Node that contains the file.
   *
   * @param {string} filePath The path to the Compute Node file that you want to
   * get the properties of.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.fileGetPropertiesFromComputeNodeOptions] Additional
   * parameters for the operation
   *
   * @param {number} [options.fileGetPropertiesFromComputeNodeOptions.timeout]
   * The maximum time that the server can spend processing the request, in
   * seconds. The default is 30 seconds.
   *
   * @param {uuid}
   * [options.fileGetPropertiesFromComputeNodeOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean}
   * [options.fileGetPropertiesFromComputeNodeOptions.returnClientRequestId]
   * Whether the server should return the client-request-id in the response.
   *
   * @param {date} [options.fileGetPropertiesFromComputeNodeOptions.ocpDate] The
   * time the request was issued. Client libraries typically set this to the
   * current system clock time; set it explicitly if you are calling the REST API
   * directly.
   *
   * @param {date}
   * [options.fileGetPropertiesFromComputeNodeOptions.ifModifiedSince] A
   * timestamp indicating the last modified time of the resource known to the
   * client. The operation will be performed only if the resource on the service
   * has been modified since the specified time.
   *
   * @param {date}
   * [options.fileGetPropertiesFromComputeNodeOptions.ifUnmodifiedSince] A
   * timestamp indicating the last modified time of the resource known to the
   * client. The operation will be performed only if the resource on the service
   * has not been modified since the specified time.
   *
   * @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.
   */
  getPropertiesFromComputeNode(poolId, nodeId, filePath, 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._getPropertiesFromComputeNode(poolId, nodeId, filePath, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getPropertiesFromComputeNode(poolId, nodeId, filePath, options, optionalCallback);
    }
  }

  /**
   * @summary Lists the files in a Task's directory on its Compute Node.
   *
   * @param {string} jobId The ID of the Job that contains the Task.
   *
   * @param {string} taskId The ID of the Task whose files you want to list.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {boolean} [options.recursive] Whether to list children of the Task
   * directory. This parameter can be used in combination with the filter
   * parameter to list specific type of files.
   *
   * @param {object} [options.fileListFromTaskOptions] Additional parameters for
   * the operation
   *
   * @param {string} [options.fileListFromTaskOptions.filter] An OData $filter
   * clause. For more information on constructing this filter, see
   * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-task-files.
   *
   * @param {number} [options.fileListFromTaskOptions.maxResults] The maximum
   * number of items to return in the response. A maximum of 1000 files can be
   * returned.
   *
   * @param {number} [options.fileListFromTaskOptions.timeout] The maximum time
   * that the server can spend processing the request, in seconds. The default is
   * 30 seconds.
   *
   * @param {uuid} [options.fileListFromTaskOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean} [options.fileListFromTaskOptions.returnClientRequestId]
   * Whether the server should return the client-request-id in the response.
   *
   * @param {date} [options.fileListFromTaskOptions.ocpDate] The time the request
   * was issued. Client libraries typically set this to the current system clock
   * time; set it explicitly if you are calling the REST API directly.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<NodeFileListResult>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listFromTaskWithHttpOperationResponse(jobId, taskId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listFromTask(jobId, taskId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Lists the files in a Task's directory on its Compute Node.
   *
   * @param {string} jobId The ID of the Job that contains the Task.
   *
   * @param {string} taskId The ID of the Task whose files you want to list.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {boolean} [options.recursive] Whether to list children of the Task
   * directory. This parameter can be used in combination with the filter
   * parameter to list specific type of files.
   *
   * @param {object} [options.fileListFromTaskOptions] Additional parameters for
   * the operation
   *
   * @param {string} [options.fileListFromTaskOptions.filter] An OData $filter
   * clause. For more information on constructing this filter, see
   * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-task-files.
   *
   * @param {number} [options.fileListFromTaskOptions.maxResults] The maximum
   * number of items to return in the response. A maximum of 1000 files can be
   * returned.
   *
   * @param {number} [options.fileListFromTaskOptions.timeout] The maximum time
   * that the server can spend processing the request, in seconds. The default is
   * 30 seconds.
   *
   * @param {uuid} [options.fileListFromTaskOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean} [options.fileListFromTaskOptions.returnClientRequestId]
   * Whether the server should return the client-request-id in the response.
   *
   * @param {date} [options.fileListFromTaskOptions.ocpDate] The time the request
   * was issued. Client libraries typically set this to the current system clock
   * time; set it explicitly if you are calling the REST API directly.
   *
   * @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 {NodeFileListResult} - 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 NodeFileListResult} 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.
   */
  listFromTask(jobId, taskId, 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._listFromTask(jobId, taskId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listFromTask(jobId, taskId, options, optionalCallback);
    }
  }

  /**
   * @summary Lists all of the files in Task directories on the specified Compute
   * Node.
   *
   * @param {string} poolId The ID of the Pool that contains the Compute Node.
   *
   * @param {string} nodeId The ID of the Compute Node whose files you want to
   * list.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {boolean} [options.recursive] Whether to list children of a
   * directory.
   *
   * @param {object} [options.fileListFromComputeNodeOptions] Additional
   * parameters for the operation
   *
   * @param {string} [options.fileListFromComputeNodeOptions.filter] An OData
   * $filter clause. For more information on constructing this filter, see
   * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-compute-node-files.
   *
   * @param {number} [options.fileListFromComputeNodeOptions.maxResults] The
   * maximum number of items to return in the response. A maximum of 1000 files
   * can be returned.
   *
   * @param {number} [options.fileListFromComputeNodeOptions.timeout] The maximum
   * time that the server can spend processing the request, in seconds. The
   * default is 30 seconds.
   *
   * @param {uuid} [options.fileListFromComputeNodeOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean}
   * [options.fileListFromComputeNodeOptions.returnClientRequestId] Whether the
   * server should return the client-request-id in the response.
   *
   * @param {date} [options.fileListFromComputeNodeOptions.ocpDate] The time the
   * request was issued. Client libraries typically set this to the current
   * system clock time; set it explicitly if you are calling the REST API
   * directly.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<NodeFileListResult>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listFromComputeNodeWithHttpOperationResponse(poolId, nodeId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listFromComputeNode(poolId, nodeId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Lists all of the files in Task directories on the specified Compute
   * Node.
   *
   * @param {string} poolId The ID of the Pool that contains the Compute Node.
   *
   * @param {string} nodeId The ID of the Compute Node whose files you want to
   * list.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {boolean} [options.recursive] Whether to list children of a
   * directory.
   *
   * @param {object} [options.fileListFromComputeNodeOptions] Additional
   * parameters for the operation
   *
   * @param {string} [options.fileListFromComputeNodeOptions.filter] An OData
   * $filter clause. For more information on constructing this filter, see
   * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-compute-node-files.
   *
   * @param {number} [options.fileListFromComputeNodeOptions.maxResults] The
   * maximum number of items to return in the response. A maximum of 1000 files
   * can be returned.
   *
   * @param {number} [options.fileListFromComputeNodeOptions.timeout] The maximum
   * time that the server can spend processing the request, in seconds. The
   * default is 30 seconds.
   *
   * @param {uuid} [options.fileListFromComputeNodeOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean}
   * [options.fileListFromComputeNodeOptions.returnClientRequestId] Whether the
   * server should return the client-request-id in the response.
   *
   * @param {date} [options.fileListFromComputeNodeOptions.ocpDate] The time the
   * request was issued. Client libraries typically set this to the current
   * system clock time; set it explicitly if you are calling the REST API
   * directly.
   *
   * @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 {NodeFileListResult} - 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 NodeFileListResult} 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.
   */
  listFromComputeNode(poolId, nodeId, 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._listFromComputeNode(poolId, nodeId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listFromComputeNode(poolId, nodeId, options, optionalCallback);
    }
  }

  /**
   * @summary Lists the files in a Task's directory on its Compute Node.
   *
   * @param {string} nextPageLink The NextLink from the previous successful call
   * to List operation.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.fileListFromTaskNextOptions] Additional parameters
   * for the operation
   *
   * @param {uuid} [options.fileListFromTaskNextOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean} [options.fileListFromTaskNextOptions.returnClientRequestId]
   * Whether the server should return the client-request-id in the response.
   *
   * @param {date} [options.fileListFromTaskNextOptions.ocpDate] The time the
   * request was issued. Client libraries typically set this to the current
   * system clock time; set it explicitly if you are calling the REST API
   * directly.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<NodeFileListResult>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listFromTaskNextWithHttpOperationResponse(nextPageLink, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listFromTaskNext(nextPageLink, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Lists the files in a Task's directory on its Compute Node.
   *
   * @param {string} nextPageLink The NextLink from the previous successful call
   * to List operation.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.fileListFromTaskNextOptions] Additional parameters
   * for the operation
   *
   * @param {uuid} [options.fileListFromTaskNextOptions.clientRequestId] The
   * caller-generated request identity, in the form of a GUID with no decoration
   * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean} [options.fileListFromTaskNextOptions.returnClientRequestId]
   * Whether the server should return the client-request-id in the response.
   *
   * @param {date} [options.fileListFromTaskNextOptions.ocpDate] The time the
   * request was issued. Client libraries typically set this to the current
   * system clock time; set it explicitly if you are calling the REST API
   * directly.
   *
   * @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 {NodeFileListResult} - 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 NodeFileListResult} 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.
   */
  listFromTaskNext(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._listFromTaskNext(nextPageLink, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listFromTaskNext(nextPageLink, options, optionalCallback);
    }
  }

  /**
   * @summary Lists all of the files in Task directories on the specified Compute
   * Node.
   *
   * @param {string} nextPageLink The NextLink from the previous successful call
   * to List operation.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.fileListFromComputeNodeNextOptions] Additional
   * parameters for the operation
   *
   * @param {uuid} [options.fileListFromComputeNodeNextOptions.clientRequestId]
   * The caller-generated request identity, in the form of a GUID with no
   * decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean}
   * [options.fileListFromComputeNodeNextOptions.returnClientRequestId] Whether
   * the server should return the client-request-id in the response.
   *
   * @param {date} [options.fileListFromComputeNodeNextOptions.ocpDate] The time
   * the request was issued. Client libraries typically set this to the current
   * system clock time; set it explicitly if you are calling the REST API
   * directly.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<NodeFileListResult>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listFromComputeNodeNextWithHttpOperationResponse(nextPageLink, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listFromComputeNodeNext(nextPageLink, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Lists all of the files in Task directories on the specified Compute
   * Node.
   *
   * @param {string} nextPageLink The NextLink from the previous successful call
   * to List operation.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.fileListFromComputeNodeNextOptions] Additional
   * parameters for the operation
   *
   * @param {uuid} [options.fileListFromComputeNodeNextOptions.clientRequestId]
   * The caller-generated request identity, in the form of a GUID with no
   * decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
   *
   * @param {boolean}
   * [options.fileListFromComputeNodeNextOptions.returnClientRequestId] Whether
   * the server should return the client-request-id in the response.
   *
   * @param {date} [options.fileListFromComputeNodeNextOptions.ocpDate] The time
   * the request was issued. Client libraries typically set this to the current
   * system clock time; set it explicitly if you are calling the REST API
   * directly.
   *
   * @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 {NodeFileListResult} - 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 NodeFileListResult} 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.
   */
  listFromComputeNodeNext(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._listFromComputeNodeNext(nextPageLink, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listFromComputeNodeNext(nextPageLink, options, optionalCallback);
    }
  }

}

module.exports = File;

redpajama_set_name: RedPajamaGithub