diff --git a/lib/services/networkManagement2/lib/lib/frontdoorManagementClient.d.ts b/lib/services/networkManagement2/lib/lib/frontdoorManagementClient.d.ts new file mode 100644 index 0000000000..b00e448a61 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/frontdoorManagementClient.d.ts @@ -0,0 +1,211 @@ +/* + * 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. + */ + +import { ServiceClient, ServiceClientOptions, ServiceCallback, HttpOperationResponse, ServiceClientCredentials } from 'ms-rest'; +import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; +import * as operations from "./operations"; + +export default class FrontdoorManagementClient extends AzureServiceClient { + /** + * Initializes a new instance of the FrontdoorManagementClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @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] - The preferred language for the response. + * + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + */ + constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); + + credentials: ServiceClientCredentials; + + subscriptionId: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + frontDoors: operations.FrontDoors; + routingRules: operations.RoutingRules; + healthProbeSettings: operations.HealthProbeSettings; + loadBalancingSettings: operations.LoadBalancingSettings; + backendPools: operations.BackendPools; + frontendEndpoints: operations.FrontendEndpoints; + endpoints: operations.Endpoints; + policies: operations.Policies; + + + /** + * Check the availability of a Front Door resource name. + * + * @param {object} checkFrontDoorNameAvailabilityInput Input to check. + * + * @param {string} checkFrontDoorNameAvailabilityInput.name The resource name + * to validate. + * + * @param {string} checkFrontDoorNameAvailabilityInput.type The type of the + * resource whose name is to be validated. Possible values include: + * 'Microsoft.Network/frontDoors', + * 'Microsoft.Network/frontDoors/frontendEndpoints' + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + checkFrontDoorNameAvailabilityWithHttpOperationResponse(checkFrontDoorNameAvailabilityInput: models.CheckNameAvailabilityInput, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Check the availability of a Front Door resource name. + * + * @param {object} checkFrontDoorNameAvailabilityInput Input to check. + * + * @param {string} checkFrontDoorNameAvailabilityInput.name The resource name + * to validate. + * + * @param {string} checkFrontDoorNameAvailabilityInput.type The type of the + * resource whose name is to be validated. Possible values include: + * 'Microsoft.Network/frontDoors', + * 'Microsoft.Network/frontDoors/frontendEndpoints' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {CheckNameAvailabilityOutput} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {CheckNameAvailabilityOutput} [result] - The deserialized result object if an error did not occur. + * See {@link CheckNameAvailabilityOutput} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + checkFrontDoorNameAvailability(checkFrontDoorNameAvailabilityInput: models.CheckNameAvailabilityInput, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkFrontDoorNameAvailability(checkFrontDoorNameAvailabilityInput: models.CheckNameAvailabilityInput, callback: ServiceCallback): void; + checkFrontDoorNameAvailability(checkFrontDoorNameAvailabilityInput: models.CheckNameAvailabilityInput, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Check the availability of a Front Door subdomain. + * + * @param {object} checkFrontDoorNameAvailabilityInput Input to check. + * + * @param {string} checkFrontDoorNameAvailabilityInput.name The resource name + * to validate. + * + * @param {string} checkFrontDoorNameAvailabilityInput.type The type of the + * resource whose name is to be validated. Possible values include: + * 'Microsoft.Network/frontDoors', + * 'Microsoft.Network/frontDoors/frontendEndpoints' + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + checkFrontDoorNameAvailabilityWithSubscriptionWithHttpOperationResponse(checkFrontDoorNameAvailabilityInput: models.CheckNameAvailabilityInput, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Check the availability of a Front Door subdomain. + * + * @param {object} checkFrontDoorNameAvailabilityInput Input to check. + * + * @param {string} checkFrontDoorNameAvailabilityInput.name The resource name + * to validate. + * + * @param {string} checkFrontDoorNameAvailabilityInput.type The type of the + * resource whose name is to be validated. Possible values include: + * 'Microsoft.Network/frontDoors', + * 'Microsoft.Network/frontDoors/frontendEndpoints' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {CheckNameAvailabilityOutput} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {CheckNameAvailabilityOutput} [result] - The deserialized result object if an error did not occur. + * See {@link CheckNameAvailabilityOutput} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + checkFrontDoorNameAvailabilityWithSubscription(checkFrontDoorNameAvailabilityInput: models.CheckNameAvailabilityInput, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkFrontDoorNameAvailabilityWithSubscription(checkFrontDoorNameAvailabilityInput: models.CheckNameAvailabilityInput, callback: ServiceCallback): void; + checkFrontDoorNameAvailabilityWithSubscription(checkFrontDoorNameAvailabilityInput: models.CheckNameAvailabilityInput, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +export { FrontdoorManagementClient, models as FrontdoorManagementModels }; diff --git a/lib/services/networkManagement2/lib/lib/frontdoorManagementClient.js b/lib/services/networkManagement2/lib/lib/frontdoorManagementClient.js new file mode 100644 index 0000000000..77306fb076 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/frontdoorManagementClient.js @@ -0,0 +1,608 @@ +/* + * 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 WebResource = msRest.WebResource; + +const models = require('./models'); +const operations = require('./operations'); + + +/** + * Check the availability of a Front Door resource name. + * + * @param {object} checkFrontDoorNameAvailabilityInput Input to check. + * + * @param {string} checkFrontDoorNameAvailabilityInput.name The resource name + * to validate. + * + * @param {string} checkFrontDoorNameAvailabilityInput.type The type of the + * resource whose name is to be validated. Possible values include: + * 'Microsoft.Network/frontDoors', + * 'Microsoft.Network/frontDoors/frontendEndpoints' + * + * @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 CheckNameAvailabilityOutput} 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 _checkFrontDoorNameAvailability(checkFrontDoorNameAvailabilityInput, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-08-01'; + // Validate + try { + if (checkFrontDoorNameAvailabilityInput === null || checkFrontDoorNameAvailabilityInput === undefined) { + throw new Error('checkFrontDoorNameAvailabilityInput cannot be null or undefined.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Network/checkFrontDoorNameAvailability'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (checkFrontDoorNameAvailabilityInput !== null && checkFrontDoorNameAvailabilityInput !== undefined) { + let requestModelMapper = new client.models['CheckNameAvailabilityInput']().mapper(); + requestModel = client.serialize(requestModelMapper, checkFrontDoorNameAvailabilityInput, 'checkFrontDoorNameAvailabilityInput'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(checkFrontDoorNameAvailabilityInput, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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['CheckNameAvailabilityOutput']().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); + }); +} + +/** + * Check the availability of a Front Door subdomain. + * + * @param {object} checkFrontDoorNameAvailabilityInput Input to check. + * + * @param {string} checkFrontDoorNameAvailabilityInput.name The resource name + * to validate. + * + * @param {string} checkFrontDoorNameAvailabilityInput.type The type of the + * resource whose name is to be validated. Possible values include: + * 'Microsoft.Network/frontDoors', + * 'Microsoft.Network/frontDoors/frontendEndpoints' + * + * @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 CheckNameAvailabilityOutput} 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 _checkFrontDoorNameAvailabilityWithSubscription(checkFrontDoorNameAvailabilityInput, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-08-01'; + // Validate + try { + if (checkFrontDoorNameAvailabilityInput === null || checkFrontDoorNameAvailabilityInput === undefined) { + throw new Error('checkFrontDoorNameAvailabilityInput cannot be null or undefined.'); + } + if (this.subscriptionId === null || this.subscriptionId === undefined || typeof this.subscriptionId.valueOf() !== 'string') { + throw new Error('this.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/checkFrontDoorNameAvailability'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (checkFrontDoorNameAvailabilityInput !== null && checkFrontDoorNameAvailabilityInput !== undefined) { + let requestModelMapper = new client.models['CheckNameAvailabilityInput']().mapper(); + requestModel = client.serialize(requestModelMapper, checkFrontDoorNameAvailabilityInput, 'checkFrontDoorNameAvailabilityInput'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(checkFrontDoorNameAvailabilityInput, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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['CheckNameAvailabilityOutput']().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 FrontdoorManagementClient. */ +class FrontdoorManagementClient extends ServiceClient { + /** + * Create a FrontdoorManagementClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * @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] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + */ + constructor(credentials, subscriptionId, baseUri, options) { + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId === null || subscriptionId === undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) options = {}; + + super(credentials, options); + + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.baseUri = baseUri; + if (!this.baseUri) { + this.baseUri = 'https://management.azure.com'; + } + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + 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.frontDoors = new operations.FrontDoors(this); + this.routingRules = new operations.RoutingRules(this); + this.healthProbeSettings = new operations.HealthProbeSettings(this); + this.loadBalancingSettings = new operations.LoadBalancingSettings(this); + this.backendPools = new operations.BackendPools(this); + this.frontendEndpoints = new operations.FrontendEndpoints(this); + this.endpoints = new operations.Endpoints(this); + this.policies = new operations.Policies(this); + this.models = models; + this._checkFrontDoorNameAvailability = _checkFrontDoorNameAvailability; + this._checkFrontDoorNameAvailabilityWithSubscription = _checkFrontDoorNameAvailabilityWithSubscription; + msRest.addSerializationMixin(this); + } + + /** + * Check the availability of a Front Door resource name. + * + * @param {object} checkFrontDoorNameAvailabilityInput Input to check. + * + * @param {string} checkFrontDoorNameAvailabilityInput.name The resource name + * to validate. + * + * @param {string} checkFrontDoorNameAvailabilityInput.type The type of the + * resource whose name is to be validated. Possible values include: + * 'Microsoft.Network/frontDoors', + * 'Microsoft.Network/frontDoors/frontendEndpoints' + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + checkFrontDoorNameAvailabilityWithHttpOperationResponse(checkFrontDoorNameAvailabilityInput, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._checkFrontDoorNameAvailability(checkFrontDoorNameAvailabilityInput, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Check the availability of a Front Door resource name. + * + * @param {object} checkFrontDoorNameAvailabilityInput Input to check. + * + * @param {string} checkFrontDoorNameAvailabilityInput.name The resource name + * to validate. + * + * @param {string} checkFrontDoorNameAvailabilityInput.type The type of the + * resource whose name is to be validated. Possible values include: + * 'Microsoft.Network/frontDoors', + * 'Microsoft.Network/frontDoors/frontendEndpoints' + * + * @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 {CheckNameAvailabilityOutput} - 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 CheckNameAvailabilityOutput} 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. + */ + checkFrontDoorNameAvailability(checkFrontDoorNameAvailabilityInput, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._checkFrontDoorNameAvailability(checkFrontDoorNameAvailabilityInput, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._checkFrontDoorNameAvailability(checkFrontDoorNameAvailabilityInput, options, optionalCallback); + } + } + + /** + * Check the availability of a Front Door subdomain. + * + * @param {object} checkFrontDoorNameAvailabilityInput Input to check. + * + * @param {string} checkFrontDoorNameAvailabilityInput.name The resource name + * to validate. + * + * @param {string} checkFrontDoorNameAvailabilityInput.type The type of the + * resource whose name is to be validated. Possible values include: + * 'Microsoft.Network/frontDoors', + * 'Microsoft.Network/frontDoors/frontendEndpoints' + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + checkFrontDoorNameAvailabilityWithSubscriptionWithHttpOperationResponse(checkFrontDoorNameAvailabilityInput, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._checkFrontDoorNameAvailabilityWithSubscription(checkFrontDoorNameAvailabilityInput, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Check the availability of a Front Door subdomain. + * + * @param {object} checkFrontDoorNameAvailabilityInput Input to check. + * + * @param {string} checkFrontDoorNameAvailabilityInput.name The resource name + * to validate. + * + * @param {string} checkFrontDoorNameAvailabilityInput.type The type of the + * resource whose name is to be validated. Possible values include: + * 'Microsoft.Network/frontDoors', + * 'Microsoft.Network/frontDoors/frontendEndpoints' + * + * @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 {CheckNameAvailabilityOutput} - 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 CheckNameAvailabilityOutput} 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. + */ + checkFrontDoorNameAvailabilityWithSubscription(checkFrontDoorNameAvailabilityInput, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._checkFrontDoorNameAvailabilityWithSubscription(checkFrontDoorNameAvailabilityInput, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._checkFrontDoorNameAvailabilityWithSubscription(checkFrontDoorNameAvailabilityInput, options, optionalCallback); + } + } + +} + +module.exports = FrontdoorManagementClient; +module.exports['default'] = FrontdoorManagementClient; +module.exports.FrontdoorManagementClient = FrontdoorManagementClient; +module.exports.FrontdoorManagementModels = models; diff --git a/lib/services/networkManagement2/lib/lib/models/azureAsyncOperationResult.js b/lib/services/networkManagement2/lib/lib/models/azureAsyncOperationResult.js new file mode 100644 index 0000000000..4870803217 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/azureAsyncOperationResult.js @@ -0,0 +1,75 @@ +/* + * 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'; + +/** + * The response body contains the status of the specified asynchronous + * operation, indicating whether it has succeeded, is in progress, or has + * failed. Note that this status is distinct from the HTTP status code returned + * for the Get Operation Status operation itself. If the asynchronous operation + * succeeded, the response body includes the HTTP status code for the + * successful request. If the asynchronous operation failed, the response body + * includes the HTTP status code for the failed request and error information + * regarding the failure. + * + */ +class AzureAsyncOperationResult { + /** + * Create a AzureAsyncOperationResult. + * @member {string} [status] Status of the Azure async operation. Possible + * values are: 'InProgress', 'Succeeded', and 'Failed'. Possible values + * include: 'InProgress', 'Succeeded', 'Failed' + * @member {object} [error] + * @member {string} [error.code] + * @member {string} [error.message] + * @member {string} [error.target] + * @member {array} [error.details] + * @member {string} [error.innerError] + */ + constructor() { + } + + /** + * Defines the metadata of AzureAsyncOperationResult + * + * @returns {object} metadata of AzureAsyncOperationResult + * + */ + mapper() { + return { + required: false, + serializedName: 'AzureAsyncOperationResult', + type: { + name: 'Composite', + className: 'AzureAsyncOperationResult', + modelProperties: { + status: { + required: false, + serializedName: 'status', + type: { + name: 'String' + } + }, + error: { + required: false, + serializedName: 'error', + type: { + name: 'Composite', + className: 'ErrorModel' + } + } + } + } + }; + } +} + +module.exports = AzureAsyncOperationResult; diff --git a/lib/services/networkManagement2/lib/lib/models/azureManagedOverrideRuleGroup.js b/lib/services/networkManagement2/lib/lib/models/azureManagedOverrideRuleGroup.js new file mode 100644 index 0000000000..57d51bc2ad --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/azureManagedOverrideRuleGroup.js @@ -0,0 +1,62 @@ +/* + * 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'; + +/** + * Defines contents of a web application rule + * + */ +class AzureManagedOverrideRuleGroup { + /** + * Create a AzureManagedOverrideRuleGroup. + * @member {string} ruleGroupOverride Describes overrideruleGroup. Possible + * values include: 'SqlInjection', 'XSS' + * @member {string} action Type of Actions. Possible values include: 'Allow', + * 'Block', 'Log' + */ + constructor() { + } + + /** + * Defines the metadata of AzureManagedOverrideRuleGroup + * + * @returns {object} metadata of AzureManagedOverrideRuleGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'AzureManagedOverrideRuleGroup', + type: { + name: 'Composite', + className: 'AzureManagedOverrideRuleGroup', + modelProperties: { + ruleGroupOverride: { + required: true, + serializedName: 'ruleGroupOverride', + type: { + name: 'String' + } + }, + action: { + required: true, + serializedName: 'action', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AzureManagedOverrideRuleGroup; diff --git a/lib/services/networkManagement2/lib/lib/models/azureManagedRuleSet.js b/lib/services/networkManagement2/lib/lib/models/azureManagedRuleSet.js new file mode 100644 index 0000000000..97b5305923 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/azureManagedRuleSet.js @@ -0,0 +1,92 @@ +/* + * 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 models = require('./index'); + +/** + * Describes azure managed provider. + * + * @extends models['ManagedRuleSet'] + */ +class AzureManagedRuleSet extends models['ManagedRuleSet'] { + /** + * Create a AzureManagedRuleSet. + * @member {array} [ruleGroupOverrides] List of azure managed provider + * override configuration (optional) + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AzureManagedRuleSet + * + * @returns {object} metadata of AzureManagedRuleSet + * + */ + mapper() { + return { + required: false, + serializedName: 'AzureManagedRuleSet', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'ruleSetType', + clientName: 'ruleSetType' + }, + uberParent: 'ManagedRuleSet', + className: 'AzureManagedRuleSet', + modelProperties: { + priority: { + required: false, + serializedName: 'priority', + type: { + name: 'Number' + } + }, + version: { + required: false, + serializedName: 'version', + type: { + name: 'Number' + } + }, + ruleSetType: { + required: true, + serializedName: 'ruleSetType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + ruleGroupOverrides: { + required: false, + serializedName: 'ruleGroupOverrides', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AzureManagedOverrideRuleGroupElementType', + type: { + name: 'Composite', + className: 'AzureManagedOverrideRuleGroup' + } + } + } + } + } + } + }; + } +} + +module.exports = AzureManagedRuleSet; diff --git a/lib/services/networkManagement2/lib/lib/models/backend.js b/lib/services/networkManagement2/lib/lib/models/backend.js new file mode 100644 index 0000000000..a20e8a4083 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/backend.js @@ -0,0 +1,125 @@ +/* + * 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'; + +/** + * Backend address of a frontDoor load balancer. + * + */ +class Backend { + /** + * Create a Backend. + * @member {string} [address] Location of the backend (IP address or FQDN) + * @member {number} [httpPort] The HTTP TCP port number. Must be between 1 + * and 65535. + * @member {number} [httpsPort] The HTTPS TCP port number. Must be between 1 + * and 65535. + * @member {string} [enabledState] Whether to enable use of this backend. + * Permitted values are 'Enabled' or 'Disabled'. Possible values include: + * 'Enabled', 'Disabled' + * @member {number} [priority] Priority to use for load balancing. Higher + * priorities will not be used for load balancing if any lower priority + * backend is healthy. + * @member {number} [weight] Weight of this endpoint for load balancing + * purposes. + * @member {string} [backendHostHeader] The value to use as the host header + * sent to the backend. If blank or unspecified, this defaults to the + * incoming host. + */ + constructor() { + } + + /** + * Defines the metadata of Backend + * + * @returns {object} metadata of Backend + * + */ + mapper() { + return { + required: false, + serializedName: 'Backend', + type: { + name: 'Composite', + className: 'Backend', + modelProperties: { + address: { + required: false, + serializedName: 'address', + type: { + name: 'String' + } + }, + httpPort: { + required: false, + serializedName: 'httpPort', + constraints: { + InclusiveMaximum: 65535, + InclusiveMinimum: 1 + }, + type: { + name: 'Number' + } + }, + httpsPort: { + required: false, + serializedName: 'httpsPort', + constraints: { + InclusiveMaximum: 65535, + InclusiveMinimum: 1 + }, + type: { + name: 'Number' + } + }, + enabledState: { + required: false, + serializedName: 'enabledState', + type: { + name: 'String' + } + }, + priority: { + required: false, + serializedName: 'priority', + constraints: { + InclusiveMaximum: 5, + InclusiveMinimum: 1 + }, + type: { + name: 'Number' + } + }, + weight: { + required: false, + serializedName: 'weight', + constraints: { + InclusiveMaximum: 1000, + InclusiveMinimum: 1 + }, + type: { + name: 'Number' + } + }, + backendHostHeader: { + required: false, + serializedName: 'backendHostHeader', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Backend; diff --git a/lib/services/networkManagement2/lib/lib/models/backendPool.js b/lib/services/networkManagement2/lib/lib/models/backendPool.js new file mode 100644 index 0000000000..f7ff8a02f2 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/backendPool.js @@ -0,0 +1,119 @@ +/* + * 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 models = require('./index'); + +/** + * A backend pool is a collection of backends that can be routed to. + * + * @extends models['SubResource'] + */ +class BackendPool extends models['SubResource'] { + /** + * Create a BackendPool. + * @member {array} [backends] The set of backends for this pool + * @member {object} [loadBalancingSettings] Load balancing settings for a + * backend pool + * @member {string} [loadBalancingSettings.id] Resource ID. + * @member {object} [healthProbeSettings] L7 health probe settings for a + * backend pool + * @member {string} [healthProbeSettings.id] Resource ID. + * @member {string} [resourceState] Resource status. Possible values include: + * 'Creating', 'Enabling', 'Enabled', 'Disabling', 'Disabled', 'Deleting' + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of BackendPool + * + * @returns {object} metadata of BackendPool + * + */ + mapper() { + return { + required: false, + serializedName: 'BackendPool', + type: { + name: 'Composite', + className: 'BackendPool', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + backends: { + required: false, + serializedName: 'properties.backends', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BackendElementType', + type: { + name: 'Composite', + className: 'Backend' + } + } + } + }, + loadBalancingSettings: { + required: false, + serializedName: 'properties.loadBalancingSettings', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + healthProbeSettings: { + required: false, + serializedName: 'properties.healthProbeSettings', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + resourceState: { + required: false, + serializedName: 'properties.resourceState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BackendPool; diff --git a/lib/services/networkManagement2/lib/lib/models/backendPoolListResult.js b/lib/services/networkManagement2/lib/lib/models/backendPoolListResult.js new file mode 100644 index 0000000000..4d77352f50 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/backendPoolListResult.js @@ -0,0 +1,70 @@ +/* + * 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'; + +/** + * Result of the request to list Backend Pools. It contains a list of Backend + * Pools objects and a URL link to get the the next set of results. + */ +class BackendPoolListResult extends Array { + /** + * Create a BackendPoolListResult. + * @member {string} [nextLink] URL to get the next set of BackendPool objects + * if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of BackendPoolListResult + * + * @returns {object} metadata of BackendPoolListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'BackendPoolListResult', + type: { + name: 'Composite', + className: 'BackendPoolListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BackendPoolElementType', + type: { + name: 'Composite', + className: 'BackendPool' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BackendPoolListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/backendPoolUpdateParameters.js b/lib/services/networkManagement2/lib/lib/models/backendPoolUpdateParameters.js new file mode 100644 index 0000000000..f812b39aa7 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/backendPoolUpdateParameters.js @@ -0,0 +1,82 @@ +/* + * 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'; + +/** + * A collection of backends that can be routed to. + * + */ +class BackendPoolUpdateParameters { + /** + * Create a BackendPoolUpdateParameters. + * @member {array} [backends] The set of backends for this pool + * @member {object} [loadBalancingSettings] Load balancing settings for a + * backend pool + * @member {string} [loadBalancingSettings.id] Resource ID. + * @member {object} [healthProbeSettings] L7 health probe settings for a + * backend pool + * @member {string} [healthProbeSettings.id] Resource ID. + */ + constructor() { + } + + /** + * Defines the metadata of BackendPoolUpdateParameters + * + * @returns {object} metadata of BackendPoolUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'BackendPoolUpdateParameters', + type: { + name: 'Composite', + className: 'BackendPoolUpdateParameters', + modelProperties: { + backends: { + required: false, + serializedName: 'backends', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BackendElementType', + type: { + name: 'Composite', + className: 'Backend' + } + } + } + }, + loadBalancingSettings: { + required: false, + serializedName: 'loadBalancingSettings', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + healthProbeSettings: { + required: false, + serializedName: 'healthProbeSettings', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + } + }; + } +} + +module.exports = BackendPoolUpdateParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/cacheConfiguration.js b/lib/services/networkManagement2/lib/lib/models/cacheConfiguration.js new file mode 100644 index 0000000000..198afe5622 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/cacheConfiguration.js @@ -0,0 +1,64 @@ +/* + * 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'; + +/** + * Caching settings for a caching-type route. To disable caching, do not + * provide a cacheConfiguration object. + * + */ +class CacheConfiguration { + /** + * Create a CacheConfiguration. + * @member {string} [queryParameterStripDirective] Treatment of URL query + * terms when forming the cache key. Possible values include: 'StripNone', + * 'StripAll' + * @member {string} [dynamicCompression] Whether to use dynamic compression + * for cached content. Possible values include: 'Enabled', 'Disabled' + */ + constructor() { + } + + /** + * Defines the metadata of CacheConfiguration + * + * @returns {object} metadata of CacheConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'CacheConfiguration', + type: { + name: 'Composite', + className: 'CacheConfiguration', + modelProperties: { + queryParameterStripDirective: { + required: false, + serializedName: 'queryParameterStripDirective', + type: { + name: 'String' + } + }, + dynamicCompression: { + required: false, + serializedName: 'dynamicCompression', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CacheConfiguration; diff --git a/lib/services/networkManagement2/lib/lib/models/checkNameAvailabilityInput.js b/lib/services/networkManagement2/lib/lib/models/checkNameAvailabilityInput.js new file mode 100644 index 0000000000..a3108083d2 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/checkNameAvailabilityInput.js @@ -0,0 +1,63 @@ +/* + * 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'; + +/** + * Input of CheckNameAvailability API. + * + */ +class CheckNameAvailabilityInput { + /** + * Create a CheckNameAvailabilityInput. + * @member {string} name The resource name to validate. + * @member {string} type The type of the resource whose name is to be + * validated. Possible values include: 'Microsoft.Network/frontDoors', + * 'Microsoft.Network/frontDoors/frontendEndpoints' + */ + constructor() { + } + + /** + * Defines the metadata of CheckNameAvailabilityInput + * + * @returns {object} metadata of CheckNameAvailabilityInput + * + */ + mapper() { + return { + required: false, + serializedName: 'CheckNameAvailabilityInput', + type: { + name: 'Composite', + className: 'CheckNameAvailabilityInput', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: true, + serializedName: 'type', + type: { + name: 'Enum', + allowedValues: [ 'Microsoft.Network/frontDoors', 'Microsoft.Network/frontDoors/frontendEndpoints' ] + } + } + } + } + }; + } +} + +module.exports = CheckNameAvailabilityInput; diff --git a/lib/services/networkManagement2/lib/lib/models/checkNameAvailabilityOutput.js b/lib/services/networkManagement2/lib/lib/models/checkNameAvailabilityOutput.js new file mode 100644 index 0000000000..7699b34c79 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/checkNameAvailabilityOutput.js @@ -0,0 +1,73 @@ +/* + * 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'; + +/** + * Output of check name availability API. + * + */ +class CheckNameAvailabilityOutput { + /** + * Create a CheckNameAvailabilityOutput. + * @member {string} [nameAvailability] Indicates whether the name is + * available. Possible values include: 'Available', 'Unavailable' + * @member {string} [reason] The reason why the name is not available. + * @member {string} [message] The detailed error message describing why the + * name is not available. + */ + constructor() { + } + + /** + * Defines the metadata of CheckNameAvailabilityOutput + * + * @returns {object} metadata of CheckNameAvailabilityOutput + * + */ + mapper() { + return { + required: false, + serializedName: 'CheckNameAvailabilityOutput', + type: { + name: 'Composite', + className: 'CheckNameAvailabilityOutput', + modelProperties: { + nameAvailability: { + required: false, + readOnly: true, + serializedName: 'nameAvailability', + type: { + name: 'String' + } + }, + reason: { + required: false, + readOnly: true, + serializedName: 'reason', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CheckNameAvailabilityOutput; diff --git a/lib/services/networkManagement2/lib/lib/models/customHttpsConfiguration.js b/lib/services/networkManagement2/lib/lib/models/customHttpsConfiguration.js new file mode 100644 index 0000000000..6efe7fe9fe --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/customHttpsConfiguration.js @@ -0,0 +1,100 @@ +/* + * 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'; + +/** + * Https settings for a domain + * + */ +class CustomHttpsConfiguration { + /** + * Create a CustomHttpsConfiguration. + * @member {string} [certificateSource] Defines the source of the SSL + * certificate. Possible values include: 'AzureKeyVault', 'FrontDoor' + * @member {string} [protocolType] Defines the TLS extension protocol that is + * used for secure delivery. Possible values include: 'ServerNameIndication' + * @member {object} [vault] The Key Vault containing the SSL certificate + * @member {string} [vault.id] Resource ID. + * @member {string} [secretName] The name of the Key Vault secret + * representing the full certificate PFX + * @member {string} [secretVersion] The version of the Key Vault secret + * representing the full certificate PFX + * @member {string} [certificateType] Defines the type of the certificate + * used for secure connections to a frontendEndpoint. Possible values + * include: 'Dedicated' + */ + constructor() { + } + + /** + * Defines the metadata of CustomHttpsConfiguration + * + * @returns {object} metadata of CustomHttpsConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'CustomHttpsConfiguration', + type: { + name: 'Composite', + className: 'CustomHttpsConfiguration', + modelProperties: { + certificateSource: { + required: false, + serializedName: 'certificateSource', + type: { + name: 'String' + } + }, + protocolType: { + required: false, + serializedName: 'protocolType', + type: { + name: 'String' + } + }, + vault: { + required: false, + serializedName: 'keyVaultCertificateSourceParameters.vault', + type: { + name: 'Composite', + className: 'KeyVaultCertificateSourceParametersVault' + } + }, + secretName: { + required: false, + serializedName: 'keyVaultCertificateSourceParameters.secretName', + type: { + name: 'String' + } + }, + secretVersion: { + required: false, + serializedName: 'keyVaultCertificateSourceParameters.secretVersion', + type: { + name: 'String' + } + }, + certificateType: { + required: false, + serializedName: 'frontDoorCertificateSourceParameters.certificateType', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CustomHttpsConfiguration; diff --git a/lib/services/networkManagement2/lib/lib/models/customRule.js b/lib/services/networkManagement2/lib/lib/models/customRule.js new file mode 100644 index 0000000000..1276b3f49a --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/customRule.js @@ -0,0 +1,141 @@ +/* + * 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'; + +/** + * Defines contents of a web application rule + * + */ +class CustomRule { + /** + * Create a CustomRule. + * @member {string} [name] Gets name of the resource that is unique within a + * policy. This name can be used to access the resource. + * @member {string} [etag] Gets a unique read-only string that changes + * whenever the resource is updated. + * @member {number} priority Describes priority of the rule. Rules with a + * lower value will be evaluated before rules with a higher value + * @member {string} ruleType Describes type of rule. Possible values include: + * 'MatchRule', 'RateLimitRule' + * @member {number} [rateLimitDurationInMinutes] Defines rate limit duration. + * Default - 1 minute + * @member {number} [rateLimitThreshold] Defines rate limit thresold + * @member {array} matchConditions List of match conditions + * @member {string} action Type of Actions. Possible values include: 'Allow', + * 'Block', 'Log' + * @member {array} [transforms] List of transforms + */ + constructor() { + } + + /** + * Defines the metadata of CustomRule + * + * @returns {object} metadata of CustomRule + * + */ + mapper() { + return { + required: false, + serializedName: 'CustomRule', + type: { + name: 'Composite', + className: 'CustomRule', + modelProperties: { + name: { + required: false, + serializedName: 'name', + constraints: { + MaxLength: 128 + }, + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + }, + priority: { + required: true, + serializedName: 'priority', + type: { + name: 'Number' + } + }, + ruleType: { + required: true, + serializedName: 'ruleType', + type: { + name: 'String' + } + }, + rateLimitDurationInMinutes: { + required: false, + serializedName: 'rateLimitDurationInMinutes', + type: { + name: 'Number' + } + }, + rateLimitThreshold: { + required: false, + serializedName: 'rateLimitThreshold', + type: { + name: 'Number' + } + }, + matchConditions: { + required: true, + serializedName: 'matchConditions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MatchCondition1ElementType', + type: { + name: 'Composite', + className: 'MatchCondition1' + } + } + } + }, + action: { + required: true, + serializedName: 'action', + type: { + name: 'String' + } + }, + transforms: { + required: false, + serializedName: 'transforms', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TransformElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = CustomRule; diff --git a/lib/services/networkManagement2/lib/lib/models/customRules.js b/lib/services/networkManagement2/lib/lib/models/customRules.js new file mode 100644 index 0000000000..90cbc888df --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/customRules.js @@ -0,0 +1,60 @@ +/* + * 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'; + +/** + * Defines contents of custom rules + * + */ +class CustomRules { + /** + * Create a CustomRules. + * @member {array} [rules] List of rules + */ + constructor() { + } + + /** + * Defines the metadata of CustomRules + * + * @returns {object} metadata of CustomRules + * + */ + mapper() { + return { + required: false, + serializedName: 'CustomRules', + type: { + name: 'Composite', + className: 'CustomRules', + modelProperties: { + rules: { + required: false, + serializedName: 'rules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CustomRuleElementType', + type: { + name: 'Composite', + className: 'CustomRule' + } + } + } + } + } + } + }; + } +} + +module.exports = CustomRules; diff --git a/lib/services/networkManagement2/lib/lib/models/errorDetails.js b/lib/services/networkManagement2/lib/lib/models/errorDetails.js new file mode 100644 index 0000000000..fcac88503a --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/errorDetails.js @@ -0,0 +1,67 @@ +/* + * 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'; + +/** + * Class representing a ErrorDetails. + */ +class ErrorDetails { + /** + * Create a ErrorDetails. + * @member {string} [code] + * @member {string} [target] + * @member {string} [message] + */ + constructor() { + } + + /** + * Defines the metadata of ErrorDetails + * + * @returns {object} metadata of ErrorDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorDetails', + type: { + name: 'Composite', + className: 'ErrorDetails', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + target: { + required: false, + serializedName: 'target', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorDetails; diff --git a/lib/services/networkManagement2/lib/lib/models/errorModel.js b/lib/services/networkManagement2/lib/lib/models/errorModel.js new file mode 100644 index 0000000000..955cde1528 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/errorModel.js @@ -0,0 +1,91 @@ +/* + * 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'; + +/** + * Class representing a ErrorModel. + */ +class ErrorModel { + /** + * Create a ErrorModel. + * @member {string} [code] + * @member {string} [message] + * @member {string} [target] + * @member {array} [details] + * @member {string} [innerError] + */ + constructor() { + } + + /** + * Defines the metadata of ErrorModel + * + * @returns {object} metadata of ErrorModel + * + */ + mapper() { + return { + required: false, + serializedName: 'Error', + type: { + name: 'Composite', + className: 'ErrorModel', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + }, + target: { + required: false, + serializedName: 'target', + type: { + name: 'String' + } + }, + details: { + required: false, + serializedName: 'details', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ErrorDetailsElementType', + type: { + name: 'Composite', + className: 'ErrorDetails' + } + } + } + }, + innerError: { + required: false, + serializedName: 'innerError', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorModel; diff --git a/lib/services/networkManagement2/lib/lib/models/errorResponse.js b/lib/services/networkManagement2/lib/lib/models/errorResponse.js new file mode 100644 index 0000000000..f7411b7340 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/errorResponse.js @@ -0,0 +1,64 @@ +/* + * 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'; + +/** + * Error reponse indicates Front Door service is not able to process the + * incoming request. The reason is provided in the error message. + * + */ +class ErrorResponse { + /** + * Create a ErrorResponse. + * @member {string} [code] Error code. + * @member {string} [message] Error message indicating why the operation + * failed. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorResponse + * + * @returns {object} metadata of ErrorResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorResponse', + type: { + name: 'Composite', + className: 'ErrorResponse', + modelProperties: { + code: { + required: false, + readOnly: true, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorResponse; diff --git a/lib/services/networkManagement2/lib/lib/models/frontDoor.js b/lib/services/networkManagement2/lib/lib/models/frontDoor.js new file mode 100644 index 0000000000..90c3366037 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/frontDoor.js @@ -0,0 +1,225 @@ +/* + * 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 models = require('./index'); + +/** + * Front Door represents a collection of backend endpoints to route traffic to + * along with rules that specify how traffic is sent there. + * + * @extends models['Resource'] + */ +class FrontDoor extends models['Resource'] { + /** + * Create a FrontDoor. + * @member {string} [friendlyName] A friendly name for the frontDoor + * @member {array} [routingRules] Routing rules associated with this Front + * Door. + * @member {array} [loadBalancingSettings] Load balancing settings associated + * with this Front Door instance. + * @member {array} [healthProbeSettings] Health probe settings associated + * with this Front Door instance. + * @member {array} [backendPools] Backend pools available to routing rules. + * @member {array} [frontendEndpoints] Frontend endpoints available to + * routing rules. + * @member {string} [enabledState] Operational status of the Front Door load + * balancer. Permitted values are 'Enabled' or 'Disabled'. Possible values + * include: 'Enabled', 'Disabled' + * @member {string} [resourceState] Resource status of the Front Door. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * @member {string} [provisioningState] Provisioning state of the Front Door. + * @member {string} [cname] The host that each frontendEndpoint must CNAME + * to. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of FrontDoor + * + * @returns {object} metadata of FrontDoor + * + */ + mapper() { + return { + required: false, + serializedName: 'FrontDoor', + type: { + name: 'Composite', + className: 'FrontDoor', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + friendlyName: { + required: false, + serializedName: 'properties.friendlyName', + type: { + name: 'String' + } + }, + routingRules: { + required: false, + serializedName: 'properties.routingRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RoutingRuleElementType', + type: { + name: 'Composite', + className: 'RoutingRule' + } + } + } + }, + loadBalancingSettings: { + required: false, + serializedName: 'properties.loadBalancingSettings', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LoadBalancingSettingsModelElementType', + type: { + name: 'Composite', + className: 'LoadBalancingSettingsModel' + } + } + } + }, + healthProbeSettings: { + required: false, + serializedName: 'properties.healthProbeSettings', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'HealthProbeSettingsModelElementType', + type: { + name: 'Composite', + className: 'HealthProbeSettingsModel' + } + } + } + }, + backendPools: { + required: false, + serializedName: 'properties.backendPools', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BackendPoolElementType', + type: { + name: 'Composite', + className: 'BackendPool' + } + } + } + }, + frontendEndpoints: { + required: false, + serializedName: 'properties.frontendEndpoints', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'FrontendEndpointElementType', + type: { + name: 'Composite', + className: 'FrontendEndpoint' + } + } + } + }, + enabledState: { + required: false, + serializedName: 'properties.enabledState', + type: { + name: 'String' + } + }, + resourceState: { + required: false, + serializedName: 'properties.resourceState', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + cname: { + required: false, + readOnly: true, + serializedName: 'properties.cname', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = FrontDoor; diff --git a/lib/services/networkManagement2/lib/lib/models/frontDoorListResult.js b/lib/services/networkManagement2/lib/lib/models/frontDoorListResult.js new file mode 100644 index 0000000000..d719fd6e2e --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/frontDoorListResult.js @@ -0,0 +1,70 @@ +/* + * 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'; + +/** + * Result of the request to list Front Doors. It contains a list of Front Door + * objects and a URL link to get the the next set of results. + */ +class FrontDoorListResult extends Array { + /** + * Create a FrontDoorListResult. + * @member {string} [nextLink] URL to get the next set of Front Door objects + * if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of FrontDoorListResult + * + * @returns {object} metadata of FrontDoorListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'FrontDoorListResult', + type: { + name: 'Composite', + className: 'FrontDoorListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'FrontDoorElementType', + type: { + name: 'Composite', + className: 'FrontDoor' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = FrontDoorListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/frontDoorUpdateParameters.js b/lib/services/networkManagement2/lib/lib/models/frontDoorUpdateParameters.js new file mode 100644 index 0000000000..f6dd2a0426 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/frontDoorUpdateParameters.js @@ -0,0 +1,146 @@ +/* + * 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'; + +/** + * The properties needed to update a Front Door + * + */ +class FrontDoorUpdateParameters { + /** + * Create a FrontDoorUpdateParameters. + * @member {string} [friendlyName] A friendly name for the frontDoor + * @member {array} [routingRules] Routing rules associated with this Front + * Door. + * @member {array} [loadBalancingSettings] Load balancing settings associated + * with this Front Door instance. + * @member {array} [healthProbeSettings] Health probe settings associated + * with this Front Door instance. + * @member {array} [backendPools] Backend pools available to routing rules. + * @member {array} [frontendEndpoints] Frontend endpoints available to + * routing rules. + * @member {string} [enabledState] Operational status of the Front Door load + * balancer. Permitted values are 'Enabled' or 'Disabled'. Possible values + * include: 'Enabled', 'Disabled' + */ + constructor() { + } + + /** + * Defines the metadata of FrontDoorUpdateParameters + * + * @returns {object} metadata of FrontDoorUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'FrontDoorUpdateParameters', + type: { + name: 'Composite', + className: 'FrontDoorUpdateParameters', + modelProperties: { + friendlyName: { + required: false, + serializedName: 'friendlyName', + type: { + name: 'String' + } + }, + routingRules: { + required: false, + serializedName: 'routingRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RoutingRuleElementType', + type: { + name: 'Composite', + className: 'RoutingRule' + } + } + } + }, + loadBalancingSettings: { + required: false, + serializedName: 'loadBalancingSettings', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LoadBalancingSettingsModelElementType', + type: { + name: 'Composite', + className: 'LoadBalancingSettingsModel' + } + } + } + }, + healthProbeSettings: { + required: false, + serializedName: 'healthProbeSettings', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'HealthProbeSettingsModelElementType', + type: { + name: 'Composite', + className: 'HealthProbeSettingsModel' + } + } + } + }, + backendPools: { + required: false, + serializedName: 'backendPools', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BackendPoolElementType', + type: { + name: 'Composite', + className: 'BackendPool' + } + } + } + }, + frontendEndpoints: { + required: false, + serializedName: 'frontendEndpoints', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'FrontendEndpointElementType', + type: { + name: 'Composite', + className: 'FrontendEndpoint' + } + } + } + }, + enabledState: { + required: false, + serializedName: 'enabledState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = FrontDoorUpdateParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/frontendEndpoint.js b/lib/services/networkManagement2/lib/lib/models/frontendEndpoint.js new file mode 100644 index 0000000000..d4cd4f4d82 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/frontendEndpoint.js @@ -0,0 +1,175 @@ +/* + * 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 models = require('./index'); + +/** + * A frontend endpoint used for routing. + * + * @extends models['SubResource'] + */ +class FrontendEndpoint extends models['SubResource'] { + /** + * Create a FrontendEndpoint. + * @member {string} [hostName] The host name of the frontendEndpoint. Must be + * a domain name. + * @member {string} [sessionAffinityEnabledState] Whether to allow session + * affinity on this host. Valid options are 'Enabled' or 'Disabled'. Possible + * values include: 'Enabled', 'Disabled' + * @member {number} [sessionAffinityTtlSeconds] UNUSED. This field will be + * ignored. The TTL to use in seconds for session affinity, if applicable. + * @member {object} [webApplicationFirewallPolicyLink] Defines the Web + * Application Firewall policy for each host (if applicable) + * @member {string} [webApplicationFirewallPolicyLink.id] Resource ID. + * @member {string} [resourceState] Resource status. Possible values include: + * 'Creating', 'Enabling', 'Enabled', 'Disabling', 'Disabled', 'Deleting' + * @member {string} [customHttpsProvisioningState] Provisioning status of + * Custom Https of the frontendEndpoint. Possible values include: 'Enabling', + * 'Enabled', 'Disabling', 'Disabled', 'Failed' + * @member {string} [customHttpsProvisioningSubstate] Provisioning substate + * shows the progress of custom HTTPS enabling/disabling process step by + * step. Possible values include: 'SubmittingDomainControlValidationRequest', + * 'PendingDomainControlValidationREquestApproval', + * 'DomainControlValidationRequestApproved', + * 'DomainControlValidationRequestRejected', + * 'DomainControlValidationRequestTimedOut', 'IssuingCertificate', + * 'DeployingCertificate', 'CertificateDeployed', 'DeletingCertificate', + * 'CertificateDeleted' + * @member {object} [customHttpsConfiguration] The configuration specifying + * how to enable HTTPS + * @member {string} [customHttpsConfiguration.certificateSource] Defines the + * source of the SSL certificate. Possible values include: 'AzureKeyVault', + * 'FrontDoor' + * @member {string} [customHttpsConfiguration.protocolType] Defines the TLS + * extension protocol that is used for secure delivery. Possible values + * include: 'ServerNameIndication' + * @member {object} [customHttpsConfiguration.vault] The Key Vault containing + * the SSL certificate + * @member {string} [customHttpsConfiguration.vault.id] Resource ID. + * @member {string} [customHttpsConfiguration.secretName] The name of the Key + * Vault secret representing the full certificate PFX + * @member {string} [customHttpsConfiguration.secretVersion] The version of + * the Key Vault secret representing the full certificate PFX + * @member {string} [customHttpsConfiguration.certificateType] Defines the + * type of the certificate used for secure connections to a frontendEndpoint. + * Possible values include: 'Dedicated' + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of FrontendEndpoint + * + * @returns {object} metadata of FrontendEndpoint + * + */ + mapper() { + return { + required: false, + serializedName: 'FrontendEndpoint', + type: { + name: 'Composite', + className: 'FrontendEndpoint', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + hostName: { + required: false, + serializedName: 'properties.hostName', + type: { + name: 'String' + } + }, + sessionAffinityEnabledState: { + required: false, + serializedName: 'properties.sessionAffinityEnabledState', + type: { + name: 'String' + } + }, + sessionAffinityTtlSeconds: { + required: false, + serializedName: 'properties.sessionAffinityTtlSeconds', + type: { + name: 'Number' + } + }, + webApplicationFirewallPolicyLink: { + required: false, + serializedName: 'properties.webApplicationFirewallPolicyLink', + type: { + name: 'Composite', + className: 'FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink' + } + }, + resourceState: { + required: false, + serializedName: 'properties.resourceState', + type: { + name: 'String' + } + }, + customHttpsProvisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.customHttpsProvisioningState', + type: { + name: 'String' + } + }, + customHttpsProvisioningSubstate: { + required: false, + readOnly: true, + serializedName: 'properties.customHttpsProvisioningSubstate', + type: { + name: 'String' + } + }, + customHttpsConfiguration: { + required: false, + readOnly: true, + serializedName: 'properties.customHttpsConfiguration', + type: { + name: 'Composite', + className: 'CustomHttpsConfiguration' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = FrontendEndpoint; diff --git a/lib/services/networkManagement2/lib/lib/models/frontendEndpointUpdateParameters.js b/lib/services/networkManagement2/lib/lib/models/frontendEndpointUpdateParameters.js new file mode 100644 index 0000000000..4661f6aed1 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/frontendEndpointUpdateParameters.js @@ -0,0 +1,83 @@ +/* + * 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'; + +/** + * Frontend endpoint used in routing rule + * + */ +class FrontendEndpointUpdateParameters { + /** + * Create a FrontendEndpointUpdateParameters. + * @member {string} [hostName] The host name of the frontendEndpoint. Must be + * a domain name. + * @member {string} [sessionAffinityEnabledState] Whether to allow session + * affinity on this host. Valid options are 'Enabled' or 'Disabled'. Possible + * values include: 'Enabled', 'Disabled' + * @member {number} [sessionAffinityTtlSeconds] UNUSED. This field will be + * ignored. The TTL to use in seconds for session affinity, if applicable. + * @member {object} [webApplicationFirewallPolicyLink] Defines the Web + * Application Firewall policy for each host (if applicable) + * @member {string} [webApplicationFirewallPolicyLink.id] Resource ID. + */ + constructor() { + } + + /** + * Defines the metadata of FrontendEndpointUpdateParameters + * + * @returns {object} metadata of FrontendEndpointUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'FrontendEndpointUpdateParameters', + type: { + name: 'Composite', + className: 'FrontendEndpointUpdateParameters', + modelProperties: { + hostName: { + required: false, + serializedName: 'hostName', + type: { + name: 'String' + } + }, + sessionAffinityEnabledState: { + required: false, + serializedName: 'sessionAffinityEnabledState', + type: { + name: 'String' + } + }, + sessionAffinityTtlSeconds: { + required: false, + serializedName: 'sessionAffinityTtlSeconds', + type: { + name: 'Number' + } + }, + webApplicationFirewallPolicyLink: { + required: false, + serializedName: 'webApplicationFirewallPolicyLink', + type: { + name: 'Composite', + className: 'FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink' + } + } + } + } + }; + } +} + +module.exports = FrontendEndpointUpdateParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/frontendEndpointUpdateParametersWebApplicationFirewallPolicyLink.js b/lib/services/networkManagement2/lib/lib/models/frontendEndpointUpdateParametersWebApplicationFirewallPolicyLink.js new file mode 100644 index 0000000000..3fa1e51455 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/frontendEndpointUpdateParametersWebApplicationFirewallPolicyLink.js @@ -0,0 +1,52 @@ +/* + * 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'; + +/** + * Defines the Web Application Firewall policy for each host (if applicable) + * + */ +class FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink { + /** + * Create a FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink. + * @member {string} [id] Resource ID. + */ + constructor() { + } + + /** + * Defines the metadata of FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink + * + * @returns {object} metadata of FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink + * + */ + mapper() { + return { + required: false, + serializedName: 'FrontendEndpointUpdateParameters_webApplicationFirewallPolicyLink', + type: { + name: 'Composite', + className: 'FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink; diff --git a/lib/services/networkManagement2/lib/lib/models/frontendEndpointsListResult.js b/lib/services/networkManagement2/lib/lib/models/frontendEndpointsListResult.js new file mode 100644 index 0000000000..381bdce9c5 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/frontendEndpointsListResult.js @@ -0,0 +1,70 @@ +/* + * 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'; + +/** + * Result of the request to list frontend endpoints. It contains a list of + * Frontend endpoint objects and a URL link to get the the next set of results. + */ +class FrontendEndpointsListResult extends Array { + /** + * Create a FrontendEndpointsListResult. + * @member {string} [nextLink] URL to get the next set of frontend endpoints + * if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of FrontendEndpointsListResult + * + * @returns {object} metadata of FrontendEndpointsListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'FrontendEndpointsListResult', + type: { + name: 'Composite', + className: 'FrontendEndpointsListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'FrontendEndpointElementType', + type: { + name: 'Composite', + className: 'FrontendEndpoint' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = FrontendEndpointsListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/healthProbeSettingsListResult.js b/lib/services/networkManagement2/lib/lib/models/healthProbeSettingsListResult.js new file mode 100644 index 0000000000..6449669558 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/healthProbeSettingsListResult.js @@ -0,0 +1,71 @@ +/* + * 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'; + +/** + * Result of the request to list HealthProbeSettings. It contains a list of + * HealthProbeSettings objects and a URL link to get the the next set of + * results. + */ +class HealthProbeSettingsListResult extends Array { + /** + * Create a HealthProbeSettingsListResult. + * @member {string} [nextLink] URL to get the next set of HealthProbeSettings + * objects if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of HealthProbeSettingsListResult + * + * @returns {object} metadata of HealthProbeSettingsListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'HealthProbeSettingsListResult', + type: { + name: 'Composite', + className: 'HealthProbeSettingsListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'HealthProbeSettingsModelElementType', + type: { + name: 'Composite', + className: 'HealthProbeSettingsModel' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = HealthProbeSettingsListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/healthProbeSettingsModel.js b/lib/services/networkManagement2/lib/lib/models/healthProbeSettingsModel.js new file mode 100644 index 0000000000..551e3d35b2 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/healthProbeSettingsModel.js @@ -0,0 +1,107 @@ +/* + * 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 models = require('./index'); + +/** + * Load balancing settings for a backend pool + * + * @extends models['SubResource'] + */ +class HealthProbeSettingsModel extends models['SubResource'] { + /** + * Create a HealthProbeSettingsModel. + * @member {string} [path] The path to use for the health probe. Default is / + * @member {string} [protocol] Protocol scheme to use for this probe. + * Possible values include: 'Http', 'Https' + * @member {number} [intervalInSeconds] The number of seconds between health + * probes. + * @member {string} [resourceState] Resource status. Possible values include: + * 'Creating', 'Enabling', 'Enabled', 'Disabling', 'Disabled', 'Deleting' + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of HealthProbeSettingsModel + * + * @returns {object} metadata of HealthProbeSettingsModel + * + */ + mapper() { + return { + required: false, + serializedName: 'HealthProbeSettingsModel', + type: { + name: 'Composite', + className: 'HealthProbeSettingsModel', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + path: { + required: false, + serializedName: 'properties.path', + type: { + name: 'String' + } + }, + protocol: { + required: false, + serializedName: 'properties.protocol', + type: { + name: 'String' + } + }, + intervalInSeconds: { + required: false, + serializedName: 'properties.intervalInSeconds', + type: { + name: 'Number' + } + }, + resourceState: { + required: false, + serializedName: 'properties.resourceState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = HealthProbeSettingsModel; diff --git a/lib/services/networkManagement2/lib/lib/models/healthProbeSettingsUpdateParameters.js b/lib/services/networkManagement2/lib/lib/models/healthProbeSettingsUpdateParameters.js new file mode 100644 index 0000000000..6c87904add --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/healthProbeSettingsUpdateParameters.js @@ -0,0 +1,70 @@ +/* + * 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'; + +/** + * L7 health probe settings for a backend pool + * + */ +class HealthProbeSettingsUpdateParameters { + /** + * Create a HealthProbeSettingsUpdateParameters. + * @member {string} [path] The path to use for the health probe. Default is / + * @member {string} [protocol] Protocol scheme to use for this probe. + * Possible values include: 'Http', 'Https' + * @member {number} [intervalInSeconds] The number of seconds between health + * probes. + */ + constructor() { + } + + /** + * Defines the metadata of HealthProbeSettingsUpdateParameters + * + * @returns {object} metadata of HealthProbeSettingsUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'HealthProbeSettingsUpdateParameters', + type: { + name: 'Composite', + className: 'HealthProbeSettingsUpdateParameters', + modelProperties: { + path: { + required: false, + serializedName: 'path', + type: { + name: 'String' + } + }, + protocol: { + required: false, + serializedName: 'protocol', + type: { + name: 'String' + } + }, + intervalInSeconds: { + required: false, + serializedName: 'intervalInSeconds', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = HealthProbeSettingsUpdateParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/index.d.ts b/lib/services/networkManagement2/lib/lib/models/index.d.ts new file mode 100644 index 0000000000..79481eaa80 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/index.d.ts @@ -0,0 +1,978 @@ +/* + * 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. + */ + +import { BaseResource } from 'ms-rest-azure'; +import { CloudError } from 'ms-rest-azure'; +import * as moment from 'moment'; + +export { BaseResource } from 'ms-rest-azure'; +export { CloudError } from 'ms-rest-azure'; + + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * Common resource representation. + * + * @member {string} [id] Resource ID. + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + * @member {string} [location] Resource location. + * @member {object} [tags] Resource tags. + */ +export interface Resource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; + location?: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the FrontDoor class. + * @constructor + * Front Door represents a collection of backend endpoints to route traffic to + * along with rules that specify how traffic is sent there. + * + * @member {string} [friendlyName] A friendly name for the frontDoor + * @member {array} [routingRules] Routing rules associated with this Front + * Door. + * @member {array} [loadBalancingSettings] Load balancing settings associated + * with this Front Door instance. + * @member {array} [healthProbeSettings] Health probe settings associated with + * this Front Door instance. + * @member {array} [backendPools] Backend pools available to routing rules. + * @member {array} [frontendEndpoints] Frontend endpoints available to routing + * rules. + * @member {string} [enabledState] Operational status of the Front Door load + * balancer. Permitted values are 'Enabled' or 'Disabled'. Possible values + * include: 'Enabled', 'Disabled' + * @member {string} [resourceState] Resource status of the Front Door. Possible + * values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', 'Disabled', + * 'Deleting' + * @member {string} [provisioningState] Provisioning state of the Front Door. + * @member {string} [cname] The host that each frontendEndpoint must CNAME to. + */ +export interface FrontDoor extends Resource { + friendlyName?: string; + routingRules?: RoutingRule[]; + loadBalancingSettings?: LoadBalancingSettingsModel[]; + healthProbeSettings?: HealthProbeSettingsModel[]; + backendPools?: BackendPool[]; + frontendEndpoints?: FrontendEndpoint[]; + enabledState?: string; + resourceState?: string; + readonly provisioningState?: string; + readonly cname?: string; +} + +/** + * @class + * Initializes a new instance of the SubResource class. + * @constructor + * Reference to another subresource. + * + * @member {string} [id] Resource ID. + */ +export interface SubResource extends BaseResource { + id?: string; +} + +/** + * @class + * Initializes a new instance of the RoutingRule class. + * @constructor + * A routing rule represents a specification for traffic to treat and where to + * send it, along with health probe information. + * + * @member {array} [frontendEndpoints] Frontend endpoints associated with this + * rule + * @member {array} [acceptedProtocols] Protocol schemes to match for this rule + * @member {array} [patternsToMatch] The route patterns of the rule. + * @member {string} [customForwardingPath] A custom path used to rewrite + * resource paths matched by this rule. Leave empty to use incoming path. + * @member {string} [forwardingProtocol] Protocol this rule will use when + * forwarding traffic to backends. Possible values include: 'HttpOnly', + * 'HttpsOnly', 'MatchRequest' + * @member {object} [cacheConfiguration] The caching configuration associated + * with this rule. + * @member {string} [cacheConfiguration.queryParameterStripDirective] Treatment + * of URL query terms when forming the cache key. Possible values include: + * 'StripNone', 'StripAll' + * @member {string} [cacheConfiguration.dynamicCompression] Whether to use + * dynamic compression for cached content. Possible values include: 'Enabled', + * 'Disabled' + * @member {object} [backendPool] A reference to the BackendPool which this + * rule routes to. + * @member {string} [backendPool.id] Resource ID. + * @member {string} [enabledState] Whether to enable use of this rule. + * Permitted values are 'Enabled' or 'Disabled'. Possible values include: + * 'Enabled', 'Disabled' + * @member {string} [resourceState] Resource status. Possible values include: + * 'Creating', 'Enabling', 'Enabled', 'Disabling', 'Disabled', 'Deleting' + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + */ +export interface RoutingRule extends SubResource { + frontendEndpoints?: SubResource[]; + acceptedProtocols?: string[]; + patternsToMatch?: string[]; + customForwardingPath?: string; + forwardingProtocol?: string; + cacheConfiguration?: CacheConfiguration; + backendPool?: SubResource; + enabledState?: string; + resourceState?: string; + name?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the LoadBalancingSettingsModel class. + * @constructor + * Load balancing settings for a backend pool + * + * @member {number} [sampleSize] The number of samples to consider for load + * balancing decisions + * @member {number} [successfulSamplesRequired] The number of samples within + * the sample period that must succeed + * @member {number} [additionalLatencyMilliseconds] The additional latency in + * milliseconds for probes to fall into the lowest latency bucket + * @member {string} [resourceState] Resource status. Possible values include: + * 'Creating', 'Enabling', 'Enabled', 'Disabling', 'Disabled', 'Deleting' + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + */ +export interface LoadBalancingSettingsModel extends SubResource { + sampleSize?: number; + successfulSamplesRequired?: number; + additionalLatencyMilliseconds?: number; + resourceState?: string; + name?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the HealthProbeSettingsModel class. + * @constructor + * Load balancing settings for a backend pool + * + * @member {string} [path] The path to use for the health probe. Default is / + * @member {string} [protocol] Protocol scheme to use for this probe. Possible + * values include: 'Http', 'Https' + * @member {number} [intervalInSeconds] The number of seconds between health + * probes. + * @member {string} [resourceState] Resource status. Possible values include: + * 'Creating', 'Enabling', 'Enabled', 'Disabling', 'Disabled', 'Deleting' + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + */ +export interface HealthProbeSettingsModel extends SubResource { + path?: string; + protocol?: string; + intervalInSeconds?: number; + resourceState?: string; + name?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the BackendPool class. + * @constructor + * A backend pool is a collection of backends that can be routed to. + * + * @member {array} [backends] The set of backends for this pool + * @member {object} [loadBalancingSettings] Load balancing settings for a + * backend pool + * @member {string} [loadBalancingSettings.id] Resource ID. + * @member {object} [healthProbeSettings] L7 health probe settings for a + * backend pool + * @member {string} [healthProbeSettings.id] Resource ID. + * @member {string} [resourceState] Resource status. Possible values include: + * 'Creating', 'Enabling', 'Enabled', 'Disabling', 'Disabled', 'Deleting' + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + */ +export interface BackendPool extends SubResource { + backends?: Backend[]; + loadBalancingSettings?: SubResource; + healthProbeSettings?: SubResource; + resourceState?: string; + name?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the KeyVaultCertificateSourceParametersVault class. + * @constructor + * The Key Vault containing the SSL certificate + * + * @member {string} [id] Resource ID. + */ +export interface KeyVaultCertificateSourceParametersVault { + id?: string; +} + +/** + * @class + * Initializes a new instance of the CustomHttpsConfiguration class. + * @constructor + * Https settings for a domain + * + * @member {string} [certificateSource] Defines the source of the SSL + * certificate. Possible values include: 'AzureKeyVault', 'FrontDoor' + * @member {string} [protocolType] Defines the TLS extension protocol that is + * used for secure delivery. Possible values include: 'ServerNameIndication' + * @member {object} [vault] The Key Vault containing the SSL certificate + * @member {string} [vault.id] Resource ID. + * @member {string} [secretName] The name of the Key Vault secret representing + * the full certificate PFX + * @member {string} [secretVersion] The version of the Key Vault secret + * representing the full certificate PFX + * @member {string} [certificateType] Defines the type of the certificate used + * for secure connections to a frontendEndpoint. Possible values include: + * 'Dedicated' + */ +export interface CustomHttpsConfiguration { + certificateSource?: string; + protocolType?: string; + vault?: KeyVaultCertificateSourceParametersVault; + secretName?: string; + secretVersion?: string; + certificateType?: string; +} + +/** + * @class + * Initializes a new instance of the FrontendEndpoint class. + * @constructor + * A frontend endpoint used for routing. + * + * @member {string} [hostName] The host name of the frontendEndpoint. Must be a + * domain name. + * @member {string} [sessionAffinityEnabledState] Whether to allow session + * affinity on this host. Valid options are 'Enabled' or 'Disabled'. Possible + * values include: 'Enabled', 'Disabled' + * @member {number} [sessionAffinityTtlSeconds] UNUSED. This field will be + * ignored. The TTL to use in seconds for session affinity, if applicable. + * @member {object} [webApplicationFirewallPolicyLink] Defines the Web + * Application Firewall policy for each host (if applicable) + * @member {string} [webApplicationFirewallPolicyLink.id] Resource ID. + * @member {string} [resourceState] Resource status. Possible values include: + * 'Creating', 'Enabling', 'Enabled', 'Disabling', 'Disabled', 'Deleting' + * @member {string} [customHttpsProvisioningState] Provisioning status of + * Custom Https of the frontendEndpoint. Possible values include: 'Enabling', + * 'Enabled', 'Disabling', 'Disabled', 'Failed' + * @member {string} [customHttpsProvisioningSubstate] Provisioning substate + * shows the progress of custom HTTPS enabling/disabling process step by step. + * Possible values include: 'SubmittingDomainControlValidationRequest', + * 'PendingDomainControlValidationREquestApproval', + * 'DomainControlValidationRequestApproved', + * 'DomainControlValidationRequestRejected', + * 'DomainControlValidationRequestTimedOut', 'IssuingCertificate', + * 'DeployingCertificate', 'CertificateDeployed', 'DeletingCertificate', + * 'CertificateDeleted' + * @member {object} [customHttpsConfiguration] The configuration specifying how + * to enable HTTPS + * @member {string} [customHttpsConfiguration.certificateSource] Defines the + * source of the SSL certificate. Possible values include: 'AzureKeyVault', + * 'FrontDoor' + * @member {string} [customHttpsConfiguration.protocolType] Defines the TLS + * extension protocol that is used for secure delivery. Possible values + * include: 'ServerNameIndication' + * @member {object} [customHttpsConfiguration.vault] The Key Vault containing + * the SSL certificate + * @member {string} [customHttpsConfiguration.vault.id] Resource ID. + * @member {string} [customHttpsConfiguration.secretName] The name of the Key + * Vault secret representing the full certificate PFX + * @member {string} [customHttpsConfiguration.secretVersion] The version of the + * Key Vault secret representing the full certificate PFX + * @member {string} [customHttpsConfiguration.certificateType] Defines the type + * of the certificate used for secure connections to a frontendEndpoint. + * Possible values include: 'Dedicated' + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + */ +export interface FrontendEndpoint extends SubResource { + hostName?: string; + sessionAffinityEnabledState?: string; + sessionAffinityTtlSeconds?: number; + webApplicationFirewallPolicyLink?: FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink; + resourceState?: string; + readonly customHttpsProvisioningState?: string; + readonly customHttpsProvisioningSubstate?: string; + readonly customHttpsConfiguration?: CustomHttpsConfiguration; + name?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the FrontDoorUpdateParameters class. + * @constructor + * The properties needed to update a Front Door + * + * @member {string} [friendlyName] A friendly name for the frontDoor + * @member {array} [routingRules] Routing rules associated with this Front + * Door. + * @member {array} [loadBalancingSettings] Load balancing settings associated + * with this Front Door instance. + * @member {array} [healthProbeSettings] Health probe settings associated with + * this Front Door instance. + * @member {array} [backendPools] Backend pools available to routing rules. + * @member {array} [frontendEndpoints] Frontend endpoints available to routing + * rules. + * @member {string} [enabledState] Operational status of the Front Door load + * balancer. Permitted values are 'Enabled' or 'Disabled'. Possible values + * include: 'Enabled', 'Disabled' + */ +export interface FrontDoorUpdateParameters { + friendlyName?: string; + routingRules?: RoutingRule[]; + loadBalancingSettings?: LoadBalancingSettingsModel[]; + healthProbeSettings?: HealthProbeSettingsModel[]; + backendPools?: BackendPool[]; + frontendEndpoints?: FrontendEndpoint[]; + enabledState?: string; +} + +/** + * @class + * Initializes a new instance of the PurgeParameters class. + * @constructor + * Parameters required for content purge. + * + * @member {array} contentPaths The path to the content to be purged. Can + * describe a file path or a wild card directory. + */ +export interface PurgeParameters { + contentPaths: string[]; +} + +/** + * @class + * Initializes a new instance of the CacheConfiguration class. + * @constructor + * Caching settings for a caching-type route. To disable caching, do not + * provide a cacheConfiguration object. + * + * @member {string} [queryParameterStripDirective] Treatment of URL query terms + * when forming the cache key. Possible values include: 'StripNone', 'StripAll' + * @member {string} [dynamicCompression] Whether to use dynamic compression for + * cached content. Possible values include: 'Enabled', 'Disabled' + */ +export interface CacheConfiguration { + queryParameterStripDirective?: string; + dynamicCompression?: string; +} + +/** + * @class + * Initializes a new instance of the RoutingRuleUpdateParameters class. + * @constructor + * Routing rules to apply to an endpoint + * + * @member {array} [frontendEndpoints] Frontend endpoints associated with this + * rule + * @member {array} [acceptedProtocols] Protocol schemes to match for this rule + * @member {array} [patternsToMatch] The route patterns of the rule. + * @member {string} [customForwardingPath] A custom path used to rewrite + * resource paths matched by this rule. Leave empty to use incoming path. + * @member {string} [forwardingProtocol] Protocol this rule will use when + * forwarding traffic to backends. Possible values include: 'HttpOnly', + * 'HttpsOnly', 'MatchRequest' + * @member {object} [cacheConfiguration] The caching configuration associated + * with this rule. + * @member {string} [cacheConfiguration.queryParameterStripDirective] Treatment + * of URL query terms when forming the cache key. Possible values include: + * 'StripNone', 'StripAll' + * @member {string} [cacheConfiguration.dynamicCompression] Whether to use + * dynamic compression for cached content. Possible values include: 'Enabled', + * 'Disabled' + * @member {object} [backendPool] A reference to the BackendPool which this + * rule routes to. + * @member {string} [backendPool.id] Resource ID. + * @member {string} [enabledState] Whether to enable use of this rule. + * Permitted values are 'Enabled' or 'Disabled'. Possible values include: + * 'Enabled', 'Disabled' + */ +export interface RoutingRuleUpdateParameters { + frontendEndpoints?: SubResource[]; + acceptedProtocols?: string[]; + patternsToMatch?: string[]; + customForwardingPath?: string; + forwardingProtocol?: string; + cacheConfiguration?: CacheConfiguration; + backendPool?: SubResource; + enabledState?: string; +} + +/** + * @class + * Initializes a new instance of the Backend class. + * @constructor + * Backend address of a frontDoor load balancer. + * + * @member {string} [address] Location of the backend (IP address or FQDN) + * @member {number} [httpPort] The HTTP TCP port number. Must be between 1 and + * 65535. + * @member {number} [httpsPort] The HTTPS TCP port number. Must be between 1 + * and 65535. + * @member {string} [enabledState] Whether to enable use of this backend. + * Permitted values are 'Enabled' or 'Disabled'. Possible values include: + * 'Enabled', 'Disabled' + * @member {number} [priority] Priority to use for load balancing. Higher + * priorities will not be used for load balancing if any lower priority backend + * is healthy. + * @member {number} [weight] Weight of this endpoint for load balancing + * purposes. + * @member {string} [backendHostHeader] The value to use as the host header + * sent to the backend. If blank or unspecified, this defaults to the incoming + * host. + */ +export interface Backend { + address?: string; + httpPort?: number; + httpsPort?: number; + enabledState?: string; + priority?: number; + weight?: number; + backendHostHeader?: string; +} + +/** + * @class + * Initializes a new instance of the LoadBalancingSettingsUpdateParameters class. + * @constructor + * Round-Robin load balancing settings for a backend pool + * + * @member {number} [sampleSize] The number of samples to consider for load + * balancing decisions + * @member {number} [successfulSamplesRequired] The number of samples within + * the sample period that must succeed + * @member {number} [additionalLatencyMilliseconds] The additional latency in + * milliseconds for probes to fall into the lowest latency bucket + */ +export interface LoadBalancingSettingsUpdateParameters { + sampleSize?: number; + successfulSamplesRequired?: number; + additionalLatencyMilliseconds?: number; +} + +/** + * @class + * Initializes a new instance of the HealthProbeSettingsUpdateParameters class. + * @constructor + * L7 health probe settings for a backend pool + * + * @member {string} [path] The path to use for the health probe. Default is / + * @member {string} [protocol] Protocol scheme to use for this probe. Possible + * values include: 'Http', 'Https' + * @member {number} [intervalInSeconds] The number of seconds between health + * probes. + */ +export interface HealthProbeSettingsUpdateParameters { + path?: string; + protocol?: string; + intervalInSeconds?: number; +} + +/** + * @class + * Initializes a new instance of the BackendPoolUpdateParameters class. + * @constructor + * A collection of backends that can be routed to. + * + * @member {array} [backends] The set of backends for this pool + * @member {object} [loadBalancingSettings] Load balancing settings for a + * backend pool + * @member {string} [loadBalancingSettings.id] Resource ID. + * @member {object} [healthProbeSettings] L7 health probe settings for a + * backend pool + * @member {string} [healthProbeSettings.id] Resource ID. + */ +export interface BackendPoolUpdateParameters { + backends?: Backend[]; + loadBalancingSettings?: SubResource; + healthProbeSettings?: SubResource; +} + +/** + * @class + * Initializes a new instance of the FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink class. + * @constructor + * Defines the Web Application Firewall policy for each host (if applicable) + * + * @member {string} [id] Resource ID. + */ +export interface FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink { + id?: string; +} + +/** + * @class + * Initializes a new instance of the FrontendEndpointUpdateParameters class. + * @constructor + * Frontend endpoint used in routing rule + * + * @member {string} [hostName] The host name of the frontendEndpoint. Must be a + * domain name. + * @member {string} [sessionAffinityEnabledState] Whether to allow session + * affinity on this host. Valid options are 'Enabled' or 'Disabled'. Possible + * values include: 'Enabled', 'Disabled' + * @member {number} [sessionAffinityTtlSeconds] UNUSED. This field will be + * ignored. The TTL to use in seconds for session affinity, if applicable. + * @member {object} [webApplicationFirewallPolicyLink] Defines the Web + * Application Firewall policy for each host (if applicable) + * @member {string} [webApplicationFirewallPolicyLink.id] Resource ID. + */ +export interface FrontendEndpointUpdateParameters { + hostName?: string; + sessionAffinityEnabledState?: string; + sessionAffinityTtlSeconds?: number; + webApplicationFirewallPolicyLink?: FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink; +} + +/** + * @class + * Initializes a new instance of the ValidateCustomDomainInput class. + * @constructor + * Input of the custom domain to be validated for DNS mapping. + * + * @member {string} hostName The host name of the custom domain. Must be a + * domain name. + */ +export interface ValidateCustomDomainInput { + hostName: string; +} + +/** + * @class + * Initializes a new instance of the ValidateCustomDomainOutput class. + * @constructor + * Output of custom domain validation. + * + * @member {boolean} [customDomainValidated] Indicates whether the custom + * domain is valid or not. + * @member {string} [reason] The reason why the custom domain is not valid. + * @member {string} [message] Error message describing why the custom domain is + * not valid. + */ +export interface ValidateCustomDomainOutput { + readonly customDomainValidated?: boolean; + readonly reason?: string; + readonly message?: string; +} + +/** + * @class + * Initializes a new instance of the ErrorResponse class. + * @constructor + * Error reponse indicates Front Door service is not able to process the + * incoming request. The reason is provided in the error message. + * + * @member {string} [code] Error code. + * @member {string} [message] Error message indicating why the operation + * failed. + */ +export interface ErrorResponse { + readonly code?: string; + readonly message?: string; +} + +/** + * @class + * Initializes a new instance of the CheckNameAvailabilityInput class. + * @constructor + * Input of CheckNameAvailability API. + * + * @member {string} name The resource name to validate. + * @member {string} type The type of the resource whose name is to be + * validated. Possible values include: 'Microsoft.Network/frontDoors', + * 'Microsoft.Network/frontDoors/frontendEndpoints' + */ +export interface CheckNameAvailabilityInput { + name: string; + type: string; +} + +/** + * @class + * Initializes a new instance of the CheckNameAvailabilityOutput class. + * @constructor + * Output of check name availability API. + * + * @member {string} [nameAvailability] Indicates whether the name is available. + * Possible values include: 'Available', 'Unavailable' + * @member {string} [reason] The reason why the name is not available. + * @member {string} [message] The detailed error message describing why the + * name is not available. + */ +export interface CheckNameAvailabilityOutput { + readonly nameAvailability?: string; + readonly reason?: string; + readonly message?: string; +} + +/** + * @class + * Initializes a new instance of the ErrorDetails class. + * @constructor + * @member {string} [code] + * @member {string} [target] + * @member {string} [message] + */ +export interface ErrorDetails { + code?: string; + target?: string; + message?: string; +} + +/** + * @class + * Initializes a new instance of the ErrorModel class. + * @constructor + * @member {string} [code] + * @member {string} [message] + * @member {string} [target] + * @member {array} [details] + * @member {string} [innerError] + */ +export interface ErrorModel { + code?: string; + message?: string; + target?: string; + details?: ErrorDetails[]; + innerError?: string; +} + +/** + * @class + * Initializes a new instance of the AzureAsyncOperationResult class. + * @constructor + * The response body contains the status of the specified asynchronous + * operation, indicating whether it has succeeded, is in progress, or has + * failed. Note that this status is distinct from the HTTP status code returned + * for the Get Operation Status operation itself. If the asynchronous operation + * succeeded, the response body includes the HTTP status code for the + * successful request. If the asynchronous operation failed, the response body + * includes the HTTP status code for the failed request and error information + * regarding the failure. + * + * @member {string} [status] Status of the Azure async operation. Possible + * values are: 'InProgress', 'Succeeded', and 'Failed'. Possible values + * include: 'InProgress', 'Succeeded', 'Failed' + * @member {object} [error] + * @member {string} [error.code] + * @member {string} [error.message] + * @member {string} [error.target] + * @member {array} [error.details] + * @member {string} [error.innerError] + */ +export interface AzureAsyncOperationResult { + status?: string; + error?: ErrorModel; +} + +/** + * @class + * Initializes a new instance of the TagsObject class. + * @constructor + * Tags object for patch operations. + * + * @member {object} [tags] Resource tags. + */ +export interface TagsObject { + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the PolicySettings class. + * @constructor + * Defines contents of a web application firewall global configuration + * + * @member {string} [enabledState] describes if the policy is in enabled state + * or disabled state. Possible values include: 'Disabled', 'Enabled' + * @member {string} [mode] Describes if it is in detection mode or prevention + * mode at policy level. Possible values include: 'Prevention', 'Detection' + */ +export interface PolicySettings { + enabledState?: string; + mode?: string; +} + +/** + * @class + * Initializes a new instance of the MatchCondition1 class. + * @constructor + * Define match conditions + * + * @member {string} matchVariable Match Variable. Possible values include: + * 'RemoteAddr', 'RequestMethod', 'QueryString', 'PostArgs', 'RequestUri', + * 'RequestHeader', 'RequestBody' + * @member {string} [selector] Name of selector in RequestHeader or RequestBody + * to be matched + * @member {string} operator Describes operator to be matched. Possible values + * include: 'Any', 'IPMatch', 'GeoMatch', 'Equal', 'Contains', 'LessThan', + * 'GreaterThan', 'LessThanOrEqual', 'GreaterThanOrEqual', 'BeginsWith', + * 'EndsWith' + * @member {boolean} [negateCondition] Describes if this is negate condition or + * not + * @member {array} matchValue Match value + */ +export interface MatchCondition1 { + matchVariable: string; + selector?: string; + operator: string; + negateCondition?: boolean; + matchValue: string[]; +} + +/** + * @class + * Initializes a new instance of the CustomRule class. + * @constructor + * Defines contents of a web application rule + * + * @member {string} [name] Gets name of the resource that is unique within a + * policy. This name can be used to access the resource. + * @member {string} [etag] Gets a unique read-only string that changes whenever + * the resource is updated. + * @member {number} priority Describes priority of the rule. Rules with a lower + * value will be evaluated before rules with a higher value + * @member {string} ruleType Describes type of rule. Possible values include: + * 'MatchRule', 'RateLimitRule' + * @member {number} [rateLimitDurationInMinutes] Defines rate limit duration. + * Default - 1 minute + * @member {number} [rateLimitThreshold] Defines rate limit thresold + * @member {array} matchConditions List of match conditions + * @member {string} action Type of Actions. Possible values include: 'Allow', + * 'Block', 'Log' + * @member {array} [transforms] List of transforms + */ +export interface CustomRule { + name?: string; + readonly etag?: string; + priority: number; + ruleType: string; + rateLimitDurationInMinutes?: number; + rateLimitThreshold?: number; + matchConditions: MatchCondition1[]; + action: string; + transforms?: string[]; +} + +/** + * @class + * Initializes a new instance of the CustomRules class. + * @constructor + * Defines contents of custom rules + * + * @member {array} [rules] List of rules + */ +export interface CustomRules { + rules?: CustomRule[]; +} + +/** + * @class + * Initializes a new instance of the ManagedRuleSet class. + * @constructor + * Base class for all types of ManagedRuleSet. + * + * @member {number} [priority] Describes priority of the rule + * @member {number} [version] defines version of the ruleset + * @member {string} ruleSetType Polymorphic Discriminator + */ +export interface ManagedRuleSet { + priority?: number; + version?: number; + ruleSetType: string; +} + +/** + * @class + * Initializes a new instance of the ManagedRuleSets class. + * @constructor + * Defines ManagedRuleSets - array of managedRuleSet + * + * @member {array} [ruleSets] List of rules + */ +export interface ManagedRuleSets { + ruleSets?: ManagedRuleSet[]; +} + +/** + * @class + * Initializes a new instance of the WebApplicationFirewallPolicy class. + * @constructor + * Defines web application firewall policy. + * + * @member {object} [policySettings] Describes policySettings for policy + * @member {string} [policySettings.enabledState] describes if the policy is in + * enabled state or disabled state. Possible values include: 'Disabled', + * 'Enabled' + * @member {string} [policySettings.mode] Describes if it is in detection mode + * or prevention mode at policy level. Possible values include: 'Prevention', + * 'Detection' + * @member {object} [customRules] Describes custom rules inside the policy + * @member {array} [customRules.rules] List of rules + * @member {object} [managedRules] Describes managed rules inside the policy + * @member {array} [managedRules.ruleSets] List of rules + * @member {string} [provisioningState] Provisioning state of the + * WebApplicationFirewallPolicy. + * @member {string} [etag] Gets a unique read-only string that changes whenever + * the resource is updated. + */ +export interface WebApplicationFirewallPolicy extends Resource { + policySettings?: PolicySettings; + customRules?: CustomRules; + managedRules?: ManagedRuleSets; + readonly provisioningState?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the AzureManagedOverrideRuleGroup class. + * @constructor + * Defines contents of a web application rule + * + * @member {string} ruleGroupOverride Describes overrideruleGroup. Possible + * values include: 'SqlInjection', 'XSS' + * @member {string} action Type of Actions. Possible values include: 'Allow', + * 'Block', 'Log' + */ +export interface AzureManagedOverrideRuleGroup { + ruleGroupOverride: string; + action: string; +} + +/** + * @class + * Initializes a new instance of the AzureManagedRuleSet class. + * @constructor + * Describes azure managed provider. + * + * @member {array} [ruleGroupOverrides] List of azure managed provider override + * configuration (optional) + */ +export interface AzureManagedRuleSet extends ManagedRuleSet { + ruleGroupOverrides?: AzureManagedOverrideRuleGroup[]; +} + + +/** + * @class + * Initializes a new instance of the FrontDoorListResult class. + * @constructor + * Result of the request to list Front Doors. It contains a list of Front Door + * objects and a URL link to get the the next set of results. + * + * @member {string} [nextLink] URL to get the next set of Front Door objects if + * there are any. + */ +export interface FrontDoorListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the RoutingRuleListResult class. + * @constructor + * Result of the request to list Routing Rules. It contains a list of Routing + * Rule objects and a URL link to get the the next set of results. + * + * @member {string} [nextLink] URL to get the next set of RoutingRule objects + * if there are any. + */ +export interface RoutingRuleListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the HealthProbeSettingsListResult class. + * @constructor + * Result of the request to list HealthProbeSettings. It contains a list of + * HealthProbeSettings objects and a URL link to get the the next set of + * results. + * + * @member {string} [nextLink] URL to get the next set of HealthProbeSettings + * objects if there are any. + */ +export interface HealthProbeSettingsListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the LoadBalancingSettingsListResult class. + * @constructor + * Result of the request to list load balancing settings. It contains a list of + * load balancing settings objects and a URL link to get the the next set of + * results. + * + * @member {string} [nextLink] URL to get the next set of LoadBalancingSettings + * objects if there are any. + */ +export interface LoadBalancingSettingsListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the BackendPoolListResult class. + * @constructor + * Result of the request to list Backend Pools. It contains a list of Backend + * Pools objects and a URL link to get the the next set of results. + * + * @member {string} [nextLink] URL to get the next set of BackendPool objects + * if there are any. + */ +export interface BackendPoolListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the FrontendEndpointsListResult class. + * @constructor + * Result of the request to list frontend endpoints. It contains a list of + * Frontend endpoint objects and a URL link to get the the next set of results. + * + * @member {string} [nextLink] URL to get the next set of frontend endpoints if + * there are any. + */ +export interface FrontendEndpointsListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the WebApplicationFirewallPolicyListResult class. + * @constructor + * Result of the request to list WebApplicationFirewallPolicies. It contains a + * list of WebApplicationFirewallPolicy objects and a URL link to get the the + * next set of results. + * + * @member {string} [nextLink] URL to get the next set of + * WebApplicationFirewallPolicy objects if there are any. + */ +export interface WebApplicationFirewallPolicyListResult extends Array { + nextLink?: string; +} diff --git a/lib/services/networkManagement2/lib/lib/models/index.js b/lib/services/networkManagement2/lib/lib/models/index.js new file mode 100644 index 0000000000..85509abec0 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/index.js @@ -0,0 +1,69 @@ +/* + * 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'; + +var msRestAzure = require('ms-rest-azure'); + +exports.BaseResource = msRestAzure.BaseResource; +exports.CloudError = msRestAzure.CloudError; +exports.Resource = require('./resource'); +exports.FrontDoor = require('./frontDoor'); +exports.SubResource = require('./subResource'); +exports.RoutingRule = require('./routingRule'); +exports.LoadBalancingSettingsModel = require('./loadBalancingSettingsModel'); +exports.HealthProbeSettingsModel = require('./healthProbeSettingsModel'); +exports.BackendPool = require('./backendPool'); +exports.KeyVaultCertificateSourceParametersVault = require('./keyVaultCertificateSourceParametersVault'); +exports.CustomHttpsConfiguration = require('./customHttpsConfiguration'); +exports.FrontendEndpoint = require('./frontendEndpoint'); +exports.FrontDoorUpdateParameters = require('./frontDoorUpdateParameters'); +exports.PurgeParameters = require('./purgeParameters'); +exports.CacheConfiguration = require('./cacheConfiguration'); +exports.RoutingRuleUpdateParameters = require('./routingRuleUpdateParameters'); +exports.Backend = require('./backend'); +exports.LoadBalancingSettingsUpdateParameters = require('./loadBalancingSettingsUpdateParameters'); +exports.HealthProbeSettingsUpdateParameters = require('./healthProbeSettingsUpdateParameters'); +exports.BackendPoolUpdateParameters = require('./backendPoolUpdateParameters'); +exports.FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink = require('./frontendEndpointUpdateParametersWebApplicationFirewallPolicyLink'); +exports.FrontendEndpointUpdateParameters = require('./frontendEndpointUpdateParameters'); +exports.ValidateCustomDomainInput = require('./validateCustomDomainInput'); +exports.ValidateCustomDomainOutput = require('./validateCustomDomainOutput'); +exports.ErrorResponse = require('./errorResponse'); +exports.CheckNameAvailabilityInput = require('./checkNameAvailabilityInput'); +exports.CheckNameAvailabilityOutput = require('./checkNameAvailabilityOutput'); +exports.ErrorDetails = require('./errorDetails'); +exports.ErrorModel = require('./errorModel'); +exports.AzureAsyncOperationResult = require('./azureAsyncOperationResult'); +exports.TagsObject = require('./tagsObject'); +exports.PolicySettings = require('./policySettings'); +exports.MatchCondition1 = require('./matchCondition1'); +exports.CustomRule = require('./customRule'); +exports.CustomRules = require('./customRules'); +exports.ManagedRuleSet = require('./managedRuleSet'); +exports.ManagedRuleSets = require('./managedRuleSets'); +exports.WebApplicationFirewallPolicy = require('./webApplicationFirewallPolicy'); +exports.AzureManagedOverrideRuleGroup = require('./azureManagedOverrideRuleGroup'); +exports.AzureManagedRuleSet = require('./azureManagedRuleSet'); +exports.FrontDoorListResult = require('./frontDoorListResult'); +exports.RoutingRuleListResult = require('./routingRuleListResult'); +exports.HealthProbeSettingsListResult = require('./healthProbeSettingsListResult'); +exports.LoadBalancingSettingsListResult = require('./loadBalancingSettingsListResult'); +exports.BackendPoolListResult = require('./backendPoolListResult'); +exports.FrontendEndpointsListResult = require('./frontendEndpointsListResult'); +exports.WebApplicationFirewallPolicyListResult = require('./webApplicationFirewallPolicyListResult'); +exports.discriminators = { + 'Unknown' : exports.ManagedRuleSet, + 'ManagedRuleSet.AzureManagedRuleSet' : exports.AzureManagedRuleSet +}; diff --git a/lib/services/networkManagement2/lib/lib/models/keyVaultCertificateSourceParametersVault.js b/lib/services/networkManagement2/lib/lib/models/keyVaultCertificateSourceParametersVault.js new file mode 100644 index 0000000000..b7cef60222 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/keyVaultCertificateSourceParametersVault.js @@ -0,0 +1,52 @@ +/* + * 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'; + +/** + * The Key Vault containing the SSL certificate + * + */ +class KeyVaultCertificateSourceParametersVault { + /** + * Create a KeyVaultCertificateSourceParametersVault. + * @member {string} [id] Resource ID. + */ + constructor() { + } + + /** + * Defines the metadata of KeyVaultCertificateSourceParametersVault + * + * @returns {object} metadata of KeyVaultCertificateSourceParametersVault + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyVaultCertificateSourceParameters_vault', + type: { + name: 'Composite', + className: 'KeyVaultCertificateSourceParametersVault', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = KeyVaultCertificateSourceParametersVault; diff --git a/lib/services/networkManagement2/lib/lib/models/loadBalancingSettingsListResult.js b/lib/services/networkManagement2/lib/lib/models/loadBalancingSettingsListResult.js new file mode 100644 index 0000000000..e184b7ccde --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/loadBalancingSettingsListResult.js @@ -0,0 +1,71 @@ +/* + * 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'; + +/** + * Result of the request to list load balancing settings. It contains a list of + * load balancing settings objects and a URL link to get the the next set of + * results. + */ +class LoadBalancingSettingsListResult extends Array { + /** + * Create a LoadBalancingSettingsListResult. + * @member {string} [nextLink] URL to get the next set of + * LoadBalancingSettings objects if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LoadBalancingSettingsListResult + * + * @returns {object} metadata of LoadBalancingSettingsListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'LoadBalancingSettingsListResult', + type: { + name: 'Composite', + className: 'LoadBalancingSettingsListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LoadBalancingSettingsModelElementType', + type: { + name: 'Composite', + className: 'LoadBalancingSettingsModel' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LoadBalancingSettingsListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/loadBalancingSettingsModel.js b/lib/services/networkManagement2/lib/lib/models/loadBalancingSettingsModel.js new file mode 100644 index 0000000000..e1388e021e --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/loadBalancingSettingsModel.js @@ -0,0 +1,108 @@ +/* + * 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 models = require('./index'); + +/** + * Load balancing settings for a backend pool + * + * @extends models['SubResource'] + */ +class LoadBalancingSettingsModel extends models['SubResource'] { + /** + * Create a LoadBalancingSettingsModel. + * @member {number} [sampleSize] The number of samples to consider for load + * balancing decisions + * @member {number} [successfulSamplesRequired] The number of samples within + * the sample period that must succeed + * @member {number} [additionalLatencyMilliseconds] The additional latency in + * milliseconds for probes to fall into the lowest latency bucket + * @member {string} [resourceState] Resource status. Possible values include: + * 'Creating', 'Enabling', 'Enabled', 'Disabling', 'Disabled', 'Deleting' + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LoadBalancingSettingsModel + * + * @returns {object} metadata of LoadBalancingSettingsModel + * + */ + mapper() { + return { + required: false, + serializedName: 'LoadBalancingSettingsModel', + type: { + name: 'Composite', + className: 'LoadBalancingSettingsModel', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + sampleSize: { + required: false, + serializedName: 'properties.sampleSize', + type: { + name: 'Number' + } + }, + successfulSamplesRequired: { + required: false, + serializedName: 'properties.successfulSamplesRequired', + type: { + name: 'Number' + } + }, + additionalLatencyMilliseconds: { + required: false, + serializedName: 'properties.additionalLatencyMilliseconds', + type: { + name: 'Number' + } + }, + resourceState: { + required: false, + serializedName: 'properties.resourceState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LoadBalancingSettingsModel; diff --git a/lib/services/networkManagement2/lib/lib/models/loadBalancingSettingsUpdateParameters.js b/lib/services/networkManagement2/lib/lib/models/loadBalancingSettingsUpdateParameters.js new file mode 100644 index 0000000000..1abb521224 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/loadBalancingSettingsUpdateParameters.js @@ -0,0 +1,71 @@ +/* + * 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'; + +/** + * Round-Robin load balancing settings for a backend pool + * + */ +class LoadBalancingSettingsUpdateParameters { + /** + * Create a LoadBalancingSettingsUpdateParameters. + * @member {number} [sampleSize] The number of samples to consider for load + * balancing decisions + * @member {number} [successfulSamplesRequired] The number of samples within + * the sample period that must succeed + * @member {number} [additionalLatencyMilliseconds] The additional latency in + * milliseconds for probes to fall into the lowest latency bucket + */ + constructor() { + } + + /** + * Defines the metadata of LoadBalancingSettingsUpdateParameters + * + * @returns {object} metadata of LoadBalancingSettingsUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'LoadBalancingSettingsUpdateParameters', + type: { + name: 'Composite', + className: 'LoadBalancingSettingsUpdateParameters', + modelProperties: { + sampleSize: { + required: false, + serializedName: 'sampleSize', + type: { + name: 'Number' + } + }, + successfulSamplesRequired: { + required: false, + serializedName: 'successfulSamplesRequired', + type: { + name: 'Number' + } + }, + additionalLatencyMilliseconds: { + required: false, + serializedName: 'additionalLatencyMilliseconds', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = LoadBalancingSettingsUpdateParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/managedRuleSet.js b/lib/services/networkManagement2/lib/lib/models/managedRuleSet.js new file mode 100644 index 0000000000..e115d2a68c --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/managedRuleSet.js @@ -0,0 +1,74 @@ +/* + * 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'; + +/** + * Base class for all types of ManagedRuleSet. + * + */ +class ManagedRuleSet { + /** + * Create a ManagedRuleSet. + * @member {number} [priority] Describes priority of the rule + * @member {number} [version] defines version of the ruleset + * @member {string} ruleSetType Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of ManagedRuleSet + * + * @returns {object} metadata of ManagedRuleSet + * + */ + mapper() { + return { + required: false, + serializedName: 'Unknown', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'ruleSetType', + clientName: 'ruleSetType' + }, + uberParent: 'ManagedRuleSet', + className: 'ManagedRuleSet', + modelProperties: { + priority: { + required: false, + serializedName: 'priority', + type: { + name: 'Number' + } + }, + version: { + required: false, + serializedName: 'version', + type: { + name: 'Number' + } + }, + ruleSetType: { + required: true, + serializedName: 'ruleSetType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ManagedRuleSet; diff --git a/lib/services/networkManagement2/lib/lib/models/managedRuleSets.js b/lib/services/networkManagement2/lib/lib/models/managedRuleSets.js new file mode 100644 index 0000000000..ffc9449879 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/managedRuleSets.js @@ -0,0 +1,65 @@ +/* + * 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'; + +/** + * Defines ManagedRuleSets - array of managedRuleSet + * + */ +class ManagedRuleSets { + /** + * Create a ManagedRuleSets. + * @member {array} [ruleSets] List of rules + */ + constructor() { + } + + /** + * Defines the metadata of ManagedRuleSets + * + * @returns {object} metadata of ManagedRuleSets + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagedRuleSets', + type: { + name: 'Composite', + className: 'ManagedRuleSets', + modelProperties: { + ruleSets: { + required: false, + serializedName: 'ruleSets', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ManagedRuleSetElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'ruleSetType', + clientName: 'ruleSetType' + }, + uberParent: 'ManagedRuleSet', + className: 'ManagedRuleSet' + } + } + } + } + } + } + }; + } +} + +module.exports = ManagedRuleSets; diff --git a/lib/services/networkManagement2/lib/lib/models/matchCondition1.js b/lib/services/networkManagement2/lib/lib/models/matchCondition1.js new file mode 100644 index 0000000000..e480792f23 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/matchCondition1.js @@ -0,0 +1,98 @@ +/* + * 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'; + +/** + * Define match conditions + * + */ +class MatchCondition1 { + /** + * Create a MatchCondition1. + * @member {string} matchVariable Match Variable. Possible values include: + * 'RemoteAddr', 'RequestMethod', 'QueryString', 'PostArgs', 'RequestUri', + * 'RequestHeader', 'RequestBody' + * @member {string} [selector] Name of selector in RequestHeader or + * RequestBody to be matched + * @member {string} operator Describes operator to be matched. Possible + * values include: 'Any', 'IPMatch', 'GeoMatch', 'Equal', 'Contains', + * 'LessThan', 'GreaterThan', 'LessThanOrEqual', 'GreaterThanOrEqual', + * 'BeginsWith', 'EndsWith' + * @member {boolean} [negateCondition] Describes if this is negate condition + * or not + * @member {array} matchValue Match value + */ + constructor() { + } + + /** + * Defines the metadata of MatchCondition1 + * + * @returns {object} metadata of MatchCondition1 + * + */ + mapper() { + return { + required: false, + serializedName: 'MatchCondition', + type: { + name: 'Composite', + className: 'MatchCondition1', + modelProperties: { + matchVariable: { + required: true, + serializedName: 'matchVariable', + type: { + name: 'String' + } + }, + selector: { + required: false, + serializedName: 'selector', + type: { + name: 'String' + } + }, + operator: { + required: true, + serializedName: 'operator', + type: { + name: 'String' + } + }, + negateCondition: { + required: false, + serializedName: 'negateCondition', + type: { + name: 'Boolean' + } + }, + matchValue: { + required: true, + serializedName: 'matchValue', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = MatchCondition1; diff --git a/lib/services/networkManagement2/lib/lib/models/policySettings.js b/lib/services/networkManagement2/lib/lib/models/policySettings.js new file mode 100644 index 0000000000..f75fd99adb --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/policySettings.js @@ -0,0 +1,63 @@ +/* + * 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'; + +/** + * Defines contents of a web application firewall global configuration + * + */ +class PolicySettings { + /** + * Create a PolicySettings. + * @member {string} [enabledState] describes if the policy is in enabled + * state or disabled state. Possible values include: 'Disabled', 'Enabled' + * @member {string} [mode] Describes if it is in detection mode or + * prevention mode at policy level. Possible values include: 'Prevention', + * 'Detection' + */ + constructor() { + } + + /** + * Defines the metadata of PolicySettings + * + * @returns {object} metadata of PolicySettings + * + */ + mapper() { + return { + required: false, + serializedName: 'policySettings', + type: { + name: 'Composite', + className: 'PolicySettings', + modelProperties: { + enabledState: { + required: false, + serializedName: 'enabledState', + type: { + name: 'String' + } + }, + mode: { + required: false, + serializedName: 'mode', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PolicySettings; diff --git a/lib/services/networkManagement2/lib/lib/models/purgeParameters.js b/lib/services/networkManagement2/lib/lib/models/purgeParameters.js new file mode 100644 index 0000000000..e3be748479 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/purgeParameters.js @@ -0,0 +1,60 @@ +/* + * 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'; + +/** + * Parameters required for content purge. + * + */ +class PurgeParameters { + /** + * Create a PurgeParameters. + * @member {array} contentPaths The path to the content to be purged. Can + * describe a file path or a wild card directory. + */ + constructor() { + } + + /** + * Defines the metadata of PurgeParameters + * + * @returns {object} metadata of PurgeParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'PurgeParameters', + type: { + name: 'Composite', + className: 'PurgeParameters', + modelProperties: { + contentPaths: { + required: true, + serializedName: 'contentPaths', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = PurgeParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/resource.js b/lib/services/networkManagement2/lib/lib/models/resource.js new file mode 100644 index 0000000000..4b70929508 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/resource.js @@ -0,0 +1,98 @@ +/* + * 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 models = require('./index'); + +/** + * Common resource representation. + * + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @member {string} [id] Resource ID. + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + * @member {string} [location] Resource location. + * @member {object} [tags] Resource tags. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Resource + * + * @returns {object} metadata of Resource + * + */ + mapper() { + return { + required: false, + serializedName: 'Resource', + type: { + name: 'Composite', + className: 'Resource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = Resource; diff --git a/lib/services/networkManagement2/lib/lib/models/routingRule.js b/lib/services/networkManagement2/lib/lib/models/routingRule.js new file mode 100644 index 0000000000..4bbb21cafb --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/routingRule.js @@ -0,0 +1,186 @@ +/* + * 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 models = require('./index'); + +/** + * A routing rule represents a specification for traffic to treat and where to + * send it, along with health probe information. + * + * @extends models['SubResource'] + */ +class RoutingRule extends models['SubResource'] { + /** + * Create a RoutingRule. + * @member {array} [frontendEndpoints] Frontend endpoints associated with + * this rule + * @member {array} [acceptedProtocols] Protocol schemes to match for this + * rule + * @member {array} [patternsToMatch] The route patterns of the rule. + * @member {string} [customForwardingPath] A custom path used to rewrite + * resource paths matched by this rule. Leave empty to use incoming path. + * @member {string} [forwardingProtocol] Protocol this rule will use when + * forwarding traffic to backends. Possible values include: 'HttpOnly', + * 'HttpsOnly', 'MatchRequest' + * @member {object} [cacheConfiguration] The caching configuration associated + * with this rule. + * @member {string} [cacheConfiguration.queryParameterStripDirective] + * Treatment of URL query terms when forming the cache key. Possible values + * include: 'StripNone', 'StripAll' + * @member {string} [cacheConfiguration.dynamicCompression] Whether to use + * dynamic compression for cached content. Possible values include: + * 'Enabled', 'Disabled' + * @member {object} [backendPool] A reference to the BackendPool which this + * rule routes to. + * @member {string} [backendPool.id] Resource ID. + * @member {string} [enabledState] Whether to enable use of this rule. + * Permitted values are 'Enabled' or 'Disabled'. Possible values include: + * 'Enabled', 'Disabled' + * @member {string} [resourceState] Resource status. Possible values include: + * 'Creating', 'Enabling', 'Enabled', 'Disabling', 'Disabled', 'Deleting' + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RoutingRule + * + * @returns {object} metadata of RoutingRule + * + */ + mapper() { + return { + required: false, + serializedName: 'RoutingRule', + type: { + name: 'Composite', + className: 'RoutingRule', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + frontendEndpoints: { + required: false, + serializedName: 'properties.frontendEndpoints', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + acceptedProtocols: { + required: false, + serializedName: 'properties.acceptedProtocols', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'FrontDoorProtocolElementType', + type: { + name: 'String' + } + } + } + }, + patternsToMatch: { + required: false, + serializedName: 'properties.patternsToMatch', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + customForwardingPath: { + required: false, + serializedName: 'properties.customForwardingPath', + type: { + name: 'String' + } + }, + forwardingProtocol: { + required: false, + serializedName: 'properties.forwardingProtocol', + type: { + name: 'String' + } + }, + cacheConfiguration: { + required: false, + serializedName: 'properties.cacheConfiguration', + type: { + name: 'Composite', + className: 'CacheConfiguration' + } + }, + backendPool: { + required: false, + serializedName: 'properties.backendPool', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + enabledState: { + required: false, + serializedName: 'properties.enabledState', + type: { + name: 'String' + } + }, + resourceState: { + required: false, + serializedName: 'properties.resourceState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RoutingRule; diff --git a/lib/services/networkManagement2/lib/lib/models/routingRuleListResult.js b/lib/services/networkManagement2/lib/lib/models/routingRuleListResult.js new file mode 100644 index 0000000000..004f60a9f5 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/routingRuleListResult.js @@ -0,0 +1,70 @@ +/* + * 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'; + +/** + * Result of the request to list Routing Rules. It contains a list of Routing + * Rule objects and a URL link to get the the next set of results. + */ +class RoutingRuleListResult extends Array { + /** + * Create a RoutingRuleListResult. + * @member {string} [nextLink] URL to get the next set of RoutingRule objects + * if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RoutingRuleListResult + * + * @returns {object} metadata of RoutingRuleListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'RoutingRuleListResult', + type: { + name: 'Composite', + className: 'RoutingRuleListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RoutingRuleElementType', + type: { + name: 'Composite', + className: 'RoutingRule' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RoutingRuleListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/routingRuleUpdateParameters.js b/lib/services/networkManagement2/lib/lib/models/routingRuleUpdateParameters.js new file mode 100644 index 0000000000..7f02de2afd --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/routingRuleUpdateParameters.js @@ -0,0 +1,148 @@ +/* + * 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'; + +/** + * Routing rules to apply to an endpoint + * + */ +class RoutingRuleUpdateParameters { + /** + * Create a RoutingRuleUpdateParameters. + * @member {array} [frontendEndpoints] Frontend endpoints associated with + * this rule + * @member {array} [acceptedProtocols] Protocol schemes to match for this + * rule + * @member {array} [patternsToMatch] The route patterns of the rule. + * @member {string} [customForwardingPath] A custom path used to rewrite + * resource paths matched by this rule. Leave empty to use incoming path. + * @member {string} [forwardingProtocol] Protocol this rule will use when + * forwarding traffic to backends. Possible values include: 'HttpOnly', + * 'HttpsOnly', 'MatchRequest' + * @member {object} [cacheConfiguration] The caching configuration associated + * with this rule. + * @member {string} [cacheConfiguration.queryParameterStripDirective] + * Treatment of URL query terms when forming the cache key. Possible values + * include: 'StripNone', 'StripAll' + * @member {string} [cacheConfiguration.dynamicCompression] Whether to use + * dynamic compression for cached content. Possible values include: + * 'Enabled', 'Disabled' + * @member {object} [backendPool] A reference to the BackendPool which this + * rule routes to. + * @member {string} [backendPool.id] Resource ID. + * @member {string} [enabledState] Whether to enable use of this rule. + * Permitted values are 'Enabled' or 'Disabled'. Possible values include: + * 'Enabled', 'Disabled' + */ + constructor() { + } + + /** + * Defines the metadata of RoutingRuleUpdateParameters + * + * @returns {object} metadata of RoutingRuleUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'RoutingRuleUpdateParameters', + type: { + name: 'Composite', + className: 'RoutingRuleUpdateParameters', + modelProperties: { + frontendEndpoints: { + required: false, + serializedName: 'frontendEndpoints', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + acceptedProtocols: { + required: false, + serializedName: 'acceptedProtocols', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'FrontDoorProtocolElementType', + type: { + name: 'String' + } + } + } + }, + patternsToMatch: { + required: false, + serializedName: 'patternsToMatch', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + customForwardingPath: { + required: false, + serializedName: 'customForwardingPath', + type: { + name: 'String' + } + }, + forwardingProtocol: { + required: false, + serializedName: 'forwardingProtocol', + type: { + name: 'String' + } + }, + cacheConfiguration: { + required: false, + serializedName: 'cacheConfiguration', + type: { + name: 'Composite', + className: 'CacheConfiguration' + } + }, + backendPool: { + required: false, + serializedName: 'backendPool', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + enabledState: { + required: false, + serializedName: 'enabledState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RoutingRuleUpdateParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/subResource.js b/lib/services/networkManagement2/lib/lib/models/subResource.js new file mode 100644 index 0000000000..51215f1707 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/subResource.js @@ -0,0 +1,56 @@ +/* + * 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 models = require('./index'); + +/** + * Reference to another subresource. + * + * @extends models['BaseResource'] + */ +class SubResource extends models['BaseResource'] { + /** + * Create a SubResource. + * @member {string} [id] Resource ID. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SubResource + * + * @returns {object} metadata of SubResource + * + */ + mapper() { + return { + required: false, + serializedName: 'SubResource', + type: { + name: 'Composite', + className: 'SubResource', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SubResource; diff --git a/lib/services/networkManagement2/lib/lib/models/tagsObject.js b/lib/services/networkManagement2/lib/lib/models/tagsObject.js new file mode 100644 index 0000000000..755b116391 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/tagsObject.js @@ -0,0 +1,59 @@ +/* + * 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'; + +/** + * Tags object for patch operations. + * + */ +class TagsObject { + /** + * Create a TagsObject. + * @member {object} [tags] Resource tags. + */ + constructor() { + } + + /** + * Defines the metadata of TagsObject + * + * @returns {object} metadata of TagsObject + * + */ + mapper() { + return { + required: false, + serializedName: 'TagsObject', + type: { + name: 'Composite', + className: 'TagsObject', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = TagsObject; diff --git a/lib/services/networkManagement2/lib/lib/models/validateCustomDomainInput.js b/lib/services/networkManagement2/lib/lib/models/validateCustomDomainInput.js new file mode 100644 index 0000000000..71bf5ec871 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/validateCustomDomainInput.js @@ -0,0 +1,53 @@ +/* + * 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'; + +/** + * Input of the custom domain to be validated for DNS mapping. + * + */ +class ValidateCustomDomainInput { + /** + * Create a ValidateCustomDomainInput. + * @member {string} hostName The host name of the custom domain. Must be a + * domain name. + */ + constructor() { + } + + /** + * Defines the metadata of ValidateCustomDomainInput + * + * @returns {object} metadata of ValidateCustomDomainInput + * + */ + mapper() { + return { + required: false, + serializedName: 'ValidateCustomDomainInput', + type: { + name: 'Composite', + className: 'ValidateCustomDomainInput', + modelProperties: { + hostName: { + required: true, + serializedName: 'hostName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ValidateCustomDomainInput; diff --git a/lib/services/networkManagement2/lib/lib/models/validateCustomDomainOutput.js b/lib/services/networkManagement2/lib/lib/models/validateCustomDomainOutput.js new file mode 100644 index 0000000000..cf285a32b7 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/validateCustomDomainOutput.js @@ -0,0 +1,73 @@ +/* + * 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'; + +/** + * Output of custom domain validation. + * + */ +class ValidateCustomDomainOutput { + /** + * Create a ValidateCustomDomainOutput. + * @member {boolean} [customDomainValidated] Indicates whether the custom + * domain is valid or not. + * @member {string} [reason] The reason why the custom domain is not valid. + * @member {string} [message] Error message describing why the custom domain + * is not valid. + */ + constructor() { + } + + /** + * Defines the metadata of ValidateCustomDomainOutput + * + * @returns {object} metadata of ValidateCustomDomainOutput + * + */ + mapper() { + return { + required: false, + serializedName: 'ValidateCustomDomainOutput', + type: { + name: 'Composite', + className: 'ValidateCustomDomainOutput', + modelProperties: { + customDomainValidated: { + required: false, + readOnly: true, + serializedName: 'customDomainValidated', + type: { + name: 'Boolean' + } + }, + reason: { + required: false, + readOnly: true, + serializedName: 'reason', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ValidateCustomDomainOutput; diff --git a/lib/services/networkManagement2/lib/lib/models/webApplicationFirewallPolicy.js b/lib/services/networkManagement2/lib/lib/models/webApplicationFirewallPolicy.js new file mode 100644 index 0000000000..934a35cd9b --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/webApplicationFirewallPolicy.js @@ -0,0 +1,147 @@ +/* + * 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 models = require('./index'); + +/** + * Defines web application firewall policy. + * + * @extends models['Resource'] + */ +class WebApplicationFirewallPolicy extends models['Resource'] { + /** + * Create a WebApplicationFirewallPolicy. + * @member {object} [policySettings] Describes policySettings for policy + * @member {string} [policySettings.enabledState] describes if the policy is + * in enabled state or disabled state. Possible values include: 'Disabled', + * 'Enabled' + * @member {string} [policySettings.mode] Describes if it is in detection + * mode or prevention mode at policy level. Possible values include: + * 'Prevention', 'Detection' + * @member {object} [customRules] Describes custom rules inside the policy + * @member {array} [customRules.rules] List of rules + * @member {object} [managedRules] Describes managed rules inside the policy + * @member {array} [managedRules.ruleSets] List of rules + * @member {string} [provisioningState] Provisioning state of the + * WebApplicationFirewallPolicy. + * @member {string} [etag] Gets a unique read-only string that changes + * whenever the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of WebApplicationFirewallPolicy + * + * @returns {object} metadata of WebApplicationFirewallPolicy + * + */ + mapper() { + return { + required: false, + serializedName: 'WebApplicationFirewallPolicy', + type: { + name: 'Composite', + className: 'WebApplicationFirewallPolicy', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + policySettings: { + required: false, + serializedName: 'properties.policySettings', + type: { + name: 'Composite', + className: 'PolicySettings' + } + }, + customRules: { + required: false, + serializedName: 'properties.customRules', + type: { + name: 'Composite', + className: 'CustomRules' + } + }, + managedRules: { + required: false, + serializedName: 'properties.managedRules', + type: { + name: 'Composite', + className: 'ManagedRuleSets' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = WebApplicationFirewallPolicy; diff --git a/lib/services/networkManagement2/lib/lib/models/webApplicationFirewallPolicyListResult.js b/lib/services/networkManagement2/lib/lib/models/webApplicationFirewallPolicyListResult.js new file mode 100644 index 0000000000..3c1e0e9e9d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/webApplicationFirewallPolicyListResult.js @@ -0,0 +1,71 @@ +/* + * 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'; + +/** + * Result of the request to list WebApplicationFirewallPolicies. It contains a + * list of WebApplicationFirewallPolicy objects and a URL link to get the the + * next set of results. + */ +class WebApplicationFirewallPolicyListResult extends Array { + /** + * Create a WebApplicationFirewallPolicyListResult. + * @member {string} [nextLink] URL to get the next set of + * WebApplicationFirewallPolicy objects if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of WebApplicationFirewallPolicyListResult + * + * @returns {object} metadata of WebApplicationFirewallPolicyListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'WebApplicationFirewallPolicyListResult', + type: { + name: 'Composite', + className: 'WebApplicationFirewallPolicyListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'WebApplicationFirewallPolicyElementType', + type: { + name: 'Composite', + className: 'WebApplicationFirewallPolicy' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = WebApplicationFirewallPolicyListResult; diff --git a/lib/services/networkManagement2/lib/lib/operations/backendPools.js b/lib/services/networkManagement2/lib/lib/operations/backendPools.js new file mode 100644 index 0000000000..34d80677b7 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/backendPools.js @@ -0,0 +1,1900 @@ +/* + * 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 of the Backend Pools within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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 BackendPoolListResult} 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 _listByFrontDoor(resourceGroupName, frontDoorName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/backendPools'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + 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['ErrorResponse']().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['BackendPoolListResult']().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 a Backend Pool with the specified Pool name within the specified Front + * Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @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 BackendPool} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, frontDoorName, backendPoolName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (backendPoolName === null || backendPoolName === undefined || typeof backendPoolName.valueOf() !== 'string') { + throw new Error('backendPoolName cannot be null or undefined and it must be of type string.'); + } + if (backendPoolName !== null && backendPoolName !== undefined) { + if (backendPoolName.length > 90) + { + throw new Error('"backendPoolName" should satisfy the constraint - "MaxLength": 90'); + } + if (backendPoolName.length < 1) + { + throw new Error('"backendPoolName" should satisfy the constraint - "MinLength": 1'); + } + if (backendPoolName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"backendPoolName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/backendPools/{backendPoolName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{backendPoolName}', encodeURIComponent(backendPoolName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + 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['ErrorResponse']().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['BackendPool']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates a new Backend Pool with the specified Pool name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} backendPoolParameters Backend Pool properties needed to + * create a new Pool. + * + * @param {array} [backendPoolParameters.backends] The set of backends for this + * pool + * + * @param {object} [backendPoolParameters.loadBalancingSettings] Load balancing + * settings for a backend pool + * + * @param {object} [backendPoolParameters.healthProbeSettings] L7 health probe + * settings for a backend pool + * + * @param {string} [backendPoolParameters.healthProbeSettings.id] Resource ID. + * + * @param {string} [backendPoolParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [backendPoolParameters.name] Resource name. + * + * @param {string} [backendPoolParameters.id] Resource ID. + * + * @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 BackendPool} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BackendPool']().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); + }); + }); +} + + +/** + * Deletes an existing Backend Pool with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, frontDoorName, backendPoolName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, frontDoorName, backendPoolName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Creates a new Backend Pool with the specified Pool name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} backendPoolParameters Backend Pool properties needed to + * create a new Pool. + * + * @param {array} [backendPoolParameters.backends] The set of backends for this + * pool + * + * @param {object} [backendPoolParameters.loadBalancingSettings] Load balancing + * settings for a backend pool + * + * @param {object} [backendPoolParameters.healthProbeSettings] L7 health probe + * settings for a backend pool + * + * @param {string} [backendPoolParameters.healthProbeSettings.id] Resource ID. + * + * @param {string} [backendPoolParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [backendPoolParameters.name] Resource name. + * + * @param {string} [backendPoolParameters.id] Resource ID. + * + * @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 BackendPool} 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 _beginCreateOrUpdate(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (backendPoolName === null || backendPoolName === undefined || typeof backendPoolName.valueOf() !== 'string') { + throw new Error('backendPoolName cannot be null or undefined and it must be of type string.'); + } + if (backendPoolName !== null && backendPoolName !== undefined) { + if (backendPoolName.length > 90) + { + throw new Error('"backendPoolName" should satisfy the constraint - "MaxLength": 90'); + } + if (backendPoolName.length < 1) + { + throw new Error('"backendPoolName" should satisfy the constraint - "MinLength": 1'); + } + if (backendPoolName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"backendPoolName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (backendPoolParameters === null || backendPoolParameters === undefined) { + throw new Error('backendPoolParameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/backendPools/{backendPoolName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{backendPoolName}', encodeURIComponent(backendPoolName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (backendPoolParameters !== null && backendPoolParameters !== undefined) { + let requestModelMapper = new client.models['BackendPool']().mapper(); + requestModel = client.serialize(requestModelMapper, backendPoolParameters, 'backendPoolParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(backendPoolParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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['BackendPool']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BackendPool']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + // Deserialize Response + if (statusCode === 202) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BackendPool']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError2 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError2.request = msRest.stripRequest(httpRequest); + deserializationError2.response = msRest.stripResponse(response); + return callback(deserializationError2); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes an existing Backend Pool with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, frontDoorName, backendPoolName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (backendPoolName === null || backendPoolName === undefined || typeof backendPoolName.valueOf() !== 'string') { + throw new Error('backendPoolName cannot be null or undefined and it must be of type string.'); + } + if (backendPoolName !== null && backendPoolName !== undefined) { + if (backendPoolName.length > 90) + { + throw new Error('"backendPoolName" should satisfy the constraint - "MaxLength": 90'); + } + if (backendPoolName.length < 1) + { + throw new Error('"backendPoolName" should satisfy the constraint - "MinLength": 1'); + } + if (backendPoolName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"backendPoolName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/backendPools/{backendPoolName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{backendPoolName}', encodeURIComponent(backendPoolName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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); + }); +} + +/** + * Lists all of the Backend Pools within a Front Door. + * + * @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 BackendPoolListResult} 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 _listByFrontDoorNext(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) { + 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['ErrorResponse']().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['BackendPoolListResult']().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 BackendPools. */ +class BackendPools { + /** + * Create a BackendPools. + * @param {FrontdoorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByFrontDoor = _listByFrontDoor; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._listByFrontDoorNext = _listByFrontDoorNext; + } + + /** + * Lists all of the Backend Pools within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByFrontDoorWithHttpOperationResponse(resourceGroupName, frontDoorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByFrontDoor(resourceGroupName, frontDoorName, 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 of the Backend Pools within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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 {BackendPoolListResult} - 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 BackendPoolListResult} 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. + */ + listByFrontDoor(resourceGroupName, frontDoorName, 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._listByFrontDoor(resourceGroupName, frontDoorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByFrontDoor(resourceGroupName, frontDoorName, options, optionalCallback); + } + } + + /** + * Gets a Backend Pool with the specified Pool name within the specified Front + * Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, frontDoorName, backendPoolName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, frontDoorName, backendPoolName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a Backend Pool with the specified Pool name within the specified Front + * Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @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 {BackendPool} - 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 BackendPool} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, frontDoorName, backendPoolName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, frontDoorName, backendPoolName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, frontDoorName, backendPoolName, options, optionalCallback); + } + } + + /** + * Creates a new Backend Pool with the specified Pool name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} backendPoolParameters Backend Pool properties needed to + * create a new Pool. + * + * @param {array} [backendPoolParameters.backends] The set of backends for this + * pool + * + * @param {object} [backendPoolParameters.loadBalancingSettings] Load balancing + * settings for a backend pool + * + * @param {object} [backendPoolParameters.healthProbeSettings] L7 health probe + * settings for a backend pool + * + * @param {string} [backendPoolParameters.healthProbeSettings.id] Resource ID. + * + * @param {string} [backendPoolParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [backendPoolParameters.name] Resource name. + * + * @param {string} [backendPoolParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new Backend Pool with the specified Pool name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} backendPoolParameters Backend Pool properties needed to + * create a new Pool. + * + * @param {array} [backendPoolParameters.backends] The set of backends for this + * pool + * + * @param {object} [backendPoolParameters.loadBalancingSettings] Load balancing + * settings for a backend pool + * + * @param {object} [backendPoolParameters.healthProbeSettings] L7 health probe + * settings for a backend pool + * + * @param {string} [backendPoolParameters.healthProbeSettings.id] Resource ID. + * + * @param {string} [backendPoolParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [backendPoolParameters.name] Resource name. + * + * @param {string} [backendPoolParameters.id] Resource ID. + * + * @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 {BackendPool} - 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 BackendPool} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters, options, optionalCallback); + } + } + + /** + * Deletes an existing Backend Pool with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, frontDoorName, backendPoolName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, frontDoorName, backendPoolName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes an existing Backend Pool with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, frontDoorName, backendPoolName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, frontDoorName, backendPoolName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, frontDoorName, backendPoolName, options, optionalCallback); + } + } + + /** + * Creates a new Backend Pool with the specified Pool name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} backendPoolParameters Backend Pool properties needed to + * create a new Pool. + * + * @param {array} [backendPoolParameters.backends] The set of backends for this + * pool + * + * @param {object} [backendPoolParameters.loadBalancingSettings] Load balancing + * settings for a backend pool + * + * @param {object} [backendPoolParameters.healthProbeSettings] L7 health probe + * settings for a backend pool + * + * @param {string} [backendPoolParameters.healthProbeSettings.id] Resource ID. + * + * @param {string} [backendPoolParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [backendPoolParameters.name] Resource name. + * + * @param {string} [backendPoolParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new Backend Pool with the specified Pool name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} backendPoolParameters Backend Pool properties needed to + * create a new Pool. + * + * @param {array} [backendPoolParameters.backends] The set of backends for this + * pool + * + * @param {object} [backendPoolParameters.loadBalancingSettings] Load balancing + * settings for a backend pool + * + * @param {object} [backendPoolParameters.healthProbeSettings] L7 health probe + * settings for a backend pool + * + * @param {string} [backendPoolParameters.healthProbeSettings.id] Resource ID. + * + * @param {string} [backendPoolParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [backendPoolParameters.name] Resource name. + * + * @param {string} [backendPoolParameters.id] Resource ID. + * + * @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 {BackendPool} - 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 BackendPool} 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. + */ + beginCreateOrUpdate(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters, 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._beginCreateOrUpdate(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters, options, optionalCallback); + } + } + + /** + * Deletes an existing Backend Pool with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, frontDoorName, backendPoolName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, frontDoorName, backendPoolName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes an existing Backend Pool with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, frontDoorName, backendPoolName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, frontDoorName, backendPoolName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, frontDoorName, backendPoolName, options, optionalCallback); + } + } + + /** + * Lists all of the Backend Pools within a Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByFrontDoorNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByFrontDoorNext(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 of the Backend Pools within a Front Door. + * + * @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 {BackendPoolListResult} - 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 BackendPoolListResult} 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. + */ + listByFrontDoorNext(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._listByFrontDoorNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByFrontDoorNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = BackendPools; diff --git a/lib/services/networkManagement2/lib/lib/operations/endpoints.js b/lib/services/networkManagement2/lib/lib/operations/endpoints.js new file mode 100644 index 0000000000..90ea2a87d6 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/endpoints.js @@ -0,0 +1,495 @@ +/* + * 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; + + +/** + * Removes a content from Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} contentFilePaths The path to the content to be purged. Path + * can be a full URL, e.g. '/pictures/city.png' which removes a single file, or + * a directory with a wildcard, e.g. '/pictures/*' which removes all folders + * and files in the directory. + * + * @param {array} contentFilePaths.contentPaths The path to the content to be + * purged. Can describe a file path or a wild card directory. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _purgeContent(resourceGroupName, frontDoorName, contentFilePaths, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginPurgeContent(resourceGroupName, frontDoorName, contentFilePaths, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Removes a content from Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} contentFilePaths The path to the content to be purged. Path + * can be a full URL, e.g. '/pictures/city.png' which removes a single file, or + * a directory with a wildcard, e.g. '/pictures/*' which removes all folders + * and files in the directory. + * + * @param {array} contentFilePaths.contentPaths The path to the content to be + * purged. Can describe a file path or a wild card directory. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginPurgeContent(resourceGroupName, frontDoorName, contentFilePaths, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (contentFilePaths === null || contentFilePaths === undefined) { + throw new Error('contentFilePaths cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/purge'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (contentFilePaths !== null && contentFilePaths !== undefined) { + let requestModelMapper = new client.models['PurgeParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, contentFilePaths, 'contentFilePaths'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(contentFilePaths, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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); + }); +} + +/** Class representing a Endpoints. */ +class Endpoints { + /** + * Create a Endpoints. + * @param {FrontdoorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._purgeContent = _purgeContent; + this._beginPurgeContent = _beginPurgeContent; + } + + /** + * Removes a content from Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} contentFilePaths The path to the content to be purged. Path + * can be a full URL, e.g. '/pictures/city.png' which removes a single file, or + * a directory with a wildcard, e.g. '/pictures/*' which removes all folders + * and files in the directory. + * + * @param {array} contentFilePaths.contentPaths The path to the content to be + * purged. Can describe a file path or a wild card directory. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + purgeContentWithHttpOperationResponse(resourceGroupName, frontDoorName, contentFilePaths, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._purgeContent(resourceGroupName, frontDoorName, contentFilePaths, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Removes a content from Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} contentFilePaths The path to the content to be purged. Path + * can be a full URL, e.g. '/pictures/city.png' which removes a single file, or + * a directory with a wildcard, e.g. '/pictures/*' which removes all folders + * and files in the directory. + * + * @param {array} contentFilePaths.contentPaths The path to the content to be + * purged. Can describe a file path or a wild card directory. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + purgeContent(resourceGroupName, frontDoorName, contentFilePaths, 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._purgeContent(resourceGroupName, frontDoorName, contentFilePaths, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._purgeContent(resourceGroupName, frontDoorName, contentFilePaths, options, optionalCallback); + } + } + + /** + * Removes a content from Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} contentFilePaths The path to the content to be purged. Path + * can be a full URL, e.g. '/pictures/city.png' which removes a single file, or + * a directory with a wildcard, e.g. '/pictures/*' which removes all folders + * and files in the directory. + * + * @param {array} contentFilePaths.contentPaths The path to the content to be + * purged. Can describe a file path or a wild card directory. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginPurgeContentWithHttpOperationResponse(resourceGroupName, frontDoorName, contentFilePaths, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginPurgeContent(resourceGroupName, frontDoorName, contentFilePaths, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Removes a content from Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} contentFilePaths The path to the content to be purged. Path + * can be a full URL, e.g. '/pictures/city.png' which removes a single file, or + * a directory with a wildcard, e.g. '/pictures/*' which removes all folders + * and files in the directory. + * + * @param {array} contentFilePaths.contentPaths The path to the content to be + * purged. Can describe a file path or a wild card directory. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginPurgeContent(resourceGroupName, frontDoorName, contentFilePaths, 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._beginPurgeContent(resourceGroupName, frontDoorName, contentFilePaths, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginPurgeContent(resourceGroupName, frontDoorName, contentFilePaths, options, optionalCallback); + } + } + +} + +module.exports = Endpoints; diff --git a/lib/services/networkManagement2/lib/lib/operations/frontDoors.js b/lib/services/networkManagement2/lib/lib/operations/frontDoors.js new file mode 100644 index 0000000000..415c410655 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/frontDoors.js @@ -0,0 +1,2566 @@ +/* + * 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 of the Front Doors within an Azure subscription. + * + * @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 FrontDoorListResult} 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(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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/frontDoors'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + 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['ErrorResponse']().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['FrontDoorListResult']().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 of the Front Doors within a resource group under a subscription. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @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 FrontDoorListResult} 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 _listByResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + 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['ErrorResponse']().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['FrontDoorListResult']().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 a Front Door with the specified Front Door name under the specified + * subscription and resource group. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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 FrontDoor} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, frontDoorName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + 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['ErrorResponse']().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['FrontDoor']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates a new Front Door with a Front Door name under the specified + * subscription and resource group. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} frontDoorParameters Front Door properties needed to create a + * new Front Door. + * + * @param {string} [frontDoorParameters.friendlyName] A friendly name for the + * frontDoor + * + * @param {array} [frontDoorParameters.routingRules] Routing rules associated + * with this Front Door. + * + * @param {array} [frontDoorParameters.loadBalancingSettings] Load balancing + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.healthProbeSettings] Health probe + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.backendPools] Backend pools available to + * routing rules. + * + * @param {array} [frontDoorParameters.frontendEndpoints] Frontend endpoints + * available to routing rules. + * + * @param {string} [frontDoorParameters.enabledState] Operational status of the + * Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. + * Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [frontDoorParameters.resourceState] Resource status of the + * Front Door. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [frontDoorParameters.location] Resource location. + * + * @param {object} [frontDoorParameters.tags] Resource tags. + * + * @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 FrontDoor} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, frontDoorName, frontDoorParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, frontDoorName, frontDoorParameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['FrontDoor']().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); + }); + }); +} + + +/** + * Deletes an existing Front Door with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, frontDoorName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, frontDoorName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Validates the custom domain mapping to ensure it maps to the correct Front + * Door endpoint in DNS. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} customDomainProperties Custom domain to be validated. + * + * @param {string} customDomainProperties.hostName The host name of the custom + * domain. Must be a domain name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ValidateCustomDomainOutput} 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 _validateCustomDomain(resourceGroupName, frontDoorName, customDomainProperties, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (customDomainProperties === null || customDomainProperties === undefined) { + throw new Error('customDomainProperties cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/validateCustomDomain'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (customDomainProperties !== null && customDomainProperties !== undefined) { + let requestModelMapper = new client.models['ValidateCustomDomainInput']().mapper(); + requestModel = client.serialize(requestModelMapper, customDomainProperties, 'customDomainProperties'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(customDomainProperties, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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['ValidateCustomDomainOutput']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates a new Front Door with a Front Door name under the specified + * subscription and resource group. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} frontDoorParameters Front Door properties needed to create a + * new Front Door. + * + * @param {string} [frontDoorParameters.friendlyName] A friendly name for the + * frontDoor + * + * @param {array} [frontDoorParameters.routingRules] Routing rules associated + * with this Front Door. + * + * @param {array} [frontDoorParameters.loadBalancingSettings] Load balancing + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.healthProbeSettings] Health probe + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.backendPools] Backend pools available to + * routing rules. + * + * @param {array} [frontDoorParameters.frontendEndpoints] Frontend endpoints + * available to routing rules. + * + * @param {string} [frontDoorParameters.enabledState] Operational status of the + * Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. + * Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [frontDoorParameters.resourceState] Resource status of the + * Front Door. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [frontDoorParameters.location] Resource location. + * + * @param {object} [frontDoorParameters.tags] Resource tags. + * + * @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 FrontDoor} 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 _beginCreateOrUpdate(resourceGroupName, frontDoorName, frontDoorParameters, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (frontDoorParameters === null || frontDoorParameters === undefined) { + throw new Error('frontDoorParameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (frontDoorParameters !== null && frontDoorParameters !== undefined) { + let requestModelMapper = new client.models['FrontDoor']().mapper(); + requestModel = client.serialize(requestModelMapper, frontDoorParameters, 'frontDoorParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(frontDoorParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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['FrontDoor']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['FrontDoor']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + // Deserialize Response + if (statusCode === 202) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['FrontDoor']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError2 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError2.request = msRest.stripRequest(httpRequest); + deserializationError2.response = msRest.stripResponse(response); + return callback(deserializationError2); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes an existing Front Door with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, frontDoorName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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); + }); +} + +/** + * Lists all of the Front Doors within an Azure subscription. + * + * @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 FrontDoorListResult} 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) { + 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['ErrorResponse']().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['FrontDoorListResult']().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 of the Front Doors within a resource group under a subscription. + * + * @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 FrontDoorListResult} 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 _listByResourceGroupNext(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) { + 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['ErrorResponse']().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['FrontDoorListResult']().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 FrontDoors. */ +class FrontDoors { + /** + * Create a FrontDoors. + * @param {FrontdoorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listByResourceGroup = _listByResourceGroup; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._validateCustomDomain = _validateCustomDomain; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._listNext = _listNext; + this._listByResourceGroupNext = _listByResourceGroupNext; + } + + /** + * Lists all of the Front Doors within an Azure subscription. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(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 of the Front Doors within an Azure subscription. + * + * @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 {FrontDoorListResult} - 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 FrontDoorListResult} 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(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(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Lists all of the Front Doors within a resource group under a subscription. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, 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 of the Front Doors within a resource group under a subscription. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @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 {FrontDoorListResult} - 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 FrontDoorListResult} 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. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * Gets a Front Door with the specified Front Door name under the specified + * subscription and resource group. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, frontDoorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, frontDoorName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a Front Door with the specified Front Door name under the specified + * subscription and resource group. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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 {FrontDoor} - 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 FrontDoor} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, frontDoorName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, frontDoorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, frontDoorName, options, optionalCallback); + } + } + + /** + * Creates a new Front Door with a Front Door name under the specified + * subscription and resource group. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} frontDoorParameters Front Door properties needed to create a + * new Front Door. + * + * @param {string} [frontDoorParameters.friendlyName] A friendly name for the + * frontDoor + * + * @param {array} [frontDoorParameters.routingRules] Routing rules associated + * with this Front Door. + * + * @param {array} [frontDoorParameters.loadBalancingSettings] Load balancing + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.healthProbeSettings] Health probe + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.backendPools] Backend pools available to + * routing rules. + * + * @param {array} [frontDoorParameters.frontendEndpoints] Frontend endpoints + * available to routing rules. + * + * @param {string} [frontDoorParameters.enabledState] Operational status of the + * Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. + * Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [frontDoorParameters.resourceState] Resource status of the + * Front Door. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [frontDoorParameters.location] Resource location. + * + * @param {object} [frontDoorParameters.tags] Resource tags. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, frontDoorName, frontDoorParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, frontDoorName, frontDoorParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new Front Door with a Front Door name under the specified + * subscription and resource group. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} frontDoorParameters Front Door properties needed to create a + * new Front Door. + * + * @param {string} [frontDoorParameters.friendlyName] A friendly name for the + * frontDoor + * + * @param {array} [frontDoorParameters.routingRules] Routing rules associated + * with this Front Door. + * + * @param {array} [frontDoorParameters.loadBalancingSettings] Load balancing + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.healthProbeSettings] Health probe + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.backendPools] Backend pools available to + * routing rules. + * + * @param {array} [frontDoorParameters.frontendEndpoints] Frontend endpoints + * available to routing rules. + * + * @param {string} [frontDoorParameters.enabledState] Operational status of the + * Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. + * Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [frontDoorParameters.resourceState] Resource status of the + * Front Door. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [frontDoorParameters.location] Resource location. + * + * @param {object} [frontDoorParameters.tags] Resource tags. + * + * @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 {FrontDoor} - 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 FrontDoor} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, frontDoorName, frontDoorParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, frontDoorName, frontDoorParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, frontDoorName, frontDoorParameters, options, optionalCallback); + } + } + + /** + * Deletes an existing Front Door with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, frontDoorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, frontDoorName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes an existing Front Door with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, frontDoorName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, frontDoorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, frontDoorName, options, optionalCallback); + } + } + + /** + * Validates the custom domain mapping to ensure it maps to the correct Front + * Door endpoint in DNS. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} customDomainProperties Custom domain to be validated. + * + * @param {string} customDomainProperties.hostName The host name of the custom + * domain. Must be a domain name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + validateCustomDomainWithHttpOperationResponse(resourceGroupName, frontDoorName, customDomainProperties, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._validateCustomDomain(resourceGroupName, frontDoorName, customDomainProperties, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Validates the custom domain mapping to ensure it maps to the correct Front + * Door endpoint in DNS. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} customDomainProperties Custom domain to be validated. + * + * @param {string} customDomainProperties.hostName The host name of the custom + * domain. Must be a domain name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ValidateCustomDomainOutput} - 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 ValidateCustomDomainOutput} 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. + */ + validateCustomDomain(resourceGroupName, frontDoorName, customDomainProperties, 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._validateCustomDomain(resourceGroupName, frontDoorName, customDomainProperties, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._validateCustomDomain(resourceGroupName, frontDoorName, customDomainProperties, options, optionalCallback); + } + } + + /** + * Creates a new Front Door with a Front Door name under the specified + * subscription and resource group. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} frontDoorParameters Front Door properties needed to create a + * new Front Door. + * + * @param {string} [frontDoorParameters.friendlyName] A friendly name for the + * frontDoor + * + * @param {array} [frontDoorParameters.routingRules] Routing rules associated + * with this Front Door. + * + * @param {array} [frontDoorParameters.loadBalancingSettings] Load balancing + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.healthProbeSettings] Health probe + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.backendPools] Backend pools available to + * routing rules. + * + * @param {array} [frontDoorParameters.frontendEndpoints] Frontend endpoints + * available to routing rules. + * + * @param {string} [frontDoorParameters.enabledState] Operational status of the + * Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. + * Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [frontDoorParameters.resourceState] Resource status of the + * Front Door. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [frontDoorParameters.location] Resource location. + * + * @param {object} [frontDoorParameters.tags] Resource tags. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, frontDoorName, frontDoorParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, frontDoorName, frontDoorParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new Front Door with a Front Door name under the specified + * subscription and resource group. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} frontDoorParameters Front Door properties needed to create a + * new Front Door. + * + * @param {string} [frontDoorParameters.friendlyName] A friendly name for the + * frontDoor + * + * @param {array} [frontDoorParameters.routingRules] Routing rules associated + * with this Front Door. + * + * @param {array} [frontDoorParameters.loadBalancingSettings] Load balancing + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.healthProbeSettings] Health probe + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.backendPools] Backend pools available to + * routing rules. + * + * @param {array} [frontDoorParameters.frontendEndpoints] Frontend endpoints + * available to routing rules. + * + * @param {string} [frontDoorParameters.enabledState] Operational status of the + * Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. + * Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [frontDoorParameters.resourceState] Resource status of the + * Front Door. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [frontDoorParameters.location] Resource location. + * + * @param {object} [frontDoorParameters.tags] Resource tags. + * + * @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 {FrontDoor} - 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 FrontDoor} 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. + */ + beginCreateOrUpdate(resourceGroupName, frontDoorName, frontDoorParameters, 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._beginCreateOrUpdate(resourceGroupName, frontDoorName, frontDoorParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, frontDoorName, frontDoorParameters, options, optionalCallback); + } + } + + /** + * Deletes an existing Front Door with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, frontDoorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, frontDoorName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes an existing Front Door with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, frontDoorName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, frontDoorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, frontDoorName, options, optionalCallback); + } + } + + /** + * Lists all of the Front Doors within an Azure subscription. + * + * @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} - 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 of the Front Doors within an Azure subscription. + * + * @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 {FrontDoorListResult} - 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 FrontDoorListResult} 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); + } + } + + /** + * Lists all of the Front Doors within a resource group under a subscription. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(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 of the Front Doors within a resource group under a subscription. + * + * @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 {FrontDoorListResult} - 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 FrontDoorListResult} 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. + */ + listByResourceGroupNext(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._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = FrontDoors; diff --git a/lib/services/networkManagement2/lib/lib/operations/frontendEndpoints.js b/lib/services/networkManagement2/lib/lib/operations/frontendEndpoints.js new file mode 100644 index 0000000000..20779f395c --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/frontendEndpoints.js @@ -0,0 +1,2999 @@ +/* + * 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 of the frontend endpoints within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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 FrontendEndpointsListResult} 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 _listByFrontDoor(resourceGroupName, frontDoorName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + 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['ErrorResponse']().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['FrontendEndpointsListResult']().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 a Frontend endpoint with the specified name within the specified Front + * Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @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 FrontendEndpoint} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, frontDoorName, frontendEndpointName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (frontendEndpointName === null || frontendEndpointName === undefined || typeof frontendEndpointName.valueOf() !== 'string') { + throw new Error('frontendEndpointName cannot be null or undefined and it must be of type string.'); + } + if (frontendEndpointName !== null && frontendEndpointName !== undefined) { + if (frontendEndpointName.length > 255) + { + throw new Error('"frontendEndpointName" should satisfy the constraint - "MaxLength": 255'); + } + if (frontendEndpointName.length < 1) + { + throw new Error('"frontendEndpointName" should satisfy the constraint - "MinLength": 1'); + } + if (frontendEndpointName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"frontendEndpointName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/provider/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{frontendEndpointName}', encodeURIComponent(frontendEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + 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['ErrorResponse']().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['FrontendEndpoint']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates a new frontend endpoint with the specified host name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} frontendEndpointParameters Frontend endpoint properties + * needed to create a new endpoint. + * + * @param {string} [frontendEndpointParameters.hostName] The host name of the + * frontendEndpoint. Must be a domain name. + * + * @param {string} [frontendEndpointParameters.sessionAffinityEnabledState] + * Whether to allow session affinity on this host. Valid options are 'Enabled' + * or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + * + * @param {number} [frontendEndpointParameters.sessionAffinityTtlSeconds] + * UNUSED. This field will be ignored. The TTL to use in seconds for session + * affinity, if applicable. + * + * @param {object} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink] Defines the + * Web Application Firewall policy for each host (if applicable) + * + * @param {string} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink.id] Resource + * ID. + * + * @param {string} [frontendEndpointParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [frontendEndpointParameters.name] Resource name. + * + * @param {string} [frontendEndpointParameters.id] Resource ID. + * + * @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 FrontendEndpoint} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['FrontendEndpoint']().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); + }); + }); +} + + +/** + * Deletes an existing frontend endpoint with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, frontDoorName, frontendEndpointName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, frontDoorName, frontendEndpointName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Enables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} customHttpsConfiguration The configuration specifying how to + * enable HTTPS + * + * @param {string} [customHttpsConfiguration.certificateSource] Defines the + * source of the SSL certificate. Possible values include: 'AzureKeyVault', + * 'FrontDoor' + * + * @param {string} [customHttpsConfiguration.protocolType] Defines the TLS + * extension protocol that is used for secure delivery. Possible values + * include: 'ServerNameIndication' + * + * @param {object} [customHttpsConfiguration.vault] The Key Vault containing + * the SSL certificate + * + * @param {string} [customHttpsConfiguration.vault.id] Resource ID. + * + * @param {string} [customHttpsConfiguration.secretName] The name of the Key + * Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.secretVersion] The version of the + * Key Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.certificateType] Defines the type + * of the certificate used for secure connections to a frontendEndpoint. + * Possible values include: 'Dedicated' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _enableHttps(resourceGroupName, frontDoorName, frontendEndpointName, customHttpsConfiguration, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginEnableHttps(resourceGroupName, frontDoorName, frontendEndpointName, customHttpsConfiguration, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Disables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _disableHttps(resourceGroupName, frontDoorName, frontendEndpointName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDisableHttps(resourceGroupName, frontDoorName, frontendEndpointName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Creates a new frontend endpoint with the specified host name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} frontendEndpointParameters Frontend endpoint properties + * needed to create a new endpoint. + * + * @param {string} [frontendEndpointParameters.hostName] The host name of the + * frontendEndpoint. Must be a domain name. + * + * @param {string} [frontendEndpointParameters.sessionAffinityEnabledState] + * Whether to allow session affinity on this host. Valid options are 'Enabled' + * or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + * + * @param {number} [frontendEndpointParameters.sessionAffinityTtlSeconds] + * UNUSED. This field will be ignored. The TTL to use in seconds for session + * affinity, if applicable. + * + * @param {object} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink] Defines the + * Web Application Firewall policy for each host (if applicable) + * + * @param {string} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink.id] Resource + * ID. + * + * @param {string} [frontendEndpointParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [frontendEndpointParameters.name] Resource name. + * + * @param {string} [frontendEndpointParameters.id] Resource ID. + * + * @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 FrontendEndpoint} 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 _beginCreateOrUpdate(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (frontendEndpointName === null || frontendEndpointName === undefined || typeof frontendEndpointName.valueOf() !== 'string') { + throw new Error('frontendEndpointName cannot be null or undefined and it must be of type string.'); + } + if (frontendEndpointName !== null && frontendEndpointName !== undefined) { + if (frontendEndpointName.length > 255) + { + throw new Error('"frontendEndpointName" should satisfy the constraint - "MaxLength": 255'); + } + if (frontendEndpointName.length < 1) + { + throw new Error('"frontendEndpointName" should satisfy the constraint - "MinLength": 1'); + } + if (frontendEndpointName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"frontendEndpointName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (frontendEndpointParameters === null || frontendEndpointParameters === undefined) { + throw new Error('frontendEndpointParameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/provider/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{frontendEndpointName}', encodeURIComponent(frontendEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (frontendEndpointParameters !== null && frontendEndpointParameters !== undefined) { + let requestModelMapper = new client.models['FrontendEndpoint']().mapper(); + requestModel = client.serialize(requestModelMapper, frontendEndpointParameters, 'frontendEndpointParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(frontendEndpointParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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['FrontendEndpoint']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['FrontendEndpoint']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + // Deserialize Response + if (statusCode === 202) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['FrontendEndpoint']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError2 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError2.request = msRest.stripRequest(httpRequest); + deserializationError2.response = msRest.stripResponse(response); + return callback(deserializationError2); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes an existing frontend endpoint with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, frontDoorName, frontendEndpointName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (frontendEndpointName === null || frontendEndpointName === undefined || typeof frontendEndpointName.valueOf() !== 'string') { + throw new Error('frontendEndpointName cannot be null or undefined and it must be of type string.'); + } + if (frontendEndpointName !== null && frontendEndpointName !== undefined) { + if (frontendEndpointName.length > 255) + { + throw new Error('"frontendEndpointName" should satisfy the constraint - "MaxLength": 255'); + } + if (frontendEndpointName.length < 1) + { + throw new Error('"frontendEndpointName" should satisfy the constraint - "MinLength": 1'); + } + if (frontendEndpointName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"frontendEndpointName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/provider/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{frontendEndpointName}', encodeURIComponent(frontendEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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); + }); +} + +/** + * Enables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} customHttpsConfiguration The configuration specifying how to + * enable HTTPS + * + * @param {string} [customHttpsConfiguration.certificateSource] Defines the + * source of the SSL certificate. Possible values include: 'AzureKeyVault', + * 'FrontDoor' + * + * @param {string} [customHttpsConfiguration.protocolType] Defines the TLS + * extension protocol that is used for secure delivery. Possible values + * include: 'ServerNameIndication' + * + * @param {object} [customHttpsConfiguration.vault] The Key Vault containing + * the SSL certificate + * + * @param {string} [customHttpsConfiguration.vault.id] Resource ID. + * + * @param {string} [customHttpsConfiguration.secretName] The name of the Key + * Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.secretVersion] The version of the + * Key Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.certificateType] Defines the type + * of the certificate used for secure connections to a frontendEndpoint. + * Possible values include: 'Dedicated' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginEnableHttps(resourceGroupName, frontDoorName, frontendEndpointName, customHttpsConfiguration, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (frontendEndpointName === null || frontendEndpointName === undefined || typeof frontendEndpointName.valueOf() !== 'string') { + throw new Error('frontendEndpointName cannot be null or undefined and it must be of type string.'); + } + if (frontendEndpointName !== null && frontendEndpointName !== undefined) { + if (frontendEndpointName.length > 255) + { + throw new Error('"frontendEndpointName" should satisfy the constraint - "MaxLength": 255'); + } + if (frontendEndpointName.length < 1) + { + throw new Error('"frontendEndpointName" should satisfy the constraint - "MinLength": 1'); + } + if (frontendEndpointName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"frontendEndpointName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (customHttpsConfiguration === null || customHttpsConfiguration === undefined) { + throw new Error('customHttpsConfiguration cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/provider/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/enableHttps'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{frontendEndpointName}', encodeURIComponent(frontendEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (customHttpsConfiguration !== null && customHttpsConfiguration !== undefined) { + let requestModelMapper = new client.models['CustomHttpsConfiguration']().mapper(); + requestModel = client.serialize(requestModelMapper, customHttpsConfiguration, 'customHttpsConfiguration'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(customHttpsConfiguration, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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); + }); +} + +/** + * Disables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDisableHttps(resourceGroupName, frontDoorName, frontendEndpointName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (frontendEndpointName === null || frontendEndpointName === undefined || typeof frontendEndpointName.valueOf() !== 'string') { + throw new Error('frontendEndpointName cannot be null or undefined and it must be of type string.'); + } + if (frontendEndpointName !== null && frontendEndpointName !== undefined) { + if (frontendEndpointName.length > 255) + { + throw new Error('"frontendEndpointName" should satisfy the constraint - "MaxLength": 255'); + } + if (frontendEndpointName.length < 1) + { + throw new Error('"frontendEndpointName" should satisfy the constraint - "MinLength": 1'); + } + if (frontendEndpointName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"frontendEndpointName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/provider/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/disableHttps'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{frontendEndpointName}', encodeURIComponent(frontendEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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); + }); +} + +/** + * Lists all of the frontend endpoints within a Front Door. + * + * @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 FrontendEndpointsListResult} 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 _listByFrontDoorNext(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) { + 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['ErrorResponse']().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['FrontendEndpointsListResult']().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 FrontendEndpoints. */ +class FrontendEndpoints { + /** + * Create a FrontendEndpoints. + * @param {FrontdoorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByFrontDoor = _listByFrontDoor; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._enableHttps = _enableHttps; + this._disableHttps = _disableHttps; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginEnableHttps = _beginEnableHttps; + this._beginDisableHttps = _beginDisableHttps; + this._listByFrontDoorNext = _listByFrontDoorNext; + } + + /** + * Lists all of the frontend endpoints within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByFrontDoorWithHttpOperationResponse(resourceGroupName, frontDoorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByFrontDoor(resourceGroupName, frontDoorName, 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 of the frontend endpoints within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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 {FrontendEndpointsListResult} - 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 FrontendEndpointsListResult} 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. + */ + listByFrontDoor(resourceGroupName, frontDoorName, 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._listByFrontDoor(resourceGroupName, frontDoorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByFrontDoor(resourceGroupName, frontDoorName, options, optionalCallback); + } + } + + /** + * Gets a Frontend endpoint with the specified name within the specified Front + * Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, frontDoorName, frontendEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, frontDoorName, frontendEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a Frontend endpoint with the specified name within the specified Front + * Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @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 {FrontendEndpoint} - 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 FrontendEndpoint} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, frontDoorName, frontendEndpointName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, frontDoorName, frontendEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, frontDoorName, frontendEndpointName, options, optionalCallback); + } + } + + /** + * Creates a new frontend endpoint with the specified host name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} frontendEndpointParameters Frontend endpoint properties + * needed to create a new endpoint. + * + * @param {string} [frontendEndpointParameters.hostName] The host name of the + * frontendEndpoint. Must be a domain name. + * + * @param {string} [frontendEndpointParameters.sessionAffinityEnabledState] + * Whether to allow session affinity on this host. Valid options are 'Enabled' + * or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + * + * @param {number} [frontendEndpointParameters.sessionAffinityTtlSeconds] + * UNUSED. This field will be ignored. The TTL to use in seconds for session + * affinity, if applicable. + * + * @param {object} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink] Defines the + * Web Application Firewall policy for each host (if applicable) + * + * @param {string} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink.id] Resource + * ID. + * + * @param {string} [frontendEndpointParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [frontendEndpointParameters.name] Resource name. + * + * @param {string} [frontendEndpointParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new frontend endpoint with the specified host name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} frontendEndpointParameters Frontend endpoint properties + * needed to create a new endpoint. + * + * @param {string} [frontendEndpointParameters.hostName] The host name of the + * frontendEndpoint. Must be a domain name. + * + * @param {string} [frontendEndpointParameters.sessionAffinityEnabledState] + * Whether to allow session affinity on this host. Valid options are 'Enabled' + * or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + * + * @param {number} [frontendEndpointParameters.sessionAffinityTtlSeconds] + * UNUSED. This field will be ignored. The TTL to use in seconds for session + * affinity, if applicable. + * + * @param {object} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink] Defines the + * Web Application Firewall policy for each host (if applicable) + * + * @param {string} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink.id] Resource + * ID. + * + * @param {string} [frontendEndpointParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [frontendEndpointParameters.name] Resource name. + * + * @param {string} [frontendEndpointParameters.id] Resource ID. + * + * @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 {FrontendEndpoint} - 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 FrontendEndpoint} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters, options, optionalCallback); + } + } + + /** + * Deletes an existing frontend endpoint with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, frontDoorName, frontendEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, frontDoorName, frontendEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes an existing frontend endpoint with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, frontDoorName, frontendEndpointName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, frontDoorName, frontendEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, frontDoorName, frontendEndpointName, options, optionalCallback); + } + } + + /** + * Enables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} customHttpsConfiguration The configuration specifying how to + * enable HTTPS + * + * @param {string} [customHttpsConfiguration.certificateSource] Defines the + * source of the SSL certificate. Possible values include: 'AzureKeyVault', + * 'FrontDoor' + * + * @param {string} [customHttpsConfiguration.protocolType] Defines the TLS + * extension protocol that is used for secure delivery. Possible values + * include: 'ServerNameIndication' + * + * @param {object} [customHttpsConfiguration.vault] The Key Vault containing + * the SSL certificate + * + * @param {string} [customHttpsConfiguration.vault.id] Resource ID. + * + * @param {string} [customHttpsConfiguration.secretName] The name of the Key + * Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.secretVersion] The version of the + * Key Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.certificateType] Defines the type + * of the certificate used for secure connections to a frontendEndpoint. + * Possible values include: 'Dedicated' + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + enableHttpsWithHttpOperationResponse(resourceGroupName, frontDoorName, frontendEndpointName, customHttpsConfiguration, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._enableHttps(resourceGroupName, frontDoorName, frontendEndpointName, customHttpsConfiguration, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Enables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} customHttpsConfiguration The configuration specifying how to + * enable HTTPS + * + * @param {string} [customHttpsConfiguration.certificateSource] Defines the + * source of the SSL certificate. Possible values include: 'AzureKeyVault', + * 'FrontDoor' + * + * @param {string} [customHttpsConfiguration.protocolType] Defines the TLS + * extension protocol that is used for secure delivery. Possible values + * include: 'ServerNameIndication' + * + * @param {object} [customHttpsConfiguration.vault] The Key Vault containing + * the SSL certificate + * + * @param {string} [customHttpsConfiguration.vault.id] Resource ID. + * + * @param {string} [customHttpsConfiguration.secretName] The name of the Key + * Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.secretVersion] The version of the + * Key Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.certificateType] Defines the type + * of the certificate used for secure connections to a frontendEndpoint. + * Possible values include: 'Dedicated' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + enableHttps(resourceGroupName, frontDoorName, frontendEndpointName, customHttpsConfiguration, 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._enableHttps(resourceGroupName, frontDoorName, frontendEndpointName, customHttpsConfiguration, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._enableHttps(resourceGroupName, frontDoorName, frontendEndpointName, customHttpsConfiguration, options, optionalCallback); + } + } + + /** + * Disables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + disableHttpsWithHttpOperationResponse(resourceGroupName, frontDoorName, frontendEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._disableHttps(resourceGroupName, frontDoorName, frontendEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Disables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + disableHttps(resourceGroupName, frontDoorName, frontendEndpointName, 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._disableHttps(resourceGroupName, frontDoorName, frontendEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._disableHttps(resourceGroupName, frontDoorName, frontendEndpointName, options, optionalCallback); + } + } + + /** + * Creates a new frontend endpoint with the specified host name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} frontendEndpointParameters Frontend endpoint properties + * needed to create a new endpoint. + * + * @param {string} [frontendEndpointParameters.hostName] The host name of the + * frontendEndpoint. Must be a domain name. + * + * @param {string} [frontendEndpointParameters.sessionAffinityEnabledState] + * Whether to allow session affinity on this host. Valid options are 'Enabled' + * or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + * + * @param {number} [frontendEndpointParameters.sessionAffinityTtlSeconds] + * UNUSED. This field will be ignored. The TTL to use in seconds for session + * affinity, if applicable. + * + * @param {object} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink] Defines the + * Web Application Firewall policy for each host (if applicable) + * + * @param {string} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink.id] Resource + * ID. + * + * @param {string} [frontendEndpointParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [frontendEndpointParameters.name] Resource name. + * + * @param {string} [frontendEndpointParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new frontend endpoint with the specified host name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} frontendEndpointParameters Frontend endpoint properties + * needed to create a new endpoint. + * + * @param {string} [frontendEndpointParameters.hostName] The host name of the + * frontendEndpoint. Must be a domain name. + * + * @param {string} [frontendEndpointParameters.sessionAffinityEnabledState] + * Whether to allow session affinity on this host. Valid options are 'Enabled' + * or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + * + * @param {number} [frontendEndpointParameters.sessionAffinityTtlSeconds] + * UNUSED. This field will be ignored. The TTL to use in seconds for session + * affinity, if applicable. + * + * @param {object} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink] Defines the + * Web Application Firewall policy for each host (if applicable) + * + * @param {string} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink.id] Resource + * ID. + * + * @param {string} [frontendEndpointParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [frontendEndpointParameters.name] Resource name. + * + * @param {string} [frontendEndpointParameters.id] Resource ID. + * + * @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 {FrontendEndpoint} - 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 FrontendEndpoint} 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. + */ + beginCreateOrUpdate(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters, 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._beginCreateOrUpdate(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters, options, optionalCallback); + } + } + + /** + * Deletes an existing frontend endpoint with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, frontDoorName, frontendEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, frontDoorName, frontendEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes an existing frontend endpoint with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, frontDoorName, frontendEndpointName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, frontDoorName, frontendEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, frontDoorName, frontendEndpointName, options, optionalCallback); + } + } + + /** + * Enables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} customHttpsConfiguration The configuration specifying how to + * enable HTTPS + * + * @param {string} [customHttpsConfiguration.certificateSource] Defines the + * source of the SSL certificate. Possible values include: 'AzureKeyVault', + * 'FrontDoor' + * + * @param {string} [customHttpsConfiguration.protocolType] Defines the TLS + * extension protocol that is used for secure delivery. Possible values + * include: 'ServerNameIndication' + * + * @param {object} [customHttpsConfiguration.vault] The Key Vault containing + * the SSL certificate + * + * @param {string} [customHttpsConfiguration.vault.id] Resource ID. + * + * @param {string} [customHttpsConfiguration.secretName] The name of the Key + * Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.secretVersion] The version of the + * Key Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.certificateType] Defines the type + * of the certificate used for secure connections to a frontendEndpoint. + * Possible values include: 'Dedicated' + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginEnableHttpsWithHttpOperationResponse(resourceGroupName, frontDoorName, frontendEndpointName, customHttpsConfiguration, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginEnableHttps(resourceGroupName, frontDoorName, frontendEndpointName, customHttpsConfiguration, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Enables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} customHttpsConfiguration The configuration specifying how to + * enable HTTPS + * + * @param {string} [customHttpsConfiguration.certificateSource] Defines the + * source of the SSL certificate. Possible values include: 'AzureKeyVault', + * 'FrontDoor' + * + * @param {string} [customHttpsConfiguration.protocolType] Defines the TLS + * extension protocol that is used for secure delivery. Possible values + * include: 'ServerNameIndication' + * + * @param {object} [customHttpsConfiguration.vault] The Key Vault containing + * the SSL certificate + * + * @param {string} [customHttpsConfiguration.vault.id] Resource ID. + * + * @param {string} [customHttpsConfiguration.secretName] The name of the Key + * Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.secretVersion] The version of the + * Key Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.certificateType] Defines the type + * of the certificate used for secure connections to a frontendEndpoint. + * Possible values include: 'Dedicated' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginEnableHttps(resourceGroupName, frontDoorName, frontendEndpointName, customHttpsConfiguration, 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._beginEnableHttps(resourceGroupName, frontDoorName, frontendEndpointName, customHttpsConfiguration, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginEnableHttps(resourceGroupName, frontDoorName, frontendEndpointName, customHttpsConfiguration, options, optionalCallback); + } + } + + /** + * Disables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDisableHttpsWithHttpOperationResponse(resourceGroupName, frontDoorName, frontendEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDisableHttps(resourceGroupName, frontDoorName, frontendEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Disables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDisableHttps(resourceGroupName, frontDoorName, frontendEndpointName, 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._beginDisableHttps(resourceGroupName, frontDoorName, frontendEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDisableHttps(resourceGroupName, frontDoorName, frontendEndpointName, options, optionalCallback); + } + } + + /** + * Lists all of the frontend endpoints within a Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByFrontDoorNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByFrontDoorNext(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 of the frontend endpoints within a Front Door. + * + * @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 {FrontendEndpointsListResult} - 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 FrontendEndpointsListResult} 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. + */ + listByFrontDoorNext(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._listByFrontDoorNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByFrontDoorNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = FrontendEndpoints; diff --git a/lib/services/networkManagement2/lib/lib/operations/healthProbeSettings.js b/lib/services/networkManagement2/lib/lib/operations/healthProbeSettings.js new file mode 100644 index 0000000000..2976abe5f8 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/healthProbeSettings.js @@ -0,0 +1,1898 @@ +/* + * 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 of the HealthProbeSettings within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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 HealthProbeSettingsListResult} 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 _listByFrontDoor(resourceGroupName, frontDoorName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/healthProbeSettings'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + 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['ErrorResponse']().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['HealthProbeSettingsListResult']().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 a HealthProbeSettings with the specified Rule name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @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 HealthProbeSettingsModel} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, frontDoorName, healthProbeSettingsName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (healthProbeSettingsName === null || healthProbeSettingsName === undefined || typeof healthProbeSettingsName.valueOf() !== 'string') { + throw new Error('healthProbeSettingsName cannot be null or undefined and it must be of type string.'); + } + if (healthProbeSettingsName !== null && healthProbeSettingsName !== undefined) { + if (healthProbeSettingsName.length > 90) + { + throw new Error('"healthProbeSettingsName" should satisfy the constraint - "MaxLength": 90'); + } + if (healthProbeSettingsName.length < 1) + { + throw new Error('"healthProbeSettingsName" should satisfy the constraint - "MinLength": 1'); + } + if (healthProbeSettingsName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"healthProbeSettingsName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/healthProbeSettings/{healthProbeSettingsName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{healthProbeSettingsName}', encodeURIComponent(healthProbeSettingsName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + 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['ErrorResponse']().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['HealthProbeSettingsModel']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates a new HealthProbeSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} healthProbeSettingsParameters HealthProbeSettings properties + * needed to create a new Front Door. + * + * @param {string} [healthProbeSettingsParameters.path] The path to use for the + * health probe. Default is / + * + * @param {string} [healthProbeSettingsParameters.protocol] Protocol scheme to + * use for this probe. Possible values include: 'Http', 'Https' + * + * @param {number} [healthProbeSettingsParameters.intervalInSeconds] The number + * of seconds between health probes. + * + * @param {string} [healthProbeSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [healthProbeSettingsParameters.name] Resource name. + * + * @param {string} [healthProbeSettingsParameters.id] Resource ID. + * + * @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 HealthProbeSettingsModel} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['HealthProbeSettingsModel']().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); + }); + }); +} + + +/** + * Deletes an existing HealthProbeSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, frontDoorName, healthProbeSettingsName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, frontDoorName, healthProbeSettingsName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Creates a new HealthProbeSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} healthProbeSettingsParameters HealthProbeSettings properties + * needed to create a new Front Door. + * + * @param {string} [healthProbeSettingsParameters.path] The path to use for the + * health probe. Default is / + * + * @param {string} [healthProbeSettingsParameters.protocol] Protocol scheme to + * use for this probe. Possible values include: 'Http', 'Https' + * + * @param {number} [healthProbeSettingsParameters.intervalInSeconds] The number + * of seconds between health probes. + * + * @param {string} [healthProbeSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [healthProbeSettingsParameters.name] Resource name. + * + * @param {string} [healthProbeSettingsParameters.id] Resource ID. + * + * @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 HealthProbeSettingsModel} 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 _beginCreateOrUpdate(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (healthProbeSettingsName === null || healthProbeSettingsName === undefined || typeof healthProbeSettingsName.valueOf() !== 'string') { + throw new Error('healthProbeSettingsName cannot be null or undefined and it must be of type string.'); + } + if (healthProbeSettingsName !== null && healthProbeSettingsName !== undefined) { + if (healthProbeSettingsName.length > 90) + { + throw new Error('"healthProbeSettingsName" should satisfy the constraint - "MaxLength": 90'); + } + if (healthProbeSettingsName.length < 1) + { + throw new Error('"healthProbeSettingsName" should satisfy the constraint - "MinLength": 1'); + } + if (healthProbeSettingsName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"healthProbeSettingsName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (healthProbeSettingsParameters === null || healthProbeSettingsParameters === undefined) { + throw new Error('healthProbeSettingsParameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/healthProbeSettings/{healthProbeSettingsName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{healthProbeSettingsName}', encodeURIComponent(healthProbeSettingsName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (healthProbeSettingsParameters !== null && healthProbeSettingsParameters !== undefined) { + let requestModelMapper = new client.models['HealthProbeSettingsModel']().mapper(); + requestModel = client.serialize(requestModelMapper, healthProbeSettingsParameters, 'healthProbeSettingsParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(healthProbeSettingsParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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['HealthProbeSettingsModel']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['HealthProbeSettingsModel']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + // Deserialize Response + if (statusCode === 202) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['HealthProbeSettingsModel']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError2 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError2.request = msRest.stripRequest(httpRequest); + deserializationError2.response = msRest.stripResponse(response); + return callback(deserializationError2); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes an existing HealthProbeSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, frontDoorName, healthProbeSettingsName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (healthProbeSettingsName === null || healthProbeSettingsName === undefined || typeof healthProbeSettingsName.valueOf() !== 'string') { + throw new Error('healthProbeSettingsName cannot be null or undefined and it must be of type string.'); + } + if (healthProbeSettingsName !== null && healthProbeSettingsName !== undefined) { + if (healthProbeSettingsName.length > 90) + { + throw new Error('"healthProbeSettingsName" should satisfy the constraint - "MaxLength": 90'); + } + if (healthProbeSettingsName.length < 1) + { + throw new Error('"healthProbeSettingsName" should satisfy the constraint - "MinLength": 1'); + } + if (healthProbeSettingsName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"healthProbeSettingsName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/healthProbeSettings/{healthProbeSettingsName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{healthProbeSettingsName}', encodeURIComponent(healthProbeSettingsName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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); + }); +} + +/** + * Lists all of the HealthProbeSettings within a Front Door. + * + * @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 HealthProbeSettingsListResult} 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 _listByFrontDoorNext(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) { + 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['ErrorResponse']().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['HealthProbeSettingsListResult']().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 HealthProbeSettings. */ +class HealthProbeSettings { + /** + * Create a HealthProbeSettings. + * @param {FrontdoorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByFrontDoor = _listByFrontDoor; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._listByFrontDoorNext = _listByFrontDoorNext; + } + + /** + * Lists all of the HealthProbeSettings within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByFrontDoorWithHttpOperationResponse(resourceGroupName, frontDoorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByFrontDoor(resourceGroupName, frontDoorName, 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 of the HealthProbeSettings within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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 {HealthProbeSettingsListResult} - 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 HealthProbeSettingsListResult} 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. + */ + listByFrontDoor(resourceGroupName, frontDoorName, 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._listByFrontDoor(resourceGroupName, frontDoorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByFrontDoor(resourceGroupName, frontDoorName, options, optionalCallback); + } + } + + /** + * Gets a HealthProbeSettings with the specified Rule name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, frontDoorName, healthProbeSettingsName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, frontDoorName, healthProbeSettingsName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a HealthProbeSettings with the specified Rule name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @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 {HealthProbeSettingsModel} - 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 HealthProbeSettingsModel} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, frontDoorName, healthProbeSettingsName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, frontDoorName, healthProbeSettingsName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, frontDoorName, healthProbeSettingsName, options, optionalCallback); + } + } + + /** + * Creates a new HealthProbeSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} healthProbeSettingsParameters HealthProbeSettings properties + * needed to create a new Front Door. + * + * @param {string} [healthProbeSettingsParameters.path] The path to use for the + * health probe. Default is / + * + * @param {string} [healthProbeSettingsParameters.protocol] Protocol scheme to + * use for this probe. Possible values include: 'Http', 'Https' + * + * @param {number} [healthProbeSettingsParameters.intervalInSeconds] The number + * of seconds between health probes. + * + * @param {string} [healthProbeSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [healthProbeSettingsParameters.name] Resource name. + * + * @param {string} [healthProbeSettingsParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new HealthProbeSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} healthProbeSettingsParameters HealthProbeSettings properties + * needed to create a new Front Door. + * + * @param {string} [healthProbeSettingsParameters.path] The path to use for the + * health probe. Default is / + * + * @param {string} [healthProbeSettingsParameters.protocol] Protocol scheme to + * use for this probe. Possible values include: 'Http', 'Https' + * + * @param {number} [healthProbeSettingsParameters.intervalInSeconds] The number + * of seconds between health probes. + * + * @param {string} [healthProbeSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [healthProbeSettingsParameters.name] Resource name. + * + * @param {string} [healthProbeSettingsParameters.id] Resource ID. + * + * @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 {HealthProbeSettingsModel} - 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 HealthProbeSettingsModel} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters, options, optionalCallback); + } + } + + /** + * Deletes an existing HealthProbeSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, frontDoorName, healthProbeSettingsName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, frontDoorName, healthProbeSettingsName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes an existing HealthProbeSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, frontDoorName, healthProbeSettingsName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, frontDoorName, healthProbeSettingsName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, frontDoorName, healthProbeSettingsName, options, optionalCallback); + } + } + + /** + * Creates a new HealthProbeSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} healthProbeSettingsParameters HealthProbeSettings properties + * needed to create a new Front Door. + * + * @param {string} [healthProbeSettingsParameters.path] The path to use for the + * health probe. Default is / + * + * @param {string} [healthProbeSettingsParameters.protocol] Protocol scheme to + * use for this probe. Possible values include: 'Http', 'Https' + * + * @param {number} [healthProbeSettingsParameters.intervalInSeconds] The number + * of seconds between health probes. + * + * @param {string} [healthProbeSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [healthProbeSettingsParameters.name] Resource name. + * + * @param {string} [healthProbeSettingsParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new HealthProbeSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} healthProbeSettingsParameters HealthProbeSettings properties + * needed to create a new Front Door. + * + * @param {string} [healthProbeSettingsParameters.path] The path to use for the + * health probe. Default is / + * + * @param {string} [healthProbeSettingsParameters.protocol] Protocol scheme to + * use for this probe. Possible values include: 'Http', 'Https' + * + * @param {number} [healthProbeSettingsParameters.intervalInSeconds] The number + * of seconds between health probes. + * + * @param {string} [healthProbeSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [healthProbeSettingsParameters.name] Resource name. + * + * @param {string} [healthProbeSettingsParameters.id] Resource ID. + * + * @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 {HealthProbeSettingsModel} - 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 HealthProbeSettingsModel} 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. + */ + beginCreateOrUpdate(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters, 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._beginCreateOrUpdate(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters, options, optionalCallback); + } + } + + /** + * Deletes an existing HealthProbeSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, frontDoorName, healthProbeSettingsName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, frontDoorName, healthProbeSettingsName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes an existing HealthProbeSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, frontDoorName, healthProbeSettingsName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, frontDoorName, healthProbeSettingsName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, frontDoorName, healthProbeSettingsName, options, optionalCallback); + } + } + + /** + * Lists all of the HealthProbeSettings within a Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByFrontDoorNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByFrontDoorNext(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 of the HealthProbeSettings within a Front Door. + * + * @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 {HealthProbeSettingsListResult} - 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 HealthProbeSettingsListResult} 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. + */ + listByFrontDoorNext(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._listByFrontDoorNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByFrontDoorNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = HealthProbeSettings; diff --git a/lib/services/networkManagement2/lib/lib/operations/index.d.ts b/lib/services/networkManagement2/lib/lib/operations/index.d.ts new file mode 100644 index 0000000000..4a279d79c8 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/index.d.ts @@ -0,0 +1,4711 @@ +/* + * 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. +*/ + +import { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; +import * as models from '../models'; + + +/** + * @class + * FrontDoors + * __NOTE__: An instance of this class is automatically created for an + * instance of the FrontdoorManagementClient. + */ +export interface FrontDoors { + + + /** + * Lists all of the Front Doors within an Azure subscription. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the Front Doors within an Azure subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {FrontDoorListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FrontDoorListResult} [result] - The deserialized result object if an error did not occur. + * See {@link FrontDoorListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all of the Front Doors within a resource group under a subscription. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the Front Doors within a resource group under a subscription. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {FrontDoorListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FrontDoorListResult} [result] - The deserialized result object if an error did not occur. + * See {@link FrontDoorListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a Front Door with the specified Front Door name under the specified + * subscription and resource group. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a Front Door with the specified Front Door name under the specified + * subscription and resource group. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {FrontDoor} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FrontDoor} [result] - The deserialized result object if an error did not occur. + * See {@link FrontDoor} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, frontDoorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, frontDoorName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, frontDoorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new Front Door with a Front Door name under the specified + * subscription and resource group. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} frontDoorParameters Front Door properties needed to create a + * new Front Door. + * + * @param {string} [frontDoorParameters.friendlyName] A friendly name for the + * frontDoor + * + * @param {array} [frontDoorParameters.routingRules] Routing rules associated + * with this Front Door. + * + * @param {array} [frontDoorParameters.loadBalancingSettings] Load balancing + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.healthProbeSettings] Health probe + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.backendPools] Backend pools available to + * routing rules. + * + * @param {array} [frontDoorParameters.frontendEndpoints] Frontend endpoints + * available to routing rules. + * + * @param {string} [frontDoorParameters.enabledState] Operational status of the + * Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. + * Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [frontDoorParameters.resourceState] Resource status of the + * Front Door. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [frontDoorParameters.location] Resource location. + * + * @param {object} [frontDoorParameters.tags] Resource tags. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, frontDoorParameters: models.FrontDoor, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new Front Door with a Front Door name under the specified + * subscription and resource group. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} frontDoorParameters Front Door properties needed to create a + * new Front Door. + * + * @param {string} [frontDoorParameters.friendlyName] A friendly name for the + * frontDoor + * + * @param {array} [frontDoorParameters.routingRules] Routing rules associated + * with this Front Door. + * + * @param {array} [frontDoorParameters.loadBalancingSettings] Load balancing + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.healthProbeSettings] Health probe + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.backendPools] Backend pools available to + * routing rules. + * + * @param {array} [frontDoorParameters.frontendEndpoints] Frontend endpoints + * available to routing rules. + * + * @param {string} [frontDoorParameters.enabledState] Operational status of the + * Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. + * Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [frontDoorParameters.resourceState] Resource status of the + * Front Door. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [frontDoorParameters.location] Resource location. + * + * @param {object} [frontDoorParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {FrontDoor} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FrontDoor} [result] - The deserialized result object if an error did not occur. + * See {@link FrontDoor} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, frontDoorName: string, frontDoorParameters: models.FrontDoor, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, frontDoorName: string, frontDoorParameters: models.FrontDoor, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, frontDoorName: string, frontDoorParameters: models.FrontDoor, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an existing Front Door with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an existing Front Door with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, frontDoorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, frontDoorName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, frontDoorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Validates the custom domain mapping to ensure it maps to the correct Front + * Door endpoint in DNS. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} customDomainProperties Custom domain to be validated. + * + * @param {string} customDomainProperties.hostName The host name of the custom + * domain. Must be a domain name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + validateCustomDomainWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, customDomainProperties: models.ValidateCustomDomainInput, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Validates the custom domain mapping to ensure it maps to the correct Front + * Door endpoint in DNS. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} customDomainProperties Custom domain to be validated. + * + * @param {string} customDomainProperties.hostName The host name of the custom + * domain. Must be a domain name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {ValidateCustomDomainOutput} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ValidateCustomDomainOutput} [result] - The deserialized result object if an error did not occur. + * See {@link ValidateCustomDomainOutput} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + validateCustomDomain(resourceGroupName: string, frontDoorName: string, customDomainProperties: models.ValidateCustomDomainInput, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + validateCustomDomain(resourceGroupName: string, frontDoorName: string, customDomainProperties: models.ValidateCustomDomainInput, callback: ServiceCallback): void; + validateCustomDomain(resourceGroupName: string, frontDoorName: string, customDomainProperties: models.ValidateCustomDomainInput, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new Front Door with a Front Door name under the specified + * subscription and resource group. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} frontDoorParameters Front Door properties needed to create a + * new Front Door. + * + * @param {string} [frontDoorParameters.friendlyName] A friendly name for the + * frontDoor + * + * @param {array} [frontDoorParameters.routingRules] Routing rules associated + * with this Front Door. + * + * @param {array} [frontDoorParameters.loadBalancingSettings] Load balancing + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.healthProbeSettings] Health probe + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.backendPools] Backend pools available to + * routing rules. + * + * @param {array} [frontDoorParameters.frontendEndpoints] Frontend endpoints + * available to routing rules. + * + * @param {string} [frontDoorParameters.enabledState] Operational status of the + * Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. + * Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [frontDoorParameters.resourceState] Resource status of the + * Front Door. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [frontDoorParameters.location] Resource location. + * + * @param {object} [frontDoorParameters.tags] Resource tags. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, frontDoorParameters: models.FrontDoor, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new Front Door with a Front Door name under the specified + * subscription and resource group. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} frontDoorParameters Front Door properties needed to create a + * new Front Door. + * + * @param {string} [frontDoorParameters.friendlyName] A friendly name for the + * frontDoor + * + * @param {array} [frontDoorParameters.routingRules] Routing rules associated + * with this Front Door. + * + * @param {array} [frontDoorParameters.loadBalancingSettings] Load balancing + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.healthProbeSettings] Health probe + * settings associated with this Front Door instance. + * + * @param {array} [frontDoorParameters.backendPools] Backend pools available to + * routing rules. + * + * @param {array} [frontDoorParameters.frontendEndpoints] Frontend endpoints + * available to routing rules. + * + * @param {string} [frontDoorParameters.enabledState] Operational status of the + * Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. + * Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [frontDoorParameters.resourceState] Resource status of the + * Front Door. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [frontDoorParameters.location] Resource location. + * + * @param {object} [frontDoorParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {FrontDoor} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FrontDoor} [result] - The deserialized result object if an error did not occur. + * See {@link FrontDoor} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, frontDoorParameters: models.FrontDoor, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, frontDoorParameters: models.FrontDoor, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, frontDoorParameters: models.FrontDoor, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an existing Front Door with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an existing Front Door with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all of the Front Doors within an Azure subscription. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the Front Doors within an Azure subscription. + * + * @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 {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {FrontDoorListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FrontDoorListResult} [result] - The deserialized result object if an error did not occur. + * See {@link FrontDoorListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all of the Front Doors within a resource group under a subscription. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the Front Doors within a resource group under a subscription. + * + * @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 {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {FrontDoorListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FrontDoorListResult} [result] - The deserialized result object if an error did not occur. + * See {@link FrontDoorListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * RoutingRules + * __NOTE__: An instance of this class is automatically created for an + * instance of the FrontdoorManagementClient. + */ +export interface RoutingRules { + + + /** + * Lists all of the Routing Rules within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByFrontDoorWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the Routing Rules within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {RoutingRuleListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {RoutingRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RoutingRuleListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByFrontDoor(resourceGroupName: string, frontDoorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByFrontDoor(resourceGroupName: string, frontDoorName: string, callback: ServiceCallback): void; + listByFrontDoor(resourceGroupName: string, frontDoorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a Routing Rule with the specified Rule name within the specified Front + * Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, routingRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a Routing Rule with the specified Rule name within the specified Front + * Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {RoutingRule} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {RoutingRule} [result] - The deserialized result object if an error did not occur. + * See {@link RoutingRule} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, frontDoorName: string, routingRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, frontDoorName: string, routingRuleName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, frontDoorName: string, routingRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new Routing Rule with the specified Rule name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} routingRuleParameters Routing Rule properties needed to + * create a new Front Door. + * + * @param {array} [routingRuleParameters.frontendEndpoints] Frontend endpoints + * associated with this rule + * + * @param {array} [routingRuleParameters.acceptedProtocols] Protocol schemes to + * match for this rule + * + * @param {array} [routingRuleParameters.patternsToMatch] The route patterns of + * the rule. + * + * @param {string} [routingRuleParameters.customForwardingPath] A custom path + * used to rewrite resource paths matched by this rule. Leave empty to use + * incoming path. + * + * @param {string} [routingRuleParameters.forwardingProtocol] Protocol this + * rule will use when forwarding traffic to backends. Possible values include: + * 'HttpOnly', 'HttpsOnly', 'MatchRequest' + * + * @param {object} [routingRuleParameters.cacheConfiguration] The caching + * configuration associated with this rule. + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.queryParameterStripDirective] + * Treatment of URL query terms when forming the cache key. Possible values + * include: 'StripNone', 'StripAll' + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.dynamicCompression] Whether to use + * dynamic compression for cached content. Possible values include: 'Enabled', + * 'Disabled' + * + * @param {object} [routingRuleParameters.backendPool] A reference to the + * BackendPool which this rule routes to. + * + * @param {string} [routingRuleParameters.backendPool.id] Resource ID. + * + * @param {string} [routingRuleParameters.enabledState] Whether to enable use + * of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values + * include: 'Enabled', 'Disabled' + * + * @param {string} [routingRuleParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [routingRuleParameters.name] Resource name. + * + * @param {string} [routingRuleParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, routingRuleName: string, routingRuleParameters: models.RoutingRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new Routing Rule with the specified Rule name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} routingRuleParameters Routing Rule properties needed to + * create a new Front Door. + * + * @param {array} [routingRuleParameters.frontendEndpoints] Frontend endpoints + * associated with this rule + * + * @param {array} [routingRuleParameters.acceptedProtocols] Protocol schemes to + * match for this rule + * + * @param {array} [routingRuleParameters.patternsToMatch] The route patterns of + * the rule. + * + * @param {string} [routingRuleParameters.customForwardingPath] A custom path + * used to rewrite resource paths matched by this rule. Leave empty to use + * incoming path. + * + * @param {string} [routingRuleParameters.forwardingProtocol] Protocol this + * rule will use when forwarding traffic to backends. Possible values include: + * 'HttpOnly', 'HttpsOnly', 'MatchRequest' + * + * @param {object} [routingRuleParameters.cacheConfiguration] The caching + * configuration associated with this rule. + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.queryParameterStripDirective] + * Treatment of URL query terms when forming the cache key. Possible values + * include: 'StripNone', 'StripAll' + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.dynamicCompression] Whether to use + * dynamic compression for cached content. Possible values include: 'Enabled', + * 'Disabled' + * + * @param {object} [routingRuleParameters.backendPool] A reference to the + * BackendPool which this rule routes to. + * + * @param {string} [routingRuleParameters.backendPool.id] Resource ID. + * + * @param {string} [routingRuleParameters.enabledState] Whether to enable use + * of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values + * include: 'Enabled', 'Disabled' + * + * @param {string} [routingRuleParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [routingRuleParameters.name] Resource name. + * + * @param {string} [routingRuleParameters.id] Resource ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {RoutingRule} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {RoutingRule} [result] - The deserialized result object if an error did not occur. + * See {@link RoutingRule} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, frontDoorName: string, routingRuleName: string, routingRuleParameters: models.RoutingRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, frontDoorName: string, routingRuleName: string, routingRuleParameters: models.RoutingRule, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, frontDoorName: string, routingRuleName: string, routingRuleParameters: models.RoutingRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an existing Routing Rule with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, routingRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an existing Routing Rule with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, frontDoorName: string, routingRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, frontDoorName: string, routingRuleName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, frontDoorName: string, routingRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new Routing Rule with the specified Rule name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} routingRuleParameters Routing Rule properties needed to + * create a new Front Door. + * + * @param {array} [routingRuleParameters.frontendEndpoints] Frontend endpoints + * associated with this rule + * + * @param {array} [routingRuleParameters.acceptedProtocols] Protocol schemes to + * match for this rule + * + * @param {array} [routingRuleParameters.patternsToMatch] The route patterns of + * the rule. + * + * @param {string} [routingRuleParameters.customForwardingPath] A custom path + * used to rewrite resource paths matched by this rule. Leave empty to use + * incoming path. + * + * @param {string} [routingRuleParameters.forwardingProtocol] Protocol this + * rule will use when forwarding traffic to backends. Possible values include: + * 'HttpOnly', 'HttpsOnly', 'MatchRequest' + * + * @param {object} [routingRuleParameters.cacheConfiguration] The caching + * configuration associated with this rule. + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.queryParameterStripDirective] + * Treatment of URL query terms when forming the cache key. Possible values + * include: 'StripNone', 'StripAll' + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.dynamicCompression] Whether to use + * dynamic compression for cached content. Possible values include: 'Enabled', + * 'Disabled' + * + * @param {object} [routingRuleParameters.backendPool] A reference to the + * BackendPool which this rule routes to. + * + * @param {string} [routingRuleParameters.backendPool.id] Resource ID. + * + * @param {string} [routingRuleParameters.enabledState] Whether to enable use + * of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values + * include: 'Enabled', 'Disabled' + * + * @param {string} [routingRuleParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [routingRuleParameters.name] Resource name. + * + * @param {string} [routingRuleParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, routingRuleName: string, routingRuleParameters: models.RoutingRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new Routing Rule with the specified Rule name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} routingRuleParameters Routing Rule properties needed to + * create a new Front Door. + * + * @param {array} [routingRuleParameters.frontendEndpoints] Frontend endpoints + * associated with this rule + * + * @param {array} [routingRuleParameters.acceptedProtocols] Protocol schemes to + * match for this rule + * + * @param {array} [routingRuleParameters.patternsToMatch] The route patterns of + * the rule. + * + * @param {string} [routingRuleParameters.customForwardingPath] A custom path + * used to rewrite resource paths matched by this rule. Leave empty to use + * incoming path. + * + * @param {string} [routingRuleParameters.forwardingProtocol] Protocol this + * rule will use when forwarding traffic to backends. Possible values include: + * 'HttpOnly', 'HttpsOnly', 'MatchRequest' + * + * @param {object} [routingRuleParameters.cacheConfiguration] The caching + * configuration associated with this rule. + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.queryParameterStripDirective] + * Treatment of URL query terms when forming the cache key. Possible values + * include: 'StripNone', 'StripAll' + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.dynamicCompression] Whether to use + * dynamic compression for cached content. Possible values include: 'Enabled', + * 'Disabled' + * + * @param {object} [routingRuleParameters.backendPool] A reference to the + * BackendPool which this rule routes to. + * + * @param {string} [routingRuleParameters.backendPool.id] Resource ID. + * + * @param {string} [routingRuleParameters.enabledState] Whether to enable use + * of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values + * include: 'Enabled', 'Disabled' + * + * @param {string} [routingRuleParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [routingRuleParameters.name] Resource name. + * + * @param {string} [routingRuleParameters.id] Resource ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {RoutingRule} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {RoutingRule} [result] - The deserialized result object if an error did not occur. + * See {@link RoutingRule} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, routingRuleName: string, routingRuleParameters: models.RoutingRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, routingRuleName: string, routingRuleParameters: models.RoutingRule, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, routingRuleName: string, routingRuleParameters: models.RoutingRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an existing Routing Rule with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, routingRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an existing Routing Rule with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, routingRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, routingRuleName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, routingRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all of the Routing Rules within a Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByFrontDoorNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the Routing Rules within a Front Door. + * + * @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 {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {RoutingRuleListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {RoutingRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RoutingRuleListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByFrontDoorNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByFrontDoorNext(nextPageLink: string, callback: ServiceCallback): void; + listByFrontDoorNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * HealthProbeSettings + * __NOTE__: An instance of this class is automatically created for an + * instance of the FrontdoorManagementClient. + */ +export interface HealthProbeSettings { + + + /** + * Lists all of the HealthProbeSettings within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByFrontDoorWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the HealthProbeSettings within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {HealthProbeSettingsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {HealthProbeSettingsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link HealthProbeSettingsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByFrontDoor(resourceGroupName: string, frontDoorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByFrontDoor(resourceGroupName: string, frontDoorName: string, callback: ServiceCallback): void; + listByFrontDoor(resourceGroupName: string, frontDoorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a HealthProbeSettings with the specified Rule name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a HealthProbeSettings with the specified Rule name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {HealthProbeSettingsModel} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {HealthProbeSettingsModel} [result] - The deserialized result object if an error did not occur. + * See {@link HealthProbeSettingsModel} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new HealthProbeSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} healthProbeSettingsParameters HealthProbeSettings properties + * needed to create a new Front Door. + * + * @param {string} [healthProbeSettingsParameters.path] The path to use for the + * health probe. Default is / + * + * @param {string} [healthProbeSettingsParameters.protocol] Protocol scheme to + * use for this probe. Possible values include: 'Http', 'Https' + * + * @param {number} [healthProbeSettingsParameters.intervalInSeconds] The number + * of seconds between health probes. + * + * @param {string} [healthProbeSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [healthProbeSettingsParameters.name] Resource name. + * + * @param {string} [healthProbeSettingsParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, healthProbeSettingsParameters: models.HealthProbeSettingsModel, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new HealthProbeSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} healthProbeSettingsParameters HealthProbeSettings properties + * needed to create a new Front Door. + * + * @param {string} [healthProbeSettingsParameters.path] The path to use for the + * health probe. Default is / + * + * @param {string} [healthProbeSettingsParameters.protocol] Protocol scheme to + * use for this probe. Possible values include: 'Http', 'Https' + * + * @param {number} [healthProbeSettingsParameters.intervalInSeconds] The number + * of seconds between health probes. + * + * @param {string} [healthProbeSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [healthProbeSettingsParameters.name] Resource name. + * + * @param {string} [healthProbeSettingsParameters.id] Resource ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {HealthProbeSettingsModel} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {HealthProbeSettingsModel} [result] - The deserialized result object if an error did not occur. + * See {@link HealthProbeSettingsModel} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, healthProbeSettingsParameters: models.HealthProbeSettingsModel, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, healthProbeSettingsParameters: models.HealthProbeSettingsModel, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, healthProbeSettingsParameters: models.HealthProbeSettingsModel, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an existing HealthProbeSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an existing HealthProbeSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new HealthProbeSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} healthProbeSettingsParameters HealthProbeSettings properties + * needed to create a new Front Door. + * + * @param {string} [healthProbeSettingsParameters.path] The path to use for the + * health probe. Default is / + * + * @param {string} [healthProbeSettingsParameters.protocol] Protocol scheme to + * use for this probe. Possible values include: 'Http', 'Https' + * + * @param {number} [healthProbeSettingsParameters.intervalInSeconds] The number + * of seconds between health probes. + * + * @param {string} [healthProbeSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [healthProbeSettingsParameters.name] Resource name. + * + * @param {string} [healthProbeSettingsParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, healthProbeSettingsParameters: models.HealthProbeSettingsModel, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new HealthProbeSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} healthProbeSettingsParameters HealthProbeSettings properties + * needed to create a new Front Door. + * + * @param {string} [healthProbeSettingsParameters.path] The path to use for the + * health probe. Default is / + * + * @param {string} [healthProbeSettingsParameters.protocol] Protocol scheme to + * use for this probe. Possible values include: 'Http', 'Https' + * + * @param {number} [healthProbeSettingsParameters.intervalInSeconds] The number + * of seconds between health probes. + * + * @param {string} [healthProbeSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [healthProbeSettingsParameters.name] Resource name. + * + * @param {string} [healthProbeSettingsParameters.id] Resource ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {HealthProbeSettingsModel} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {HealthProbeSettingsModel} [result] - The deserialized result object if an error did not occur. + * See {@link HealthProbeSettingsModel} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, healthProbeSettingsParameters: models.HealthProbeSettingsModel, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, healthProbeSettingsParameters: models.HealthProbeSettingsModel, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, healthProbeSettingsParameters: models.HealthProbeSettingsModel, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an existing HealthProbeSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an existing HealthProbeSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} healthProbeSettingsName Name of the health probe settings + * which is unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, healthProbeSettingsName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all of the HealthProbeSettings within a Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByFrontDoorNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the HealthProbeSettings within a Front Door. + * + * @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 {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {HealthProbeSettingsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {HealthProbeSettingsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link HealthProbeSettingsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByFrontDoorNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByFrontDoorNext(nextPageLink: string, callback: ServiceCallback): void; + listByFrontDoorNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * LoadBalancingSettings + * __NOTE__: An instance of this class is automatically created for an + * instance of the FrontdoorManagementClient. + */ +export interface LoadBalancingSettings { + + + /** + * Lists all of the LoadBalancingSettings within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByFrontDoorWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the LoadBalancingSettings within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {LoadBalancingSettingsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LoadBalancingSettingsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancingSettingsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByFrontDoor(resourceGroupName: string, frontDoorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByFrontDoor(resourceGroupName: string, frontDoorName: string, callback: ServiceCallback): void; + listByFrontDoor(resourceGroupName: string, frontDoorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a LoadBalancingSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a LoadBalancingSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {LoadBalancingSettingsModel} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LoadBalancingSettingsModel} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancingSettingsModel} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new LoadBalancingSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} loadBalancingSettingsParameters LoadBalancingSettings + * properties needed to create a new Front Door. + * + * @param {number} [loadBalancingSettingsParameters.sampleSize] The number of + * samples to consider for load balancing decisions + * + * @param {number} [loadBalancingSettingsParameters.successfulSamplesRequired] + * The number of samples within the sample period that must succeed + * + * @param {number} + * [loadBalancingSettingsParameters.additionalLatencyMilliseconds] The + * additional latency in milliseconds for probes to fall into the lowest + * latency bucket + * + * @param {string} [loadBalancingSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [loadBalancingSettingsParameters.name] Resource name. + * + * @param {string} [loadBalancingSettingsParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, loadBalancingSettingsParameters: models.LoadBalancingSettingsModel, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new LoadBalancingSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} loadBalancingSettingsParameters LoadBalancingSettings + * properties needed to create a new Front Door. + * + * @param {number} [loadBalancingSettingsParameters.sampleSize] The number of + * samples to consider for load balancing decisions + * + * @param {number} [loadBalancingSettingsParameters.successfulSamplesRequired] + * The number of samples within the sample period that must succeed + * + * @param {number} + * [loadBalancingSettingsParameters.additionalLatencyMilliseconds] The + * additional latency in milliseconds for probes to fall into the lowest + * latency bucket + * + * @param {string} [loadBalancingSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [loadBalancingSettingsParameters.name] Resource name. + * + * @param {string} [loadBalancingSettingsParameters.id] Resource ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {LoadBalancingSettingsModel} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LoadBalancingSettingsModel} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancingSettingsModel} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, loadBalancingSettingsParameters: models.LoadBalancingSettingsModel, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, loadBalancingSettingsParameters: models.LoadBalancingSettingsModel, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, loadBalancingSettingsParameters: models.LoadBalancingSettingsModel, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an existing LoadBalancingSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an existing LoadBalancingSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new LoadBalancingSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} loadBalancingSettingsParameters LoadBalancingSettings + * properties needed to create a new Front Door. + * + * @param {number} [loadBalancingSettingsParameters.sampleSize] The number of + * samples to consider for load balancing decisions + * + * @param {number} [loadBalancingSettingsParameters.successfulSamplesRequired] + * The number of samples within the sample period that must succeed + * + * @param {number} + * [loadBalancingSettingsParameters.additionalLatencyMilliseconds] The + * additional latency in milliseconds for probes to fall into the lowest + * latency bucket + * + * @param {string} [loadBalancingSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [loadBalancingSettingsParameters.name] Resource name. + * + * @param {string} [loadBalancingSettingsParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, loadBalancingSettingsParameters: models.LoadBalancingSettingsModel, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new LoadBalancingSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} loadBalancingSettingsParameters LoadBalancingSettings + * properties needed to create a new Front Door. + * + * @param {number} [loadBalancingSettingsParameters.sampleSize] The number of + * samples to consider for load balancing decisions + * + * @param {number} [loadBalancingSettingsParameters.successfulSamplesRequired] + * The number of samples within the sample period that must succeed + * + * @param {number} + * [loadBalancingSettingsParameters.additionalLatencyMilliseconds] The + * additional latency in milliseconds for probes to fall into the lowest + * latency bucket + * + * @param {string} [loadBalancingSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [loadBalancingSettingsParameters.name] Resource name. + * + * @param {string} [loadBalancingSettingsParameters.id] Resource ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {LoadBalancingSettingsModel} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LoadBalancingSettingsModel} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancingSettingsModel} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, loadBalancingSettingsParameters: models.LoadBalancingSettingsModel, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, loadBalancingSettingsParameters: models.LoadBalancingSettingsModel, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, loadBalancingSettingsParameters: models.LoadBalancingSettingsModel, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an existing LoadBalancingSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an existing LoadBalancingSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, loadBalancingSettingsName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all of the LoadBalancingSettings within a Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByFrontDoorNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the LoadBalancingSettings within a Front Door. + * + * @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 {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {LoadBalancingSettingsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LoadBalancingSettingsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancingSettingsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByFrontDoorNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByFrontDoorNext(nextPageLink: string, callback: ServiceCallback): void; + listByFrontDoorNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * BackendPools + * __NOTE__: An instance of this class is automatically created for an + * instance of the FrontdoorManagementClient. + */ +export interface BackendPools { + + + /** + * Lists all of the Backend Pools within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByFrontDoorWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the Backend Pools within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {BackendPoolListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BackendPoolListResult} [result] - The deserialized result object if an error did not occur. + * See {@link BackendPoolListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByFrontDoor(resourceGroupName: string, frontDoorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByFrontDoor(resourceGroupName: string, frontDoorName: string, callback: ServiceCallback): void; + listByFrontDoor(resourceGroupName: string, frontDoorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a Backend Pool with the specified Pool name within the specified Front + * Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, backendPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a Backend Pool with the specified Pool name within the specified Front + * Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {BackendPool} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BackendPool} [result] - The deserialized result object if an error did not occur. + * See {@link BackendPool} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, frontDoorName: string, backendPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, frontDoorName: string, backendPoolName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, frontDoorName: string, backendPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new Backend Pool with the specified Pool name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} backendPoolParameters Backend Pool properties needed to + * create a new Pool. + * + * @param {array} [backendPoolParameters.backends] The set of backends for this + * pool + * + * @param {object} [backendPoolParameters.loadBalancingSettings] Load balancing + * settings for a backend pool + * + * @param {object} [backendPoolParameters.healthProbeSettings] L7 health probe + * settings for a backend pool + * + * @param {string} [backendPoolParameters.healthProbeSettings.id] Resource ID. + * + * @param {string} [backendPoolParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [backendPoolParameters.name] Resource name. + * + * @param {string} [backendPoolParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, backendPoolName: string, backendPoolParameters: models.BackendPool, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new Backend Pool with the specified Pool name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} backendPoolParameters Backend Pool properties needed to + * create a new Pool. + * + * @param {array} [backendPoolParameters.backends] The set of backends for this + * pool + * + * @param {object} [backendPoolParameters.loadBalancingSettings] Load balancing + * settings for a backend pool + * + * @param {object} [backendPoolParameters.healthProbeSettings] L7 health probe + * settings for a backend pool + * + * @param {string} [backendPoolParameters.healthProbeSettings.id] Resource ID. + * + * @param {string} [backendPoolParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [backendPoolParameters.name] Resource name. + * + * @param {string} [backendPoolParameters.id] Resource ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {BackendPool} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BackendPool} [result] - The deserialized result object if an error did not occur. + * See {@link BackendPool} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, frontDoorName: string, backendPoolName: string, backendPoolParameters: models.BackendPool, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, frontDoorName: string, backendPoolName: string, backendPoolParameters: models.BackendPool, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, frontDoorName: string, backendPoolName: string, backendPoolParameters: models.BackendPool, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an existing Backend Pool with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, backendPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an existing Backend Pool with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, frontDoorName: string, backendPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, frontDoorName: string, backendPoolName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, frontDoorName: string, backendPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new Backend Pool with the specified Pool name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} backendPoolParameters Backend Pool properties needed to + * create a new Pool. + * + * @param {array} [backendPoolParameters.backends] The set of backends for this + * pool + * + * @param {object} [backendPoolParameters.loadBalancingSettings] Load balancing + * settings for a backend pool + * + * @param {object} [backendPoolParameters.healthProbeSettings] L7 health probe + * settings for a backend pool + * + * @param {string} [backendPoolParameters.healthProbeSettings.id] Resource ID. + * + * @param {string} [backendPoolParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [backendPoolParameters.name] Resource name. + * + * @param {string} [backendPoolParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, backendPoolName: string, backendPoolParameters: models.BackendPool, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new Backend Pool with the specified Pool name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} backendPoolParameters Backend Pool properties needed to + * create a new Pool. + * + * @param {array} [backendPoolParameters.backends] The set of backends for this + * pool + * + * @param {object} [backendPoolParameters.loadBalancingSettings] Load balancing + * settings for a backend pool + * + * @param {object} [backendPoolParameters.healthProbeSettings] L7 health probe + * settings for a backend pool + * + * @param {string} [backendPoolParameters.healthProbeSettings.id] Resource ID. + * + * @param {string} [backendPoolParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [backendPoolParameters.name] Resource name. + * + * @param {string} [backendPoolParameters.id] Resource ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {BackendPool} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BackendPool} [result] - The deserialized result object if an error did not occur. + * See {@link BackendPool} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, backendPoolName: string, backendPoolParameters: models.BackendPool, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, backendPoolName: string, backendPoolParameters: models.BackendPool, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, backendPoolName: string, backendPoolParameters: models.BackendPool, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an existing Backend Pool with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, backendPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an existing Backend Pool with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} backendPoolName Name of the Backend Pool which is unique + * within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, backendPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, backendPoolName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, backendPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all of the Backend Pools within a Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByFrontDoorNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the Backend Pools within a Front Door. + * + * @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 {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {BackendPoolListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BackendPoolListResult} [result] - The deserialized result object if an error did not occur. + * See {@link BackendPoolListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByFrontDoorNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByFrontDoorNext(nextPageLink: string, callback: ServiceCallback): void; + listByFrontDoorNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * FrontendEndpoints + * __NOTE__: An instance of this class is automatically created for an + * instance of the FrontdoorManagementClient. + */ +export interface FrontendEndpoints { + + + /** + * Lists all of the frontend endpoints within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByFrontDoorWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the frontend endpoints within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {FrontendEndpointsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FrontendEndpointsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link FrontendEndpointsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByFrontDoor(resourceGroupName: string, frontDoorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByFrontDoor(resourceGroupName: string, frontDoorName: string, callback: ServiceCallback): void; + listByFrontDoor(resourceGroupName: string, frontDoorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a Frontend endpoint with the specified name within the specified Front + * Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a Frontend endpoint with the specified name within the specified Front + * Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {FrontendEndpoint} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FrontendEndpoint} [result] - The deserialized result object if an error did not occur. + * See {@link FrontendEndpoint} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new frontend endpoint with the specified host name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} frontendEndpointParameters Frontend endpoint properties + * needed to create a new endpoint. + * + * @param {string} [frontendEndpointParameters.hostName] The host name of the + * frontendEndpoint. Must be a domain name. + * + * @param {string} [frontendEndpointParameters.sessionAffinityEnabledState] + * Whether to allow session affinity on this host. Valid options are 'Enabled' + * or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + * + * @param {number} [frontendEndpointParameters.sessionAffinityTtlSeconds] + * UNUSED. This field will be ignored. The TTL to use in seconds for session + * affinity, if applicable. + * + * @param {object} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink] Defines the + * Web Application Firewall policy for each host (if applicable) + * + * @param {string} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink.id] Resource + * ID. + * + * @param {string} [frontendEndpointParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [frontendEndpointParameters.name] Resource name. + * + * @param {string} [frontendEndpointParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, frontendEndpointParameters: models.FrontendEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new frontend endpoint with the specified host name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} frontendEndpointParameters Frontend endpoint properties + * needed to create a new endpoint. + * + * @param {string} [frontendEndpointParameters.hostName] The host name of the + * frontendEndpoint. Must be a domain name. + * + * @param {string} [frontendEndpointParameters.sessionAffinityEnabledState] + * Whether to allow session affinity on this host. Valid options are 'Enabled' + * or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + * + * @param {number} [frontendEndpointParameters.sessionAffinityTtlSeconds] + * UNUSED. This field will be ignored. The TTL to use in seconds for session + * affinity, if applicable. + * + * @param {object} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink] Defines the + * Web Application Firewall policy for each host (if applicable) + * + * @param {string} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink.id] Resource + * ID. + * + * @param {string} [frontendEndpointParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [frontendEndpointParameters.name] Resource name. + * + * @param {string} [frontendEndpointParameters.id] Resource ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {FrontendEndpoint} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FrontendEndpoint} [result] - The deserialized result object if an error did not occur. + * See {@link FrontendEndpoint} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, frontendEndpointParameters: models.FrontendEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, frontendEndpointParameters: models.FrontendEndpoint, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, frontendEndpointParameters: models.FrontendEndpoint, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an existing frontend endpoint with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an existing frontend endpoint with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Enables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} customHttpsConfiguration The configuration specifying how to + * enable HTTPS + * + * @param {string} [customHttpsConfiguration.certificateSource] Defines the + * source of the SSL certificate. Possible values include: 'AzureKeyVault', + * 'FrontDoor' + * + * @param {string} [customHttpsConfiguration.protocolType] Defines the TLS + * extension protocol that is used for secure delivery. Possible values + * include: 'ServerNameIndication' + * + * @param {object} [customHttpsConfiguration.vault] The Key Vault containing + * the SSL certificate + * + * @param {string} [customHttpsConfiguration.vault.id] Resource ID. + * + * @param {string} [customHttpsConfiguration.secretName] The name of the Key + * Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.secretVersion] The version of the + * Key Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.certificateType] Defines the type + * of the certificate used for secure connections to a frontendEndpoint. + * Possible values include: 'Dedicated' + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + enableHttpsWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, customHttpsConfiguration: models.CustomHttpsConfiguration, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Enables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} customHttpsConfiguration The configuration specifying how to + * enable HTTPS + * + * @param {string} [customHttpsConfiguration.certificateSource] Defines the + * source of the SSL certificate. Possible values include: 'AzureKeyVault', + * 'FrontDoor' + * + * @param {string} [customHttpsConfiguration.protocolType] Defines the TLS + * extension protocol that is used for secure delivery. Possible values + * include: 'ServerNameIndication' + * + * @param {object} [customHttpsConfiguration.vault] The Key Vault containing + * the SSL certificate + * + * @param {string} [customHttpsConfiguration.vault.id] Resource ID. + * + * @param {string} [customHttpsConfiguration.secretName] The name of the Key + * Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.secretVersion] The version of the + * Key Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.certificateType] Defines the type + * of the certificate used for secure connections to a frontendEndpoint. + * Possible values include: 'Dedicated' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + enableHttps(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, customHttpsConfiguration: models.CustomHttpsConfiguration, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + enableHttps(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, customHttpsConfiguration: models.CustomHttpsConfiguration, callback: ServiceCallback): void; + enableHttps(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, customHttpsConfiguration: models.CustomHttpsConfiguration, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Disables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + disableHttpsWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Disables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + disableHttps(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + disableHttps(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, callback: ServiceCallback): void; + disableHttps(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new frontend endpoint with the specified host name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} frontendEndpointParameters Frontend endpoint properties + * needed to create a new endpoint. + * + * @param {string} [frontendEndpointParameters.hostName] The host name of the + * frontendEndpoint. Must be a domain name. + * + * @param {string} [frontendEndpointParameters.sessionAffinityEnabledState] + * Whether to allow session affinity on this host. Valid options are 'Enabled' + * or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + * + * @param {number} [frontendEndpointParameters.sessionAffinityTtlSeconds] + * UNUSED. This field will be ignored. The TTL to use in seconds for session + * affinity, if applicable. + * + * @param {object} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink] Defines the + * Web Application Firewall policy for each host (if applicable) + * + * @param {string} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink.id] Resource + * ID. + * + * @param {string} [frontendEndpointParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [frontendEndpointParameters.name] Resource name. + * + * @param {string} [frontendEndpointParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, frontendEndpointParameters: models.FrontendEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new frontend endpoint with the specified host name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} frontendEndpointParameters Frontend endpoint properties + * needed to create a new endpoint. + * + * @param {string} [frontendEndpointParameters.hostName] The host name of the + * frontendEndpoint. Must be a domain name. + * + * @param {string} [frontendEndpointParameters.sessionAffinityEnabledState] + * Whether to allow session affinity on this host. Valid options are 'Enabled' + * or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + * + * @param {number} [frontendEndpointParameters.sessionAffinityTtlSeconds] + * UNUSED. This field will be ignored. The TTL to use in seconds for session + * affinity, if applicable. + * + * @param {object} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink] Defines the + * Web Application Firewall policy for each host (if applicable) + * + * @param {string} + * [frontendEndpointParameters.webApplicationFirewallPolicyLink.id] Resource + * ID. + * + * @param {string} [frontendEndpointParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [frontendEndpointParameters.name] Resource name. + * + * @param {string} [frontendEndpointParameters.id] Resource ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {FrontendEndpoint} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FrontendEndpoint} [result] - The deserialized result object if an error did not occur. + * See {@link FrontendEndpoint} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, frontendEndpointParameters: models.FrontendEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, frontendEndpointParameters: models.FrontendEndpoint, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, frontendEndpointParameters: models.FrontendEndpoint, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an existing frontend endpoint with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an existing frontend endpoint with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Enables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} customHttpsConfiguration The configuration specifying how to + * enable HTTPS + * + * @param {string} [customHttpsConfiguration.certificateSource] Defines the + * source of the SSL certificate. Possible values include: 'AzureKeyVault', + * 'FrontDoor' + * + * @param {string} [customHttpsConfiguration.protocolType] Defines the TLS + * extension protocol that is used for secure delivery. Possible values + * include: 'ServerNameIndication' + * + * @param {object} [customHttpsConfiguration.vault] The Key Vault containing + * the SSL certificate + * + * @param {string} [customHttpsConfiguration.vault.id] Resource ID. + * + * @param {string} [customHttpsConfiguration.secretName] The name of the Key + * Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.secretVersion] The version of the + * Key Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.certificateType] Defines the type + * of the certificate used for secure connections to a frontendEndpoint. + * Possible values include: 'Dedicated' + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginEnableHttpsWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, customHttpsConfiguration: models.CustomHttpsConfiguration, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Enables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} customHttpsConfiguration The configuration specifying how to + * enable HTTPS + * + * @param {string} [customHttpsConfiguration.certificateSource] Defines the + * source of the SSL certificate. Possible values include: 'AzureKeyVault', + * 'FrontDoor' + * + * @param {string} [customHttpsConfiguration.protocolType] Defines the TLS + * extension protocol that is used for secure delivery. Possible values + * include: 'ServerNameIndication' + * + * @param {object} [customHttpsConfiguration.vault] The Key Vault containing + * the SSL certificate + * + * @param {string} [customHttpsConfiguration.vault.id] Resource ID. + * + * @param {string} [customHttpsConfiguration.secretName] The name of the Key + * Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.secretVersion] The version of the + * Key Vault secret representing the full certificate PFX + * + * @param {string} [customHttpsConfiguration.certificateType] Defines the type + * of the certificate used for secure connections to a frontendEndpoint. + * Possible values include: 'Dedicated' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginEnableHttps(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, customHttpsConfiguration: models.CustomHttpsConfiguration, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginEnableHttps(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, customHttpsConfiguration: models.CustomHttpsConfiguration, callback: ServiceCallback): void; + beginEnableHttps(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, customHttpsConfiguration: models.CustomHttpsConfiguration, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Disables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDisableHttpsWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Disables a frontendEndpoint for HTTPS traffic + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} frontendEndpointName Name of the Frontend endpoint which is + * unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDisableHttps(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDisableHttps(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, callback: ServiceCallback): void; + beginDisableHttps(resourceGroupName: string, frontDoorName: string, frontendEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all of the frontend endpoints within a Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByFrontDoorNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the frontend endpoints within a Front Door. + * + * @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 {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {FrontendEndpointsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FrontendEndpointsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link FrontendEndpointsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByFrontDoorNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByFrontDoorNext(nextPageLink: string, callback: ServiceCallback): void; + listByFrontDoorNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Endpoints + * __NOTE__: An instance of this class is automatically created for an + * instance of the FrontdoorManagementClient. + */ +export interface Endpoints { + + + /** + * Removes a content from Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} contentFilePaths The path to the content to be purged. Path + * can be a full URL, e.g. '/pictures/city.png' which removes a single file, or + * a directory with a wildcard, e.g. '/pictures/*' which removes all folders + * and files in the directory. + * + * @param {array} contentFilePaths.contentPaths The path to the content to be + * purged. Can describe a file path or a wild card directory. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + purgeContentWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, contentFilePaths: models.PurgeParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Removes a content from Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} contentFilePaths The path to the content to be purged. Path + * can be a full URL, e.g. '/pictures/city.png' which removes a single file, or + * a directory with a wildcard, e.g. '/pictures/*' which removes all folders + * and files in the directory. + * + * @param {array} contentFilePaths.contentPaths The path to the content to be + * purged. Can describe a file path or a wild card directory. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + purgeContent(resourceGroupName: string, frontDoorName: string, contentFilePaths: models.PurgeParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + purgeContent(resourceGroupName: string, frontDoorName: string, contentFilePaths: models.PurgeParameters, callback: ServiceCallback): void; + purgeContent(resourceGroupName: string, frontDoorName: string, contentFilePaths: models.PurgeParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Removes a content from Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} contentFilePaths The path to the content to be purged. Path + * can be a full URL, e.g. '/pictures/city.png' which removes a single file, or + * a directory with a wildcard, e.g. '/pictures/*' which removes all folders + * and files in the directory. + * + * @param {array} contentFilePaths.contentPaths The path to the content to be + * purged. Can describe a file path or a wild card directory. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginPurgeContentWithHttpOperationResponse(resourceGroupName: string, frontDoorName: string, contentFilePaths: models.PurgeParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Removes a content from Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {object} contentFilePaths The path to the content to be purged. Path + * can be a full URL, e.g. '/pictures/city.png' which removes a single file, or + * a directory with a wildcard, e.g. '/pictures/*' which removes all folders + * and files in the directory. + * + * @param {array} contentFilePaths.contentPaths The path to the content to be + * purged. Can describe a file path or a wild card directory. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginPurgeContent(resourceGroupName: string, frontDoorName: string, contentFilePaths: models.PurgeParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPurgeContent(resourceGroupName: string, frontDoorName: string, contentFilePaths: models.PurgeParameters, callback: ServiceCallback): void; + beginPurgeContent(resourceGroupName: string, frontDoorName: string, contentFilePaths: models.PurgeParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Policies + * __NOTE__: An instance of this class is automatically created for an + * instance of the FrontdoorManagementClient. + */ +export interface Policies { + + + /** + * Lists all of the protection policies within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the protection policies within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {WebApplicationFirewallPolicyListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {WebApplicationFirewallPolicyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link WebApplicationFirewallPolicyListResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve protection policy with specified name within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, policyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve protection policy with specified name within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {WebApplicationFirewallPolicy} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {WebApplicationFirewallPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link WebApplicationFirewallPolicy} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, policyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, policyName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, policyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or update policy with specified ruleset name within a resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @param {object} parameters Policy to be created. + * + * @param {object} [parameters.policySettings] Describes policySettings for + * policy + * + * @param {string} [parameters.policySettings.enabledState] describes if the + * policy is in enabled state or disabled state. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {string} [parameters.policySettings.mode] Describes if it is in + * detection mode or prevention mode at policy level. Possible values include: + * 'Prevention', 'Detection' + * + * @param {object} [parameters.customRules] Describes custom rules inside the + * policy + * + * @param {array} [parameters.customRules.rules] List of rules + * + * @param {object} [parameters.managedRules] Describes managed rules inside the + * policy + * + * @param {array} [parameters.managedRules.ruleSets] List of rules + * + * @param {string} [parameters.etag] Gets a unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, policyName: string, parameters: models.WebApplicationFirewallPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or update policy with specified ruleset name within a resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @param {object} parameters Policy to be created. + * + * @param {object} [parameters.policySettings] Describes policySettings for + * policy + * + * @param {string} [parameters.policySettings.enabledState] describes if the + * policy is in enabled state or disabled state. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {string} [parameters.policySettings.mode] Describes if it is in + * detection mode or prevention mode at policy level. Possible values include: + * 'Prevention', 'Detection' + * + * @param {object} [parameters.customRules] Describes custom rules inside the + * policy + * + * @param {array} [parameters.customRules.rules] List of rules + * + * @param {object} [parameters.managedRules] Describes managed rules inside the + * policy + * + * @param {array} [parameters.managedRules.ruleSets] List of rules + * + * @param {string} [parameters.etag] Gets a unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {WebApplicationFirewallPolicy} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {WebApplicationFirewallPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link WebApplicationFirewallPolicy} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, policyName: string, parameters: models.WebApplicationFirewallPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, policyName: string, parameters: models.WebApplicationFirewallPolicy, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, policyName: string, parameters: models.WebApplicationFirewallPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes Policy + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, policyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes Policy + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, policyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, policyName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, policyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes Policy + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, policyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes Policy + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, policyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, policyName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, policyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all of the protection policies within a resource group. + * + * @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} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the protection policies within a resource group. + * + * @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 {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|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 {WebApplicationFirewallPolicyListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {WebApplicationFirewallPolicyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link WebApplicationFirewallPolicyListResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/networkManagement2/lib/lib/operations/index.js b/lib/services/networkManagement2/lib/lib/operations/index.js new file mode 100644 index 0000000000..598f43eee3 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/index.js @@ -0,0 +1,24 @@ +/* + * 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'; + +exports.FrontDoors = require('./frontDoors'); +exports.RoutingRules = require('./routingRules'); +exports.HealthProbeSettings = require('./healthProbeSettings'); +exports.LoadBalancingSettings = require('./loadBalancingSettings'); +exports.BackendPools = require('./backendPools'); +exports.FrontendEndpoints = require('./frontendEndpoints'); +exports.Endpoints = require('./endpoints'); +exports.Policies = require('./policies'); diff --git a/lib/services/networkManagement2/lib/lib/operations/loadBalancingSettings.js b/lib/services/networkManagement2/lib/lib/operations/loadBalancingSettings.js new file mode 100644 index 0000000000..e448ae6d5b --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/loadBalancingSettings.js @@ -0,0 +1,1910 @@ +/* + * 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 of the LoadBalancingSettings within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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 LoadBalancingSettingsListResult} 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 _listByFrontDoor(resourceGroupName, frontDoorName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/loadBalancingSettings'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + 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['ErrorResponse']().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['LoadBalancingSettingsListResult']().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 a LoadBalancingSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @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 LoadBalancingSettingsModel} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, frontDoorName, loadBalancingSettingsName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (loadBalancingSettingsName === null || loadBalancingSettingsName === undefined || typeof loadBalancingSettingsName.valueOf() !== 'string') { + throw new Error('loadBalancingSettingsName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancingSettingsName !== null && loadBalancingSettingsName !== undefined) { + if (loadBalancingSettingsName.length > 90) + { + throw new Error('"loadBalancingSettingsName" should satisfy the constraint - "MaxLength": 90'); + } + if (loadBalancingSettingsName.length < 1) + { + throw new Error('"loadBalancingSettingsName" should satisfy the constraint - "MinLength": 1'); + } + if (loadBalancingSettingsName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"loadBalancingSettingsName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/loadBalancingSettings/{loadBalancingSettingsName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{loadBalancingSettingsName}', encodeURIComponent(loadBalancingSettingsName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + 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['ErrorResponse']().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['LoadBalancingSettingsModel']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates a new LoadBalancingSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} loadBalancingSettingsParameters LoadBalancingSettings + * properties needed to create a new Front Door. + * + * @param {number} [loadBalancingSettingsParameters.sampleSize] The number of + * samples to consider for load balancing decisions + * + * @param {number} [loadBalancingSettingsParameters.successfulSamplesRequired] + * The number of samples within the sample period that must succeed + * + * @param {number} + * [loadBalancingSettingsParameters.additionalLatencyMilliseconds] The + * additional latency in milliseconds for probes to fall into the lowest + * latency bucket + * + * @param {string} [loadBalancingSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [loadBalancingSettingsParameters.name] Resource name. + * + * @param {string} [loadBalancingSettingsParameters.id] Resource ID. + * + * @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 LoadBalancingSettingsModel} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancingSettingsModel']().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); + }); + }); +} + + +/** + * Deletes an existing LoadBalancingSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, frontDoorName, loadBalancingSettingsName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, frontDoorName, loadBalancingSettingsName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Creates a new LoadBalancingSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} loadBalancingSettingsParameters LoadBalancingSettings + * properties needed to create a new Front Door. + * + * @param {number} [loadBalancingSettingsParameters.sampleSize] The number of + * samples to consider for load balancing decisions + * + * @param {number} [loadBalancingSettingsParameters.successfulSamplesRequired] + * The number of samples within the sample period that must succeed + * + * @param {number} + * [loadBalancingSettingsParameters.additionalLatencyMilliseconds] The + * additional latency in milliseconds for probes to fall into the lowest + * latency bucket + * + * @param {string} [loadBalancingSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [loadBalancingSettingsParameters.name] Resource name. + * + * @param {string} [loadBalancingSettingsParameters.id] Resource ID. + * + * @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 LoadBalancingSettingsModel} 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 _beginCreateOrUpdate(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (loadBalancingSettingsName === null || loadBalancingSettingsName === undefined || typeof loadBalancingSettingsName.valueOf() !== 'string') { + throw new Error('loadBalancingSettingsName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancingSettingsName !== null && loadBalancingSettingsName !== undefined) { + if (loadBalancingSettingsName.length > 90) + { + throw new Error('"loadBalancingSettingsName" should satisfy the constraint - "MaxLength": 90'); + } + if (loadBalancingSettingsName.length < 1) + { + throw new Error('"loadBalancingSettingsName" should satisfy the constraint - "MinLength": 1'); + } + if (loadBalancingSettingsName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"loadBalancingSettingsName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (loadBalancingSettingsParameters === null || loadBalancingSettingsParameters === undefined) { + throw new Error('loadBalancingSettingsParameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/loadBalancingSettings/{loadBalancingSettingsName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{loadBalancingSettingsName}', encodeURIComponent(loadBalancingSettingsName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (loadBalancingSettingsParameters !== null && loadBalancingSettingsParameters !== undefined) { + let requestModelMapper = new client.models['LoadBalancingSettingsModel']().mapper(); + requestModel = client.serialize(requestModelMapper, loadBalancingSettingsParameters, 'loadBalancingSettingsParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(loadBalancingSettingsParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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['LoadBalancingSettingsModel']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancingSettingsModel']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + // Deserialize Response + if (statusCode === 202) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancingSettingsModel']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError2 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError2.request = msRest.stripRequest(httpRequest); + deserializationError2.response = msRest.stripResponse(response); + return callback(deserializationError2); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes an existing LoadBalancingSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, frontDoorName, loadBalancingSettingsName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (loadBalancingSettingsName === null || loadBalancingSettingsName === undefined || typeof loadBalancingSettingsName.valueOf() !== 'string') { + throw new Error('loadBalancingSettingsName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancingSettingsName !== null && loadBalancingSettingsName !== undefined) { + if (loadBalancingSettingsName.length > 90) + { + throw new Error('"loadBalancingSettingsName" should satisfy the constraint - "MaxLength": 90'); + } + if (loadBalancingSettingsName.length < 1) + { + throw new Error('"loadBalancingSettingsName" should satisfy the constraint - "MinLength": 1'); + } + if (loadBalancingSettingsName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"loadBalancingSettingsName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/loadBalancingSettings/{loadBalancingSettingsName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{loadBalancingSettingsName}', encodeURIComponent(loadBalancingSettingsName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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); + }); +} + +/** + * Lists all of the LoadBalancingSettings within a Front Door. + * + * @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 LoadBalancingSettingsListResult} 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 _listByFrontDoorNext(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) { + 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['ErrorResponse']().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['LoadBalancingSettingsListResult']().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 LoadBalancingSettings. */ +class LoadBalancingSettings { + /** + * Create a LoadBalancingSettings. + * @param {FrontdoorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByFrontDoor = _listByFrontDoor; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._listByFrontDoorNext = _listByFrontDoorNext; + } + + /** + * Lists all of the LoadBalancingSettings within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByFrontDoorWithHttpOperationResponse(resourceGroupName, frontDoorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByFrontDoor(resourceGroupName, frontDoorName, 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 of the LoadBalancingSettings within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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 {LoadBalancingSettingsListResult} - 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 LoadBalancingSettingsListResult} 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. + */ + listByFrontDoor(resourceGroupName, frontDoorName, 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._listByFrontDoor(resourceGroupName, frontDoorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByFrontDoor(resourceGroupName, frontDoorName, options, optionalCallback); + } + } + + /** + * Gets a LoadBalancingSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, frontDoorName, loadBalancingSettingsName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, frontDoorName, loadBalancingSettingsName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a LoadBalancingSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @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 {LoadBalancingSettingsModel} - 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 LoadBalancingSettingsModel} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, frontDoorName, loadBalancingSettingsName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, frontDoorName, loadBalancingSettingsName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, frontDoorName, loadBalancingSettingsName, options, optionalCallback); + } + } + + /** + * Creates a new LoadBalancingSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} loadBalancingSettingsParameters LoadBalancingSettings + * properties needed to create a new Front Door. + * + * @param {number} [loadBalancingSettingsParameters.sampleSize] The number of + * samples to consider for load balancing decisions + * + * @param {number} [loadBalancingSettingsParameters.successfulSamplesRequired] + * The number of samples within the sample period that must succeed + * + * @param {number} + * [loadBalancingSettingsParameters.additionalLatencyMilliseconds] The + * additional latency in milliseconds for probes to fall into the lowest + * latency bucket + * + * @param {string} [loadBalancingSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [loadBalancingSettingsParameters.name] Resource name. + * + * @param {string} [loadBalancingSettingsParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new LoadBalancingSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} loadBalancingSettingsParameters LoadBalancingSettings + * properties needed to create a new Front Door. + * + * @param {number} [loadBalancingSettingsParameters.sampleSize] The number of + * samples to consider for load balancing decisions + * + * @param {number} [loadBalancingSettingsParameters.successfulSamplesRequired] + * The number of samples within the sample period that must succeed + * + * @param {number} + * [loadBalancingSettingsParameters.additionalLatencyMilliseconds] The + * additional latency in milliseconds for probes to fall into the lowest + * latency bucket + * + * @param {string} [loadBalancingSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [loadBalancingSettingsParameters.name] Resource name. + * + * @param {string} [loadBalancingSettingsParameters.id] Resource ID. + * + * @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 {LoadBalancingSettingsModel} - 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 LoadBalancingSettingsModel} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters, options, optionalCallback); + } + } + + /** + * Deletes an existing LoadBalancingSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, frontDoorName, loadBalancingSettingsName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, frontDoorName, loadBalancingSettingsName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes an existing LoadBalancingSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, frontDoorName, loadBalancingSettingsName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, frontDoorName, loadBalancingSettingsName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, frontDoorName, loadBalancingSettingsName, options, optionalCallback); + } + } + + /** + * Creates a new LoadBalancingSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} loadBalancingSettingsParameters LoadBalancingSettings + * properties needed to create a new Front Door. + * + * @param {number} [loadBalancingSettingsParameters.sampleSize] The number of + * samples to consider for load balancing decisions + * + * @param {number} [loadBalancingSettingsParameters.successfulSamplesRequired] + * The number of samples within the sample period that must succeed + * + * @param {number} + * [loadBalancingSettingsParameters.additionalLatencyMilliseconds] The + * additional latency in milliseconds for probes to fall into the lowest + * latency bucket + * + * @param {string} [loadBalancingSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [loadBalancingSettingsParameters.name] Resource name. + * + * @param {string} [loadBalancingSettingsParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new LoadBalancingSettings with the specified Rule name within the + * specified Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} loadBalancingSettingsParameters LoadBalancingSettings + * properties needed to create a new Front Door. + * + * @param {number} [loadBalancingSettingsParameters.sampleSize] The number of + * samples to consider for load balancing decisions + * + * @param {number} [loadBalancingSettingsParameters.successfulSamplesRequired] + * The number of samples within the sample period that must succeed + * + * @param {number} + * [loadBalancingSettingsParameters.additionalLatencyMilliseconds] The + * additional latency in milliseconds for probes to fall into the lowest + * latency bucket + * + * @param {string} [loadBalancingSettingsParameters.resourceState] Resource + * status. Possible values include: 'Creating', 'Enabling', 'Enabled', + * 'Disabling', 'Disabled', 'Deleting' + * + * @param {string} [loadBalancingSettingsParameters.name] Resource name. + * + * @param {string} [loadBalancingSettingsParameters.id] Resource ID. + * + * @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 {LoadBalancingSettingsModel} - 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 LoadBalancingSettingsModel} 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. + */ + beginCreateOrUpdate(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters, 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._beginCreateOrUpdate(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters, options, optionalCallback); + } + } + + /** + * Deletes an existing LoadBalancingSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, frontDoorName, loadBalancingSettingsName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, frontDoorName, loadBalancingSettingsName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes an existing LoadBalancingSettings with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} loadBalancingSettingsName Name of the load balancing + * settings which is unique within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, frontDoorName, loadBalancingSettingsName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, frontDoorName, loadBalancingSettingsName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, frontDoorName, loadBalancingSettingsName, options, optionalCallback); + } + } + + /** + * Lists all of the LoadBalancingSettings within a Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByFrontDoorNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByFrontDoorNext(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 of the LoadBalancingSettings within a Front Door. + * + * @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 {LoadBalancingSettingsListResult} - 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 LoadBalancingSettingsListResult} 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. + */ + listByFrontDoorNext(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._listByFrontDoorNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByFrontDoorNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = LoadBalancingSettings; diff --git a/lib/services/networkManagement2/lib/lib/operations/policies.js b/lib/services/networkManagement2/lib/lib/operations/policies.js new file mode 100644 index 0000000000..a4012ad990 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/policies.js @@ -0,0 +1,1438 @@ +/* + * 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 of the protection policies within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 WebApplicationFirewallPolicyListResult} 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(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-08-01'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + 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['ErrorResponse']().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['WebApplicationFirewallPolicyListResult']().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); + }); +} + +/** + * Retrieve protection policy with specified name within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @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 WebApplicationFirewallPolicy} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, policyName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (policyName === null || policyName === undefined || typeof policyName.valueOf() !== 'string') { + throw new Error('policyName cannot be null or undefined and it must be of type string.'); + } + if (policyName !== null && policyName !== undefined) { + if (policyName.length > 128) + { + throw new Error('"policyName" should satisfy the constraint - "MaxLength": 128'); + } + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{policyName}', encodeURIComponent(policyName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + 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['ErrorResponse']().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['WebApplicationFirewallPolicy']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or update policy with specified ruleset name within a resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @param {object} parameters Policy to be created. + * + * @param {object} [parameters.policySettings] Describes policySettings for + * policy + * + * @param {string} [parameters.policySettings.enabledState] describes if the + * policy is in enabled state or disabled state. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {string} [parameters.policySettings.mode] Describes if it is in + * detection mode or prevention mode at policy level. Possible values include: + * 'Prevention', 'Detection' + * + * @param {object} [parameters.customRules] Describes custom rules inside the + * policy + * + * @param {array} [parameters.customRules.rules] List of rules + * + * @param {object} [parameters.managedRules] Describes managed rules inside the + * policy + * + * @param {array} [parameters.managedRules.ruleSets] List of rules + * + * @param {string} [parameters.etag] Gets a unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @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 WebApplicationFirewallPolicy} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, policyName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-08-01'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (policyName === null || policyName === undefined || typeof policyName.valueOf() !== 'string') { + throw new Error('policyName cannot be null or undefined and it must be of type string.'); + } + if (policyName !== null && policyName !== undefined) { + if (policyName.length > 128) + { + throw new Error('"policyName" should satisfy the constraint - "MaxLength": 128'); + } + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{policyName}', encodeURIComponent(policyName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['WebApplicationFirewallPolicy']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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['WebApplicationFirewallPolicy']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['WebApplicationFirewallPolicy']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Deletes Policy + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, policyName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, policyName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Deletes Policy + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, policyName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (policyName === null || policyName === undefined || typeof policyName.valueOf() !== 'string') { + throw new Error('policyName cannot be null or undefined and it must be of type string.'); + } + if (policyName !== null && policyName !== undefined) { + if (policyName.length > 128) + { + throw new Error('"policyName" should satisfy the constraint - "MaxLength": 128'); + } + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{policyName}', encodeURIComponent(policyName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all of the protection policies within a resource group. + * + * @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 WebApplicationFirewallPolicyListResult} 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) { + 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['ErrorResponse']().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['WebApplicationFirewallPolicyListResult']().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 Policies. */ +class Policies { + /** + * Create a Policies. + * @param {FrontdoorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._beginDeleteMethod = _beginDeleteMethod; + this._listNext = _listNext; + } + + /** + * Lists all of the protection policies within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, 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 of the protection policies within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 {WebApplicationFirewallPolicyListResult} - 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 WebApplicationFirewallPolicyListResult} 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(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, options, optionalCallback); + } + } + + /** + * Retrieve protection policy with specified name within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, policyName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, policyName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve protection policy with specified name within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @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 {WebApplicationFirewallPolicy} - 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 WebApplicationFirewallPolicy} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, policyName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, policyName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, policyName, options, optionalCallback); + } + } + + /** + * Creates or update policy with specified ruleset name within a resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @param {object} parameters Policy to be created. + * + * @param {object} [parameters.policySettings] Describes policySettings for + * policy + * + * @param {string} [parameters.policySettings.enabledState] describes if the + * policy is in enabled state or disabled state. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {string} [parameters.policySettings.mode] Describes if it is in + * detection mode or prevention mode at policy level. Possible values include: + * 'Prevention', 'Detection' + * + * @param {object} [parameters.customRules] Describes custom rules inside the + * policy + * + * @param {array} [parameters.customRules.rules] List of rules + * + * @param {object} [parameters.managedRules] Describes managed rules inside the + * policy + * + * @param {array} [parameters.managedRules.ruleSets] List of rules + * + * @param {string} [parameters.etag] Gets a unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, policyName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, policyName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or update policy with specified ruleset name within a resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @param {object} parameters Policy to be created. + * + * @param {object} [parameters.policySettings] Describes policySettings for + * policy + * + * @param {string} [parameters.policySettings.enabledState] describes if the + * policy is in enabled state or disabled state. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {string} [parameters.policySettings.mode] Describes if it is in + * detection mode or prevention mode at policy level. Possible values include: + * 'Prevention', 'Detection' + * + * @param {object} [parameters.customRules] Describes custom rules inside the + * policy + * + * @param {array} [parameters.customRules.rules] List of rules + * + * @param {object} [parameters.managedRules] Describes managed rules inside the + * policy + * + * @param {array} [parameters.managedRules.ruleSets] List of rules + * + * @param {string} [parameters.etag] Gets a unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @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 {WebApplicationFirewallPolicy} - 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 WebApplicationFirewallPolicy} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, policyName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, policyName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, policyName, parameters, options, optionalCallback); + } + } + + /** + * Deletes Policy + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, policyName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, policyName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes Policy + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, policyName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, policyName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, policyName, options, optionalCallback); + } + } + + /** + * Deletes Policy + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, policyName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, policyName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes Policy + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} policyName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, policyName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, policyName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, policyName, options, optionalCallback); + } + } + + /** + * Lists all of the protection policies within a resource group. + * + * @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} - 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 of the protection policies within a resource group. + * + * @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 {WebApplicationFirewallPolicyListResult} - 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 WebApplicationFirewallPolicyListResult} 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 = Policies; diff --git a/lib/services/networkManagement2/lib/lib/operations/routingRules.js b/lib/services/networkManagement2/lib/lib/operations/routingRules.js new file mode 100644 index 0000000000..de2f82f988 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/routingRules.js @@ -0,0 +1,2068 @@ +/* + * 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 of the Routing Rules within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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 RoutingRuleListResult} 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 _listByFrontDoor(resourceGroupName, frontDoorName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/routingRules'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + 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['ErrorResponse']().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['RoutingRuleListResult']().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 a Routing Rule with the specified Rule name within the specified Front + * Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @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 RoutingRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, frontDoorName, routingRuleName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (routingRuleName === null || routingRuleName === undefined || typeof routingRuleName.valueOf() !== 'string') { + throw new Error('routingRuleName cannot be null or undefined and it must be of type string.'); + } + if (routingRuleName !== null && routingRuleName !== undefined) { + if (routingRuleName.length > 90) + { + throw new Error('"routingRuleName" should satisfy the constraint - "MaxLength": 90'); + } + if (routingRuleName.length < 1) + { + throw new Error('"routingRuleName" should satisfy the constraint - "MinLength": 1'); + } + if (routingRuleName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"routingRuleName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/routingRules/{routingRuleName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{routingRuleName}', encodeURIComponent(routingRuleName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + 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['ErrorResponse']().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['RoutingRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates a new Routing Rule with the specified Rule name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} routingRuleParameters Routing Rule properties needed to + * create a new Front Door. + * + * @param {array} [routingRuleParameters.frontendEndpoints] Frontend endpoints + * associated with this rule + * + * @param {array} [routingRuleParameters.acceptedProtocols] Protocol schemes to + * match for this rule + * + * @param {array} [routingRuleParameters.patternsToMatch] The route patterns of + * the rule. + * + * @param {string} [routingRuleParameters.customForwardingPath] A custom path + * used to rewrite resource paths matched by this rule. Leave empty to use + * incoming path. + * + * @param {string} [routingRuleParameters.forwardingProtocol] Protocol this + * rule will use when forwarding traffic to backends. Possible values include: + * 'HttpOnly', 'HttpsOnly', 'MatchRequest' + * + * @param {object} [routingRuleParameters.cacheConfiguration] The caching + * configuration associated with this rule. + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.queryParameterStripDirective] + * Treatment of URL query terms when forming the cache key. Possible values + * include: 'StripNone', 'StripAll' + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.dynamicCompression] Whether to use + * dynamic compression for cached content. Possible values include: 'Enabled', + * 'Disabled' + * + * @param {object} [routingRuleParameters.backendPool] A reference to the + * BackendPool which this rule routes to. + * + * @param {string} [routingRuleParameters.backendPool.id] Resource ID. + * + * @param {string} [routingRuleParameters.enabledState] Whether to enable use + * of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values + * include: 'Enabled', 'Disabled' + * + * @param {string} [routingRuleParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [routingRuleParameters.name] Resource name. + * + * @param {string} [routingRuleParameters.id] Resource ID. + * + * @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 RoutingRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RoutingRule']().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); + }); + }); +} + + +/** + * Deletes an existing Routing Rule with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, frontDoorName, routingRuleName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, frontDoorName, routingRuleName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Creates a new Routing Rule with the specified Rule name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} routingRuleParameters Routing Rule properties needed to + * create a new Front Door. + * + * @param {array} [routingRuleParameters.frontendEndpoints] Frontend endpoints + * associated with this rule + * + * @param {array} [routingRuleParameters.acceptedProtocols] Protocol schemes to + * match for this rule + * + * @param {array} [routingRuleParameters.patternsToMatch] The route patterns of + * the rule. + * + * @param {string} [routingRuleParameters.customForwardingPath] A custom path + * used to rewrite resource paths matched by this rule. Leave empty to use + * incoming path. + * + * @param {string} [routingRuleParameters.forwardingProtocol] Protocol this + * rule will use when forwarding traffic to backends. Possible values include: + * 'HttpOnly', 'HttpsOnly', 'MatchRequest' + * + * @param {object} [routingRuleParameters.cacheConfiguration] The caching + * configuration associated with this rule. + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.queryParameterStripDirective] + * Treatment of URL query terms when forming the cache key. Possible values + * include: 'StripNone', 'StripAll' + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.dynamicCompression] Whether to use + * dynamic compression for cached content. Possible values include: 'Enabled', + * 'Disabled' + * + * @param {object} [routingRuleParameters.backendPool] A reference to the + * BackendPool which this rule routes to. + * + * @param {string} [routingRuleParameters.backendPool.id] Resource ID. + * + * @param {string} [routingRuleParameters.enabledState] Whether to enable use + * of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values + * include: 'Enabled', 'Disabled' + * + * @param {string} [routingRuleParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [routingRuleParameters.name] Resource name. + * + * @param {string} [routingRuleParameters.id] Resource ID. + * + * @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 RoutingRule} 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 _beginCreateOrUpdate(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (routingRuleName === null || routingRuleName === undefined || typeof routingRuleName.valueOf() !== 'string') { + throw new Error('routingRuleName cannot be null or undefined and it must be of type string.'); + } + if (routingRuleName !== null && routingRuleName !== undefined) { + if (routingRuleName.length > 90) + { + throw new Error('"routingRuleName" should satisfy the constraint - "MaxLength": 90'); + } + if (routingRuleName.length < 1) + { + throw new Error('"routingRuleName" should satisfy the constraint - "MinLength": 1'); + } + if (routingRuleName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"routingRuleName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (routingRuleParameters === null || routingRuleParameters === undefined) { + throw new Error('routingRuleParameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/routingRules/{routingRuleName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{routingRuleName}', encodeURIComponent(routingRuleName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (routingRuleParameters !== null && routingRuleParameters !== undefined) { + let requestModelMapper = new client.models['RoutingRule']().mapper(); + requestModel = client.serialize(requestModelMapper, routingRuleParameters, 'routingRuleParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(routingRuleParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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['RoutingRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RoutingRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + // Deserialize Response + if (statusCode === 202) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RoutingRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError2 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError2.request = msRest.stripRequest(httpRequest); + deserializationError2.response = msRest.stripResponse(response); + return callback(deserializationError2); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes an existing Routing Rule with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, frontDoorName, routingRuleName, 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 apiVersion = '2018-08-01'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 80) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 80'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9_\-\(\)\.]*[^\.]$/'); + } + } + if (frontDoorName === null || frontDoorName === undefined || typeof frontDoorName.valueOf() !== 'string') { + throw new Error('frontDoorName cannot be null or undefined and it must be of type string.'); + } + if (frontDoorName !== null && frontDoorName !== undefined) { + if (frontDoorName.length > 74) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MaxLength": 74'); + } + if (frontDoorName.length < 5) + { + throw new Error('"frontDoorName" should satisfy the constraint - "MinLength": 5'); + } + if (frontDoorName.match(/^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/) === null) + { + throw new Error('"frontDoorName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+([-a-zA-Z0-9][a-zA-Z0-9])$/'); + } + } + if (routingRuleName === null || routingRuleName === undefined || typeof routingRuleName.valueOf() !== 'string') { + throw new Error('routingRuleName cannot be null or undefined and it must be of type string.'); + } + if (routingRuleName !== null && routingRuleName !== undefined) { + if (routingRuleName.length > 90) + { + throw new Error('"routingRuleName" should satisfy the constraint - "MaxLength": 90'); + } + if (routingRuleName.length < 1) + { + throw new Error('"routingRuleName" should satisfy the constraint - "MinLength": 1'); + } + if (routingRuleName.match(/^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/) === null) + { + throw new Error('"routingRuleName" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/routingRules/{routingRuleName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{frontDoorName}', encodeURIComponent(frontDoorName)); + requestUrl = requestUrl.replace('{routingRuleName}', encodeURIComponent(routingRuleName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorResponse']().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); + }); +} + +/** + * Lists all of the Routing Rules within a Front Door. + * + * @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 RoutingRuleListResult} 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 _listByFrontDoorNext(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) { + 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['ErrorResponse']().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['RoutingRuleListResult']().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 RoutingRules. */ +class RoutingRules { + /** + * Create a RoutingRules. + * @param {FrontdoorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByFrontDoor = _listByFrontDoor; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._listByFrontDoorNext = _listByFrontDoorNext; + } + + /** + * Lists all of the Routing Rules within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByFrontDoorWithHttpOperationResponse(resourceGroupName, frontDoorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByFrontDoor(resourceGroupName, frontDoorName, 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 of the Routing Rules within a Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @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 {RoutingRuleListResult} - 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 RoutingRuleListResult} 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. + */ + listByFrontDoor(resourceGroupName, frontDoorName, 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._listByFrontDoor(resourceGroupName, frontDoorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByFrontDoor(resourceGroupName, frontDoorName, options, optionalCallback); + } + } + + /** + * Gets a Routing Rule with the specified Rule name within the specified Front + * Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, frontDoorName, routingRuleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, frontDoorName, routingRuleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a Routing Rule with the specified Rule name within the specified Front + * Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @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 {RoutingRule} - 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 RoutingRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, frontDoorName, routingRuleName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, frontDoorName, routingRuleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, frontDoorName, routingRuleName, options, optionalCallback); + } + } + + /** + * Creates a new Routing Rule with the specified Rule name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} routingRuleParameters Routing Rule properties needed to + * create a new Front Door. + * + * @param {array} [routingRuleParameters.frontendEndpoints] Frontend endpoints + * associated with this rule + * + * @param {array} [routingRuleParameters.acceptedProtocols] Protocol schemes to + * match for this rule + * + * @param {array} [routingRuleParameters.patternsToMatch] The route patterns of + * the rule. + * + * @param {string} [routingRuleParameters.customForwardingPath] A custom path + * used to rewrite resource paths matched by this rule. Leave empty to use + * incoming path. + * + * @param {string} [routingRuleParameters.forwardingProtocol] Protocol this + * rule will use when forwarding traffic to backends. Possible values include: + * 'HttpOnly', 'HttpsOnly', 'MatchRequest' + * + * @param {object} [routingRuleParameters.cacheConfiguration] The caching + * configuration associated with this rule. + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.queryParameterStripDirective] + * Treatment of URL query terms when forming the cache key. Possible values + * include: 'StripNone', 'StripAll' + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.dynamicCompression] Whether to use + * dynamic compression for cached content. Possible values include: 'Enabled', + * 'Disabled' + * + * @param {object} [routingRuleParameters.backendPool] A reference to the + * BackendPool which this rule routes to. + * + * @param {string} [routingRuleParameters.backendPool.id] Resource ID. + * + * @param {string} [routingRuleParameters.enabledState] Whether to enable use + * of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values + * include: 'Enabled', 'Disabled' + * + * @param {string} [routingRuleParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [routingRuleParameters.name] Resource name. + * + * @param {string} [routingRuleParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new Routing Rule with the specified Rule name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} routingRuleParameters Routing Rule properties needed to + * create a new Front Door. + * + * @param {array} [routingRuleParameters.frontendEndpoints] Frontend endpoints + * associated with this rule + * + * @param {array} [routingRuleParameters.acceptedProtocols] Protocol schemes to + * match for this rule + * + * @param {array} [routingRuleParameters.patternsToMatch] The route patterns of + * the rule. + * + * @param {string} [routingRuleParameters.customForwardingPath] A custom path + * used to rewrite resource paths matched by this rule. Leave empty to use + * incoming path. + * + * @param {string} [routingRuleParameters.forwardingProtocol] Protocol this + * rule will use when forwarding traffic to backends. Possible values include: + * 'HttpOnly', 'HttpsOnly', 'MatchRequest' + * + * @param {object} [routingRuleParameters.cacheConfiguration] The caching + * configuration associated with this rule. + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.queryParameterStripDirective] + * Treatment of URL query terms when forming the cache key. Possible values + * include: 'StripNone', 'StripAll' + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.dynamicCompression] Whether to use + * dynamic compression for cached content. Possible values include: 'Enabled', + * 'Disabled' + * + * @param {object} [routingRuleParameters.backendPool] A reference to the + * BackendPool which this rule routes to. + * + * @param {string} [routingRuleParameters.backendPool.id] Resource ID. + * + * @param {string} [routingRuleParameters.enabledState] Whether to enable use + * of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values + * include: 'Enabled', 'Disabled' + * + * @param {string} [routingRuleParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [routingRuleParameters.name] Resource name. + * + * @param {string} [routingRuleParameters.id] Resource ID. + * + * @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 {RoutingRule} - 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 RoutingRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters, options, optionalCallback); + } + } + + /** + * Deletes an existing Routing Rule with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, frontDoorName, routingRuleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, frontDoorName, routingRuleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes an existing Routing Rule with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, frontDoorName, routingRuleName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, frontDoorName, routingRuleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, frontDoorName, routingRuleName, options, optionalCallback); + } + } + + /** + * Creates a new Routing Rule with the specified Rule name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} routingRuleParameters Routing Rule properties needed to + * create a new Front Door. + * + * @param {array} [routingRuleParameters.frontendEndpoints] Frontend endpoints + * associated with this rule + * + * @param {array} [routingRuleParameters.acceptedProtocols] Protocol schemes to + * match for this rule + * + * @param {array} [routingRuleParameters.patternsToMatch] The route patterns of + * the rule. + * + * @param {string} [routingRuleParameters.customForwardingPath] A custom path + * used to rewrite resource paths matched by this rule. Leave empty to use + * incoming path. + * + * @param {string} [routingRuleParameters.forwardingProtocol] Protocol this + * rule will use when forwarding traffic to backends. Possible values include: + * 'HttpOnly', 'HttpsOnly', 'MatchRequest' + * + * @param {object} [routingRuleParameters.cacheConfiguration] The caching + * configuration associated with this rule. + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.queryParameterStripDirective] + * Treatment of URL query terms when forming the cache key. Possible values + * include: 'StripNone', 'StripAll' + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.dynamicCompression] Whether to use + * dynamic compression for cached content. Possible values include: 'Enabled', + * 'Disabled' + * + * @param {object} [routingRuleParameters.backendPool] A reference to the + * BackendPool which this rule routes to. + * + * @param {string} [routingRuleParameters.backendPool.id] Resource ID. + * + * @param {string} [routingRuleParameters.enabledState] Whether to enable use + * of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values + * include: 'Enabled', 'Disabled' + * + * @param {string} [routingRuleParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [routingRuleParameters.name] Resource name. + * + * @param {string} [routingRuleParameters.id] Resource ID. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new Routing Rule with the specified Rule name within the specified + * Front Door. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} routingRuleParameters Routing Rule properties needed to + * create a new Front Door. + * + * @param {array} [routingRuleParameters.frontendEndpoints] Frontend endpoints + * associated with this rule + * + * @param {array} [routingRuleParameters.acceptedProtocols] Protocol schemes to + * match for this rule + * + * @param {array} [routingRuleParameters.patternsToMatch] The route patterns of + * the rule. + * + * @param {string} [routingRuleParameters.customForwardingPath] A custom path + * used to rewrite resource paths matched by this rule. Leave empty to use + * incoming path. + * + * @param {string} [routingRuleParameters.forwardingProtocol] Protocol this + * rule will use when forwarding traffic to backends. Possible values include: + * 'HttpOnly', 'HttpsOnly', 'MatchRequest' + * + * @param {object} [routingRuleParameters.cacheConfiguration] The caching + * configuration associated with this rule. + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.queryParameterStripDirective] + * Treatment of URL query terms when forming the cache key. Possible values + * include: 'StripNone', 'StripAll' + * + * @param {string} + * [routingRuleParameters.cacheConfiguration.dynamicCompression] Whether to use + * dynamic compression for cached content. Possible values include: 'Enabled', + * 'Disabled' + * + * @param {object} [routingRuleParameters.backendPool] A reference to the + * BackendPool which this rule routes to. + * + * @param {string} [routingRuleParameters.backendPool.id] Resource ID. + * + * @param {string} [routingRuleParameters.enabledState] Whether to enable use + * of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values + * include: 'Enabled', 'Disabled' + * + * @param {string} [routingRuleParameters.resourceState] Resource status. + * Possible values include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + * 'Disabled', 'Deleting' + * + * @param {string} [routingRuleParameters.name] Resource name. + * + * @param {string} [routingRuleParameters.id] Resource ID. + * + * @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 {RoutingRule} - 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 RoutingRule} 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. + */ + beginCreateOrUpdate(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters, 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._beginCreateOrUpdate(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters, options, optionalCallback); + } + } + + /** + * Deletes an existing Routing Rule with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, frontDoorName, routingRuleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, frontDoorName, routingRuleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes an existing Routing Rule with the specified parameters. + * + * @param {string} resourceGroupName Name of the Resource group within the + * Azure subscription. + * + * @param {string} frontDoorName Name of the Front Door which is globally + * unique. + * + * @param {string} routingRuleName Name of the Routing Rule which is unique + * within the Front Door. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, frontDoorName, routingRuleName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, frontDoorName, routingRuleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, frontDoorName, routingRuleName, options, optionalCallback); + } + } + + /** + * Lists all of the Routing Rules within a Front Door. + * + * @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} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByFrontDoorNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByFrontDoorNext(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 of the Routing Rules within a Front Door. + * + * @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 {RoutingRuleListResult} - 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 RoutingRuleListResult} 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. + */ + listByFrontDoorNext(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._listByFrontDoorNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByFrontDoorNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = RoutingRules; diff --git a/lib/services/networkManagement2/lib/package.json b/lib/services/networkManagement2/lib/package.json index dd479f1635..c2ea074c61 100644 --- a/lib/services/networkManagement2/lib/package.json +++ b/lib/services/networkManagement2/lib/package.json @@ -1,22 +1,25 @@ { - "name": "azure-arm-network", + "name": "azure-arm-frontdoor", "author": "Microsoft Corporation", - "description": "NetworkManagementClient Library with typescript type definitions for node", - "version": "", + "description": "FrontdoorManagementClient Library with typescript type definitions for node", + "version": "5.2.0", "dependencies": { "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5" }, - "keywords": [ "node", "azure" ], + "keywords": [ + "node", + "azure" + ], "license": "MIT", - "main": "./lib/networkManagementClient.js", - "types": "./lib/networkManagementClient.d.ts", - "homepage": "http://github.com/azure/azure-sdk-for-node", + "main": "./lib/frontdoorManagementClient.js", + "types": "./lib/frontdoorManagementClient.d.ts", + "homepage": "https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/networkManagement2/lib", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-node.git" }, "bugs": { - "url": "http://github.com/Azure/azure-sdk-for-node/issues" + "url": "https://github.com/azure/azure-sdk-for-node/issues" } }