diff --git a/lib/services/datafactoryManagement/lib/models/createLinkedIntegrationRuntimeRequest.js b/lib/services/datafactoryManagement/lib/models/createLinkedIntegrationRuntimeRequest.js new file mode 100644 index 0000000000..b9f5655fa3 --- /dev/null +++ b/lib/services/datafactoryManagement/lib/models/createLinkedIntegrationRuntimeRequest.js @@ -0,0 +1,79 @@ +/* + * 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 linked integration runtime information. + * + */ +class CreateLinkedIntegrationRuntimeRequest { + /** + * Create a CreateLinkedIntegrationRuntimeRequest. + * @member {string} [name] The name of the linked integration runtime. + * @member {string} [subscriptionId] The ID of the subscription that the + * linked integration runtime belongs to. + * @member {string} [dataFactoryName] The name of the data factory that the + * linked integration runtime belongs to. + * @member {string} [dataFactoryLocation] The location of the data factory + * that the linked integration runtime belongs to. + */ + constructor() { + } + + /** + * Defines the metadata of CreateLinkedIntegrationRuntimeRequest + * + * @returns {object} metadata of CreateLinkedIntegrationRuntimeRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'CreateLinkedIntegrationRuntimeRequest', + type: { + name: 'Composite', + className: 'CreateLinkedIntegrationRuntimeRequest', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + subscriptionId: { + required: false, + serializedName: 'subscriptionId', + type: { + name: 'String' + } + }, + dataFactoryName: { + required: false, + serializedName: 'dataFactoryName', + type: { + name: 'String' + } + }, + dataFactoryLocation: { + required: false, + serializedName: 'dataFactoryLocation', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CreateLinkedIntegrationRuntimeRequest; diff --git a/lib/services/datafactoryManagement/lib/models/index.d.ts b/lib/services/datafactoryManagement/lib/models/index.d.ts index 4f9f3f21f8..2a8d18265a 100644 --- a/lib/services/datafactoryManagement/lib/models/index.d.ts +++ b/lib/services/datafactoryManagement/lib/models/index.d.ts @@ -353,6 +353,27 @@ export interface LinkedIntegrationRuntimeRequest { linkedFactoryName: string; } +/** + * @class + * Initializes a new instance of the CreateLinkedIntegrationRuntimeRequest class. + * @constructor + * The linked integration runtime information. + * + * @member {string} [name] The name of the linked integration runtime. + * @member {string} [subscriptionId] The ID of the subscription that the linked + * integration runtime belongs to. + * @member {string} [dataFactoryName] The name of the data factory that the + * linked integration runtime belongs to. + * @member {string} [dataFactoryLocation] The location of the data factory that + * the linked integration runtime belongs to. + */ +export interface CreateLinkedIntegrationRuntimeRequest { + name?: string; + subscriptionId?: string; + dataFactoryName?: string; + dataFactoryLocation?: string; +} + /** * @class * Initializes a new instance of the ParameterSpecification class. @@ -6800,7 +6821,7 @@ export interface LinkedIntegrationRuntime { * @member {date} [lastStartTime] The time the node last started up. * @member {date} [lastStopTime] The integration runtime node last stop time. * @member {string} [lastUpdateResult] The result of the last integration - * runtime node update. Possible values include: 'Succeed', 'Fail' + * runtime node update. Possible values include: 'None', 'Succeed', 'Fail' * @member {date} [lastStartUpdateTime] The last time for the integration * runtime node update start. * @member {date} [lastEndUpdateTime] The last time for the integration runtime @@ -6870,6 +6891,8 @@ export interface SelfHostedIntegrationRuntimeNode { * @member {string} [pushedVersion] The version that the integration runtime is * going to update to. * @member {string} [latestVersion] The latest version on download center. + * @member {date} [autoUpdateETA] The estimated time when the self-hosted + * integration runtime will be updated. */ export interface SelfHostedIntegrationRuntimeStatus extends IntegrationRuntimeStatus { readonly createTime?: Date; @@ -6887,6 +6910,7 @@ export interface SelfHostedIntegrationRuntimeStatus extends IntegrationRuntimeSt links?: LinkedIntegrationRuntime[]; readonly pushedVersion?: string; readonly latestVersion?: string; + readonly autoUpdateETA?: Date; } /** diff --git a/lib/services/datafactoryManagement/lib/models/index.js b/lib/services/datafactoryManagement/lib/models/index.js index dc0dc7ee2c..6bffa44c83 100644 --- a/lib/services/datafactoryManagement/lib/models/index.js +++ b/lib/services/datafactoryManagement/lib/models/index.js @@ -37,6 +37,7 @@ exports.IntegrationRuntimeStatusListResponse = require('./integrationRuntimeStat exports.UpdateIntegrationRuntimeRequest = require('./updateIntegrationRuntimeRequest'); exports.UpdateIntegrationRuntimeNodeRequest = require('./updateIntegrationRuntimeNodeRequest'); exports.LinkedIntegrationRuntimeRequest = require('./linkedIntegrationRuntimeRequest'); +exports.CreateLinkedIntegrationRuntimeRequest = require('./createLinkedIntegrationRuntimeRequest'); exports.ParameterSpecification = require('./parameterSpecification'); exports.LinkedService = require('./linkedService'); exports.LinkedServiceResource = require('./linkedServiceResource'); diff --git a/lib/services/datafactoryManagement/lib/models/selfHostedIntegrationRuntimeNode.js b/lib/services/datafactoryManagement/lib/models/selfHostedIntegrationRuntimeNode.js index 37fdfd315a..1631a5ba75 100644 --- a/lib/services/datafactoryManagement/lib/models/selfHostedIntegrationRuntimeNode.js +++ b/lib/services/datafactoryManagement/lib/models/selfHostedIntegrationRuntimeNode.js @@ -39,7 +39,7 @@ class SelfHostedIntegrationRuntimeNode { * @member {date} [lastStartTime] The time the node last started up. * @member {date} [lastStopTime] The integration runtime node last stop time. * @member {string} [lastUpdateResult] The result of the last integration - * runtime node update. Possible values include: 'Succeed', 'Fail' + * runtime node update. Possible values include: 'None', 'Succeed', 'Fail' * @member {date} [lastStartUpdateTime] The last time for the integration * runtime node update start. * @member {date} [lastEndUpdateTime] The last time for the integration diff --git a/lib/services/datafactoryManagement/lib/models/selfHostedIntegrationRuntimeStatus.js b/lib/services/datafactoryManagement/lib/models/selfHostedIntegrationRuntimeStatus.js index e6c28cd409..90e39520b5 100644 --- a/lib/services/datafactoryManagement/lib/models/selfHostedIntegrationRuntimeStatus.js +++ b/lib/services/datafactoryManagement/lib/models/selfHostedIntegrationRuntimeStatus.js @@ -49,6 +49,8 @@ class SelfHostedIntegrationRuntimeStatus extends models['IntegrationRuntimeStatu * @member {string} [pushedVersion] The version that the integration runtime * is going to update to. * @member {string} [latestVersion] The latest version on download center. + * @member {date} [autoUpdateETA] The estimated time when the self-hosted + * integration runtime will be updated. */ constructor() { super(); @@ -256,6 +258,14 @@ class SelfHostedIntegrationRuntimeStatus extends models['IntegrationRuntimeStatu type: { name: 'String' } + }, + autoUpdateETA: { + required: false, + readOnly: true, + serializedName: 'typeProperties.autoUpdateETA', + type: { + name: 'DateTime' + } } } } diff --git a/lib/services/datafactoryManagement/lib/operations/index.d.ts b/lib/services/datafactoryManagement/lib/operations/index.d.ts index 948d9d23be..7fe94b2e33 100644 --- a/lib/services/datafactoryManagement/lib/operations/index.d.ts +++ b/lib/services/datafactoryManagement/lib/operations/index.d.ts @@ -1833,6 +1833,102 @@ export interface IntegrationRuntimes { removeLinks(resourceGroupName: string, factoryName: string, integrationRuntimeName: string, linkedIntegrationRuntimeRequest: models.LinkedIntegrationRuntimeRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * Create a linked integration runtime entry in a shared integration runtime. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} factoryName The factory name. + * + * @param {string} integrationRuntimeName The integration runtime name. + * + * @param {object} createLinkedIntegrationRuntimeRequest The linked integration + * runtime properties. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.name] The name of the + * linked integration runtime. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.subscriptionId] The + * ID of the subscription that the linked integration runtime belongs to. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.dataFactoryName] The + * name of the data factory that the linked integration runtime belongs to. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.dataFactoryLocation] + * The location of the data factory that the linked integration runtime belongs + * to. + * + * @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. + */ + createLinkedIntegrationRuntimeWithHttpOperationResponse(resourceGroupName: string, factoryName: string, integrationRuntimeName: string, createLinkedIntegrationRuntimeRequest: models.CreateLinkedIntegrationRuntimeRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a linked integration runtime entry in a shared integration runtime. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} factoryName The factory name. + * + * @param {string} integrationRuntimeName The integration runtime name. + * + * @param {object} createLinkedIntegrationRuntimeRequest The linked integration + * runtime properties. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.name] The name of the + * linked integration runtime. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.subscriptionId] The + * ID of the subscription that the linked integration runtime belongs to. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.dataFactoryName] The + * name of the data factory that the linked integration runtime belongs to. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.dataFactoryLocation] + * The location of the data factory that the linked integration runtime belongs + * to. + * + * @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 {IntegrationRuntimeStatusResponse} - 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. + * + * {IntegrationRuntimeStatusResponse} [result] - The deserialized result object if an error did not occur. + * See {@link IntegrationRuntimeStatusResponse} 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. + */ + createLinkedIntegrationRuntime(resourceGroupName: string, factoryName: string, integrationRuntimeName: string, createLinkedIntegrationRuntimeRequest: models.CreateLinkedIntegrationRuntimeRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createLinkedIntegrationRuntime(resourceGroupName: string, factoryName: string, integrationRuntimeName: string, createLinkedIntegrationRuntimeRequest: models.CreateLinkedIntegrationRuntimeRequest, callback: ServiceCallback): void; + createLinkedIntegrationRuntime(resourceGroupName: string, factoryName: string, integrationRuntimeName: string, createLinkedIntegrationRuntimeRequest: models.CreateLinkedIntegrationRuntimeRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Starts a ManagedReserved type integration runtime. * @@ -2026,6 +2122,74 @@ export interface IntegrationRuntimes { export interface IntegrationRuntimeNodes { + /** + * Gets a self-hosted integration runtime node. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} factoryName The factory name. + * + * @param {string} integrationRuntimeName The integration runtime name. + * + * @param {string} nodeName The integration runtime node 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, factoryName: string, integrationRuntimeName: string, nodeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a self-hosted integration runtime node. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} factoryName The factory name. + * + * @param {string} integrationRuntimeName The integration runtime name. + * + * @param {string} nodeName The integration runtime node 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 {SelfHostedIntegrationRuntimeNode} - 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. + * + * {SelfHostedIntegrationRuntimeNode} [result] - The deserialized result object if an error did not occur. + * See {@link SelfHostedIntegrationRuntimeNode} 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, factoryName: string, integrationRuntimeName: string, nodeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, factoryName: string, integrationRuntimeName: string, nodeName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, factoryName: string, integrationRuntimeName: string, nodeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Deletes a self-hosted integration runtime node. * diff --git a/lib/services/datafactoryManagement/lib/operations/integrationRuntimeNodes.js b/lib/services/datafactoryManagement/lib/operations/integrationRuntimeNodes.js index 2baea2efc0..94c3e7a4fc 100644 --- a/lib/services/datafactoryManagement/lib/operations/integrationRuntimeNodes.js +++ b/lib/services/datafactoryManagement/lib/operations/integrationRuntimeNodes.js @@ -14,6 +14,220 @@ const msRest = require('ms-rest'); const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; +/** + * Gets a self-hosted integration runtime node. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} factoryName The factory name. + * + * @param {string} integrationRuntimeName The integration runtime name. + * + * @param {string} nodeName The integration runtime node 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 SelfHostedIntegrationRuntimeNode} 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, factoryName, integrationRuntimeName, nodeName, 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 (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 > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (factoryName === null || factoryName === undefined || typeof factoryName.valueOf() !== 'string') { + throw new Error('factoryName cannot be null or undefined and it must be of type string.'); + } + if (factoryName !== null && factoryName !== undefined) { + if (factoryName.length > 63) + { + throw new Error('"factoryName" should satisfy the constraint - "MaxLength": 63'); + } + if (factoryName.length < 3) + { + throw new Error('"factoryName" should satisfy the constraint - "MinLength": 3'); + } + if (factoryName.match(/^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/) === null) + { + throw new Error('"factoryName" should satisfy the constraint - "Pattern": /^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/'); + } + } + if (integrationRuntimeName === null || integrationRuntimeName === undefined || typeof integrationRuntimeName.valueOf() !== 'string') { + throw new Error('integrationRuntimeName cannot be null or undefined and it must be of type string.'); + } + if (integrationRuntimeName !== null && integrationRuntimeName !== undefined) { + if (integrationRuntimeName.length > 63) + { + throw new Error('"integrationRuntimeName" should satisfy the constraint - "MaxLength": 63'); + } + if (integrationRuntimeName.length < 3) + { + throw new Error('"integrationRuntimeName" should satisfy the constraint - "MinLength": 3'); + } + if (integrationRuntimeName.match(/^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/) === null) + { + throw new Error('"integrationRuntimeName" should satisfy the constraint - "Pattern": /^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/'); + } + } + if (nodeName === null || nodeName === undefined || typeof nodeName.valueOf() !== 'string') { + throw new Error('nodeName cannot be null or undefined and it must be of type string.'); + } + if (nodeName !== null && nodeName !== undefined) { + if (nodeName.length > 150) + { + throw new Error('"nodeName" should satisfy the constraint - "MaxLength": 150'); + } + if (nodeName.length < 1) + { + throw new Error('"nodeName" should satisfy the constraint - "MinLength": 1'); + } + if (nodeName.match(/^[a-z0-9A-Z][a-z0-9A-Z_-]{0,149}$/) === null) + { + throw new Error('"nodeName" should satisfy the constraint - "Pattern": /^[a-z0-9A-Z][a-z0-9A-Z_-]{0,149}$/'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{factoryName}', encodeURIComponent(factoryName)); + requestUrl = requestUrl.replace('{integrationRuntimeName}', encodeURIComponent(integrationRuntimeName)); + requestUrl = requestUrl.replace('{nodeName}', encodeURIComponent(nodeName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SelfHostedIntegrationRuntimeNode']().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 a self-hosted integration runtime node. * @@ -669,11 +883,107 @@ class IntegrationRuntimeNodes { */ constructor(client) { this.client = client; + this._get = _get; this._deleteMethod = _deleteMethod; this._update = _update; this._getIpAddress = _getIpAddress; } + /** + * Gets a self-hosted integration runtime node. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} factoryName The factory name. + * + * @param {string} integrationRuntimeName The integration runtime name. + * + * @param {string} nodeName The integration runtime node 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. + */ + getWithHttpOperationResponse(resourceGroupName, factoryName, integrationRuntimeName, nodeName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, factoryName, integrationRuntimeName, nodeName, 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 self-hosted integration runtime node. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} factoryName The factory name. + * + * @param {string} integrationRuntimeName The integration runtime name. + * + * @param {string} nodeName The integration runtime node 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 {SelfHostedIntegrationRuntimeNode} - 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 SelfHostedIntegrationRuntimeNode} 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, factoryName, integrationRuntimeName, nodeName, 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, factoryName, integrationRuntimeName, nodeName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, factoryName, integrationRuntimeName, nodeName, options, optionalCallback); + } + } + /** * Deletes a self-hosted integration runtime node. * diff --git a/lib/services/datafactoryManagement/lib/operations/integrationRuntimes.js b/lib/services/datafactoryManagement/lib/operations/integrationRuntimes.js index b4ed1c3ab9..4c3876c597 100644 --- a/lib/services/datafactoryManagement/lib/operations/integrationRuntimes.js +++ b/lib/services/datafactoryManagement/lib/operations/integrationRuntimes.js @@ -2718,6 +2718,233 @@ function _removeLinks(resourceGroupName, factoryName, integrationRuntimeName, li }); } +/** + * Create a linked integration runtime entry in a shared integration runtime. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} factoryName The factory name. + * + * @param {string} integrationRuntimeName The integration runtime name. + * + * @param {object} createLinkedIntegrationRuntimeRequest The linked integration + * runtime properties. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.name] The name of the + * linked integration runtime. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.subscriptionId] The + * ID of the subscription that the linked integration runtime belongs to. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.dataFactoryName] The + * name of the data factory that the linked integration runtime belongs to. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.dataFactoryLocation] + * The location of the data factory that the linked integration runtime belongs + * to. + * + * @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 IntegrationRuntimeStatusResponse} 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 _createLinkedIntegrationRuntime(resourceGroupName, factoryName, integrationRuntimeName, createLinkedIntegrationRuntimeRequest, 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 (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 > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (factoryName === null || factoryName === undefined || typeof factoryName.valueOf() !== 'string') { + throw new Error('factoryName cannot be null or undefined and it must be of type string.'); + } + if (factoryName !== null && factoryName !== undefined) { + if (factoryName.length > 63) + { + throw new Error('"factoryName" should satisfy the constraint - "MaxLength": 63'); + } + if (factoryName.length < 3) + { + throw new Error('"factoryName" should satisfy the constraint - "MinLength": 3'); + } + if (factoryName.match(/^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/) === null) + { + throw new Error('"factoryName" should satisfy the constraint - "Pattern": /^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/'); + } + } + if (integrationRuntimeName === null || integrationRuntimeName === undefined || typeof integrationRuntimeName.valueOf() !== 'string') { + throw new Error('integrationRuntimeName cannot be null or undefined and it must be of type string.'); + } + if (integrationRuntimeName !== null && integrationRuntimeName !== undefined) { + if (integrationRuntimeName.length > 63) + { + throw new Error('"integrationRuntimeName" should satisfy the constraint - "MaxLength": 63'); + } + if (integrationRuntimeName.length < 3) + { + throw new Error('"integrationRuntimeName" should satisfy the constraint - "MinLength": 3'); + } + if (integrationRuntimeName.match(/^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/) === null) + { + throw new Error('"integrationRuntimeName" should satisfy the constraint - "Pattern": /^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (createLinkedIntegrationRuntimeRequest === null || createLinkedIntegrationRuntimeRequest === undefined) { + throw new Error('createLinkedIntegrationRuntimeRequest 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.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/linkedIntegrationRuntime'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{factoryName}', encodeURIComponent(factoryName)); + requestUrl = requestUrl.replace('{integrationRuntimeName}', encodeURIComponent(integrationRuntimeName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = '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 (createLinkedIntegrationRuntimeRequest !== null && createLinkedIntegrationRuntimeRequest !== undefined) { + let requestModelMapper = new client.models['CreateLinkedIntegrationRuntimeRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, createLinkedIntegrationRuntimeRequest, 'createLinkedIntegrationRuntimeRequest'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(createLinkedIntegrationRuntimeRequest, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IntegrationRuntimeStatusResponse']().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); + }); +} + /** * Starts a ManagedReserved type integration runtime. * @@ -3238,6 +3465,7 @@ class IntegrationRuntimes { this._getMonitoringData = _getMonitoringData; this._upgrade = _upgrade; this._removeLinks = _removeLinks; + this._createLinkedIntegrationRuntime = _createLinkedIntegrationRuntime; this._beginStart = _beginStart; this._beginStop = _beginStop; this._listByFactoryNext = _listByFactoryNext; @@ -4694,6 +4922,129 @@ class IntegrationRuntimes { } } + /** + * Create a linked integration runtime entry in a shared integration runtime. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} factoryName The factory name. + * + * @param {string} integrationRuntimeName The integration runtime name. + * + * @param {object} createLinkedIntegrationRuntimeRequest The linked integration + * runtime properties. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.name] The name of the + * linked integration runtime. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.subscriptionId] The + * ID of the subscription that the linked integration runtime belongs to. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.dataFactoryName] The + * name of the data factory that the linked integration runtime belongs to. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.dataFactoryLocation] + * The location of the data factory that the linked integration runtime belongs + * to. + * + * @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. + */ + createLinkedIntegrationRuntimeWithHttpOperationResponse(resourceGroupName, factoryName, integrationRuntimeName, createLinkedIntegrationRuntimeRequest, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createLinkedIntegrationRuntime(resourceGroupName, factoryName, integrationRuntimeName, createLinkedIntegrationRuntimeRequest, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a linked integration runtime entry in a shared integration runtime. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} factoryName The factory name. + * + * @param {string} integrationRuntimeName The integration runtime name. + * + * @param {object} createLinkedIntegrationRuntimeRequest The linked integration + * runtime properties. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.name] The name of the + * linked integration runtime. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.subscriptionId] The + * ID of the subscription that the linked integration runtime belongs to. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.dataFactoryName] The + * name of the data factory that the linked integration runtime belongs to. + * + * @param {string} [createLinkedIntegrationRuntimeRequest.dataFactoryLocation] + * The location of the data factory that the linked integration runtime belongs + * to. + * + * @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 {IntegrationRuntimeStatusResponse} - 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 IntegrationRuntimeStatusResponse} 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. + */ + createLinkedIntegrationRuntime(resourceGroupName, factoryName, integrationRuntimeName, createLinkedIntegrationRuntimeRequest, 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._createLinkedIntegrationRuntime(resourceGroupName, factoryName, integrationRuntimeName, createLinkedIntegrationRuntimeRequest, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createLinkedIntegrationRuntime(resourceGroupName, factoryName, integrationRuntimeName, createLinkedIntegrationRuntimeRequest, options, optionalCallback); + } + } + /** * Starts a ManagedReserved type integration runtime. * diff --git a/lib/services/datafactoryManagement/package.json b/lib/services/datafactoryManagement/package.json index 4eb0501b60..ab4f831d29 100644 --- a/lib/services/datafactoryManagement/package.json +++ b/lib/services/datafactoryManagement/package.json @@ -14,7 +14,7 @@ "license": "MIT", "main": "./lib/dataFactoryManagementClient.js", "types": "./lib/dataFactoryManagementClient.d.ts", - "homepage": "https://github.com/azure/azure-sdk-for-node/lib/services/datafactoryManagement", + "homepage": "https://github.com/azure/azure-sdk-for-node", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-node.git"