azure-arm-datalake-analytics
Version:
Microsoft Azure Data Lake Analytics Management Client Library for node
788 lines (764 loc) • 31.6 kB
JavaScript
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
const msRest = require('ms-rest');
const msRestAzure = require('ms-rest-azure');
const WebResource = msRest.WebResource;
/**
* Lists all recurrences.
*
* @param {string} accountName The Azure Data Lake Analytics account to execute
* job operations on.
*
* @param {object} [options] Optional Parameters.
*
* @param {date} [options.startDateTime] The start date for when to get the
* list of recurrences. The startDateTime and endDateTime can be no more than
* 30 days apart.
*
* @param {date} [options.endDateTime] The end date for when to get the list of
* recurrences. The startDateTime and endDateTime can be no more than 30 days
* apart.
*
* @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 JobRecurrenceInformationListResult} for more
* information.
*
* {object} [request] - The HTTP Request object if an error did not occur.
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
function _list(accountName, 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 startDateTime = (options && options.startDateTime !== undefined) ? options.startDateTime : undefined;
let endDateTime = (options && options.endDateTime !== undefined) ? options.endDateTime : undefined;
// Validate
try {
if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') {
throw new Error('accountName cannot be null or undefined and it must be of type string.');
}
if (this.client.adlaJobDnsSuffix === null || this.client.adlaJobDnsSuffix === undefined || typeof this.client.adlaJobDnsSuffix.valueOf() !== 'string') {
throw new Error('this.client.adlaJobDnsSuffix cannot be null or undefined and it must be of type string.');
}
if (startDateTime && !(startDateTime instanceof Date ||
(typeof startDateTime.valueOf() === 'string' && !isNaN(Date.parse(startDateTime))))) {
throw new Error('startDateTime must be of type date.');
}
if (endDateTime && !(endDateTime instanceof Date ||
(typeof endDateTime.valueOf() === 'string' && !isNaN(Date.parse(endDateTime))))) {
throw new Error('endDateTime must be of type date.');
}
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);
}
// Construct URL
let baseUrl = this.client.baseUri;
let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'recurrences';
requestUrl = requestUrl.replace('{accountName}', accountName);
requestUrl = requestUrl.replace('{adlaJobDnsSuffix}', this.client.adlaJobDnsSuffix);
let queryParameters = [];
if (startDateTime !== null && startDateTime !== undefined) {
queryParameters.push('startDateTime=' + encodeURIComponent(client.serializeObject(startDateTime)));
}
if (endDateTime !== null && endDateTime !== undefined) {
queryParameters.push('endDateTime=' + encodeURIComponent(client.serializeObject(endDateTime)));
}
queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
if (queryParameters.length > 0) {
requestUrl += '?' + queryParameters.join('&');
}
// Create HTTP transport objects
let httpRequest = new WebResource();
httpRequest.method = 'GET';
httpRequest.url = requestUrl;
httpRequest.headers = {};
// Set Headers
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
if (this.client.generateClientRequestId) {
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
}
if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
for(let headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
httpRequest.headers[headerName] = options['customHeaders'][headerName];
}
}
}
httpRequest.body = null;
// Send Request
return client.pipeline(httpRequest, (err, response, responseBody) => {
if (err) {
return callback(err);
}
let statusCode = response.statusCode;
if (statusCode !== 200) {
let error = new Error(responseBody);
error.statusCode = response.statusCode;
error.request = msRest.stripRequest(httpRequest);
error.response = msRest.stripResponse(response);
if (responseBody === '') responseBody = null;
let parsedErrorResponse;
try {
parsedErrorResponse = JSON.parse(responseBody);
if (parsedErrorResponse) {
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
}
if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
let resultMapper = new client.models['CloudError']().mapper();
error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
}
} catch (defaultError) {
error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
`- "${responseBody}" for the default response.`;
return callback(error);
}
return callback(error);
}
// Create Result
let result = null;
if (responseBody === '') responseBody = null;
// Deserialize Response
if (statusCode === 200) {
let parsedResponse = null;
try {
parsedResponse = JSON.parse(responseBody);
result = JSON.parse(responseBody);
if (parsedResponse !== null && parsedResponse !== undefined) {
let resultMapper = new client.models['JobRecurrenceInformationListResult']().mapper();
result = client.deserialize(resultMapper, parsedResponse, 'result');
}
} catch (error) {
let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
deserializationError.request = msRest.stripRequest(httpRequest);
deserializationError.response = msRest.stripResponse(response);
return callback(deserializationError);
}
}
return callback(null, result, httpRequest, response);
});
}
/**
* Gets the recurrence information for the specified recurrence ID.
*
* @param {string} accountName The Azure Data Lake Analytics account to execute
* job operations on.
*
* @param {uuid} recurrenceIdentity Recurrence ID.
*
* @param {object} [options] Optional Parameters.
*
* @param {date} [options.startDateTime] The start date for when to get the
* recurrence and aggregate its data. The startDateTime and endDateTime can be
* no more than 30 days apart.
*
* @param {date} [options.endDateTime] The end date for when to get recurrence
* and aggregate its data. The startDateTime and endDateTime can be no more
* than 30 days apart.
*
* @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 JobRecurrenceInformation} for more
* information.
*
* {object} [request] - The HTTP Request object if an error did not occur.
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
function _get(accountName, recurrenceIdentity, 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 startDateTime = (options && options.startDateTime !== undefined) ? options.startDateTime : undefined;
let endDateTime = (options && options.endDateTime !== undefined) ? options.endDateTime : undefined;
// Validate
try {
if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') {
throw new Error('accountName cannot be null or undefined and it must be of type string.');
}
if (this.client.adlaJobDnsSuffix === null || this.client.adlaJobDnsSuffix === undefined || typeof this.client.adlaJobDnsSuffix.valueOf() !== 'string') {
throw new Error('this.client.adlaJobDnsSuffix cannot be null or undefined and it must be of type string.');
}
if (recurrenceIdentity === null || recurrenceIdentity === undefined || typeof recurrenceIdentity.valueOf() !== 'string' || !msRest.isValidUuid(recurrenceIdentity)) {
throw new Error('recurrenceIdentity cannot be null or undefined and it must be of type string and must be a valid uuid.');
}
if (startDateTime && !(startDateTime instanceof Date ||
(typeof startDateTime.valueOf() === 'string' && !isNaN(Date.parse(startDateTime))))) {
throw new Error('startDateTime must be of type date.');
}
if (endDateTime && !(endDateTime instanceof Date ||
(typeof endDateTime.valueOf() === 'string' && !isNaN(Date.parse(endDateTime))))) {
throw new Error('endDateTime must be of type date.');
}
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);
}
// Construct URL
let baseUrl = this.client.baseUri;
let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'recurrences/{recurrenceIdentity}';
requestUrl = requestUrl.replace('{accountName}', accountName);
requestUrl = requestUrl.replace('{adlaJobDnsSuffix}', this.client.adlaJobDnsSuffix);
requestUrl = requestUrl.replace('{recurrenceIdentity}', encodeURIComponent(recurrenceIdentity.toString()));
let queryParameters = [];
if (startDateTime !== null && startDateTime !== undefined) {
queryParameters.push('startDateTime=' + encodeURIComponent(client.serializeObject(startDateTime)));
}
if (endDateTime !== null && endDateTime !== undefined) {
queryParameters.push('endDateTime=' + encodeURIComponent(client.serializeObject(endDateTime)));
}
queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion));
if (queryParameters.length > 0) {
requestUrl += '?' + queryParameters.join('&');
}
// Create HTTP transport objects
let httpRequest = new WebResource();
httpRequest.method = 'GET';
httpRequest.url = requestUrl;
httpRequest.headers = {};
// Set Headers
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
if (this.client.generateClientRequestId) {
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
}
if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
for(let headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
httpRequest.headers[headerName] = options['customHeaders'][headerName];
}
}
}
httpRequest.body = null;
// Send Request
return client.pipeline(httpRequest, (err, response, responseBody) => {
if (err) {
return callback(err);
}
let statusCode = response.statusCode;
if (statusCode !== 200) {
let error = new Error(responseBody);
error.statusCode = response.statusCode;
error.request = msRest.stripRequest(httpRequest);
error.response = msRest.stripResponse(response);
if (responseBody === '') responseBody = null;
let parsedErrorResponse;
try {
parsedErrorResponse = JSON.parse(responseBody);
if (parsedErrorResponse) {
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
}
if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
let resultMapper = new client.models['CloudError']().mapper();
error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
}
} catch (defaultError) {
error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
`- "${responseBody}" for the default response.`;
return callback(error);
}
return callback(error);
}
// Create Result
let result = null;
if (responseBody === '') responseBody = null;
// Deserialize Response
if (statusCode === 200) {
let parsedResponse = null;
try {
parsedResponse = JSON.parse(responseBody);
result = JSON.parse(responseBody);
if (parsedResponse !== null && parsedResponse !== undefined) {
let resultMapper = new client.models['JobRecurrenceInformation']().mapper();
result = client.deserialize(resultMapper, parsedResponse, 'result');
}
} catch (error) {
let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
deserializationError.request = msRest.stripRequest(httpRequest);
deserializationError.response = msRest.stripResponse(response);
return callback(deserializationError);
}
}
return callback(null, result, httpRequest, response);
});
}
/**
* Lists all recurrences.
*
* @param {string} nextPageLink The NextLink from the previous successful call
* to List operation.
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @param {function} callback - The callback.
*
* @returns {function} callback(err, result, request, response)
*
* {Error} err - The Error object if an error occurred, null otherwise.
*
* {object} [result] - The deserialized result object if an error did not occur.
* See {@link JobRecurrenceInformationListResult} for more
* information.
*
* {object} [request] - The HTTP Request object if an error did not occur.
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
function _listNext(nextPageLink, options, callback) {
/* jshint validthis: true */
let client = this.client;
if(!callback && typeof options === 'function') {
callback = options;
options = null;
}
if (!callback) {
throw new Error('callback cannot be null.');
}
// Validate
try {
if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') {
throw new Error('nextPageLink cannot be null or undefined and it must be of type string.');
}
if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') {
throw new Error('this.client.acceptLanguage must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
let requestUrl = '{nextLink}';
requestUrl = requestUrl.replace('{nextLink}', nextPageLink);
// Create HTTP transport objects
let httpRequest = new WebResource();
httpRequest.method = 'GET';
httpRequest.url = requestUrl;
httpRequest.headers = {};
// Set Headers
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
if (this.client.generateClientRequestId) {
httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
}
if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) {
httpRequest.headers['accept-language'] = this.client.acceptLanguage;
}
if(options) {
for(let headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
httpRequest.headers[headerName] = options['customHeaders'][headerName];
}
}
}
httpRequest.body = null;
// Send Request
return client.pipeline(httpRequest, (err, response, responseBody) => {
if (err) {
return callback(err);
}
let statusCode = response.statusCode;
if (statusCode !== 200) {
let error = new Error(responseBody);
error.statusCode = response.statusCode;
error.request = msRest.stripRequest(httpRequest);
error.response = msRest.stripResponse(response);
if (responseBody === '') responseBody = null;
let parsedErrorResponse;
try {
parsedErrorResponse = JSON.parse(responseBody);
if (parsedErrorResponse) {
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
}
if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
let resultMapper = new client.models['CloudError']().mapper();
error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
}
} catch (defaultError) {
error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
`- "${responseBody}" for the default response.`;
return callback(error);
}
return callback(error);
}
// Create Result
let result = null;
if (responseBody === '') responseBody = null;
// Deserialize Response
if (statusCode === 200) {
let parsedResponse = null;
try {
parsedResponse = JSON.parse(responseBody);
result = JSON.parse(responseBody);
if (parsedResponse !== null && parsedResponse !== undefined) {
let resultMapper = new client.models['JobRecurrenceInformationListResult']().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 Recurrence. */
class Recurrence {
/**
* Create a Recurrence.
* @param {DataLakeAnalyticsJobManagementClient} client Reference to the service client.
*/
constructor(client) {
this.client = client;
this._list = _list;
this._get = _get;
this._listNext = _listNext;
}
/**
* Lists all recurrences.
*
* @param {string} accountName The Azure Data Lake Analytics account to execute
* job operations on.
*
* @param {object} [options] Optional Parameters.
*
* @param {date} [options.startDateTime] The start date for when to get the
* list of recurrences. The startDateTime and endDateTime can be no more than
* 30 days apart.
*
* @param {date} [options.endDateTime] The end date for when to get the list of
* recurrences. The startDateTime and endDateTime can be no more than 30 days
* apart.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse<JobRecurrenceInformationListResult>} - The deserialized result object.
*
* @reject {Error} - The error object.
*/
listWithHttpOperationResponse(accountName, options) {
let client = this.client;
let self = this;
return new Promise((resolve, reject) => {
self._list(accountName, options, (err, result, request, response) => {
let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
httpOperationResponse.body = result;
if (err) { reject(err); }
else { resolve(httpOperationResponse); }
return;
});
});
}
/**
* Lists all recurrences.
*
* @param {string} accountName The Azure Data Lake Analytics account to execute
* job operations on.
*
* @param {object} [options] Optional Parameters.
*
* @param {date} [options.startDateTime] The start date for when to get the
* list of recurrences. The startDateTime and endDateTime can be no more than
* 30 days apart.
*
* @param {date} [options.endDateTime] The end date for when to get the list of
* recurrences. The startDateTime and endDateTime can be no more than 30 days
* apart.
*
* @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 {JobRecurrenceInformationListResult} - 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 JobRecurrenceInformationListResult} for more
* information.
*
* {object} [request] - The HTTP Request object if an error did not occur.
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
list(accountName, options, optionalCallback) {
let client = this.client;
let self = this;
if (!optionalCallback && typeof options === 'function') {
optionalCallback = options;
options = null;
}
if (!optionalCallback) {
return new Promise((resolve, reject) => {
self._list(accountName, options, (err, result, request, response) => {
if (err) { reject(err); }
else { resolve(result); }
return;
});
});
} else {
return self._list(accountName, options, optionalCallback);
}
}
/**
* Gets the recurrence information for the specified recurrence ID.
*
* @param {string} accountName The Azure Data Lake Analytics account to execute
* job operations on.
*
* @param {uuid} recurrenceIdentity Recurrence ID.
*
* @param {object} [options] Optional Parameters.
*
* @param {date} [options.startDateTime] The start date for when to get the
* recurrence and aggregate its data. The startDateTime and endDateTime can be
* no more than 30 days apart.
*
* @param {date} [options.endDateTime] The end date for when to get recurrence
* and aggregate its data. The startDateTime and endDateTime can be no more
* than 30 days apart.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse<JobRecurrenceInformation>} - The deserialized result object.
*
* @reject {Error} - The error object.
*/
getWithHttpOperationResponse(accountName, recurrenceIdentity, options) {
let client = this.client;
let self = this;
return new Promise((resolve, reject) => {
self._get(accountName, recurrenceIdentity, 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 recurrence information for the specified recurrence ID.
*
* @param {string} accountName The Azure Data Lake Analytics account to execute
* job operations on.
*
* @param {uuid} recurrenceIdentity Recurrence ID.
*
* @param {object} [options] Optional Parameters.
*
* @param {date} [options.startDateTime] The start date for when to get the
* recurrence and aggregate its data. The startDateTime and endDateTime can be
* no more than 30 days apart.
*
* @param {date} [options.endDateTime] The end date for when to get recurrence
* and aggregate its data. The startDateTime and endDateTime can be no more
* than 30 days apart.
*
* @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 {JobRecurrenceInformation} - 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 JobRecurrenceInformation} for more
* information.
*
* {object} [request] - The HTTP Request object if an error did not occur.
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
get(accountName, recurrenceIdentity, options, optionalCallback) {
let client = this.client;
let self = this;
if (!optionalCallback && typeof options === 'function') {
optionalCallback = options;
options = null;
}
if (!optionalCallback) {
return new Promise((resolve, reject) => {
self._get(accountName, recurrenceIdentity, options, (err, result, request, response) => {
if (err) { reject(err); }
else { resolve(result); }
return;
});
});
} else {
return self._get(accountName, recurrenceIdentity, options, optionalCallback);
}
}
/**
* Lists all recurrences.
*
* @param {string} nextPageLink The NextLink from the previous successful call
* to List operation.
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse<JobRecurrenceInformationListResult>} - The deserialized result object.
*
* @reject {Error} - The error object.
*/
listNextWithHttpOperationResponse(nextPageLink, options) {
let client = this.client;
let self = this;
return new Promise((resolve, reject) => {
self._listNext(nextPageLink, options, (err, result, request, response) => {
let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
httpOperationResponse.body = result;
if (err) { reject(err); }
else { resolve(httpOperationResponse); }
return;
});
});
}
/**
* Lists all recurrences.
*
* @param {string} nextPageLink The NextLink from the previous successful call
* to List operation.
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @param {function} [optionalCallback] - The optional callback.
*
* @returns {function|Promise} If a callback was passed as the last parameter
* then it returns the callback else returns a Promise.
*
* {Promise} A promise is returned
*
* @resolve {JobRecurrenceInformationListResult} - 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 JobRecurrenceInformationListResult} for more
* information.
*
* {object} [request] - The HTTP Request object if an error did not occur.
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
listNext(nextPageLink, options, optionalCallback) {
let client = this.client;
let self = this;
if (!optionalCallback && typeof options === 'function') {
optionalCallback = options;
options = null;
}
if (!optionalCallback) {
return new Promise((resolve, reject) => {
self._listNext(nextPageLink, options, (err, result, request, response) => {
if (err) { reject(err); }
else { resolve(result); }
return;
});
});
} else {
return self._listNext(nextPageLink, options, optionalCallback);
}
}
}
module.exports = Recurrence;