azure
Version:
Microsoft Azure Client Library for node
89 lines (76 loc) • 3.73 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.
*/
/* jshint latedef:false */
/* jshint forin:false */
/* jshint noempty:false */
'use strict';
const msRest = require('ms-rest');
const msRestAzure = require('ms-rest-azure');
const ServiceClient = msRestAzure.AzureServiceClient;
const models = require('./models');
const operations = require('./operations');
/** Class representing a BatchServiceClient. */
class BatchServiceClient extends ServiceClient {
/**
* Create a BatchServiceClient.
* @param {credentials} credentials - Credentials needed for the client to connect to Azure.
* @param {string} [baseUri] - The base URI of the service.
* @param {object} [options] - The parameter options
* @param {Array} [options.filters] - Filters to be added to the request pipeline
* @param {object} [options.requestOptions] - Options for the underlying request object
* {@link https://github.com/request/request#requestoptions-callback Options doc}
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
* @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response.
* @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.
* @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
*/
constructor(credentials, baseUri, options) {
if (credentials === null || credentials === undefined) {
throw new Error('\'credentials\' cannot be null.');
}
if (!options) options = {};
super(credentials, options);
this.apiVersion = '2018-03-01.6.1';
this.acceptLanguage = 'en-US';
this.longRunningOperationRetryTimeout = 30;
this.generateClientRequestId = true;
this.baseUri = baseUri;
if (!this.baseUri) {
this.baseUri = 'https://batch.core.windows.net';
}
this.credentials = credentials;
let packageInfo = this.getPackageJsonInfo(__dirname);
this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`);
if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
this.acceptLanguage = options.acceptLanguage;
}
if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) {
this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout;
}
if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) {
this.generateClientRequestId = options.generateClientRequestId;
}
this.application = new operations.Application(this);
this.pool = new operations.Pool(this);
this.account = new operations.Account(this);
this.job = new operations.Job(this);
this.certificateOperations = new operations.CertificateOperations(this);
this.file = new operations.File(this);
this.jobSchedule = new operations.JobSchedule(this);
this.task = new operations.Task(this);
this.computeNodeOperations = new operations.ComputeNodeOperations(this);
this.models = models;
msRest.addSerializationMixin(this);
}
}
module.exports = BatchServiceClient;
module.exports['default'] = BatchServiceClient;
module.exports.BatchServiceClient = BatchServiceClient;
module.exports.BatchServiceModels = models;