diff --git a/lib/services/logicManagement/lib/logicManagementClient.d.ts b/lib/services/logicManagement/lib/logicManagementClient.d.ts index 7827a13988..9c6a7d813f 100644 --- a/lib/services/logicManagement/lib/logicManagementClient.d.ts +++ b/lib/services/logicManagement/lib/logicManagementClient.d.ts @@ -8,7 +8,7 @@ * regenerated. */ -import { ServiceClient, ServiceClientOptions, ServiceCallback, HttpOperationResponse, ServiceClientCredentials } from 'ms-rest'; +import { ServiceClientCredentials } from 'ms-rest'; import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; import * as models from "./models"; import * as operations from "./operations"; @@ -59,129 +59,23 @@ export default class LogicManagementClient extends AzureServiceClient { workflows: operations.Workflows; workflowVersions: operations.WorkflowVersions; workflowTriggers: operations.WorkflowTriggers; + workflowVersionTriggers: operations.WorkflowVersionTriggers; workflowTriggerHistories: operations.WorkflowTriggerHistories; workflowRuns: operations.WorkflowRuns; workflowRunActions: operations.WorkflowRunActions; workflowRunActionRepetitions: operations.WorkflowRunActionRepetitions; - workflowRunActionScopedRepetitions: operations.WorkflowRunActionScopedRepetitions; + workflowRunActionScopeRepetitions: operations.WorkflowRunActionScopeRepetitions; workflowRunOperations: operations.WorkflowRunOperations; integrationAccounts: operations.IntegrationAccounts; integrationAccountAssemblies: operations.IntegrationAccountAssemblies; integrationAccountBatchConfigurations: operations.IntegrationAccountBatchConfigurations; - schemas: operations.Schemas; - maps: operations.Maps; - partners: operations.Partners; - agreements: operations.Agreements; - certificates: operations.Certificates; - sessions: operations.Sessions; - - - /** - * Lists all of the available Logic REST API operations. - * - * @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. - */ - listOperationsWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists all of the available Logic REST API operations. - * - * @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 {OperationListResult} - 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. - * - * {OperationListResult} [result] - The deserialized result object if an error did not occur. - * See {@link OperationListResult} 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. - */ - listOperations(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listOperations(callback: ServiceCallback): void; - listOperations(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Lists all of the available Logic REST API operations. - * - * @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. - */ - listOperationsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists all of the available Logic REST API operations. - * - * @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 {OperationListResult} - 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. - * - * {OperationListResult} [result] - The deserialized result object if an error did not occur. - * See {@link OperationListResult} 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. - */ - listOperationsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listOperationsNext(nextPageLink: string, callback: ServiceCallback): void; - listOperationsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + integrationAccountSchemas: operations.IntegrationAccountSchemas; + integrationAccountMaps: operations.IntegrationAccountMaps; + integrationAccountPartners: operations.IntegrationAccountPartners; + integrationAccountAgreements: operations.IntegrationAccountAgreements; + integrationAccountCertificates: operations.IntegrationAccountCertificates; + integrationAccountSessions: operations.IntegrationAccountSessions; + operations: operations.Operations; } export { LogicManagementClient, models as LogicManagementModels }; diff --git a/lib/services/logicManagement/lib/logicManagementClient.js b/lib/services/logicManagement/lib/logicManagementClient.js index e1e9cd790e..5a26bf5fb0 100644 --- a/lib/services/logicManagement/lib/logicManagementClient.js +++ b/lib/services/logicManagement/lib/logicManagementClient.js @@ -17,270 +17,11 @@ 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'); -/** - * Lists all of the available Logic REST API operations. - * - * @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 OperationListResult} 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 _listOperations(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.'); - } - // Validate - try { - if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { - throw new Error('this.apiVersion 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('/') ? '' : '/') + 'providers/Microsoft.Logic/operations'; - let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.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.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]; - } - } - } - 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['OperationListResult']().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 available Logic REST API operations. - * - * @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 OperationListResult} 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 _listOperationsNext(nextPageLink, 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.'); - } - // 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.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 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.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]; - } - } - } - 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['OperationListResult']().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 LogicManagementClient. */ class LogicManagementClient extends ServiceClient { /** @@ -309,7 +50,7 @@ class LogicManagementClient extends ServiceClient { super(credentials, options); - this.apiVersion = '2016-06-01'; + this.apiVersion = '2018-07-01-preview'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; @@ -334,189 +75,27 @@ class LogicManagementClient extends ServiceClient { this.workflows = new operations.Workflows(this); this.workflowVersions = new operations.WorkflowVersions(this); this.workflowTriggers = new operations.WorkflowTriggers(this); + this.workflowVersionTriggers = new operations.WorkflowVersionTriggers(this); this.workflowTriggerHistories = new operations.WorkflowTriggerHistories(this); this.workflowRuns = new operations.WorkflowRuns(this); this.workflowRunActions = new operations.WorkflowRunActions(this); this.workflowRunActionRepetitions = new operations.WorkflowRunActionRepetitions(this); - this.workflowRunActionScopedRepetitions = new operations.WorkflowRunActionScopedRepetitions(this); + this.workflowRunActionScopeRepetitions = new operations.WorkflowRunActionScopeRepetitions(this); this.workflowRunOperations = new operations.WorkflowRunOperations(this); this.integrationAccounts = new operations.IntegrationAccounts(this); this.integrationAccountAssemblies = new operations.IntegrationAccountAssemblies(this); this.integrationAccountBatchConfigurations = new operations.IntegrationAccountBatchConfigurations(this); - this.schemas = new operations.Schemas(this); - this.maps = new operations.Maps(this); - this.partners = new operations.Partners(this); - this.agreements = new operations.Agreements(this); - this.certificates = new operations.Certificates(this); - this.sessions = new operations.Sessions(this); + this.integrationAccountSchemas = new operations.IntegrationAccountSchemas(this); + this.integrationAccountMaps = new operations.IntegrationAccountMaps(this); + this.integrationAccountPartners = new operations.IntegrationAccountPartners(this); + this.integrationAccountAgreements = new operations.IntegrationAccountAgreements(this); + this.integrationAccountCertificates = new operations.IntegrationAccountCertificates(this); + this.integrationAccountSessions = new operations.IntegrationAccountSessions(this); + this.operations = new operations.Operations(this); this.models = models; - this._listOperations = _listOperations; - this._listOperationsNext = _listOperationsNext; msRest.addSerializationMixin(this); } - /** - * Lists all of the available Logic REST API operations. - * - * @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. - */ - listOperationsWithHttpOperationResponse(options) { - let client = this; - let self = this; - return new Promise((resolve, reject) => { - self._listOperations(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 available Logic REST API operations. - * - * @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 {OperationListResult} - 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 OperationListResult} 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. - */ - listOperations(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._listOperations(options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listOperations(options, optionalCallback); - } - } - - /** - * Lists all of the available Logic REST API operations. - * - * @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. - */ - listOperationsNextWithHttpOperationResponse(nextPageLink, options) { - let client = this; - let self = this; - return new Promise((resolve, reject) => { - self._listOperationsNext(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 available Logic REST API operations. - * - * @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 {OperationListResult} - 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 OperationListResult} 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. - */ - listOperationsNext(nextPageLink, 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._listOperationsNext(nextPageLink, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listOperationsNext(nextPageLink, options, optionalCallback); - } - } - } module.exports = LogicManagementClient; diff --git a/lib/services/logicManagement/lib/models/aS2AgreementContent.js b/lib/services/logicManagement/lib/models/aS2AgreementContent.js index 0e4d317b73..4416e9faaf 100644 --- a/lib/services/logicManagement/lib/models/aS2AgreementContent.js +++ b/lib/services/logicManagement/lib/models/aS2AgreementContent.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The integration account AS2 agreement content. * diff --git a/lib/services/logicManagement/lib/models/aS2MdnSettings.js b/lib/services/logicManagement/lib/models/aS2MdnSettings.js index 4b246af231..a53335a89c 100644 --- a/lib/services/logicManagement/lib/models/aS2MdnSettings.js +++ b/lib/services/logicManagement/lib/models/aS2MdnSettings.js @@ -112,8 +112,7 @@ class AS2MdnSettings { required: true, serializedName: 'micHashingAlgorithm', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'None', 'MD5', 'SHA1', 'SHA2256', 'SHA2384', 'SHA2512' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/aS2OneWayAgreement.js b/lib/services/logicManagement/lib/models/aS2OneWayAgreement.js index 22f6c3f81f..18cf1224ca 100644 --- a/lib/services/logicManagement/lib/models/aS2OneWayAgreement.js +++ b/lib/services/logicManagement/lib/models/aS2OneWayAgreement.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The integration account AS2 one-way agreement. * diff --git a/lib/services/logicManagement/lib/models/aS2ProtocolSettings.js b/lib/services/logicManagement/lib/models/aS2ProtocolSettings.js index bf923df1d4..6229d5dbae 100644 --- a/lib/services/logicManagement/lib/models/aS2ProtocolSettings.js +++ b/lib/services/logicManagement/lib/models/aS2ProtocolSettings.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The AS2 agreement protocol settings. * diff --git a/lib/services/logicManagement/lib/models/aS2ValidationSettings.js b/lib/services/logicManagement/lib/models/aS2ValidationSettings.js index 33f6e3445b..629454191f 100644 --- a/lib/services/logicManagement/lib/models/aS2ValidationSettings.js +++ b/lib/services/logicManagement/lib/models/aS2ValidationSettings.js @@ -117,8 +117,7 @@ class AS2ValidationSettings { required: true, serializedName: 'encryptionAlgorithm', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'None', 'DES3', 'RC2', 'AES128', 'AES192', 'AES256' ] + name: 'String' } }, signingAlgorithm: { diff --git a/lib/services/logicManagement/lib/models/accessKeyRegenerateActionDefinition.js b/lib/services/logicManagement/lib/models/accessKeyRegenerateActionDefinition.js index 0da1f80394..764c50725c 100644 --- a/lib/services/logicManagement/lib/models/accessKeyRegenerateActionDefinition.js +++ b/lib/services/logicManagement/lib/models/accessKeyRegenerateActionDefinition.js @@ -40,8 +40,7 @@ class AccessKeyRegenerateActionDefinition { required: true, serializedName: 'keyType', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Primary', 'Secondary' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/agreementContent.js b/lib/services/logicManagement/lib/models/agreementContent.js index 11446b7ba6..c3b500b349 100644 --- a/lib/services/logicManagement/lib/models/agreementContent.js +++ b/lib/services/logicManagement/lib/models/agreementContent.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The integration account agreement content. * diff --git a/lib/services/logicManagement/lib/models/b2BPartnerContent.js b/lib/services/logicManagement/lib/models/b2BPartnerContent.js index 8a2a7bb3ec..96712a3a03 100644 --- a/lib/services/logicManagement/lib/models/b2BPartnerContent.js +++ b/lib/services/logicManagement/lib/models/b2BPartnerContent.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The B2B partner content. * diff --git a/lib/services/logicManagement/lib/models/batchReleaseCriteria.js b/lib/services/logicManagement/lib/models/batchReleaseCriteria.js index eac77b3b46..d6a56c1b02 100644 --- a/lib/services/logicManagement/lib/models/batchReleaseCriteria.js +++ b/lib/services/logicManagement/lib/models/batchReleaseCriteria.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The batch release criteria. * diff --git a/lib/services/logicManagement/lib/models/contentLink.js b/lib/services/logicManagement/lib/models/contentLink.js index 6fd355784d..2e2b5246a3 100644 --- a/lib/services/logicManagement/lib/models/contentLink.js +++ b/lib/services/logicManagement/lib/models/contentLink.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The content link. * diff --git a/lib/services/logicManagement/lib/models/edifactAgreementContent.js b/lib/services/logicManagement/lib/models/edifactAgreementContent.js index fa86e26efd..d5bf566457 100644 --- a/lib/services/logicManagement/lib/models/edifactAgreementContent.js +++ b/lib/services/logicManagement/lib/models/edifactAgreementContent.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The Edifact agreement content. * diff --git a/lib/services/logicManagement/lib/models/edifactDelimiterOverride.js b/lib/services/logicManagement/lib/models/edifactDelimiterOverride.js index 964455ae94..392a9afb88 100644 --- a/lib/services/logicManagement/lib/models/edifactDelimiterOverride.js +++ b/lib/services/logicManagement/lib/models/edifactDelimiterOverride.js @@ -104,16 +104,14 @@ class EdifactDelimiterOverride { required: true, serializedName: 'segmentTerminatorSuffix', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'None', 'CR', 'LF', 'CRLF' ] + name: 'String' } }, decimalPointIndicator: { required: true, serializedName: 'decimalPointIndicator', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Comma', 'Decimal' ] + name: 'String' } }, releaseIndicator: { diff --git a/lib/services/logicManagement/lib/models/edifactFramingSettings.js b/lib/services/logicManagement/lib/models/edifactFramingSettings.js index e0e77f2435..6467082a1e 100644 --- a/lib/services/logicManagement/lib/models/edifactFramingSettings.js +++ b/lib/services/logicManagement/lib/models/edifactFramingSettings.js @@ -113,24 +113,21 @@ class EdifactFramingSettings { required: true, serializedName: 'characterSet', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'UNOB', 'UNOA', 'UNOC', 'UNOD', 'UNOE', 'UNOF', 'UNOG', 'UNOH', 'UNOI', 'UNOJ', 'UNOK', 'UNOX', 'UNOY', 'KECA' ] + name: 'String' } }, decimalPointIndicator: { required: true, serializedName: 'decimalPointIndicator', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Comma', 'Decimal' ] + name: 'String' } }, segmentTerminatorSuffix: { required: true, serializedName: 'segmentTerminatorSuffix', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'None', 'CR', 'LF', 'CRLF' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/edifactMessageFilter.js b/lib/services/logicManagement/lib/models/edifactMessageFilter.js index 4c656113bc..37f1f2c92c 100644 --- a/lib/services/logicManagement/lib/models/edifactMessageFilter.js +++ b/lib/services/logicManagement/lib/models/edifactMessageFilter.js @@ -41,8 +41,7 @@ class EdifactMessageFilter { required: true, serializedName: 'messageFilterType', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Include', 'Exclude' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/edifactOneWayAgreement.js b/lib/services/logicManagement/lib/models/edifactOneWayAgreement.js index a700490615..d86d7f6a06 100644 --- a/lib/services/logicManagement/lib/models/edifactOneWayAgreement.js +++ b/lib/services/logicManagement/lib/models/edifactOneWayAgreement.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The Edifact one way agreement. * diff --git a/lib/services/logicManagement/lib/models/edifactProtocolSettings.js b/lib/services/logicManagement/lib/models/edifactProtocolSettings.js index 0fde9b1911..b2a08f99a8 100644 --- a/lib/services/logicManagement/lib/models/edifactProtocolSettings.js +++ b/lib/services/logicManagement/lib/models/edifactProtocolSettings.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The Edifact agreement protocol settings. * diff --git a/lib/services/logicManagement/lib/models/edifactValidationOverride.js b/lib/services/logicManagement/lib/models/edifactValidationOverride.js index fbce146710..9474a59be7 100644 --- a/lib/services/logicManagement/lib/models/edifactValidationOverride.js +++ b/lib/services/logicManagement/lib/models/edifactValidationOverride.js @@ -89,8 +89,7 @@ class EdifactValidationOverride { required: true, serializedName: 'trailingSeparatorPolicy', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'NotAllowed', 'Optional', 'Mandatory' ] + name: 'String' } }, trimLeadingAndTrailingSpacesAndZeroes: { diff --git a/lib/services/logicManagement/lib/models/edifactValidationSettings.js b/lib/services/logicManagement/lib/models/edifactValidationSettings.js index 4a0e98efe2..d199a25248 100644 --- a/lib/services/logicManagement/lib/models/edifactValidationSettings.js +++ b/lib/services/logicManagement/lib/models/edifactValidationSettings.js @@ -123,8 +123,7 @@ class EdifactValidationSettings { required: true, serializedName: 'trailingSeparatorPolicy', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'NotAllowed', 'Optional', 'Mandatory' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/errorResponse.js b/lib/services/logicManagement/lib/models/errorResponse.js index 2d2b9ddc30..4237e9f11c 100644 --- a/lib/services/logicManagement/lib/models/errorResponse.js +++ b/lib/services/logicManagement/lib/models/errorResponse.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Error response indicates Logic service is not able to process the incoming * request. The error property contains the error details. diff --git a/lib/services/logicManagement/lib/models/expression.js b/lib/services/logicManagement/lib/models/expression.js index 81c0178065..98fdbfb6d2 100644 --- a/lib/services/logicManagement/lib/models/expression.js +++ b/lib/services/logicManagement/lib/models/expression.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Class representing a Expression. */ diff --git a/lib/services/logicManagement/lib/models/getCallbackUrlParameters.js b/lib/services/logicManagement/lib/models/getCallbackUrlParameters.js index 4f333be07a..885a74e49a 100644 --- a/lib/services/logicManagement/lib/models/getCallbackUrlParameters.js +++ b/lib/services/logicManagement/lib/models/getCallbackUrlParameters.js @@ -49,8 +49,7 @@ class GetCallbackUrlParameters { required: false, serializedName: 'keyType', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Primary', 'Secondary' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/index.d.ts b/lib/services/logicManagement/lib/models/index.d.ts index f0b34d165f..404e82af6d 100644 --- a/lib/services/logicManagement/lib/models/index.d.ts +++ b/lib/services/logicManagement/lib/models/index.d.ts @@ -876,7 +876,7 @@ export interface GenerateUpgradedDefinitionParameters { * The integration account sku. * * @member {string} name The sku name. Possible values include: 'NotSpecified', - * 'Free', 'Standard' + * 'Free', 'Basic', 'Standard' */ export interface IntegrationAccountSku { name: string; @@ -891,7 +891,7 @@ export interface IntegrationAccountSku { * @member {object} [properties] The integration account properties. * @member {object} [sku] The sku. * @member {string} [sku.name] The sku name. Possible values include: - * 'NotSpecified', 'Free', 'Standard' + * 'NotSpecified', 'Free', 'Basic', 'Standard' */ export interface IntegrationAccount extends Resource { properties?: any; @@ -997,7 +997,7 @@ export interface IntegrationAccountMapPropertiesParametersSchema { * The integration account map. * * @member {string} mapType The map type. Possible values include: - * 'NotSpecified', 'Xslt' + * 'NotSpecified', 'Xslt', 'Xslt20', 'Xslt30', 'Liquid' * @member {object} [parametersSchema] The parameters schema of integration * account map. * @member {string} [parametersSchema.ref] The reference name. @@ -1035,7 +1035,7 @@ export interface IntegrationAccountMap extends Resource { * The integration account map filter for odata query. * * @member {string} mapType The map type of integration account map. Possible - * values include: 'NotSpecified', 'Xslt' + * values include: 'NotSpecified', 'Xslt', 'Xslt20', 'Xslt30', 'Liquid' */ export interface IntegrationAccountMapFilter { mapType: string; diff --git a/lib/services/logicManagement/lib/models/integrationAccount.js b/lib/services/logicManagement/lib/models/integrationAccount.js index fb18b41896..16c2621136 100644 --- a/lib/services/logicManagement/lib/models/integrationAccount.js +++ b/lib/services/logicManagement/lib/models/integrationAccount.js @@ -23,7 +23,7 @@ class IntegrationAccount extends models['Resource'] { * @member {object} [properties] The integration account properties. * @member {object} [sku] The sku. * @member {string} [sku.name] The sku name. Possible values include: - * 'NotSpecified', 'Free', 'Standard' + * 'NotSpecified', 'Free', 'Basic', 'Standard' */ constructor() { super(); diff --git a/lib/services/logicManagement/lib/models/integrationAccountAgreement.js b/lib/services/logicManagement/lib/models/integrationAccountAgreement.js index 9d4151172d..8d6fbf2571 100644 --- a/lib/services/logicManagement/lib/models/integrationAccountAgreement.js +++ b/lib/services/logicManagement/lib/models/integrationAccountAgreement.js @@ -1640,8 +1640,7 @@ class IntegrationAccountAgreement extends models['Resource'] { required: true, serializedName: 'properties.agreementType', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'AS2', 'X12', 'Edifact' ] + name: 'String' } }, hostPartner: { diff --git a/lib/services/logicManagement/lib/models/integrationAccountAgreementFilter.js b/lib/services/logicManagement/lib/models/integrationAccountAgreementFilter.js index b1cebe500f..d2e7dc6d10 100644 --- a/lib/services/logicManagement/lib/models/integrationAccountAgreementFilter.js +++ b/lib/services/logicManagement/lib/models/integrationAccountAgreementFilter.js @@ -42,8 +42,7 @@ class IntegrationAccountAgreementFilter { required: true, serializedName: 'agreementType', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'AS2', 'X12', 'Edifact' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/integrationAccountMap.js b/lib/services/logicManagement/lib/models/integrationAccountMap.js index d68590bf2b..29aece5a98 100644 --- a/lib/services/logicManagement/lib/models/integrationAccountMap.js +++ b/lib/services/logicManagement/lib/models/integrationAccountMap.js @@ -21,7 +21,7 @@ class IntegrationAccountMap extends models['Resource'] { /** * Create a IntegrationAccountMap. * @member {string} mapType The map type. Possible values include: - * 'NotSpecified', 'Xslt' + * 'NotSpecified', 'Xslt', 'Xslt20', 'Xslt30', 'Liquid' * @member {object} [parametersSchema] The parameters schema of integration * account map. * @member {string} [parametersSchema.ref] The reference name. @@ -108,8 +108,7 @@ class IntegrationAccountMap extends models['Resource'] { required: true, serializedName: 'properties.mapType', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Xslt' ] + name: 'String' } }, parametersSchema: { diff --git a/lib/services/logicManagement/lib/models/integrationAccountMapFilter.js b/lib/services/logicManagement/lib/models/integrationAccountMapFilter.js index 0e66edd189..14b381aab3 100644 --- a/lib/services/logicManagement/lib/models/integrationAccountMapFilter.js +++ b/lib/services/logicManagement/lib/models/integrationAccountMapFilter.js @@ -18,7 +18,7 @@ class IntegrationAccountMapFilter { /** * Create a IntegrationAccountMapFilter. * @member {string} mapType The map type of integration account map. Possible - * values include: 'NotSpecified', 'Xslt' + * values include: 'NotSpecified', 'Xslt', 'Xslt20', 'Xslt30', 'Liquid' */ constructor() { } @@ -41,8 +41,7 @@ class IntegrationAccountMapFilter { required: true, serializedName: 'mapType', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Xslt' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/integrationAccountPartner.js b/lib/services/logicManagement/lib/models/integrationAccountPartner.js index 1fe1a02b43..f252522131 100644 --- a/lib/services/logicManagement/lib/models/integrationAccountPartner.js +++ b/lib/services/logicManagement/lib/models/integrationAccountPartner.js @@ -97,8 +97,7 @@ class IntegrationAccountPartner extends models['Resource'] { required: true, serializedName: 'properties.partnerType', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'B2B' ] + name: 'String' } }, createdTime: { diff --git a/lib/services/logicManagement/lib/models/integrationAccountPartnerFilter.js b/lib/services/logicManagement/lib/models/integrationAccountPartnerFilter.js index 3cf743550d..7c686a59f6 100644 --- a/lib/services/logicManagement/lib/models/integrationAccountPartnerFilter.js +++ b/lib/services/logicManagement/lib/models/integrationAccountPartnerFilter.js @@ -41,8 +41,7 @@ class IntegrationAccountPartnerFilter { required: true, serializedName: 'partnerType', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'B2B' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/integrationAccountSchema.js b/lib/services/logicManagement/lib/models/integrationAccountSchema.js index 831c045dbd..9a93a98f35 100644 --- a/lib/services/logicManagement/lib/models/integrationAccountSchema.js +++ b/lib/services/logicManagement/lib/models/integrationAccountSchema.js @@ -108,8 +108,7 @@ class IntegrationAccountSchema extends models['Resource'] { required: true, serializedName: 'properties.schemaType', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Xml' ] + name: 'String' } }, targetNamespace: { diff --git a/lib/services/logicManagement/lib/models/integrationAccountSchemaFilter.js b/lib/services/logicManagement/lib/models/integrationAccountSchemaFilter.js index c0e48ad4a1..d0a454efc0 100644 --- a/lib/services/logicManagement/lib/models/integrationAccountSchemaFilter.js +++ b/lib/services/logicManagement/lib/models/integrationAccountSchemaFilter.js @@ -41,8 +41,7 @@ class IntegrationAccountSchemaFilter { required: true, serializedName: 'schemaType', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Xml' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/integrationAccountSku.js b/lib/services/logicManagement/lib/models/integrationAccountSku.js index fdf31f2b6d..cd6a1aee76 100644 --- a/lib/services/logicManagement/lib/models/integrationAccountSku.js +++ b/lib/services/logicManagement/lib/models/integrationAccountSku.js @@ -18,7 +18,7 @@ class IntegrationAccountSku { /** * Create a IntegrationAccountSku. * @member {string} name The sku name. Possible values include: - * 'NotSpecified', 'Free', 'Standard' + * 'NotSpecified', 'Free', 'Basic', 'Standard' */ constructor() { } @@ -41,8 +41,7 @@ class IntegrationAccountSku { required: true, serializedName: 'name', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Free', 'Standard' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/keyVaultKey.js b/lib/services/logicManagement/lib/models/keyVaultKey.js index b1ae467199..5fd09e1d50 100644 --- a/lib/services/logicManagement/lib/models/keyVaultKey.js +++ b/lib/services/logicManagement/lib/models/keyVaultKey.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The key vault key. * diff --git a/lib/services/logicManagement/lib/models/keyVaultKeyReference.js b/lib/services/logicManagement/lib/models/keyVaultKeyReference.js index 5843cefd3d..c17885d879 100644 --- a/lib/services/logicManagement/lib/models/keyVaultKeyReference.js +++ b/lib/services/logicManagement/lib/models/keyVaultKeyReference.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The reference to the key vault key. * diff --git a/lib/services/logicManagement/lib/models/listKeyVaultKeysDefinition.js b/lib/services/logicManagement/lib/models/listKeyVaultKeysDefinition.js index bc8934f2c6..51b2b633a2 100644 --- a/lib/services/logicManagement/lib/models/listKeyVaultKeysDefinition.js +++ b/lib/services/logicManagement/lib/models/listKeyVaultKeysDefinition.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The list key vault keys definition. * diff --git a/lib/services/logicManagement/lib/models/operation.js b/lib/services/logicManagement/lib/models/operation.js index cbbb9f1933..8f34d11df4 100644 --- a/lib/services/logicManagement/lib/models/operation.js +++ b/lib/services/logicManagement/lib/models/operation.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Logic REST API operation * diff --git a/lib/services/logicManagement/lib/models/operationResult.js b/lib/services/logicManagement/lib/models/operationResult.js index ea03af1e60..027284d537 100644 --- a/lib/services/logicManagement/lib/models/operationResult.js +++ b/lib/services/logicManagement/lib/models/operationResult.js @@ -91,8 +91,7 @@ class OperationResult extends models['OperationResultProperties'] { required: false, serializedName: 'status', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Paused', 'Running', 'Waiting', 'Succeeded', 'Skipped', 'Suspended', 'Cancelled', 'Failed', 'Faulted', 'TimedOut', 'Aborted', 'Ignored' ] + name: 'String' } }, code: { diff --git a/lib/services/logicManagement/lib/models/operationResultProperties.js b/lib/services/logicManagement/lib/models/operationResultProperties.js index c9938e3c20..89d493ca7d 100644 --- a/lib/services/logicManagement/lib/models/operationResultProperties.js +++ b/lib/services/logicManagement/lib/models/operationResultProperties.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The run operation result properties. * @@ -75,8 +73,7 @@ class OperationResultProperties { required: false, serializedName: 'status', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Paused', 'Running', 'Waiting', 'Succeeded', 'Skipped', 'Suspended', 'Cancelled', 'Failed', 'Faulted', 'TimedOut', 'Aborted', 'Ignored' ] + name: 'String' } }, code: { diff --git a/lib/services/logicManagement/lib/models/partnerContent.js b/lib/services/logicManagement/lib/models/partnerContent.js index bd000c0ce8..592eea7020 100644 --- a/lib/services/logicManagement/lib/models/partnerContent.js +++ b/lib/services/logicManagement/lib/models/partnerContent.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The integration account partner content. * diff --git a/lib/services/logicManagement/lib/models/recurrenceSchedule.js b/lib/services/logicManagement/lib/models/recurrenceSchedule.js index 2348d2e38f..1da312ae06 100644 --- a/lib/services/logicManagement/lib/models/recurrenceSchedule.js +++ b/lib/services/logicManagement/lib/models/recurrenceSchedule.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The recurrence schedule. * @@ -79,8 +77,7 @@ class RecurrenceSchedule { required: false, serializedName: 'DaysOfWeekElementType', type: { - name: 'Enum', - allowedValues: [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/recurrenceScheduleOccurrence.js b/lib/services/logicManagement/lib/models/recurrenceScheduleOccurrence.js index 7f5c6c4d67..a7fc26e83c 100644 --- a/lib/services/logicManagement/lib/models/recurrenceScheduleOccurrence.js +++ b/lib/services/logicManagement/lib/models/recurrenceScheduleOccurrence.js @@ -43,8 +43,7 @@ class RecurrenceScheduleOccurrence { required: false, serializedName: 'day', type: { - name: 'Enum', - allowedValues: [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ] + name: 'String' } }, occurrence: { diff --git a/lib/services/logicManagement/lib/models/regenerateActionParameter.js b/lib/services/logicManagement/lib/models/regenerateActionParameter.js index a91282ddf5..f1129f5797 100644 --- a/lib/services/logicManagement/lib/models/regenerateActionParameter.js +++ b/lib/services/logicManagement/lib/models/regenerateActionParameter.js @@ -41,8 +41,7 @@ class RegenerateActionParameter { required: false, serializedName: 'keyType', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Primary', 'Secondary' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/retryHistory.js b/lib/services/logicManagement/lib/models/retryHistory.js index fb4163bd19..28350a2810 100644 --- a/lib/services/logicManagement/lib/models/retryHistory.js +++ b/lib/services/logicManagement/lib/models/retryHistory.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The retry history. * diff --git a/lib/services/logicManagement/lib/models/setTriggerStateActionDefinition.js b/lib/services/logicManagement/lib/models/setTriggerStateActionDefinition.js index 48edead9f0..11767cb1c0 100644 --- a/lib/services/logicManagement/lib/models/setTriggerStateActionDefinition.js +++ b/lib/services/logicManagement/lib/models/setTriggerStateActionDefinition.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Class representing a SetTriggerStateActionDefinition. */ diff --git a/lib/services/logicManagement/lib/models/sku.js b/lib/services/logicManagement/lib/models/sku.js index d10c6b2d36..e5f4aece11 100644 --- a/lib/services/logicManagement/lib/models/sku.js +++ b/lib/services/logicManagement/lib/models/sku.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The sku type. * @@ -47,8 +45,7 @@ class Sku { required: true, serializedName: 'name', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Free', 'Shared', 'Basic', 'Standard', 'Premium' ] + name: 'String' } }, plan: { diff --git a/lib/services/logicManagement/lib/models/trackingEvent.js b/lib/services/logicManagement/lib/models/trackingEvent.js index e2a9641112..8f867db570 100644 --- a/lib/services/logicManagement/lib/models/trackingEvent.js +++ b/lib/services/logicManagement/lib/models/trackingEvent.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Class representing a TrackingEvent. */ @@ -54,8 +52,7 @@ class TrackingEvent { required: true, serializedName: 'eventLevel', type: { - name: 'Enum', - allowedValues: [ 'LogAlways', 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' ] + name: 'String' } }, eventTime: { @@ -69,8 +66,7 @@ class TrackingEvent { required: true, serializedName: 'recordType', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Custom', 'AS2Message', 'AS2MDN', 'X12Interchange', 'X12FunctionalGroup', 'X12TransactionSet', 'X12InterchangeAcknowledgment', 'X12FunctionalGroupAcknowledgment', 'X12TransactionSetAcknowledgment', 'EdifactInterchange', 'EdifactFunctionalGroup', 'EdifactTransactionSet', 'EdifactInterchangeAcknowledgment', 'EdifactFunctionalGroupAcknowledgment', 'EdifactTransactionSetAcknowledgment' ] + name: 'String' } }, error: { diff --git a/lib/services/logicManagement/lib/models/trackingEventsDefinition.js b/lib/services/logicManagement/lib/models/trackingEventsDefinition.js index 46837098ba..3b745601fb 100644 --- a/lib/services/logicManagement/lib/models/trackingEventsDefinition.js +++ b/lib/services/logicManagement/lib/models/trackingEventsDefinition.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Class representing a TrackingEventsDefinition. */ @@ -51,8 +49,7 @@ class TrackingEventsDefinition { required: false, serializedName: 'trackEventsOptions', type: { - name: 'Enum', - allowedValues: [ 'None', 'DisableSourceInfoEnrich' ] + name: 'String' } }, events: { diff --git a/lib/services/logicManagement/lib/models/workflow.js b/lib/services/logicManagement/lib/models/workflow.js index 889c3b5561..6c9efb8a78 100644 --- a/lib/services/logicManagement/lib/models/workflow.js +++ b/lib/services/logicManagement/lib/models/workflow.js @@ -113,8 +113,7 @@ class Workflow extends models['Resource'] { readOnly: true, serializedName: 'properties.provisioningState', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Moving', 'Updating', 'Registering', 'Registered', 'Unregistering', 'Unregistered', 'Completed' ] + name: 'String' } }, createdTime: { @@ -137,8 +136,7 @@ class Workflow extends models['Resource'] { required: false, serializedName: 'properties.state', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Completed', 'Enabled', 'Disabled', 'Deleted', 'Suspended' ] + name: 'String' } }, version: { diff --git a/lib/services/logicManagement/lib/models/workflowFilter.js b/lib/services/logicManagement/lib/models/workflowFilter.js index 07fe0f7a58..021d23de22 100644 --- a/lib/services/logicManagement/lib/models/workflowFilter.js +++ b/lib/services/logicManagement/lib/models/workflowFilter.js @@ -41,8 +41,7 @@ class WorkflowFilter { required: false, serializedName: 'state', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Completed', 'Enabled', 'Disabled', 'Deleted', 'Suspended' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/workflowOutputParameter.js b/lib/services/logicManagement/lib/models/workflowOutputParameter.js index f56cf96e57..83aa917ad7 100644 --- a/lib/services/logicManagement/lib/models/workflowOutputParameter.js +++ b/lib/services/logicManagement/lib/models/workflowOutputParameter.js @@ -44,8 +44,7 @@ class WorkflowOutputParameter extends models['WorkflowParameter'] { required: false, serializedName: 'type', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'String', 'SecureString', 'Int', 'Float', 'Bool', 'Array', 'Object', 'SecureObject' ] + name: 'String' } }, value: { diff --git a/lib/services/logicManagement/lib/models/workflowParameter.js b/lib/services/logicManagement/lib/models/workflowParameter.js index 25374ba7ad..8971c209bb 100644 --- a/lib/services/logicManagement/lib/models/workflowParameter.js +++ b/lib/services/logicManagement/lib/models/workflowParameter.js @@ -45,8 +45,7 @@ class WorkflowParameter { required: false, serializedName: 'type', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'String', 'SecureString', 'Int', 'Float', 'Bool', 'Array', 'Object', 'SecureObject' ] + name: 'String' } }, value: { diff --git a/lib/services/logicManagement/lib/models/workflowRun.js b/lib/services/logicManagement/lib/models/workflowRun.js index 8e5c011e2e..7e92d6fe4a 100644 --- a/lib/services/logicManagement/lib/models/workflowRun.js +++ b/lib/services/logicManagement/lib/models/workflowRun.js @@ -172,8 +172,7 @@ class WorkflowRun extends models['SubResource'] { readOnly: true, serializedName: 'properties.status', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Paused', 'Running', 'Waiting', 'Succeeded', 'Skipped', 'Suspended', 'Cancelled', 'Failed', 'Faulted', 'TimedOut', 'Aborted', 'Ignored' ] + name: 'String' } }, code: { diff --git a/lib/services/logicManagement/lib/models/workflowRunAction.js b/lib/services/logicManagement/lib/models/workflowRunAction.js index 11ff16fc26..483d3429ac 100644 --- a/lib/services/logicManagement/lib/models/workflowRunAction.js +++ b/lib/services/logicManagement/lib/models/workflowRunAction.js @@ -103,8 +103,7 @@ class WorkflowRunAction extends models['SubResource'] { readOnly: true, serializedName: 'properties.status', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Paused', 'Running', 'Waiting', 'Succeeded', 'Skipped', 'Suspended', 'Cancelled', 'Failed', 'Faulted', 'TimedOut', 'Aborted', 'Ignored' ] + name: 'String' } }, code: { diff --git a/lib/services/logicManagement/lib/models/workflowRunActionFilter.js b/lib/services/logicManagement/lib/models/workflowRunActionFilter.js index 4a72ccd469..a0721a3c1f 100644 --- a/lib/services/logicManagement/lib/models/workflowRunActionFilter.js +++ b/lib/services/logicManagement/lib/models/workflowRunActionFilter.js @@ -43,8 +43,7 @@ class WorkflowRunActionFilter { required: false, serializedName: 'status', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Paused', 'Running', 'Waiting', 'Succeeded', 'Skipped', 'Suspended', 'Cancelled', 'Failed', 'Faulted', 'TimedOut', 'Aborted', 'Ignored' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/workflowRunActionRepetitionDefinition.js b/lib/services/logicManagement/lib/models/workflowRunActionRepetitionDefinition.js index f485d0fed7..0eace5d6de 100644 --- a/lib/services/logicManagement/lib/models/workflowRunActionRepetitionDefinition.js +++ b/lib/services/logicManagement/lib/models/workflowRunActionRepetitionDefinition.js @@ -149,8 +149,7 @@ class WorkflowRunActionRepetitionDefinition extends models['Resource'] { required: false, serializedName: 'properties.status', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Paused', 'Running', 'Waiting', 'Succeeded', 'Skipped', 'Suspended', 'Cancelled', 'Failed', 'Faulted', 'TimedOut', 'Aborted', 'Ignored' ] + name: 'String' } }, code: { diff --git a/lib/services/logicManagement/lib/models/workflowRunFilter.js b/lib/services/logicManagement/lib/models/workflowRunFilter.js index 1f7197008e..30cd61554d 100644 --- a/lib/services/logicManagement/lib/models/workflowRunFilter.js +++ b/lib/services/logicManagement/lib/models/workflowRunFilter.js @@ -43,8 +43,7 @@ class WorkflowRunFilter { required: false, serializedName: 'status', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Paused', 'Running', 'Waiting', 'Succeeded', 'Skipped', 'Suspended', 'Cancelled', 'Failed', 'Faulted', 'TimedOut', 'Aborted', 'Ignored' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/workflowRunTrigger.js b/lib/services/logicManagement/lib/models/workflowRunTrigger.js index 7d5b57d57e..d503a396f9 100644 --- a/lib/services/logicManagement/lib/models/workflowRunTrigger.js +++ b/lib/services/logicManagement/lib/models/workflowRunTrigger.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The workflow run trigger. * @@ -168,8 +166,7 @@ class WorkflowRunTrigger { readOnly: true, serializedName: 'status', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Paused', 'Running', 'Waiting', 'Succeeded', 'Skipped', 'Suspended', 'Cancelled', 'Failed', 'Faulted', 'TimedOut', 'Aborted', 'Ignored' ] + name: 'String' } }, error: { diff --git a/lib/services/logicManagement/lib/models/workflowTrigger.js b/lib/services/logicManagement/lib/models/workflowTrigger.js index 5cc938d242..6b0c50e13a 100644 --- a/lib/services/logicManagement/lib/models/workflowTrigger.js +++ b/lib/services/logicManagement/lib/models/workflowTrigger.js @@ -88,8 +88,7 @@ class WorkflowTrigger extends models['SubResource'] { readOnly: true, serializedName: 'properties.provisioningState', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Moving', 'Updating', 'Registering', 'Registered', 'Unregistering', 'Unregistered', 'Completed' ] + name: 'String' } }, createdTime: { @@ -113,8 +112,7 @@ class WorkflowTrigger extends models['SubResource'] { readOnly: true, serializedName: 'properties.state', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Completed', 'Enabled', 'Disabled', 'Deleted', 'Suspended' ] + name: 'String' } }, status: { @@ -122,8 +120,7 @@ class WorkflowTrigger extends models['SubResource'] { readOnly: true, serializedName: 'properties.status', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Paused', 'Running', 'Waiting', 'Succeeded', 'Skipped', 'Suspended', 'Cancelled', 'Failed', 'Faulted', 'TimedOut', 'Aborted', 'Ignored' ] + name: 'String' } }, lastExecutionTime: { diff --git a/lib/services/logicManagement/lib/models/workflowTriggerCallbackUrl.js b/lib/services/logicManagement/lib/models/workflowTriggerCallbackUrl.js index 07f9efed11..c9f2caf618 100644 --- a/lib/services/logicManagement/lib/models/workflowTriggerCallbackUrl.js +++ b/lib/services/logicManagement/lib/models/workflowTriggerCallbackUrl.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The workflow trigger callback URL. * diff --git a/lib/services/logicManagement/lib/models/workflowTriggerFilter.js b/lib/services/logicManagement/lib/models/workflowTriggerFilter.js index 5da163a44c..3ae76eaf4a 100644 --- a/lib/services/logicManagement/lib/models/workflowTriggerFilter.js +++ b/lib/services/logicManagement/lib/models/workflowTriggerFilter.js @@ -42,8 +42,7 @@ class WorkflowTriggerFilter { required: false, serializedName: 'state', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Completed', 'Enabled', 'Disabled', 'Deleted', 'Suspended' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/workflowTriggerHistory.js b/lib/services/logicManagement/lib/models/workflowTriggerHistory.js index 79a3477c86..6beff6f94a 100644 --- a/lib/services/logicManagement/lib/models/workflowTriggerHistory.js +++ b/lib/services/logicManagement/lib/models/workflowTriggerHistory.js @@ -107,8 +107,7 @@ class WorkflowTriggerHistory extends models['SubResource'] { readOnly: true, serializedName: 'properties.status', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Paused', 'Running', 'Waiting', 'Succeeded', 'Skipped', 'Suspended', 'Cancelled', 'Failed', 'Faulted', 'TimedOut', 'Aborted', 'Ignored' ] + name: 'String' } }, code: { diff --git a/lib/services/logicManagement/lib/models/workflowTriggerHistoryFilter.js b/lib/services/logicManagement/lib/models/workflowTriggerHistoryFilter.js index 306ae90624..cac03cf70d 100644 --- a/lib/services/logicManagement/lib/models/workflowTriggerHistoryFilter.js +++ b/lib/services/logicManagement/lib/models/workflowTriggerHistoryFilter.js @@ -43,8 +43,7 @@ class WorkflowTriggerHistoryFilter { required: false, serializedName: 'status', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Paused', 'Running', 'Waiting', 'Succeeded', 'Skipped', 'Suspended', 'Cancelled', 'Failed', 'Faulted', 'TimedOut', 'Aborted', 'Ignored' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/workflowTriggerRecurrence.js b/lib/services/logicManagement/lib/models/workflowTriggerRecurrence.js index bfdb4a057f..449a8f8f71 100644 --- a/lib/services/logicManagement/lib/models/workflowTriggerRecurrence.js +++ b/lib/services/logicManagement/lib/models/workflowTriggerRecurrence.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The workflow trigger recurrence. * @@ -53,8 +51,7 @@ class WorkflowTriggerRecurrence { required: false, serializedName: 'frequency', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year' ] + name: 'String' } }, interval: { diff --git a/lib/services/logicManagement/lib/models/workflowVersion.js b/lib/services/logicManagement/lib/models/workflowVersion.js index eedd1e5e31..5b120deb11 100644 --- a/lib/services/logicManagement/lib/models/workflowVersion.js +++ b/lib/services/logicManagement/lib/models/workflowVersion.js @@ -123,8 +123,7 @@ class WorkflowVersion extends models['Resource'] { required: false, serializedName: 'properties.state', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Completed', 'Enabled', 'Disabled', 'Deleted', 'Suspended' ] + name: 'String' } }, version: { diff --git a/lib/services/logicManagement/lib/models/x12AgreementContent.js b/lib/services/logicManagement/lib/models/x12AgreementContent.js index f14539b6e0..68ed4bb879 100644 --- a/lib/services/logicManagement/lib/models/x12AgreementContent.js +++ b/lib/services/logicManagement/lib/models/x12AgreementContent.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The X12 agreement content. * diff --git a/lib/services/logicManagement/lib/models/x12DelimiterOverrides.js b/lib/services/logicManagement/lib/models/x12DelimiterOverrides.js index 4543ec7a7d..8419e25d08 100644 --- a/lib/services/logicManagement/lib/models/x12DelimiterOverrides.js +++ b/lib/services/logicManagement/lib/models/x12DelimiterOverrides.js @@ -86,8 +86,7 @@ class X12DelimiterOverrides { required: true, serializedName: 'segmentTerminatorSuffix', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'None', 'CR', 'LF', 'CRLF' ] + name: 'String' } }, replaceCharacter: { diff --git a/lib/services/logicManagement/lib/models/x12EnvelopeOverride.js b/lib/services/logicManagement/lib/models/x12EnvelopeOverride.js index 5d66ce6dcd..09b8cbd432 100644 --- a/lib/services/logicManagement/lib/models/x12EnvelopeOverride.js +++ b/lib/services/logicManagement/lib/models/x12EnvelopeOverride.js @@ -111,16 +111,14 @@ class X12EnvelopeOverride { required: true, serializedName: 'dateFormat', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'CCYYMMDD', 'YYMMDD' ] + name: 'String' } }, timeFormat: { required: true, serializedName: 'timeFormat', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'HHMM', 'HHMMSS', 'HHMMSSdd', 'HHMMSSd' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/x12EnvelopeSettings.js b/lib/services/logicManagement/lib/models/x12EnvelopeSettings.js index 3a2a830b35..595daa586b 100644 --- a/lib/services/logicManagement/lib/models/x12EnvelopeSettings.js +++ b/lib/services/logicManagement/lib/models/x12EnvelopeSettings.js @@ -228,24 +228,21 @@ class X12EnvelopeSettings { required: true, serializedName: 'groupHeaderDateFormat', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'CCYYMMDD', 'YYMMDD' ] + name: 'String' } }, groupHeaderTimeFormat: { required: true, serializedName: 'groupHeaderTimeFormat', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'HHMM', 'HHMMSS', 'HHMMSSdd', 'HHMMSSd' ] + name: 'String' } }, usageIndicator: { required: true, serializedName: 'usageIndicator', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Test', 'Information', 'Production' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/x12FramingSettings.js b/lib/services/logicManagement/lib/models/x12FramingSettings.js index 52008b84c4..a55112394a 100644 --- a/lib/services/logicManagement/lib/models/x12FramingSettings.js +++ b/lib/services/logicManagement/lib/models/x12FramingSettings.js @@ -84,16 +84,14 @@ class X12FramingSettings { required: true, serializedName: 'characterSet', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Basic', 'Extended', 'UTF8' ] + name: 'String' } }, segmentTerminatorSuffix: { required: true, serializedName: 'segmentTerminatorSuffix', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'None', 'CR', 'LF', 'CRLF' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/x12MessageFilter.js b/lib/services/logicManagement/lib/models/x12MessageFilter.js index 4871a81b50..5c9ab0df48 100644 --- a/lib/services/logicManagement/lib/models/x12MessageFilter.js +++ b/lib/services/logicManagement/lib/models/x12MessageFilter.js @@ -41,8 +41,7 @@ class X12MessageFilter { required: true, serializedName: 'messageFilterType', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Include', 'Exclude' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/x12OneWayAgreement.js b/lib/services/logicManagement/lib/models/x12OneWayAgreement.js index a78cf68b3a..a0be05cfb8 100644 --- a/lib/services/logicManagement/lib/models/x12OneWayAgreement.js +++ b/lib/services/logicManagement/lib/models/x12OneWayAgreement.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The X12 one-way agreement. * diff --git a/lib/services/logicManagement/lib/models/x12ProtocolSettings.js b/lib/services/logicManagement/lib/models/x12ProtocolSettings.js index 8f16d070a6..3c4ea4e43e 100644 --- a/lib/services/logicManagement/lib/models/x12ProtocolSettings.js +++ b/lib/services/logicManagement/lib/models/x12ProtocolSettings.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The X12 agreement protocol settings. * diff --git a/lib/services/logicManagement/lib/models/x12ValidationOverride.js b/lib/services/logicManagement/lib/models/x12ValidationOverride.js index 3b339e17fc..4c83ade39e 100644 --- a/lib/services/logicManagement/lib/models/x12ValidationOverride.js +++ b/lib/services/logicManagement/lib/models/x12ValidationOverride.js @@ -96,8 +96,7 @@ class X12ValidationOverride { required: true, serializedName: 'trailingSeparatorPolicy', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'NotAllowed', 'Optional', 'Mandatory' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/models/x12ValidationSettings.js b/lib/services/logicManagement/lib/models/x12ValidationSettings.js index c720977a06..5d09e3a095 100644 --- a/lib/services/logicManagement/lib/models/x12ValidationSettings.js +++ b/lib/services/logicManagement/lib/models/x12ValidationSettings.js @@ -123,8 +123,7 @@ class X12ValidationSettings { required: true, serializedName: 'trailingSeparatorPolicy', type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'NotAllowed', 'Optional', 'Mandatory' ] + name: 'String' } } } diff --git a/lib/services/logicManagement/lib/operations/index.d.ts b/lib/services/logicManagement/lib/operations/index.d.ts index 8bb968e032..6536615d1d 100644 --- a/lib/services/logicManagement/lib/operations/index.d.ts +++ b/lib/services/logicManagement/lib/operations/index.d.ts @@ -998,7 +998,7 @@ export interface Workflows { * * @reject {Error|ServiceError} - The error object. */ - validateWorkflowWithHttpOperationResponse(resourceGroupName: string, workflowName: string, validate: models.Workflow, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + validateByResourceGroupWithHttpOperationResponse(resourceGroupName: string, workflowName: string, validate: models.Workflow, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Validates the workflow. @@ -1055,9 +1055,9 @@ export interface Workflows { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - validateWorkflow(resourceGroupName: string, workflowName: string, validate: models.Workflow, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - validateWorkflow(resourceGroupName: string, workflowName: string, validate: models.Workflow, callback: ServiceCallback): void; - validateWorkflow(resourceGroupName: string, workflowName: string, validate: models.Workflow, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + validateByResourceGroup(resourceGroupName: string, workflowName: string, validate: models.Workflow, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + validateByResourceGroup(resourceGroupName: string, workflowName: string, validate: models.Workflow, callback: ServiceCallback): void; + validateByResourceGroup(resourceGroupName: string, workflowName: string, validate: models.Workflow, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1102,7 +1102,7 @@ export interface Workflows { * * @reject {Error|ServiceError} - The error object. */ - validateWithHttpOperationResponse(resourceGroupName: string, location: string, workflowName: string, workflow: models.Workflow, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + validateByLocationWithHttpOperationResponse(resourceGroupName: string, location: string, workflowName: string, workflow: models.Workflow, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Validates the workflow definition. @@ -1161,9 +1161,9 @@ export interface Workflows { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - validate(resourceGroupName: string, location: string, workflowName: string, workflow: models.Workflow, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - validate(resourceGroupName: string, location: string, workflowName: string, workflow: models.Workflow, callback: ServiceCallback): void; - validate(resourceGroupName: string, location: string, workflowName: string, workflow: models.Workflow, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + validateByLocation(resourceGroupName: string, location: string, workflowName: string, workflow: models.Workflow, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + validateByLocation(resourceGroupName: string, location: string, workflowName: string, workflow: models.Workflow, callback: ServiceCallback): void; + validateByLocation(resourceGroupName: string, location: string, workflowName: string, workflow: models.Workflow, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1418,88 +1418,6 @@ export interface WorkflowVersions { get(resourceGroupName: string, workflowName: string, versionId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - /** - * Get the callback url for a trigger of a workflow version. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} workflowName The workflow name. - * - * @param {string} versionId The workflow versionId. - * - * @param {string} triggerName The workflow trigger name. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.parameters] The callback URL parameters. - * - * @param {date} [options.parameters.notAfter] The expiry time. - * - * @param {string} [options.parameters.keyType] The key type. Possible values - * include: 'NotSpecified', 'Primary', 'Secondary' - * - * @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. - */ - listCallbackUrlWithHttpOperationResponse(resourceGroupName: string, workflowName: string, versionId: string, triggerName: string, options?: { parameters? : models.GetCallbackUrlParameters, customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Get the callback url for a trigger of a workflow version. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} workflowName The workflow name. - * - * @param {string} versionId The workflow versionId. - * - * @param {string} triggerName The workflow trigger name. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.parameters] The callback URL parameters. - * - * @param {date} [options.parameters.notAfter] The expiry time. - * - * @param {string} [options.parameters.keyType] The key type. Possible values - * include: 'NotSpecified', 'Primary', 'Secondary' - * - * @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 {WorkflowTriggerCallbackUrl} - 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. - * - * {WorkflowTriggerCallbackUrl} [result] - The deserialized result object if an error did not occur. - * See {@link WorkflowTriggerCallbackUrl} 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. - */ - listCallbackUrl(resourceGroupName: string, workflowName: string, versionId: string, triggerName: string, options?: { parameters? : models.GetCallbackUrlParameters, customHeaders? : { [headerName: string]: string; } }): Promise; - listCallbackUrl(resourceGroupName: string, workflowName: string, versionId: string, triggerName: string, callback: ServiceCallback): void; - listCallbackUrl(resourceGroupName: string, workflowName: string, versionId: string, triggerName: string, options: { parameters? : models.GetCallbackUrlParameters, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - /** * Gets a list of workflow versions. * @@ -2079,6 +1997,97 @@ export interface WorkflowTriggers { listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } +/** + * @class + * WorkflowVersionTriggers + * __NOTE__: An instance of this class is automatically created for an + * instance of the LogicManagementClient. + */ +export interface WorkflowVersionTriggers { + + + /** + * Get the callback url for a trigger of a workflow version. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} workflowName The workflow name. + * + * @param {string} versionId The workflow versionId. + * + * @param {string} triggerName The workflow trigger name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] The callback URL parameters. + * + * @param {date} [options.parameters.notAfter] The expiry time. + * + * @param {string} [options.parameters.keyType] The key type. Possible values + * include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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. + */ + listCallbackUrlWithHttpOperationResponse(resourceGroupName: string, workflowName: string, versionId: string, triggerName: string, options?: { parameters? : models.GetCallbackUrlParameters, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the callback url for a trigger of a workflow version. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} workflowName The workflow name. + * + * @param {string} versionId The workflow versionId. + * + * @param {string} triggerName The workflow trigger name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] The callback URL parameters. + * + * @param {date} [options.parameters.notAfter] The expiry time. + * + * @param {string} [options.parameters.keyType] The key type. Possible values + * include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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 {WorkflowTriggerCallbackUrl} - 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. + * + * {WorkflowTriggerCallbackUrl} [result] - The deserialized result object if an error did not occur. + * See {@link WorkflowTriggerCallbackUrl} 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. + */ + listCallbackUrl(resourceGroupName: string, workflowName: string, versionId: string, triggerName: string, options?: { parameters? : models.GetCallbackUrlParameters, customHeaders? : { [headerName: string]: string; } }): Promise; + listCallbackUrl(resourceGroupName: string, workflowName: string, versionId: string, triggerName: string, callback: ServiceCallback): void; + listCallbackUrl(resourceGroupName: string, workflowName: string, versionId: string, triggerName: string, options: { parameters? : models.GetCallbackUrlParameters, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + /** * @class * WorkflowTriggerHistories @@ -3122,11 +3131,11 @@ export interface WorkflowRunActionRepetitions { /** * @class - * WorkflowRunActionScopedRepetitions + * WorkflowRunActionScopeRepetitions * __NOTE__: An instance of this class is automatically created for an * instance of the LogicManagementClient. */ -export interface WorkflowRunActionScopedRepetitions { +export interface WorkflowRunActionScopeRepetitions { /** @@ -3549,7 +3558,7 @@ export interface IntegrationAccounts { * @param {object} [integrationAccount.sku] The sku. * * @param {string} integrationAccount.sku.name The sku name. Possible values - * include: 'NotSpecified', 'Free', 'Standard' + * include: 'NotSpecified', 'Free', 'Basic', 'Standard' * * @param {string} [integrationAccount.location] The resource location. * @@ -3583,7 +3592,7 @@ export interface IntegrationAccounts { * @param {object} [integrationAccount.sku] The sku. * * @param {string} integrationAccount.sku.name The sku name. Possible values - * include: 'NotSpecified', 'Free', 'Standard' + * include: 'NotSpecified', 'Free', 'Basic', 'Standard' * * @param {string} [integrationAccount.location] The resource location. * @@ -3636,7 +3645,7 @@ export interface IntegrationAccounts { * @param {object} [integrationAccount.sku] The sku. * * @param {string} integrationAccount.sku.name The sku name. Possible values - * include: 'NotSpecified', 'Free', 'Standard' + * include: 'NotSpecified', 'Free', 'Basic', 'Standard' * * @param {string} [integrationAccount.location] The resource location. * @@ -3670,7 +3679,7 @@ export interface IntegrationAccounts { * @param {object} [integrationAccount.sku] The sku. * * @param {string} integrationAccount.sku.name The sku name. Possible values - * include: 'NotSpecified', 'Free', 'Standard' + * include: 'NotSpecified', 'Free', 'Basic', 'Standard' * * @param {string} [integrationAccount.location] The resource location. * @@ -3791,7 +3800,7 @@ export interface IntegrationAccounts { * * @reject {Error|ServiceError} - The error object. */ - getCallbackUrlWithHttpOperationResponse(resourceGroupName: string, integrationAccountName: string, parameters: models.GetCallbackUrlParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listCallbackUrlWithHttpOperationResponse(resourceGroupName: string, integrationAccountName: string, parameters: models.GetCallbackUrlParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets the integration account callback URL. @@ -3834,9 +3843,9 @@ export interface IntegrationAccounts { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - getCallbackUrl(resourceGroupName: string, integrationAccountName: string, parameters: models.GetCallbackUrlParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getCallbackUrl(resourceGroupName: string, integrationAccountName: string, parameters: models.GetCallbackUrlParameters, callback: ServiceCallback): void; - getCallbackUrl(resourceGroupName: string, integrationAccountName: string, parameters: models.GetCallbackUrlParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listCallbackUrl(resourceGroupName: string, integrationAccountName: string, parameters: models.GetCallbackUrlParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listCallbackUrl(resourceGroupName: string, integrationAccountName: string, parameters: models.GetCallbackUrlParameters, callback: ServiceCallback): void; + listCallbackUrl(resourceGroupName: string, integrationAccountName: string, parameters: models.GetCallbackUrlParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -4998,11 +5007,11 @@ export interface IntegrationAccountBatchConfigurations { /** * @class - * Schemas + * IntegrationAccountSchemas * __NOTE__: An instance of this class is automatically created for an * instance of the LogicManagementClient. */ -export interface Schemas { +export interface IntegrationAccountSchemas { /** @@ -5029,7 +5038,7 @@ export interface Schemas { * * @reject {Error|ServiceError} - The error object. */ - listByIntegrationAccountsWithHttpOperationResponse(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets a list of integration account schemas. @@ -5072,9 +5081,9 @@ export interface Schemas { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, callback: ServiceCallback): void; - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, options: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, integrationAccountName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, integrationAccountName: string, options: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -5404,7 +5413,7 @@ export interface Schemas { * * @reject {Error|ServiceError} - The error object. */ - listByIntegrationAccountsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets a list of integration account schemas. @@ -5440,18 +5449,18 @@ export interface Schemas { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByIntegrationAccountsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByIntegrationAccountsNext(nextPageLink: string, callback: ServiceCallback): void; - listByIntegrationAccountsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + 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; } /** * @class - * Maps + * IntegrationAccountMaps * __NOTE__: An instance of this class is automatically created for an * instance of the LogicManagementClient. */ -export interface Maps { +export interface IntegrationAccountMaps { /** @@ -5478,7 +5487,7 @@ export interface Maps { * * @reject {Error|ServiceError} - The error object. */ - listByIntegrationAccountsWithHttpOperationResponse(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets a list of integration account maps. @@ -5521,9 +5530,9 @@ export interface Maps { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, callback: ServiceCallback): void; - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, options: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, integrationAccountName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, integrationAccountName: string, options: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -5601,7 +5610,7 @@ export interface Maps { * @param {object} map The integration account map. * * @param {string} map.mapType The map type. Possible values include: - * 'NotSpecified', 'Xslt' + * 'NotSpecified', 'Xslt', 'Xslt20', 'Xslt30', 'Liquid' * * @param {object} [map.parametersSchema] The parameters schema of integration * account map. @@ -5643,7 +5652,7 @@ export interface Maps { * @param {object} map The integration account map. * * @param {string} map.mapType The map type. Possible values include: - * 'NotSpecified', 'Xslt' + * 'NotSpecified', 'Xslt', 'Xslt20', 'Xslt30', 'Liquid' * * @param {object} [map.parametersSchema] The parameters schema of integration * account map. @@ -5849,7 +5858,7 @@ export interface Maps { * * @reject {Error|ServiceError} - The error object. */ - listByIntegrationAccountsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets a list of integration account maps. @@ -5885,18 +5894,18 @@ export interface Maps { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByIntegrationAccountsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByIntegrationAccountsNext(nextPageLink: string, callback: ServiceCallback): void; - listByIntegrationAccountsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + 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; } /** * @class - * Partners + * IntegrationAccountPartners * __NOTE__: An instance of this class is automatically created for an * instance of the LogicManagementClient. */ -export interface Partners { +export interface IntegrationAccountPartners { /** @@ -5923,7 +5932,7 @@ export interface Partners { * * @reject {Error|ServiceError} - The error object. */ - listByIntegrationAccountsWithHttpOperationResponse(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets a list of integration account partners. @@ -5966,9 +5975,9 @@ export interface Partners { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, callback: ServiceCallback): void; - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, options: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, integrationAccountName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, integrationAccountName: string, options: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -6292,7 +6301,7 @@ export interface Partners { * * @reject {Error|ServiceError} - The error object. */ - listByIntegrationAccountsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets a list of integration account partners. @@ -6328,18 +6337,18 @@ export interface Partners { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByIntegrationAccountsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByIntegrationAccountsNext(nextPageLink: string, callback: ServiceCallback): void; - listByIntegrationAccountsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + 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; } /** * @class - * Agreements + * IntegrationAccountAgreements * __NOTE__: An instance of this class is automatically created for an * instance of the LogicManagementClient. */ -export interface Agreements { +export interface IntegrationAccountAgreements { /** @@ -6366,7 +6375,7 @@ export interface Agreements { * * @reject {Error|ServiceError} - The error object. */ - listByIntegrationAccountsWithHttpOperationResponse(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets a list of integration account agreements. @@ -6409,9 +6418,9 @@ export interface Agreements { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, callback: ServiceCallback): void; - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, options: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, integrationAccountName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, integrationAccountName: string, options: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -8695,7 +8704,7 @@ export interface Agreements { * * @reject {Error|ServiceError} - The error object. */ - listByIntegrationAccountsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets a list of integration account agreements. @@ -8731,18 +8740,18 @@ export interface Agreements { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByIntegrationAccountsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByIntegrationAccountsNext(nextPageLink: string, callback: ServiceCallback): void; - listByIntegrationAccountsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + 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; } /** * @class - * Certificates + * IntegrationAccountCertificates * __NOTE__: An instance of this class is automatically created for an * instance of the LogicManagementClient. */ -export interface Certificates { +export interface IntegrationAccountCertificates { /** @@ -8766,7 +8775,7 @@ export interface Certificates { * * @reject {Error|ServiceError} - The error object. */ - listByIntegrationAccountsWithHttpOperationResponse(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets a list of integration account certificates. @@ -8806,9 +8815,9 @@ export interface Certificates { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, customHeaders? : { [headerName: string]: string; } }): Promise; - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, callback: ServiceCallback): void; - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, options: { top? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, integrationAccountName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, integrationAccountName: string, options: { top? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -9060,7 +9069,7 @@ export interface Certificates { * * @reject {Error|ServiceError} - The error object. */ - listByIntegrationAccountsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets a list of integration account certificates. @@ -9096,18 +9105,18 @@ export interface Certificates { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByIntegrationAccountsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByIntegrationAccountsNext(nextPageLink: string, callback: ServiceCallback): void; - listByIntegrationAccountsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + 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; } /** * @class - * Sessions + * IntegrationAccountSessions * __NOTE__: An instance of this class is automatically created for an * instance of the LogicManagementClient. */ -export interface Sessions { +export interface IntegrationAccountSessions { /** @@ -9134,7 +9143,7 @@ export interface Sessions { * * @reject {Error|ServiceError} - The error object. */ - listByIntegrationAccountsWithHttpOperationResponse(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets a list of integration account sessions. @@ -9177,9 +9186,9 @@ export interface Sessions { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, callback: ServiceCallback): void; - listByIntegrationAccounts(resourceGroupName: string, integrationAccountName: string, options: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(resourceGroupName: string, integrationAccountName: string, options?: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, integrationAccountName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, integrationAccountName: string, options: { top? : number, filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -9405,7 +9414,7 @@ export interface Sessions { * * @reject {Error|ServiceError} - The error object. */ - listByIntegrationAccountsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets a list of integration account sessions. @@ -9441,7 +9450,124 @@ export interface Sessions { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByIntegrationAccountsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByIntegrationAccountsNext(nextPageLink: string, callback: ServiceCallback): void; - listByIntegrationAccountsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + 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; +} + +/** + * @class + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the LogicManagementClient. + */ +export interface Operations { + + + /** + * Lists all of the available Logic REST API operations. + * + * @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 available Logic REST API operations. + * + * @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 {OperationListResult} - 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. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} 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 available Logic REST API operations. + * + * @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 available Logic REST API operations. + * + * @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 {OperationListResult} - 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. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} 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/logicManagement/lib/operations/index.js b/lib/services/logicManagement/lib/operations/index.js index 36fee3a5e8..dc0ce17904 100644 --- a/lib/services/logicManagement/lib/operations/index.js +++ b/lib/services/logicManagement/lib/operations/index.js @@ -17,18 +17,20 @@ exports.Workflows = require('./workflows'); exports.WorkflowVersions = require('./workflowVersions'); exports.WorkflowTriggers = require('./workflowTriggers'); +exports.WorkflowVersionTriggers = require('./workflowVersionTriggers'); exports.WorkflowTriggerHistories = require('./workflowTriggerHistories'); exports.WorkflowRuns = require('./workflowRuns'); exports.WorkflowRunActions = require('./workflowRunActions'); exports.WorkflowRunActionRepetitions = require('./workflowRunActionRepetitions'); -exports.WorkflowRunActionScopedRepetitions = require('./workflowRunActionScopedRepetitions'); +exports.WorkflowRunActionScopeRepetitions = require('./workflowRunActionScopeRepetitions'); exports.WorkflowRunOperations = require('./workflowRunOperations'); exports.IntegrationAccounts = require('./integrationAccounts'); exports.IntegrationAccountAssemblies = require('./integrationAccountAssemblies'); exports.IntegrationAccountBatchConfigurations = require('./integrationAccountBatchConfigurations'); -exports.Schemas = require('./schemas'); -exports.Maps = require('./maps'); -exports.Partners = require('./partners'); -exports.Agreements = require('./agreements'); -exports.Certificates = require('./certificates'); -exports.Sessions = require('./sessions'); +exports.IntegrationAccountSchemas = require('./integrationAccountSchemas'); +exports.IntegrationAccountMaps = require('./integrationAccountMaps'); +exports.IntegrationAccountPartners = require('./integrationAccountPartners'); +exports.IntegrationAccountAgreements = require('./integrationAccountAgreements'); +exports.IntegrationAccountCertificates = require('./integrationAccountCertificates'); +exports.IntegrationAccountSessions = require('./integrationAccountSessions'); +exports.Operations = require('./operations'); diff --git a/lib/services/logicManagement/lib/operations/integrationAccountAgreements.js b/lib/services/logicManagement/lib/operations/integrationAccountAgreements.js new file mode 100644 index 0000000000..d786a57e40 --- /dev/null +++ b/lib/services/logicManagement/lib/operations/integrationAccountAgreements.js @@ -0,0 +1,4530 @@ +/* + * 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; + +/** + * Gets a list of integration account agreements. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @param {string} [options.filter] The filter to apply on the operation. + * Options for filters include: AgreementType. + * + * @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 IntegrationAccountAgreementListResult} 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, integrationAccountName, 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 top = (options && options.top !== undefined) ? options.top : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + // 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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.Logic/integrationAccounts/{integrationAccountName}/agreements'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + 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['IntegrationAccountAgreementListResult']().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 an integration account agreement. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} agreementName The integration account agreement 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 IntegrationAccountAgreement} 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, integrationAccountName, agreementName, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (agreementName === null || agreementName === undefined || typeof agreementName.valueOf() !== 'string') { + throw new Error('agreementName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{agreementName}', encodeURIComponent(agreementName)); + 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['IntegrationAccountAgreement']().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 updates an integration account agreement. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} agreementName The integration account agreement name. + * + * @param {object} agreement The integration account agreement. + * + * @param {object} [agreement.metadata] The metadata. + * + * @param {string} agreement.agreementType The agreement type. Possible values + * include: 'NotSpecified', 'AS2', 'X12', 'Edifact' + * + * @param {string} agreement.hostPartner The integration account partner that + * is set as host partner for this agreement. + * + * @param {string} agreement.guestPartner The integration account partner that + * is set as guest partner for this agreement. + * + * @param {object} agreement.hostIdentity The business identity of the host + * partner. + * + * @param {object} agreement.guestIdentity The business identity of the guest + * partner. + * + * @param {object} agreement.content The agreement content. + * + * @param {object} [agreement.content.aS2] The AS2 agreement content. + * + * @param {object} agreement.content.aS2.receiveAgreement The AS2 one-way + * receive agreement. + * + * @param {object} agreement.content.aS2.sendAgreement The AS2 one-way send + * agreement. + * + * @param {object} agreement.content.aS2.sendAgreement.senderBusinessIdentity + * The sender business identity + * + * @param {object} agreement.content.aS2.sendAgreement.receiverBusinessIdentity + * The receiver business identity + * + * @param {object} agreement.content.aS2.sendAgreement.protocolSettings The AS2 + * protocol settings. + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.messageConnectionSettings + * The message connection settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.messageConnectionSettings.ignoreCertificateNameMismatch + * The value indicating whether to ignore mismatch in certificate name. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.messageConnectionSettings.supportHttpStatusCodeContinue + * The value indicating whether to support HTTP status code 'CONTINUE'. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.messageConnectionSettings.keepHttpConnectionAlive + * The value indicating whether to keep the connection alive. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.messageConnectionSettings.unfoldHttpHeaders + * The value indicating whether to unfold the HTTP headers. + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.acknowledgementConnectionSettings + * The acknowledgement connection settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.acknowledgementConnectionSettings.ignoreCertificateNameMismatch + * The value indicating whether to ignore mismatch in certificate name. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.acknowledgementConnectionSettings.supportHttpStatusCodeContinue + * The value indicating whether to support HTTP status code 'CONTINUE'. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.acknowledgementConnectionSettings.keepHttpConnectionAlive + * The value indicating whether to keep the connection alive. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.acknowledgementConnectionSettings.unfoldHttpHeaders + * The value indicating whether to unfold the HTTP headers. + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings The MDN + * settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.needMdn The + * value indicating whether to send or request a MDN. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.signMdn The + * value indicating whether the MDN needs to be signed or not. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.sendMdnAsynchronously + * The value indicating whether to send the asynchronous MDN. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.receiptDeliveryUrl] + * The receipt delivery URL. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.dispositionNotificationTo] + * The disposition notification to header value. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.signOutboundMdnIfOptional + * The value indicating whether to sign the outbound MDN if optional. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.mdnText] + * The MDN text. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.sendInboundMdnToMessageBox + * The value indicating whether to send inbound MDN to message box. + * + * @param {string} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.micHashingAlgorithm + * The signing or hashing algorithm. Possible values include: 'NotSpecified', + * 'None', 'MD5', 'SHA1', 'SHA2256', 'SHA2384', 'SHA2512' + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings The + * security settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.overrideGroupSigningCertificate + * The value indicating whether to send or request a MDN. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.signingCertificateName] + * The name of the signing certificate. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.encryptionCertificateName] + * The name of the encryption certificate. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForInboundEncodedMessages + * The value indicating whether to enable NRR for inbound encoded messages. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForInboundDecodedMessages + * The value indicating whether to enable NRR for inbound decoded messages. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForOutboundMdn + * The value indicating whether to enable NRR for outbound MDN. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForOutboundEncodedMessages + * The value indicating whether to enable NRR for outbound encoded messages. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForOutboundDecodedMessages + * The value indicating whether to enable NRR for outbound decoded messages. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForInboundMdn + * The value indicating whether to enable NRR for inbound MDN. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.sha2AlgorithmFormat] + * The Sha2 algorithm format. Valid values are Sha2, ShaHashSize, + * ShaHyphenHashSize, Sha2UnderscoreHashSize. + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings The + * validation settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.overrideMessageProperties + * The value indicating whether to override incoming message properties with + * those in agreement. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.encryptMessage + * The value indicating whether the message has to be encrypted. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.signMessage + * The value indicating whether the message has to be signed. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.compressMessage + * The value indicating whether the message has to be compressed. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.checkDuplicateMessage + * The value indicating whether to check for duplicate message. + * + * @param {number} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.interchangeDuplicatesValidityDays + * The number of days to look back for duplicate interchange. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.checkCertificateRevocationListOnSend + * The value indicating whether to check for certificate revocation list on + * send. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.checkCertificateRevocationListOnReceive + * The value indicating whether to check for certificate revocation list on + * receive. + * + * @param {string} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.encryptionAlgorithm + * The encryption algorithm. Possible values include: 'NotSpecified', 'None', + * 'DES3', 'RC2', 'AES128', 'AES192', 'AES256' + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.signingAlgorithm] + * The signing algorithm. Possible values include: 'NotSpecified', 'Default', + * 'SHA1', 'SHA2256', 'SHA2384', 'SHA2512' + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings The + * envelope settings. + * + * @param {string} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings.messageContentType + * The message content type. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings.transmitFileNameInMimeHeader + * The value indicating whether to transmit file name in mime header. + * + * @param {string} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings.fileNameTemplate + * The template for file name. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings.suspendMessageOnFileNameGenerationError + * The value indicating whether to suspend message on file name generation + * error. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings.autogenerateFileName + * The value indicating whether to auto generate file name. + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.errorSettings The error + * settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.errorSettings.suspendDuplicateMessage + * The value indicating whether to suspend duplicate message. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.errorSettings.resendIfMdnNotReceived + * The value indicating whether to resend message If MDN is not received. + * + * @param {object} [agreement.content.x12] The X12 agreement content. + * + * @param {object} agreement.content.x12.receiveAgreement The X12 one-way + * receive agreement. + * + * @param {object} agreement.content.x12.sendAgreement The X12 one-way send + * agreement. + * + * @param {object} agreement.content.x12.sendAgreement.senderBusinessIdentity + * The sender business identity + * + * @param {object} agreement.content.x12.sendAgreement.receiverBusinessIdentity + * The receiver business identity + * + * @param {object} agreement.content.x12.sendAgreement.protocolSettings The X12 + * protocol settings. + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings The + * X12 validation settings. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.validateCharacterSet + * The value indicating whether to validate character set in the message. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.checkDuplicateInterchangeControlNumber + * The value indicating whether to check for duplicate interchange control + * number. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.interchangeControlNumberValidityDays + * The validity period of interchange control number. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.checkDuplicateGroupControlNumber + * The value indicating whether to check for duplicate group control number. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.checkDuplicateTransactionSetControlNumber + * The value indicating whether to check for duplicate transaction set control + * number. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.validateEdiTypes + * The value indicating whether to Whether to validate EDI types. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.validateXsdTypes + * The value indicating whether to Whether to validate XSD types. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.allowLeadingAndTrailingSpacesAndZeroes + * The value indicating whether to allow leading and trailing spaces and + * zeroes. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.trimLeadingAndTrailingSpacesAndZeroes + * The value indicating whether to trim leading and trailing spaces and zeroes. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.trailingSeparatorPolicy + * The trailing separator policy. Possible values include: 'NotSpecified', + * 'NotAllowed', 'Optional', 'Mandatory' + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings The X12 + * framing settings. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.dataElementSeparator + * The data element separator. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.componentSeparator + * The component separator. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.replaceSeparatorsInPayload + * The value indicating whether to replace separators in payload. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.replaceCharacter + * The replacement character. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.segmentTerminator + * The segment terminator. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.characterSet + * The X12 character set. Possible values include: 'NotSpecified', 'Basic', + * 'Extended', 'UTF8' + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.segmentTerminatorSuffix + * The segment terminator suffix. Possible values include: 'NotSpecified', + * 'None', 'CR', 'LF', 'CRLF' + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings The + * X12 envelope settings. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.controlStandardsId + * The controls standards id. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.useControlStandardsIdAsRepetitionCharacter + * The value indicating whether to use control standards id as repetition + * character. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.senderApplicationId + * The sender application id. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.receiverApplicationId + * The receiver application id. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.controlVersionNumber + * The control version number. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberLowerBound + * The interchange control number lower bound. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberUpperBound + * The interchange control number upper bound. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.rolloverInterchangeControlNumber + * The value indicating whether to rollover interchange control number. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.enableDefaultGroupHeaders + * The value indicating whether to enable default group headers. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.functionalGroupId] + * The functional group id. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberLowerBound + * The group control number lower bound. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberUpperBound + * The group control number upper bound. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.rolloverGroupControlNumber + * The value indicating whether to rollover group control number. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupHeaderAgencyCode + * The group header agency code. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupHeaderVersion + * The group header version. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberLowerBound + * The transaction set control number lower bound. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberUpperBound + * The transaction set control number upper bound. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.rolloverTransactionSetControlNumber + * The value indicating whether to rollover transaction set control number. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberPrefix] + * The transaction set control number prefix. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberSuffix] + * The transaction set control number suffix. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.overwriteExistingTransactionSetControlNumber + * The value indicating whether to overwrite existing transaction set control + * number. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupHeaderDateFormat + * The group header date format. Possible values include: 'NotSpecified', + * 'CCYYMMDD', 'YYMMDD' + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupHeaderTimeFormat + * The group header time format. Possible values include: 'NotSpecified', + * 'HHMM', 'HHMMSS', 'HHMMSSdd', 'HHMMSSd' + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.usageIndicator + * The usage indicator. Possible values include: 'NotSpecified', 'Test', + * 'Information', 'Production' + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings + * The X12 acknowledgment settings. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.needTechnicalAcknowledgement + * The value indicating whether technical acknowledgement is needed. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.batchTechnicalAcknowledgements + * The value indicating whether to batch the technical acknowledgements. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.needFunctionalAcknowledgement + * The value indicating whether functional acknowledgement is needed. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.functionalAcknowledgementVersion] + * The functional acknowledgement version. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.batchFunctionalAcknowledgements + * The value indicating whether to batch functional acknowledgements. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.needImplementationAcknowledgement + * The value indicating whether implementation acknowledgement is needed. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.implementationAcknowledgementVersion] + * The implementation acknowledgement version. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.batchImplementationAcknowledgements + * The value indicating whether to batch implementation acknowledgements. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.needLoopForValidMessages + * The value indicating whether a loop is needed for valid messages. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.sendSynchronousAcknowledgement + * The value indicating whether to send synchronous acknowledgement. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberPrefix] + * The acknowledgement control number prefix. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberSuffix] + * The acknowledgement control number suffix. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberLowerBound + * The acknowledgement control number lower bound. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberUpperBound + * The acknowledgement control number upper bound. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.rolloverAcknowledgementControlNumber + * The value indicating whether to rollover acknowledgement control number. + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.messageFilter The X12 + * message filter. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.messageFilter.messageFilterType + * The message filter type. Possible values include: 'NotSpecified', 'Include', + * 'Exclude' + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.securitySettings The + * X12 security settings. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.securitySettings.authorizationQualifier + * The authorization qualifier. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.securitySettings.authorizationValue] + * The authorization value. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.securitySettings.securityQualifier + * The security qualifier. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.securitySettings.passwordValue] + * The password value. + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings The + * X12 processing settings. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.maskSecurityInfo + * The value indicating whether to mask security information. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.convertImpliedDecimal + * The value indicating whether to convert numerical type to implied decimal. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.preserveInterchange + * The value indicating whether to preserve interchange. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.suspendInterchangeOnError + * The value indicating whether to suspend interchange on error. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.createEmptyXmlTagsForTrailingSeparators + * The value indicating whether to create empty xml tags for trailing + * separators. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.useDotAsDecimalSeparator + * The value indicating whether to use dot as decimal separator. + * + * @param {array} + * [agreement.content.x12.sendAgreement.protocolSettings.envelopeOverrides] The + * X12 envelope override settings. + * + * @param {array} + * [agreement.content.x12.sendAgreement.protocolSettings.validationOverrides] + * The X12 validation override settings. + * + * @param {array} + * [agreement.content.x12.sendAgreement.protocolSettings.messageFilterList] The + * X12 message filter list. + * + * @param {array} + * agreement.content.x12.sendAgreement.protocolSettings.schemaReferences The + * X12 schema references. + * + * @param {array} + * [agreement.content.x12.sendAgreement.protocolSettings.x12DelimiterOverrides] + * The X12 delimiter override settings. + * + * @param {object} [agreement.content.edifact] The EDIFACT agreement content. + * + * @param {object} agreement.content.edifact.receiveAgreement The EDIFACT + * one-way receive agreement. + * + * @param {object} agreement.content.edifact.sendAgreement The EDIFACT one-way + * send agreement. + * + * @param {object} + * agreement.content.edifact.sendAgreement.senderBusinessIdentity The sender + * business identity + * + * @param {object} + * agreement.content.edifact.sendAgreement.receiverBusinessIdentity The + * receiver business identity + * + * @param {string} + * agreement.content.edifact.sendAgreement.receiverBusinessIdentity.qualifier + * The business identity qualifier e.g. as2identity, ZZ, ZZZ, 31, 32 + * + * @param {string} + * agreement.content.edifact.sendAgreement.receiverBusinessIdentity.value The + * user defined business identity value. + * + * @param {object} agreement.content.edifact.sendAgreement.protocolSettings The + * EDIFACT protocol settings. + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings + * The EDIFACT validation settings. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.validateCharacterSet + * The value indicating whether to validate character set in the message. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.checkDuplicateInterchangeControlNumber + * The value indicating whether to check for duplicate interchange control + * number. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.interchangeControlNumberValidityDays + * The validity period of interchange control number. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.checkDuplicateGroupControlNumber + * The value indicating whether to check for duplicate group control number. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.checkDuplicateTransactionSetControlNumber + * The value indicating whether to check for duplicate transaction set control + * number. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.validateEdiTypes + * The value indicating whether to Whether to validate EDI types. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.validateXsdTypes + * The value indicating whether to Whether to validate XSD types. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.allowLeadingAndTrailingSpacesAndZeroes + * The value indicating whether to allow leading and trailing spaces and + * zeroes. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.trimLeadingAndTrailingSpacesAndZeroes + * The value indicating whether to trim leading and trailing spaces and zeroes. + * + * @param {string} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.trailingSeparatorPolicy + * The trailing separator policy. Possible values include: 'NotSpecified', + * 'NotAllowed', 'Optional', 'Mandatory' + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings The + * EDIFACT framing settings. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.serviceCodeListDirectoryVersion] + * The service code list directory version. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.characterEncoding] + * The character encoding. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.protocolVersion + * The protocol version. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.dataElementSeparator + * The data element separator. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.componentSeparator + * The component separator. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.segmentTerminator + * The segment terminator. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.releaseIndicator + * The release indicator. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.repetitionSeparator + * The repetition separator. + * + * @param {string} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.characterSet + * The EDIFACT frame setting characterSet. Possible values include: + * 'NotSpecified', 'UNOB', 'UNOA', 'UNOC', 'UNOD', 'UNOE', 'UNOF', 'UNOG', + * 'UNOH', 'UNOI', 'UNOJ', 'UNOK', 'UNOX', 'UNOY', 'KECA' + * + * @param {string} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.decimalPointIndicator + * The EDIFACT frame setting decimal indicator. Possible values include: + * 'NotSpecified', 'Comma', 'Decimal' + * + * @param {string} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.segmentTerminatorSuffix + * The EDIFACT frame setting segment terminator suffix. Possible values + * include: 'NotSpecified', 'None', 'CR', 'LF', 'CRLF' + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings + * The EDIFACT envelope settings. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupAssociationAssignedCode] + * The group association assigned code. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.communicationAgreementId] + * The communication agreement id. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.applyDelimiterStringAdvice + * The value indicating whether to apply delimiter string advice. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.createGroupingSegments + * The value indicating whether to create grouping segments. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.enableDefaultGroupHeaders + * The value indicating whether to enable default group headers. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.recipientReferencePasswordValue] + * The recipient reference password value. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.recipientReferencePasswordQualifier] + * The recipient reference password qualifier. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.applicationReferenceId] + * The application reference id. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.processingPriorityCode] + * The processing priority code. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberLowerBound + * The interchange control number lower bound. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberUpperBound + * The interchange control number upper bound. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.rolloverInterchangeControlNumber + * The value indicating whether to rollover interchange control number. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberPrefix] + * The interchange control number prefix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberSuffix] + * The interchange control number suffix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.senderReverseRoutingAddress] + * The sender reverse routing address. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.receiverReverseRoutingAddress] + * The receiver reverse routing address. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.functionalGroupId] + * The functional group id. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupControllingAgencyCode] + * The group controlling agency code. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupMessageVersion] + * The group message version. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupMessageRelease] + * The group message release. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberLowerBound + * The group control number lower bound. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberUpperBound + * The group control number upper bound. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.rolloverGroupControlNumber + * The value indicating whether to rollover group control number. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberPrefix] + * The group control number prefix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberSuffix] + * The group control number suffix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupApplicationReceiverQualifier] + * The group application receiver qualifier. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupApplicationReceiverId] + * The group application receiver id. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupApplicationSenderQualifier] + * The group application sender qualifier. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupApplicationSenderId] + * The group application sender id. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupApplicationPassword] + * The group application password. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.overwriteExistingTransactionSetControlNumber + * The value indicating whether to overwrite existing transaction set control + * number. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberPrefix] + * The transaction set control number prefix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberSuffix] + * The transaction set control number suffix. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberLowerBound + * The transaction set control number lower bound. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberUpperBound + * The transaction set control number upper bound. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.rolloverTransactionSetControlNumber + * The value indicating whether to rollover transaction set control number. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.isTestInterchange + * The value indicating whether the message is a test interchange. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.senderInternalIdentification] + * The sender internal identification. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.senderInternalSubIdentification] + * The sender internal sub identification. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.receiverInternalIdentification] + * The receiver internal identification. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.receiverInternalSubIdentification] + * The receiver internal sub identification. + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings + * The EDIFACT acknowledgement settings. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.needTechnicalAcknowledgement + * The value indicating whether technical acknowledgement is needed. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.batchTechnicalAcknowledgements + * The value indicating whether to batch the technical acknowledgements. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.needFunctionalAcknowledgement + * The value indicating whether functional acknowledgement is needed. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.batchFunctionalAcknowledgements + * The value indicating whether to batch functional acknowledgements. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.needLoopForValidMessages + * The value indicating whether a loop is needed for valid messages. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.sendSynchronousAcknowledgement + * The value indicating whether to send synchronous acknowledgement. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberPrefix] + * The acknowledgement control number prefix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberSuffix] + * The acknowledgement control number suffix. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberLowerBound + * The acknowledgement control number lower bound. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberUpperBound + * The acknowledgement control number upper bound. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.rolloverAcknowledgementControlNumber + * The value indicating whether to rollover acknowledgement control number. + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.messageFilter The + * EDIFACT message filter. + * + * @param {string} + * agreement.content.edifact.sendAgreement.protocolSettings.messageFilter.messageFilterType + * The message filter type. Possible values include: 'NotSpecified', 'Include', + * 'Exclude' + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings + * The EDIFACT processing Settings. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings.maskSecurityInfo + * The value indicating whether to mask security information. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings.preserveInterchange + * The value indicating whether to preserve interchange. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings.suspendInterchangeOnError + * The value indicating whether to suspend interchange on error. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings.createEmptyXmlTagsForTrailingSeparators + * The value indicating whether to create empty xml tags for trailing + * separators. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings.useDotAsDecimalSeparator + * The value indicating whether to use dot as decimal separator. + * + * @param {array} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeOverrides] + * The EDIFACT envelope override settings. + * + * @param {array} + * [agreement.content.edifact.sendAgreement.protocolSettings.messageFilterList] + * The EDIFACT message filter list. + * + * @param {array} + * agreement.content.edifact.sendAgreement.protocolSettings.schemaReferences + * The EDIFACT schema references. + * + * @param {array} + * [agreement.content.edifact.sendAgreement.protocolSettings.validationOverrides] + * The EDIFACT validation override settings. + * + * @param {array} + * [agreement.content.edifact.sendAgreement.protocolSettings.edifactDelimiterOverrides] + * The EDIFACT delimiter override settings. + * + * @param {string} [agreement.location] The resource location. + * + * @param {object} [agreement.tags] The 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 IntegrationAccountAgreement} 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, integrationAccountName, agreementName, agreement, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (agreementName === null || agreementName === undefined || typeof agreementName.valueOf() !== 'string') { + throw new Error('agreementName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (agreement === null || agreement === undefined) { + throw new Error('agreement 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.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{agreementName}', encodeURIComponent(agreementName)); + 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 = '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 (agreement !== null && agreement !== undefined) { + let requestModelMapper = new client.models['IntegrationAccountAgreement']().mapper(); + requestModel = client.serialize(requestModelMapper, agreement, 'agreement'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(agreement, 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) { + 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['IntegrationAccountAgreement']().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['IntegrationAccountAgreement']().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 an integration account agreement. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} agreementName The integration account agreement 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. + * + * {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, integrationAccountName, agreementName, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (agreementName === null || agreementName === undefined || typeof agreementName.valueOf() !== 'string') { + throw new Error('agreementName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{agreementName}', encodeURIComponent(agreementName)); + 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 = '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 !== 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); + }); +} + +/** + * Get the content callback url. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} agreementName The integration account agreement name. + * + * @param {object} listContentCallbackUrlParameter + * + * @param {date} [listContentCallbackUrlParameter.notAfter] The expiry time. + * + * @param {string} [listContentCallbackUrlParameter.keyType] The key type. + * Possible values include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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 WorkflowTriggerCallbackUrl} 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 _listContentCallbackUrl(resourceGroupName, integrationAccountName, agreementName, listContentCallbackUrlParameter, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (agreementName === null || agreementName === undefined || typeof agreementName.valueOf() !== 'string') { + throw new Error('agreementName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (listContentCallbackUrlParameter === null || listContentCallbackUrlParameter === undefined) { + throw new Error('listContentCallbackUrlParameter 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.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}/listContentCallbackUrl'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{agreementName}', encodeURIComponent(agreementName)); + 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 (listContentCallbackUrlParameter !== null && listContentCallbackUrlParameter !== undefined) { + let requestModelMapper = new client.models['GetCallbackUrlParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, listContentCallbackUrlParameter, 'listContentCallbackUrlParameter'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(listContentCallbackUrlParameter, 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['WorkflowTriggerCallbackUrl']().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 list of integration account agreements. + * + * @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 IntegrationAccountAgreementListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IntegrationAccountAgreementListResult']().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 IntegrationAccountAgreements. */ +class IntegrationAccountAgreements { + /** + * Create a IntegrationAccountAgreements. + * @param {LogicManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._listContentCallbackUrl = _listContentCallbackUrl; + this._listNext = _listNext; + } + + /** + * Gets a list of integration account agreements. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @param {string} [options.filter] The filter to apply on the operation. + * Options for filters include: AgreementType. + * + * @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, integrationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, integrationAccountName, 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 list of integration account agreements. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @param {string} [options.filter] The filter to apply on the operation. + * Options for filters include: AgreementType. + * + * @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 {IntegrationAccountAgreementListResult} - 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 IntegrationAccountAgreementListResult} 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, integrationAccountName, 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, integrationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, integrationAccountName, options, optionalCallback); + } + } + + /** + * Gets an integration account agreement. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} agreementName The integration account agreement 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, integrationAccountName, agreementName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, integrationAccountName, agreementName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets an integration account agreement. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} agreementName The integration account agreement 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 {IntegrationAccountAgreement} - 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 IntegrationAccountAgreement} 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, integrationAccountName, agreementName, 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, integrationAccountName, agreementName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, integrationAccountName, agreementName, options, optionalCallback); + } + } + + /** + * Creates or updates an integration account agreement. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} agreementName The integration account agreement name. + * + * @param {object} agreement The integration account agreement. + * + * @param {object} [agreement.metadata] The metadata. + * + * @param {string} agreement.agreementType The agreement type. Possible values + * include: 'NotSpecified', 'AS2', 'X12', 'Edifact' + * + * @param {string} agreement.hostPartner The integration account partner that + * is set as host partner for this agreement. + * + * @param {string} agreement.guestPartner The integration account partner that + * is set as guest partner for this agreement. + * + * @param {object} agreement.hostIdentity The business identity of the host + * partner. + * + * @param {object} agreement.guestIdentity The business identity of the guest + * partner. + * + * @param {object} agreement.content The agreement content. + * + * @param {object} [agreement.content.aS2] The AS2 agreement content. + * + * @param {object} agreement.content.aS2.receiveAgreement The AS2 one-way + * receive agreement. + * + * @param {object} agreement.content.aS2.sendAgreement The AS2 one-way send + * agreement. + * + * @param {object} agreement.content.aS2.sendAgreement.senderBusinessIdentity + * The sender business identity + * + * @param {object} agreement.content.aS2.sendAgreement.receiverBusinessIdentity + * The receiver business identity + * + * @param {object} agreement.content.aS2.sendAgreement.protocolSettings The AS2 + * protocol settings. + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.messageConnectionSettings + * The message connection settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.messageConnectionSettings.ignoreCertificateNameMismatch + * The value indicating whether to ignore mismatch in certificate name. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.messageConnectionSettings.supportHttpStatusCodeContinue + * The value indicating whether to support HTTP status code 'CONTINUE'. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.messageConnectionSettings.keepHttpConnectionAlive + * The value indicating whether to keep the connection alive. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.messageConnectionSettings.unfoldHttpHeaders + * The value indicating whether to unfold the HTTP headers. + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.acknowledgementConnectionSettings + * The acknowledgement connection settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.acknowledgementConnectionSettings.ignoreCertificateNameMismatch + * The value indicating whether to ignore mismatch in certificate name. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.acknowledgementConnectionSettings.supportHttpStatusCodeContinue + * The value indicating whether to support HTTP status code 'CONTINUE'. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.acknowledgementConnectionSettings.keepHttpConnectionAlive + * The value indicating whether to keep the connection alive. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.acknowledgementConnectionSettings.unfoldHttpHeaders + * The value indicating whether to unfold the HTTP headers. + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings The MDN + * settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.needMdn The + * value indicating whether to send or request a MDN. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.signMdn The + * value indicating whether the MDN needs to be signed or not. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.sendMdnAsynchronously + * The value indicating whether to send the asynchronous MDN. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.receiptDeliveryUrl] + * The receipt delivery URL. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.dispositionNotificationTo] + * The disposition notification to header value. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.signOutboundMdnIfOptional + * The value indicating whether to sign the outbound MDN if optional. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.mdnText] + * The MDN text. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.sendInboundMdnToMessageBox + * The value indicating whether to send inbound MDN to message box. + * + * @param {string} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.micHashingAlgorithm + * The signing or hashing algorithm. Possible values include: 'NotSpecified', + * 'None', 'MD5', 'SHA1', 'SHA2256', 'SHA2384', 'SHA2512' + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings The + * security settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.overrideGroupSigningCertificate + * The value indicating whether to send or request a MDN. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.signingCertificateName] + * The name of the signing certificate. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.encryptionCertificateName] + * The name of the encryption certificate. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForInboundEncodedMessages + * The value indicating whether to enable NRR for inbound encoded messages. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForInboundDecodedMessages + * The value indicating whether to enable NRR for inbound decoded messages. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForOutboundMdn + * The value indicating whether to enable NRR for outbound MDN. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForOutboundEncodedMessages + * The value indicating whether to enable NRR for outbound encoded messages. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForOutboundDecodedMessages + * The value indicating whether to enable NRR for outbound decoded messages. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForInboundMdn + * The value indicating whether to enable NRR for inbound MDN. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.sha2AlgorithmFormat] + * The Sha2 algorithm format. Valid values are Sha2, ShaHashSize, + * ShaHyphenHashSize, Sha2UnderscoreHashSize. + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings The + * validation settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.overrideMessageProperties + * The value indicating whether to override incoming message properties with + * those in agreement. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.encryptMessage + * The value indicating whether the message has to be encrypted. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.signMessage + * The value indicating whether the message has to be signed. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.compressMessage + * The value indicating whether the message has to be compressed. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.checkDuplicateMessage + * The value indicating whether to check for duplicate message. + * + * @param {number} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.interchangeDuplicatesValidityDays + * The number of days to look back for duplicate interchange. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.checkCertificateRevocationListOnSend + * The value indicating whether to check for certificate revocation list on + * send. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.checkCertificateRevocationListOnReceive + * The value indicating whether to check for certificate revocation list on + * receive. + * + * @param {string} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.encryptionAlgorithm + * The encryption algorithm. Possible values include: 'NotSpecified', 'None', + * 'DES3', 'RC2', 'AES128', 'AES192', 'AES256' + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.signingAlgorithm] + * The signing algorithm. Possible values include: 'NotSpecified', 'Default', + * 'SHA1', 'SHA2256', 'SHA2384', 'SHA2512' + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings The + * envelope settings. + * + * @param {string} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings.messageContentType + * The message content type. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings.transmitFileNameInMimeHeader + * The value indicating whether to transmit file name in mime header. + * + * @param {string} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings.fileNameTemplate + * The template for file name. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings.suspendMessageOnFileNameGenerationError + * The value indicating whether to suspend message on file name generation + * error. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings.autogenerateFileName + * The value indicating whether to auto generate file name. + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.errorSettings The error + * settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.errorSettings.suspendDuplicateMessage + * The value indicating whether to suspend duplicate message. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.errorSettings.resendIfMdnNotReceived + * The value indicating whether to resend message If MDN is not received. + * + * @param {object} [agreement.content.x12] The X12 agreement content. + * + * @param {object} agreement.content.x12.receiveAgreement The X12 one-way + * receive agreement. + * + * @param {object} agreement.content.x12.sendAgreement The X12 one-way send + * agreement. + * + * @param {object} agreement.content.x12.sendAgreement.senderBusinessIdentity + * The sender business identity + * + * @param {object} agreement.content.x12.sendAgreement.receiverBusinessIdentity + * The receiver business identity + * + * @param {object} agreement.content.x12.sendAgreement.protocolSettings The X12 + * protocol settings. + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings The + * X12 validation settings. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.validateCharacterSet + * The value indicating whether to validate character set in the message. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.checkDuplicateInterchangeControlNumber + * The value indicating whether to check for duplicate interchange control + * number. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.interchangeControlNumberValidityDays + * The validity period of interchange control number. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.checkDuplicateGroupControlNumber + * The value indicating whether to check for duplicate group control number. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.checkDuplicateTransactionSetControlNumber + * The value indicating whether to check for duplicate transaction set control + * number. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.validateEdiTypes + * The value indicating whether to Whether to validate EDI types. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.validateXsdTypes + * The value indicating whether to Whether to validate XSD types. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.allowLeadingAndTrailingSpacesAndZeroes + * The value indicating whether to allow leading and trailing spaces and + * zeroes. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.trimLeadingAndTrailingSpacesAndZeroes + * The value indicating whether to trim leading and trailing spaces and zeroes. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.trailingSeparatorPolicy + * The trailing separator policy. Possible values include: 'NotSpecified', + * 'NotAllowed', 'Optional', 'Mandatory' + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings The X12 + * framing settings. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.dataElementSeparator + * The data element separator. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.componentSeparator + * The component separator. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.replaceSeparatorsInPayload + * The value indicating whether to replace separators in payload. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.replaceCharacter + * The replacement character. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.segmentTerminator + * The segment terminator. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.characterSet + * The X12 character set. Possible values include: 'NotSpecified', 'Basic', + * 'Extended', 'UTF8' + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.segmentTerminatorSuffix + * The segment terminator suffix. Possible values include: 'NotSpecified', + * 'None', 'CR', 'LF', 'CRLF' + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings The + * X12 envelope settings. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.controlStandardsId + * The controls standards id. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.useControlStandardsIdAsRepetitionCharacter + * The value indicating whether to use control standards id as repetition + * character. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.senderApplicationId + * The sender application id. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.receiverApplicationId + * The receiver application id. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.controlVersionNumber + * The control version number. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberLowerBound + * The interchange control number lower bound. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberUpperBound + * The interchange control number upper bound. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.rolloverInterchangeControlNumber + * The value indicating whether to rollover interchange control number. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.enableDefaultGroupHeaders + * The value indicating whether to enable default group headers. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.functionalGroupId] + * The functional group id. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberLowerBound + * The group control number lower bound. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberUpperBound + * The group control number upper bound. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.rolloverGroupControlNumber + * The value indicating whether to rollover group control number. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupHeaderAgencyCode + * The group header agency code. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupHeaderVersion + * The group header version. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberLowerBound + * The transaction set control number lower bound. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberUpperBound + * The transaction set control number upper bound. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.rolloverTransactionSetControlNumber + * The value indicating whether to rollover transaction set control number. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberPrefix] + * The transaction set control number prefix. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberSuffix] + * The transaction set control number suffix. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.overwriteExistingTransactionSetControlNumber + * The value indicating whether to overwrite existing transaction set control + * number. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupHeaderDateFormat + * The group header date format. Possible values include: 'NotSpecified', + * 'CCYYMMDD', 'YYMMDD' + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupHeaderTimeFormat + * The group header time format. Possible values include: 'NotSpecified', + * 'HHMM', 'HHMMSS', 'HHMMSSdd', 'HHMMSSd' + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.usageIndicator + * The usage indicator. Possible values include: 'NotSpecified', 'Test', + * 'Information', 'Production' + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings + * The X12 acknowledgment settings. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.needTechnicalAcknowledgement + * The value indicating whether technical acknowledgement is needed. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.batchTechnicalAcknowledgements + * The value indicating whether to batch the technical acknowledgements. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.needFunctionalAcknowledgement + * The value indicating whether functional acknowledgement is needed. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.functionalAcknowledgementVersion] + * The functional acknowledgement version. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.batchFunctionalAcknowledgements + * The value indicating whether to batch functional acknowledgements. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.needImplementationAcknowledgement + * The value indicating whether implementation acknowledgement is needed. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.implementationAcknowledgementVersion] + * The implementation acknowledgement version. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.batchImplementationAcknowledgements + * The value indicating whether to batch implementation acknowledgements. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.needLoopForValidMessages + * The value indicating whether a loop is needed for valid messages. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.sendSynchronousAcknowledgement + * The value indicating whether to send synchronous acknowledgement. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberPrefix] + * The acknowledgement control number prefix. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberSuffix] + * The acknowledgement control number suffix. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberLowerBound + * The acknowledgement control number lower bound. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberUpperBound + * The acknowledgement control number upper bound. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.rolloverAcknowledgementControlNumber + * The value indicating whether to rollover acknowledgement control number. + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.messageFilter The X12 + * message filter. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.messageFilter.messageFilterType + * The message filter type. Possible values include: 'NotSpecified', 'Include', + * 'Exclude' + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.securitySettings The + * X12 security settings. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.securitySettings.authorizationQualifier + * The authorization qualifier. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.securitySettings.authorizationValue] + * The authorization value. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.securitySettings.securityQualifier + * The security qualifier. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.securitySettings.passwordValue] + * The password value. + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings The + * X12 processing settings. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.maskSecurityInfo + * The value indicating whether to mask security information. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.convertImpliedDecimal + * The value indicating whether to convert numerical type to implied decimal. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.preserveInterchange + * The value indicating whether to preserve interchange. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.suspendInterchangeOnError + * The value indicating whether to suspend interchange on error. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.createEmptyXmlTagsForTrailingSeparators + * The value indicating whether to create empty xml tags for trailing + * separators. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.useDotAsDecimalSeparator + * The value indicating whether to use dot as decimal separator. + * + * @param {array} + * [agreement.content.x12.sendAgreement.protocolSettings.envelopeOverrides] The + * X12 envelope override settings. + * + * @param {array} + * [agreement.content.x12.sendAgreement.protocolSettings.validationOverrides] + * The X12 validation override settings. + * + * @param {array} + * [agreement.content.x12.sendAgreement.protocolSettings.messageFilterList] The + * X12 message filter list. + * + * @param {array} + * agreement.content.x12.sendAgreement.protocolSettings.schemaReferences The + * X12 schema references. + * + * @param {array} + * [agreement.content.x12.sendAgreement.protocolSettings.x12DelimiterOverrides] + * The X12 delimiter override settings. + * + * @param {object} [agreement.content.edifact] The EDIFACT agreement content. + * + * @param {object} agreement.content.edifact.receiveAgreement The EDIFACT + * one-way receive agreement. + * + * @param {object} agreement.content.edifact.sendAgreement The EDIFACT one-way + * send agreement. + * + * @param {object} + * agreement.content.edifact.sendAgreement.senderBusinessIdentity The sender + * business identity + * + * @param {object} + * agreement.content.edifact.sendAgreement.receiverBusinessIdentity The + * receiver business identity + * + * @param {string} + * agreement.content.edifact.sendAgreement.receiverBusinessIdentity.qualifier + * The business identity qualifier e.g. as2identity, ZZ, ZZZ, 31, 32 + * + * @param {string} + * agreement.content.edifact.sendAgreement.receiverBusinessIdentity.value The + * user defined business identity value. + * + * @param {object} agreement.content.edifact.sendAgreement.protocolSettings The + * EDIFACT protocol settings. + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings + * The EDIFACT validation settings. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.validateCharacterSet + * The value indicating whether to validate character set in the message. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.checkDuplicateInterchangeControlNumber + * The value indicating whether to check for duplicate interchange control + * number. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.interchangeControlNumberValidityDays + * The validity period of interchange control number. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.checkDuplicateGroupControlNumber + * The value indicating whether to check for duplicate group control number. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.checkDuplicateTransactionSetControlNumber + * The value indicating whether to check for duplicate transaction set control + * number. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.validateEdiTypes + * The value indicating whether to Whether to validate EDI types. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.validateXsdTypes + * The value indicating whether to Whether to validate XSD types. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.allowLeadingAndTrailingSpacesAndZeroes + * The value indicating whether to allow leading and trailing spaces and + * zeroes. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.trimLeadingAndTrailingSpacesAndZeroes + * The value indicating whether to trim leading and trailing spaces and zeroes. + * + * @param {string} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.trailingSeparatorPolicy + * The trailing separator policy. Possible values include: 'NotSpecified', + * 'NotAllowed', 'Optional', 'Mandatory' + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings The + * EDIFACT framing settings. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.serviceCodeListDirectoryVersion] + * The service code list directory version. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.characterEncoding] + * The character encoding. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.protocolVersion + * The protocol version. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.dataElementSeparator + * The data element separator. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.componentSeparator + * The component separator. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.segmentTerminator + * The segment terminator. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.releaseIndicator + * The release indicator. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.repetitionSeparator + * The repetition separator. + * + * @param {string} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.characterSet + * The EDIFACT frame setting characterSet. Possible values include: + * 'NotSpecified', 'UNOB', 'UNOA', 'UNOC', 'UNOD', 'UNOE', 'UNOF', 'UNOG', + * 'UNOH', 'UNOI', 'UNOJ', 'UNOK', 'UNOX', 'UNOY', 'KECA' + * + * @param {string} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.decimalPointIndicator + * The EDIFACT frame setting decimal indicator. Possible values include: + * 'NotSpecified', 'Comma', 'Decimal' + * + * @param {string} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.segmentTerminatorSuffix + * The EDIFACT frame setting segment terminator suffix. Possible values + * include: 'NotSpecified', 'None', 'CR', 'LF', 'CRLF' + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings + * The EDIFACT envelope settings. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupAssociationAssignedCode] + * The group association assigned code. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.communicationAgreementId] + * The communication agreement id. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.applyDelimiterStringAdvice + * The value indicating whether to apply delimiter string advice. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.createGroupingSegments + * The value indicating whether to create grouping segments. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.enableDefaultGroupHeaders + * The value indicating whether to enable default group headers. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.recipientReferencePasswordValue] + * The recipient reference password value. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.recipientReferencePasswordQualifier] + * The recipient reference password qualifier. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.applicationReferenceId] + * The application reference id. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.processingPriorityCode] + * The processing priority code. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberLowerBound + * The interchange control number lower bound. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberUpperBound + * The interchange control number upper bound. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.rolloverInterchangeControlNumber + * The value indicating whether to rollover interchange control number. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberPrefix] + * The interchange control number prefix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberSuffix] + * The interchange control number suffix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.senderReverseRoutingAddress] + * The sender reverse routing address. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.receiverReverseRoutingAddress] + * The receiver reverse routing address. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.functionalGroupId] + * The functional group id. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupControllingAgencyCode] + * The group controlling agency code. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupMessageVersion] + * The group message version. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupMessageRelease] + * The group message release. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberLowerBound + * The group control number lower bound. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberUpperBound + * The group control number upper bound. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.rolloverGroupControlNumber + * The value indicating whether to rollover group control number. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberPrefix] + * The group control number prefix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberSuffix] + * The group control number suffix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupApplicationReceiverQualifier] + * The group application receiver qualifier. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupApplicationReceiverId] + * The group application receiver id. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupApplicationSenderQualifier] + * The group application sender qualifier. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupApplicationSenderId] + * The group application sender id. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupApplicationPassword] + * The group application password. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.overwriteExistingTransactionSetControlNumber + * The value indicating whether to overwrite existing transaction set control + * number. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberPrefix] + * The transaction set control number prefix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberSuffix] + * The transaction set control number suffix. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberLowerBound + * The transaction set control number lower bound. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberUpperBound + * The transaction set control number upper bound. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.rolloverTransactionSetControlNumber + * The value indicating whether to rollover transaction set control number. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.isTestInterchange + * The value indicating whether the message is a test interchange. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.senderInternalIdentification] + * The sender internal identification. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.senderInternalSubIdentification] + * The sender internal sub identification. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.receiverInternalIdentification] + * The receiver internal identification. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.receiverInternalSubIdentification] + * The receiver internal sub identification. + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings + * The EDIFACT acknowledgement settings. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.needTechnicalAcknowledgement + * The value indicating whether technical acknowledgement is needed. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.batchTechnicalAcknowledgements + * The value indicating whether to batch the technical acknowledgements. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.needFunctionalAcknowledgement + * The value indicating whether functional acknowledgement is needed. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.batchFunctionalAcknowledgements + * The value indicating whether to batch functional acknowledgements. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.needLoopForValidMessages + * The value indicating whether a loop is needed for valid messages. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.sendSynchronousAcknowledgement + * The value indicating whether to send synchronous acknowledgement. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberPrefix] + * The acknowledgement control number prefix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberSuffix] + * The acknowledgement control number suffix. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberLowerBound + * The acknowledgement control number lower bound. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberUpperBound + * The acknowledgement control number upper bound. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.rolloverAcknowledgementControlNumber + * The value indicating whether to rollover acknowledgement control number. + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.messageFilter The + * EDIFACT message filter. + * + * @param {string} + * agreement.content.edifact.sendAgreement.protocolSettings.messageFilter.messageFilterType + * The message filter type. Possible values include: 'NotSpecified', 'Include', + * 'Exclude' + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings + * The EDIFACT processing Settings. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings.maskSecurityInfo + * The value indicating whether to mask security information. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings.preserveInterchange + * The value indicating whether to preserve interchange. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings.suspendInterchangeOnError + * The value indicating whether to suspend interchange on error. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings.createEmptyXmlTagsForTrailingSeparators + * The value indicating whether to create empty xml tags for trailing + * separators. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings.useDotAsDecimalSeparator + * The value indicating whether to use dot as decimal separator. + * + * @param {array} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeOverrides] + * The EDIFACT envelope override settings. + * + * @param {array} + * [agreement.content.edifact.sendAgreement.protocolSettings.messageFilterList] + * The EDIFACT message filter list. + * + * @param {array} + * agreement.content.edifact.sendAgreement.protocolSettings.schemaReferences + * The EDIFACT schema references. + * + * @param {array} + * [agreement.content.edifact.sendAgreement.protocolSettings.validationOverrides] + * The EDIFACT validation override settings. + * + * @param {array} + * [agreement.content.edifact.sendAgreement.protocolSettings.edifactDelimiterOverrides] + * The EDIFACT delimiter override settings. + * + * @param {string} [agreement.location] The resource location. + * + * @param {object} [agreement.tags] The 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, integrationAccountName, agreementName, agreement, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, integrationAccountName, agreementName, agreement, 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 updates an integration account agreement. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} agreementName The integration account agreement name. + * + * @param {object} agreement The integration account agreement. + * + * @param {object} [agreement.metadata] The metadata. + * + * @param {string} agreement.agreementType The agreement type. Possible values + * include: 'NotSpecified', 'AS2', 'X12', 'Edifact' + * + * @param {string} agreement.hostPartner The integration account partner that + * is set as host partner for this agreement. + * + * @param {string} agreement.guestPartner The integration account partner that + * is set as guest partner for this agreement. + * + * @param {object} agreement.hostIdentity The business identity of the host + * partner. + * + * @param {object} agreement.guestIdentity The business identity of the guest + * partner. + * + * @param {object} agreement.content The agreement content. + * + * @param {object} [agreement.content.aS2] The AS2 agreement content. + * + * @param {object} agreement.content.aS2.receiveAgreement The AS2 one-way + * receive agreement. + * + * @param {object} agreement.content.aS2.sendAgreement The AS2 one-way send + * agreement. + * + * @param {object} agreement.content.aS2.sendAgreement.senderBusinessIdentity + * The sender business identity + * + * @param {object} agreement.content.aS2.sendAgreement.receiverBusinessIdentity + * The receiver business identity + * + * @param {object} agreement.content.aS2.sendAgreement.protocolSettings The AS2 + * protocol settings. + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.messageConnectionSettings + * The message connection settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.messageConnectionSettings.ignoreCertificateNameMismatch + * The value indicating whether to ignore mismatch in certificate name. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.messageConnectionSettings.supportHttpStatusCodeContinue + * The value indicating whether to support HTTP status code 'CONTINUE'. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.messageConnectionSettings.keepHttpConnectionAlive + * The value indicating whether to keep the connection alive. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.messageConnectionSettings.unfoldHttpHeaders + * The value indicating whether to unfold the HTTP headers. + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.acknowledgementConnectionSettings + * The acknowledgement connection settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.acknowledgementConnectionSettings.ignoreCertificateNameMismatch + * The value indicating whether to ignore mismatch in certificate name. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.acknowledgementConnectionSettings.supportHttpStatusCodeContinue + * The value indicating whether to support HTTP status code 'CONTINUE'. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.acknowledgementConnectionSettings.keepHttpConnectionAlive + * The value indicating whether to keep the connection alive. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.acknowledgementConnectionSettings.unfoldHttpHeaders + * The value indicating whether to unfold the HTTP headers. + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings The MDN + * settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.needMdn The + * value indicating whether to send or request a MDN. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.signMdn The + * value indicating whether the MDN needs to be signed or not. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.sendMdnAsynchronously + * The value indicating whether to send the asynchronous MDN. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.receiptDeliveryUrl] + * The receipt delivery URL. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.dispositionNotificationTo] + * The disposition notification to header value. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.signOutboundMdnIfOptional + * The value indicating whether to sign the outbound MDN if optional. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.mdnText] + * The MDN text. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.sendInboundMdnToMessageBox + * The value indicating whether to send inbound MDN to message box. + * + * @param {string} + * agreement.content.aS2.sendAgreement.protocolSettings.mdnSettings.micHashingAlgorithm + * The signing or hashing algorithm. Possible values include: 'NotSpecified', + * 'None', 'MD5', 'SHA1', 'SHA2256', 'SHA2384', 'SHA2512' + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings The + * security settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.overrideGroupSigningCertificate + * The value indicating whether to send or request a MDN. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.signingCertificateName] + * The name of the signing certificate. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.encryptionCertificateName] + * The name of the encryption certificate. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForInboundEncodedMessages + * The value indicating whether to enable NRR for inbound encoded messages. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForInboundDecodedMessages + * The value indicating whether to enable NRR for inbound decoded messages. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForOutboundMdn + * The value indicating whether to enable NRR for outbound MDN. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForOutboundEncodedMessages + * The value indicating whether to enable NRR for outbound encoded messages. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForOutboundDecodedMessages + * The value indicating whether to enable NRR for outbound decoded messages. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.enableNrrForInboundMdn + * The value indicating whether to enable NRR for inbound MDN. + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.securitySettings.sha2AlgorithmFormat] + * The Sha2 algorithm format. Valid values are Sha2, ShaHashSize, + * ShaHyphenHashSize, Sha2UnderscoreHashSize. + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings The + * validation settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.overrideMessageProperties + * The value indicating whether to override incoming message properties with + * those in agreement. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.encryptMessage + * The value indicating whether the message has to be encrypted. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.signMessage + * The value indicating whether the message has to be signed. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.compressMessage + * The value indicating whether the message has to be compressed. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.checkDuplicateMessage + * The value indicating whether to check for duplicate message. + * + * @param {number} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.interchangeDuplicatesValidityDays + * The number of days to look back for duplicate interchange. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.checkCertificateRevocationListOnSend + * The value indicating whether to check for certificate revocation list on + * send. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.checkCertificateRevocationListOnReceive + * The value indicating whether to check for certificate revocation list on + * receive. + * + * @param {string} + * agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.encryptionAlgorithm + * The encryption algorithm. Possible values include: 'NotSpecified', 'None', + * 'DES3', 'RC2', 'AES128', 'AES192', 'AES256' + * + * @param {string} + * [agreement.content.aS2.sendAgreement.protocolSettings.validationSettings.signingAlgorithm] + * The signing algorithm. Possible values include: 'NotSpecified', 'Default', + * 'SHA1', 'SHA2256', 'SHA2384', 'SHA2512' + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings The + * envelope settings. + * + * @param {string} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings.messageContentType + * The message content type. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings.transmitFileNameInMimeHeader + * The value indicating whether to transmit file name in mime header. + * + * @param {string} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings.fileNameTemplate + * The template for file name. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings.suspendMessageOnFileNameGenerationError + * The value indicating whether to suspend message on file name generation + * error. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.envelopeSettings.autogenerateFileName + * The value indicating whether to auto generate file name. + * + * @param {object} + * agreement.content.aS2.sendAgreement.protocolSettings.errorSettings The error + * settings. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.errorSettings.suspendDuplicateMessage + * The value indicating whether to suspend duplicate message. + * + * @param {boolean} + * agreement.content.aS2.sendAgreement.protocolSettings.errorSettings.resendIfMdnNotReceived + * The value indicating whether to resend message If MDN is not received. + * + * @param {object} [agreement.content.x12] The X12 agreement content. + * + * @param {object} agreement.content.x12.receiveAgreement The X12 one-way + * receive agreement. + * + * @param {object} agreement.content.x12.sendAgreement The X12 one-way send + * agreement. + * + * @param {object} agreement.content.x12.sendAgreement.senderBusinessIdentity + * The sender business identity + * + * @param {object} agreement.content.x12.sendAgreement.receiverBusinessIdentity + * The receiver business identity + * + * @param {object} agreement.content.x12.sendAgreement.protocolSettings The X12 + * protocol settings. + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings The + * X12 validation settings. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.validateCharacterSet + * The value indicating whether to validate character set in the message. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.checkDuplicateInterchangeControlNumber + * The value indicating whether to check for duplicate interchange control + * number. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.interchangeControlNumberValidityDays + * The validity period of interchange control number. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.checkDuplicateGroupControlNumber + * The value indicating whether to check for duplicate group control number. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.checkDuplicateTransactionSetControlNumber + * The value indicating whether to check for duplicate transaction set control + * number. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.validateEdiTypes + * The value indicating whether to Whether to validate EDI types. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.validateXsdTypes + * The value indicating whether to Whether to validate XSD types. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.allowLeadingAndTrailingSpacesAndZeroes + * The value indicating whether to allow leading and trailing spaces and + * zeroes. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.trimLeadingAndTrailingSpacesAndZeroes + * The value indicating whether to trim leading and trailing spaces and zeroes. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.validationSettings.trailingSeparatorPolicy + * The trailing separator policy. Possible values include: 'NotSpecified', + * 'NotAllowed', 'Optional', 'Mandatory' + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings The X12 + * framing settings. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.dataElementSeparator + * The data element separator. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.componentSeparator + * The component separator. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.replaceSeparatorsInPayload + * The value indicating whether to replace separators in payload. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.replaceCharacter + * The replacement character. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.segmentTerminator + * The segment terminator. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.characterSet + * The X12 character set. Possible values include: 'NotSpecified', 'Basic', + * 'Extended', 'UTF8' + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.framingSettings.segmentTerminatorSuffix + * The segment terminator suffix. Possible values include: 'NotSpecified', + * 'None', 'CR', 'LF', 'CRLF' + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings The + * X12 envelope settings. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.controlStandardsId + * The controls standards id. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.useControlStandardsIdAsRepetitionCharacter + * The value indicating whether to use control standards id as repetition + * character. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.senderApplicationId + * The sender application id. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.receiverApplicationId + * The receiver application id. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.controlVersionNumber + * The control version number. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberLowerBound + * The interchange control number lower bound. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberUpperBound + * The interchange control number upper bound. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.rolloverInterchangeControlNumber + * The value indicating whether to rollover interchange control number. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.enableDefaultGroupHeaders + * The value indicating whether to enable default group headers. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.functionalGroupId] + * The functional group id. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberLowerBound + * The group control number lower bound. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberUpperBound + * The group control number upper bound. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.rolloverGroupControlNumber + * The value indicating whether to rollover group control number. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupHeaderAgencyCode + * The group header agency code. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupHeaderVersion + * The group header version. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberLowerBound + * The transaction set control number lower bound. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberUpperBound + * The transaction set control number upper bound. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.rolloverTransactionSetControlNumber + * The value indicating whether to rollover transaction set control number. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberPrefix] + * The transaction set control number prefix. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberSuffix] + * The transaction set control number suffix. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.overwriteExistingTransactionSetControlNumber + * The value indicating whether to overwrite existing transaction set control + * number. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupHeaderDateFormat + * The group header date format. Possible values include: 'NotSpecified', + * 'CCYYMMDD', 'YYMMDD' + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.groupHeaderTimeFormat + * The group header time format. Possible values include: 'NotSpecified', + * 'HHMM', 'HHMMSS', 'HHMMSSdd', 'HHMMSSd' + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.envelopeSettings.usageIndicator + * The usage indicator. Possible values include: 'NotSpecified', 'Test', + * 'Information', 'Production' + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings + * The X12 acknowledgment settings. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.needTechnicalAcknowledgement + * The value indicating whether technical acknowledgement is needed. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.batchTechnicalAcknowledgements + * The value indicating whether to batch the technical acknowledgements. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.needFunctionalAcknowledgement + * The value indicating whether functional acknowledgement is needed. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.functionalAcknowledgementVersion] + * The functional acknowledgement version. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.batchFunctionalAcknowledgements + * The value indicating whether to batch functional acknowledgements. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.needImplementationAcknowledgement + * The value indicating whether implementation acknowledgement is needed. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.implementationAcknowledgementVersion] + * The implementation acknowledgement version. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.batchImplementationAcknowledgements + * The value indicating whether to batch implementation acknowledgements. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.needLoopForValidMessages + * The value indicating whether a loop is needed for valid messages. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.sendSynchronousAcknowledgement + * The value indicating whether to send synchronous acknowledgement. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberPrefix] + * The acknowledgement control number prefix. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberSuffix] + * The acknowledgement control number suffix. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberLowerBound + * The acknowledgement control number lower bound. + * + * @param {number} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberUpperBound + * The acknowledgement control number upper bound. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.acknowledgementSettings.rolloverAcknowledgementControlNumber + * The value indicating whether to rollover acknowledgement control number. + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.messageFilter The X12 + * message filter. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.messageFilter.messageFilterType + * The message filter type. Possible values include: 'NotSpecified', 'Include', + * 'Exclude' + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.securitySettings The + * X12 security settings. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.securitySettings.authorizationQualifier + * The authorization qualifier. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.securitySettings.authorizationValue] + * The authorization value. + * + * @param {string} + * agreement.content.x12.sendAgreement.protocolSettings.securitySettings.securityQualifier + * The security qualifier. + * + * @param {string} + * [agreement.content.x12.sendAgreement.protocolSettings.securitySettings.passwordValue] + * The password value. + * + * @param {object} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings The + * X12 processing settings. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.maskSecurityInfo + * The value indicating whether to mask security information. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.convertImpliedDecimal + * The value indicating whether to convert numerical type to implied decimal. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.preserveInterchange + * The value indicating whether to preserve interchange. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.suspendInterchangeOnError + * The value indicating whether to suspend interchange on error. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.createEmptyXmlTagsForTrailingSeparators + * The value indicating whether to create empty xml tags for trailing + * separators. + * + * @param {boolean} + * agreement.content.x12.sendAgreement.protocolSettings.processingSettings.useDotAsDecimalSeparator + * The value indicating whether to use dot as decimal separator. + * + * @param {array} + * [agreement.content.x12.sendAgreement.protocolSettings.envelopeOverrides] The + * X12 envelope override settings. + * + * @param {array} + * [agreement.content.x12.sendAgreement.protocolSettings.validationOverrides] + * The X12 validation override settings. + * + * @param {array} + * [agreement.content.x12.sendAgreement.protocolSettings.messageFilterList] The + * X12 message filter list. + * + * @param {array} + * agreement.content.x12.sendAgreement.protocolSettings.schemaReferences The + * X12 schema references. + * + * @param {array} + * [agreement.content.x12.sendAgreement.protocolSettings.x12DelimiterOverrides] + * The X12 delimiter override settings. + * + * @param {object} [agreement.content.edifact] The EDIFACT agreement content. + * + * @param {object} agreement.content.edifact.receiveAgreement The EDIFACT + * one-way receive agreement. + * + * @param {object} agreement.content.edifact.sendAgreement The EDIFACT one-way + * send agreement. + * + * @param {object} + * agreement.content.edifact.sendAgreement.senderBusinessIdentity The sender + * business identity + * + * @param {object} + * agreement.content.edifact.sendAgreement.receiverBusinessIdentity The + * receiver business identity + * + * @param {string} + * agreement.content.edifact.sendAgreement.receiverBusinessIdentity.qualifier + * The business identity qualifier e.g. as2identity, ZZ, ZZZ, 31, 32 + * + * @param {string} + * agreement.content.edifact.sendAgreement.receiverBusinessIdentity.value The + * user defined business identity value. + * + * @param {object} agreement.content.edifact.sendAgreement.protocolSettings The + * EDIFACT protocol settings. + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings + * The EDIFACT validation settings. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.validateCharacterSet + * The value indicating whether to validate character set in the message. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.checkDuplicateInterchangeControlNumber + * The value indicating whether to check for duplicate interchange control + * number. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.interchangeControlNumberValidityDays + * The validity period of interchange control number. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.checkDuplicateGroupControlNumber + * The value indicating whether to check for duplicate group control number. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.checkDuplicateTransactionSetControlNumber + * The value indicating whether to check for duplicate transaction set control + * number. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.validateEdiTypes + * The value indicating whether to Whether to validate EDI types. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.validateXsdTypes + * The value indicating whether to Whether to validate XSD types. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.allowLeadingAndTrailingSpacesAndZeroes + * The value indicating whether to allow leading and trailing spaces and + * zeroes. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.trimLeadingAndTrailingSpacesAndZeroes + * The value indicating whether to trim leading and trailing spaces and zeroes. + * + * @param {string} + * agreement.content.edifact.sendAgreement.protocolSettings.validationSettings.trailingSeparatorPolicy + * The trailing separator policy. Possible values include: 'NotSpecified', + * 'NotAllowed', 'Optional', 'Mandatory' + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings The + * EDIFACT framing settings. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.serviceCodeListDirectoryVersion] + * The service code list directory version. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.characterEncoding] + * The character encoding. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.protocolVersion + * The protocol version. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.dataElementSeparator + * The data element separator. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.componentSeparator + * The component separator. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.segmentTerminator + * The segment terminator. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.releaseIndicator + * The release indicator. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.repetitionSeparator + * The repetition separator. + * + * @param {string} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.characterSet + * The EDIFACT frame setting characterSet. Possible values include: + * 'NotSpecified', 'UNOB', 'UNOA', 'UNOC', 'UNOD', 'UNOE', 'UNOF', 'UNOG', + * 'UNOH', 'UNOI', 'UNOJ', 'UNOK', 'UNOX', 'UNOY', 'KECA' + * + * @param {string} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.decimalPointIndicator + * The EDIFACT frame setting decimal indicator. Possible values include: + * 'NotSpecified', 'Comma', 'Decimal' + * + * @param {string} + * agreement.content.edifact.sendAgreement.protocolSettings.framingSettings.segmentTerminatorSuffix + * The EDIFACT frame setting segment terminator suffix. Possible values + * include: 'NotSpecified', 'None', 'CR', 'LF', 'CRLF' + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings + * The EDIFACT envelope settings. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupAssociationAssignedCode] + * The group association assigned code. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.communicationAgreementId] + * The communication agreement id. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.applyDelimiterStringAdvice + * The value indicating whether to apply delimiter string advice. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.createGroupingSegments + * The value indicating whether to create grouping segments. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.enableDefaultGroupHeaders + * The value indicating whether to enable default group headers. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.recipientReferencePasswordValue] + * The recipient reference password value. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.recipientReferencePasswordQualifier] + * The recipient reference password qualifier. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.applicationReferenceId] + * The application reference id. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.processingPriorityCode] + * The processing priority code. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberLowerBound + * The interchange control number lower bound. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberUpperBound + * The interchange control number upper bound. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.rolloverInterchangeControlNumber + * The value indicating whether to rollover interchange control number. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberPrefix] + * The interchange control number prefix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.interchangeControlNumberSuffix] + * The interchange control number suffix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.senderReverseRoutingAddress] + * The sender reverse routing address. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.receiverReverseRoutingAddress] + * The receiver reverse routing address. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.functionalGroupId] + * The functional group id. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupControllingAgencyCode] + * The group controlling agency code. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupMessageVersion] + * The group message version. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupMessageRelease] + * The group message release. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberLowerBound + * The group control number lower bound. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberUpperBound + * The group control number upper bound. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.rolloverGroupControlNumber + * The value indicating whether to rollover group control number. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberPrefix] + * The group control number prefix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupControlNumberSuffix] + * The group control number suffix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupApplicationReceiverQualifier] + * The group application receiver qualifier. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupApplicationReceiverId] + * The group application receiver id. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupApplicationSenderQualifier] + * The group application sender qualifier. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupApplicationSenderId] + * The group application sender id. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.groupApplicationPassword] + * The group application password. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.overwriteExistingTransactionSetControlNumber + * The value indicating whether to overwrite existing transaction set control + * number. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberPrefix] + * The transaction set control number prefix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberSuffix] + * The transaction set control number suffix. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberLowerBound + * The transaction set control number lower bound. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.transactionSetControlNumberUpperBound + * The transaction set control number upper bound. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.rolloverTransactionSetControlNumber + * The value indicating whether to rollover transaction set control number. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.isTestInterchange + * The value indicating whether the message is a test interchange. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.senderInternalIdentification] + * The sender internal identification. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.senderInternalSubIdentification] + * The sender internal sub identification. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.receiverInternalIdentification] + * The receiver internal identification. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeSettings.receiverInternalSubIdentification] + * The receiver internal sub identification. + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings + * The EDIFACT acknowledgement settings. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.needTechnicalAcknowledgement + * The value indicating whether technical acknowledgement is needed. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.batchTechnicalAcknowledgements + * The value indicating whether to batch the technical acknowledgements. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.needFunctionalAcknowledgement + * The value indicating whether functional acknowledgement is needed. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.batchFunctionalAcknowledgements + * The value indicating whether to batch functional acknowledgements. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.needLoopForValidMessages + * The value indicating whether a loop is needed for valid messages. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.sendSynchronousAcknowledgement + * The value indicating whether to send synchronous acknowledgement. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberPrefix] + * The acknowledgement control number prefix. + * + * @param {string} + * [agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberSuffix] + * The acknowledgement control number suffix. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberLowerBound + * The acknowledgement control number lower bound. + * + * @param {number} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.acknowledgementControlNumberUpperBound + * The acknowledgement control number upper bound. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.acknowledgementSettings.rolloverAcknowledgementControlNumber + * The value indicating whether to rollover acknowledgement control number. + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.messageFilter The + * EDIFACT message filter. + * + * @param {string} + * agreement.content.edifact.sendAgreement.protocolSettings.messageFilter.messageFilterType + * The message filter type. Possible values include: 'NotSpecified', 'Include', + * 'Exclude' + * + * @param {object} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings + * The EDIFACT processing Settings. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings.maskSecurityInfo + * The value indicating whether to mask security information. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings.preserveInterchange + * The value indicating whether to preserve interchange. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings.suspendInterchangeOnError + * The value indicating whether to suspend interchange on error. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings.createEmptyXmlTagsForTrailingSeparators + * The value indicating whether to create empty xml tags for trailing + * separators. + * + * @param {boolean} + * agreement.content.edifact.sendAgreement.protocolSettings.processingSettings.useDotAsDecimalSeparator + * The value indicating whether to use dot as decimal separator. + * + * @param {array} + * [agreement.content.edifact.sendAgreement.protocolSettings.envelopeOverrides] + * The EDIFACT envelope override settings. + * + * @param {array} + * [agreement.content.edifact.sendAgreement.protocolSettings.messageFilterList] + * The EDIFACT message filter list. + * + * @param {array} + * agreement.content.edifact.sendAgreement.protocolSettings.schemaReferences + * The EDIFACT schema references. + * + * @param {array} + * [agreement.content.edifact.sendAgreement.protocolSettings.validationOverrides] + * The EDIFACT validation override settings. + * + * @param {array} + * [agreement.content.edifact.sendAgreement.protocolSettings.edifactDelimiterOverrides] + * The EDIFACT delimiter override settings. + * + * @param {string} [agreement.location] The resource location. + * + * @param {object} [agreement.tags] The 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 {IntegrationAccountAgreement} - 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 IntegrationAccountAgreement} 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, integrationAccountName, agreementName, agreement, 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, integrationAccountName, agreementName, agreement, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, integrationAccountName, agreementName, agreement, options, optionalCallback); + } + } + + /** + * Deletes an integration account agreement. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} agreementName The integration account agreement 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, integrationAccountName, agreementName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, integrationAccountName, agreementName, 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 integration account agreement. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} agreementName The integration account agreement 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 {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, integrationAccountName, agreementName, 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, integrationAccountName, agreementName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, integrationAccountName, agreementName, options, optionalCallback); + } + } + + /** + * Get the content callback url. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} agreementName The integration account agreement name. + * + * @param {object} listContentCallbackUrlParameter + * + * @param {date} [listContentCallbackUrlParameter.notAfter] The expiry time. + * + * @param {string} [listContentCallbackUrlParameter.keyType] The key type. + * Possible values include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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. + */ + listContentCallbackUrlWithHttpOperationResponse(resourceGroupName, integrationAccountName, agreementName, listContentCallbackUrlParameter, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listContentCallbackUrl(resourceGroupName, integrationAccountName, agreementName, listContentCallbackUrlParameter, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the content callback url. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} agreementName The integration account agreement name. + * + * @param {object} listContentCallbackUrlParameter + * + * @param {date} [listContentCallbackUrlParameter.notAfter] The expiry time. + * + * @param {string} [listContentCallbackUrlParameter.keyType] The key type. + * Possible values include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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 {WorkflowTriggerCallbackUrl} - 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 WorkflowTriggerCallbackUrl} 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. + */ + listContentCallbackUrl(resourceGroupName, integrationAccountName, agreementName, listContentCallbackUrlParameter, 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._listContentCallbackUrl(resourceGroupName, integrationAccountName, agreementName, listContentCallbackUrlParameter, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listContentCallbackUrl(resourceGroupName, integrationAccountName, agreementName, listContentCallbackUrlParameter, options, optionalCallback); + } + } + + /** + * Gets a list of integration account agreements. + * + * @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; + }); + }); + } + + /** + * Gets a list of integration account agreements. + * + * @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 {IntegrationAccountAgreementListResult} - 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 IntegrationAccountAgreementListResult} 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 = IntegrationAccountAgreements; diff --git a/lib/services/logicManagement/lib/operations/integrationAccountCertificates.js b/lib/services/logicManagement/lib/operations/integrationAccountCertificates.js new file mode 100644 index 0000000000..a11d67b1e6 --- /dev/null +++ b/lib/services/logicManagement/lib/operations/integrationAccountCertificates.js @@ -0,0 +1,1301 @@ +/* + * 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; + +/** + * Gets a list of integration account certificates. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @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 IntegrationAccountCertificateListResult} 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, integrationAccountName, 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 top = (options && options.top !== undefined) ? options.top : undefined; + // 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + 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.Logic/integrationAccounts/{integrationAccountName}/certificates'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['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['IntegrationAccountCertificateListResult']().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 an integration account certificate. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} certificateName The integration account certificate 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 IntegrationAccountCertificate} 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, integrationAccountName, certificateName, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{certificateName}', encodeURIComponent(certificateName)); + 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['IntegrationAccountCertificate']().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 updates an integration account certificate. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} certificateName The integration account certificate name. + * + * @param {object} certificate The integration account certificate. + * + * @param {object} [certificate.metadata] The metadata. + * + * @param {object} [certificate.key] The key details in the key vault. + * + * @param {object} certificate.key.keyVault The key vault reference. + * + * @param {string} [certificate.key.keyVault.id] The resource id. + * + * @param {string} certificate.key.keyName The private key name in key vault. + * + * @param {string} [certificate.key.keyVersion] The private key version in key + * vault. + * + * @param {string} [certificate.publicCertificate] The public certificate. + * + * @param {string} [certificate.location] The resource location. + * + * @param {object} [certificate.tags] The 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 IntegrationAccountCertificate} 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, integrationAccountName, certificateName, certificate, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (certificate === null || certificate === undefined) { + throw new Error('certificate 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.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{certificateName}', encodeURIComponent(certificateName)); + 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 = '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 (certificate !== null && certificate !== undefined) { + let requestModelMapper = new client.models['IntegrationAccountCertificate']().mapper(); + requestModel = client.serialize(requestModelMapper, certificate, 'certificate'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(certificate, 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) { + 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['IntegrationAccountCertificate']().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['IntegrationAccountCertificate']().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 an integration account certificate. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} certificateName The integration account certificate 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. + * + * {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, integrationAccountName, certificateName, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{certificateName}', encodeURIComponent(certificateName)); + 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 = '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 !== 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); + }); +} + +/** + * Gets a list of integration account certificates. + * + * @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 IntegrationAccountCertificateListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IntegrationAccountCertificateListResult']().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 IntegrationAccountCertificates. */ +class IntegrationAccountCertificates { + /** + * Create a IntegrationAccountCertificates. + * @param {LogicManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._listNext = _listNext; + } + + /** + * Gets a list of integration account certificates. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @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, integrationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, integrationAccountName, 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 list of integration account certificates. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @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 {IntegrationAccountCertificateListResult} - 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 IntegrationAccountCertificateListResult} 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, integrationAccountName, 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, integrationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, integrationAccountName, options, optionalCallback); + } + } + + /** + * Gets an integration account certificate. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} certificateName The integration account certificate 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, integrationAccountName, certificateName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, integrationAccountName, certificateName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets an integration account certificate. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} certificateName The integration account certificate 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 {IntegrationAccountCertificate} - 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 IntegrationAccountCertificate} 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, integrationAccountName, certificateName, 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, integrationAccountName, certificateName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, integrationAccountName, certificateName, options, optionalCallback); + } + } + + /** + * Creates or updates an integration account certificate. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} certificateName The integration account certificate name. + * + * @param {object} certificate The integration account certificate. + * + * @param {object} [certificate.metadata] The metadata. + * + * @param {object} [certificate.key] The key details in the key vault. + * + * @param {object} certificate.key.keyVault The key vault reference. + * + * @param {string} [certificate.key.keyVault.id] The resource id. + * + * @param {string} certificate.key.keyName The private key name in key vault. + * + * @param {string} [certificate.key.keyVersion] The private key version in key + * vault. + * + * @param {string} [certificate.publicCertificate] The public certificate. + * + * @param {string} [certificate.location] The resource location. + * + * @param {object} [certificate.tags] The 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, integrationAccountName, certificateName, certificate, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, integrationAccountName, certificateName, certificate, 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 updates an integration account certificate. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} certificateName The integration account certificate name. + * + * @param {object} certificate The integration account certificate. + * + * @param {object} [certificate.metadata] The metadata. + * + * @param {object} [certificate.key] The key details in the key vault. + * + * @param {object} certificate.key.keyVault The key vault reference. + * + * @param {string} [certificate.key.keyVault.id] The resource id. + * + * @param {string} certificate.key.keyName The private key name in key vault. + * + * @param {string} [certificate.key.keyVersion] The private key version in key + * vault. + * + * @param {string} [certificate.publicCertificate] The public certificate. + * + * @param {string} [certificate.location] The resource location. + * + * @param {object} [certificate.tags] The 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 {IntegrationAccountCertificate} - 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 IntegrationAccountCertificate} 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, integrationAccountName, certificateName, certificate, 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, integrationAccountName, certificateName, certificate, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, integrationAccountName, certificateName, certificate, options, optionalCallback); + } + } + + /** + * Deletes an integration account certificate. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} certificateName The integration account certificate 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, integrationAccountName, certificateName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, integrationAccountName, certificateName, 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 integration account certificate. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} certificateName The integration account certificate 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 {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, integrationAccountName, certificateName, 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, integrationAccountName, certificateName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, integrationAccountName, certificateName, options, optionalCallback); + } + } + + /** + * Gets a list of integration account certificates. + * + * @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; + }); + }); + } + + /** + * Gets a list of integration account certificates. + * + * @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 {IntegrationAccountCertificateListResult} - 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 IntegrationAccountCertificateListResult} 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 = IntegrationAccountCertificates; diff --git a/lib/services/logicManagement/lib/operations/integrationAccountMaps.js b/lib/services/logicManagement/lib/operations/integrationAccountMaps.js new file mode 100644 index 0000000000..c894118fbf --- /dev/null +++ b/lib/services/logicManagement/lib/operations/integrationAccountMaps.js @@ -0,0 +1,1592 @@ +/* + * 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; + +/** + * Gets a list of integration account maps. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @param {string} [options.filter] The filter to apply on the operation. + * Options for filters include: MapType. + * + * @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 IntegrationAccountMapListResult} 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, integrationAccountName, 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 top = (options && options.top !== undefined) ? options.top : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + // 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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.Logic/integrationAccounts/{integrationAccountName}/maps'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + 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['IntegrationAccountMapListResult']().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 an integration account map. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} mapName The integration account map 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 IntegrationAccountMap} 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, integrationAccountName, mapName, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (mapName === null || mapName === undefined || typeof mapName.valueOf() !== 'string') { + throw new Error('mapName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{mapName}', encodeURIComponent(mapName)); + 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['IntegrationAccountMap']().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 updates an integration account map. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} mapName The integration account map name. + * + * @param {object} map The integration account map. + * + * @param {string} map.mapType The map type. Possible values include: + * 'NotSpecified', 'Xslt', 'Xslt20', 'Xslt30', 'Liquid' + * + * @param {object} [map.parametersSchema] The parameters schema of integration + * account map. + * + * @param {string} [map.parametersSchema.ref] The reference name. + * + * @param {string} [map.content] The content. + * + * @param {string} [map.contentType] The content type. + * + * @param {object} [map.metadata] The metadata. + * + * @param {string} [map.location] The resource location. + * + * @param {object} [map.tags] The 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 IntegrationAccountMap} 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, integrationAccountName, mapName, map, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (mapName === null || mapName === undefined || typeof mapName.valueOf() !== 'string') { + throw new Error('mapName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (map === null || map === undefined) { + throw new Error('map 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.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{mapName}', encodeURIComponent(mapName)); + 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 = '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 (map !== null && map !== undefined) { + let requestModelMapper = new client.models['IntegrationAccountMap']().mapper(); + requestModel = client.serialize(requestModelMapper, map, 'map'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(map, 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) { + 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['IntegrationAccountMap']().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['IntegrationAccountMap']().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 an integration account map. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} mapName The integration account map 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. + * + * {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, integrationAccountName, mapName, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (mapName === null || mapName === undefined || typeof mapName.valueOf() !== 'string') { + throw new Error('mapName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{mapName}', encodeURIComponent(mapName)); + 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 = '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 !== 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); + }); +} + +/** + * Get the content callback url. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} mapName The integration account map name. + * + * @param {object} listContentCallbackUrlParameter + * + * @param {date} [listContentCallbackUrlParameter.notAfter] The expiry time. + * + * @param {string} [listContentCallbackUrlParameter.keyType] The key type. + * Possible values include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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 WorkflowTriggerCallbackUrl} 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 _listContentCallbackUrl(resourceGroupName, integrationAccountName, mapName, listContentCallbackUrlParameter, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (mapName === null || mapName === undefined || typeof mapName.valueOf() !== 'string') { + throw new Error('mapName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (listContentCallbackUrlParameter === null || listContentCallbackUrlParameter === undefined) { + throw new Error('listContentCallbackUrlParameter 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.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}/listContentCallbackUrl'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{mapName}', encodeURIComponent(mapName)); + 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 (listContentCallbackUrlParameter !== null && listContentCallbackUrlParameter !== undefined) { + let requestModelMapper = new client.models['GetCallbackUrlParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, listContentCallbackUrlParameter, 'listContentCallbackUrlParameter'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(listContentCallbackUrlParameter, 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['WorkflowTriggerCallbackUrl']().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 list of integration account maps. + * + * @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 IntegrationAccountMapListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IntegrationAccountMapListResult']().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 IntegrationAccountMaps. */ +class IntegrationAccountMaps { + /** + * Create a IntegrationAccountMaps. + * @param {LogicManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._listContentCallbackUrl = _listContentCallbackUrl; + this._listNext = _listNext; + } + + /** + * Gets a list of integration account maps. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @param {string} [options.filter] The filter to apply on the operation. + * Options for filters include: MapType. + * + * @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, integrationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, integrationAccountName, 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 list of integration account maps. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @param {string} [options.filter] The filter to apply on the operation. + * Options for filters include: MapType. + * + * @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 {IntegrationAccountMapListResult} - 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 IntegrationAccountMapListResult} 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, integrationAccountName, 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, integrationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, integrationAccountName, options, optionalCallback); + } + } + + /** + * Gets an integration account map. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} mapName The integration account map 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, integrationAccountName, mapName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, integrationAccountName, mapName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets an integration account map. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} mapName The integration account map 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 {IntegrationAccountMap} - 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 IntegrationAccountMap} 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, integrationAccountName, mapName, 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, integrationAccountName, mapName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, integrationAccountName, mapName, options, optionalCallback); + } + } + + /** + * Creates or updates an integration account map. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} mapName The integration account map name. + * + * @param {object} map The integration account map. + * + * @param {string} map.mapType The map type. Possible values include: + * 'NotSpecified', 'Xslt', 'Xslt20', 'Xslt30', 'Liquid' + * + * @param {object} [map.parametersSchema] The parameters schema of integration + * account map. + * + * @param {string} [map.parametersSchema.ref] The reference name. + * + * @param {string} [map.content] The content. + * + * @param {string} [map.contentType] The content type. + * + * @param {object} [map.metadata] The metadata. + * + * @param {string} [map.location] The resource location. + * + * @param {object} [map.tags] The 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, integrationAccountName, mapName, map, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, integrationAccountName, mapName, map, 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 updates an integration account map. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} mapName The integration account map name. + * + * @param {object} map The integration account map. + * + * @param {string} map.mapType The map type. Possible values include: + * 'NotSpecified', 'Xslt', 'Xslt20', 'Xslt30', 'Liquid' + * + * @param {object} [map.parametersSchema] The parameters schema of integration + * account map. + * + * @param {string} [map.parametersSchema.ref] The reference name. + * + * @param {string} [map.content] The content. + * + * @param {string} [map.contentType] The content type. + * + * @param {object} [map.metadata] The metadata. + * + * @param {string} [map.location] The resource location. + * + * @param {object} [map.tags] The 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 {IntegrationAccountMap} - 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 IntegrationAccountMap} 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, integrationAccountName, mapName, map, 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, integrationAccountName, mapName, map, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, integrationAccountName, mapName, map, options, optionalCallback); + } + } + + /** + * Deletes an integration account map. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} mapName The integration account map 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, integrationAccountName, mapName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, integrationAccountName, mapName, 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 integration account map. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} mapName The integration account map 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 {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, integrationAccountName, mapName, 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, integrationAccountName, mapName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, integrationAccountName, mapName, options, optionalCallback); + } + } + + /** + * Get the content callback url. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} mapName The integration account map name. + * + * @param {object} listContentCallbackUrlParameter + * + * @param {date} [listContentCallbackUrlParameter.notAfter] The expiry time. + * + * @param {string} [listContentCallbackUrlParameter.keyType] The key type. + * Possible values include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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. + */ + listContentCallbackUrlWithHttpOperationResponse(resourceGroupName, integrationAccountName, mapName, listContentCallbackUrlParameter, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listContentCallbackUrl(resourceGroupName, integrationAccountName, mapName, listContentCallbackUrlParameter, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the content callback url. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} mapName The integration account map name. + * + * @param {object} listContentCallbackUrlParameter + * + * @param {date} [listContentCallbackUrlParameter.notAfter] The expiry time. + * + * @param {string} [listContentCallbackUrlParameter.keyType] The key type. + * Possible values include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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 {WorkflowTriggerCallbackUrl} - 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 WorkflowTriggerCallbackUrl} 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. + */ + listContentCallbackUrl(resourceGroupName, integrationAccountName, mapName, listContentCallbackUrlParameter, 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._listContentCallbackUrl(resourceGroupName, integrationAccountName, mapName, listContentCallbackUrlParameter, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listContentCallbackUrl(resourceGroupName, integrationAccountName, mapName, listContentCallbackUrlParameter, options, optionalCallback); + } + } + + /** + * Gets a list of integration account maps. + * + * @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; + }); + }); + } + + /** + * Gets a list of integration account maps. + * + * @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 {IntegrationAccountMapListResult} - 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 IntegrationAccountMapListResult} 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 = IntegrationAccountMaps; diff --git a/lib/services/logicManagement/lib/operations/integrationAccountPartners.js b/lib/services/logicManagement/lib/operations/integrationAccountPartners.js new file mode 100644 index 0000000000..3bff352cf6 --- /dev/null +++ b/lib/services/logicManagement/lib/operations/integrationAccountPartners.js @@ -0,0 +1,1590 @@ +/* + * 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; + +/** + * Gets a list of integration account partners. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @param {string} [options.filter] The filter to apply on the operation. + * Options for filters include: PartnerType. + * + * @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 IntegrationAccountPartnerListResult} 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, integrationAccountName, 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 top = (options && options.top !== undefined) ? options.top : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + // 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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.Logic/integrationAccounts/{integrationAccountName}/partners'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + 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['IntegrationAccountPartnerListResult']().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 an integration account partner. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} partnerName The integration account partner 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 IntegrationAccountPartner} 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, integrationAccountName, partnerName, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (partnerName === null || partnerName === undefined || typeof partnerName.valueOf() !== 'string') { + throw new Error('partnerName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{partnerName}', encodeURIComponent(partnerName)); + 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['IntegrationAccountPartner']().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 updates an integration account partner. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} partnerName The integration account partner name. + * + * @param {object} partner The integration account partner. + * + * @param {string} partner.partnerType The partner type. Possible values + * include: 'NotSpecified', 'B2B' + * + * @param {object} [partner.metadata] The metadata. + * + * @param {object} partner.content The partner content. + * + * @param {object} [partner.content.b2b] The B2B partner content. + * + * @param {array} [partner.content.b2b.businessIdentities] The list of partner + * business identities. + * + * @param {string} [partner.location] The resource location. + * + * @param {object} [partner.tags] The 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 IntegrationAccountPartner} 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, integrationAccountName, partnerName, partner, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (partnerName === null || partnerName === undefined || typeof partnerName.valueOf() !== 'string') { + throw new Error('partnerName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (partner === null || partner === undefined) { + throw new Error('partner 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.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{partnerName}', encodeURIComponent(partnerName)); + 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 = '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 (partner !== null && partner !== undefined) { + let requestModelMapper = new client.models['IntegrationAccountPartner']().mapper(); + requestModel = client.serialize(requestModelMapper, partner, 'partner'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(partner, 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) { + 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['IntegrationAccountPartner']().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['IntegrationAccountPartner']().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 an integration account partner. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} partnerName The integration account partner 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. + * + * {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, integrationAccountName, partnerName, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (partnerName === null || partnerName === undefined || typeof partnerName.valueOf() !== 'string') { + throw new Error('partnerName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{partnerName}', encodeURIComponent(partnerName)); + 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 = '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 !== 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); + }); +} + +/** + * Get the content callback url. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} partnerName The integration account partner name. + * + * @param {object} listContentCallbackUrlParameter + * + * @param {date} [listContentCallbackUrlParameter.notAfter] The expiry time. + * + * @param {string} [listContentCallbackUrlParameter.keyType] The key type. + * Possible values include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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 WorkflowTriggerCallbackUrl} 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 _listContentCallbackUrl(resourceGroupName, integrationAccountName, partnerName, listContentCallbackUrlParameter, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (partnerName === null || partnerName === undefined || typeof partnerName.valueOf() !== 'string') { + throw new Error('partnerName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (listContentCallbackUrlParameter === null || listContentCallbackUrlParameter === undefined) { + throw new Error('listContentCallbackUrlParameter 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.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}/listContentCallbackUrl'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{partnerName}', encodeURIComponent(partnerName)); + 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 (listContentCallbackUrlParameter !== null && listContentCallbackUrlParameter !== undefined) { + let requestModelMapper = new client.models['GetCallbackUrlParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, listContentCallbackUrlParameter, 'listContentCallbackUrlParameter'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(listContentCallbackUrlParameter, 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['WorkflowTriggerCallbackUrl']().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 list of integration account partners. + * + * @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 IntegrationAccountPartnerListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IntegrationAccountPartnerListResult']().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 IntegrationAccountPartners. */ +class IntegrationAccountPartners { + /** + * Create a IntegrationAccountPartners. + * @param {LogicManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._listContentCallbackUrl = _listContentCallbackUrl; + this._listNext = _listNext; + } + + /** + * Gets a list of integration account partners. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @param {string} [options.filter] The filter to apply on the operation. + * Options for filters include: PartnerType. + * + * @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, integrationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, integrationAccountName, 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 list of integration account partners. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @param {string} [options.filter] The filter to apply on the operation. + * Options for filters include: PartnerType. + * + * @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 {IntegrationAccountPartnerListResult} - 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 IntegrationAccountPartnerListResult} 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, integrationAccountName, 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, integrationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, integrationAccountName, options, optionalCallback); + } + } + + /** + * Gets an integration account partner. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} partnerName The integration account partner 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, integrationAccountName, partnerName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, integrationAccountName, partnerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets an integration account partner. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} partnerName The integration account partner 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 {IntegrationAccountPartner} - 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 IntegrationAccountPartner} 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, integrationAccountName, partnerName, 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, integrationAccountName, partnerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, integrationAccountName, partnerName, options, optionalCallback); + } + } + + /** + * Creates or updates an integration account partner. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} partnerName The integration account partner name. + * + * @param {object} partner The integration account partner. + * + * @param {string} partner.partnerType The partner type. Possible values + * include: 'NotSpecified', 'B2B' + * + * @param {object} [partner.metadata] The metadata. + * + * @param {object} partner.content The partner content. + * + * @param {object} [partner.content.b2b] The B2B partner content. + * + * @param {array} [partner.content.b2b.businessIdentities] The list of partner + * business identities. + * + * @param {string} [partner.location] The resource location. + * + * @param {object} [partner.tags] The 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, integrationAccountName, partnerName, partner, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, integrationAccountName, partnerName, partner, 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 updates an integration account partner. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} partnerName The integration account partner name. + * + * @param {object} partner The integration account partner. + * + * @param {string} partner.partnerType The partner type. Possible values + * include: 'NotSpecified', 'B2B' + * + * @param {object} [partner.metadata] The metadata. + * + * @param {object} partner.content The partner content. + * + * @param {object} [partner.content.b2b] The B2B partner content. + * + * @param {array} [partner.content.b2b.businessIdentities] The list of partner + * business identities. + * + * @param {string} [partner.location] The resource location. + * + * @param {object} [partner.tags] The 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 {IntegrationAccountPartner} - 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 IntegrationAccountPartner} 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, integrationAccountName, partnerName, partner, 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, integrationAccountName, partnerName, partner, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, integrationAccountName, partnerName, partner, options, optionalCallback); + } + } + + /** + * Deletes an integration account partner. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} partnerName The integration account partner 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, integrationAccountName, partnerName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, integrationAccountName, partnerName, 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 integration account partner. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} partnerName The integration account partner 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 {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, integrationAccountName, partnerName, 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, integrationAccountName, partnerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, integrationAccountName, partnerName, options, optionalCallback); + } + } + + /** + * Get the content callback url. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} partnerName The integration account partner name. + * + * @param {object} listContentCallbackUrlParameter + * + * @param {date} [listContentCallbackUrlParameter.notAfter] The expiry time. + * + * @param {string} [listContentCallbackUrlParameter.keyType] The key type. + * Possible values include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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. + */ + listContentCallbackUrlWithHttpOperationResponse(resourceGroupName, integrationAccountName, partnerName, listContentCallbackUrlParameter, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listContentCallbackUrl(resourceGroupName, integrationAccountName, partnerName, listContentCallbackUrlParameter, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the content callback url. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} partnerName The integration account partner name. + * + * @param {object} listContentCallbackUrlParameter + * + * @param {date} [listContentCallbackUrlParameter.notAfter] The expiry time. + * + * @param {string} [listContentCallbackUrlParameter.keyType] The key type. + * Possible values include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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 {WorkflowTriggerCallbackUrl} - 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 WorkflowTriggerCallbackUrl} 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. + */ + listContentCallbackUrl(resourceGroupName, integrationAccountName, partnerName, listContentCallbackUrlParameter, 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._listContentCallbackUrl(resourceGroupName, integrationAccountName, partnerName, listContentCallbackUrlParameter, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listContentCallbackUrl(resourceGroupName, integrationAccountName, partnerName, listContentCallbackUrlParameter, options, optionalCallback); + } + } + + /** + * Gets a list of integration account partners. + * + * @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; + }); + }); + } + + /** + * Gets a list of integration account partners. + * + * @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 {IntegrationAccountPartnerListResult} - 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 IntegrationAccountPartnerListResult} 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 = IntegrationAccountPartners; diff --git a/lib/services/logicManagement/lib/operations/integrationAccountSchemas.js b/lib/services/logicManagement/lib/operations/integrationAccountSchemas.js new file mode 100644 index 0000000000..5d07c9f1e6 --- /dev/null +++ b/lib/services/logicManagement/lib/operations/integrationAccountSchemas.js @@ -0,0 +1,1599 @@ +/* + * 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; + +/** + * Gets a list of integration account schemas. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @param {string} [options.filter] The filter to apply on the operation. + * Options for filters include: SchemaType. + * + * @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 IntegrationAccountSchemaListResult} 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, integrationAccountName, 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 top = (options && options.top !== undefined) ? options.top : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + // 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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.Logic/integrationAccounts/{integrationAccountName}/schemas'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + 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['IntegrationAccountSchemaListResult']().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 an integration account schema. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} schemaName The integration account schema 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 IntegrationAccountSchema} 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, integrationAccountName, schemaName, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (schemaName === null || schemaName === undefined || typeof schemaName.valueOf() !== 'string') { + throw new Error('schemaName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{schemaName}', encodeURIComponent(schemaName)); + 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['IntegrationAccountSchema']().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 updates an integration account schema. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} schemaName The integration account schema name. + * + * @param {object} schema The integration account schema. + * + * @param {string} schema.schemaType The schema type. Possible values include: + * 'NotSpecified', 'Xml' + * + * @param {string} [schema.targetNamespace] The target namespace of the schema. + * + * @param {string} [schema.documentName] The document name. + * + * @param {string} [schema.fileName] The file name. + * + * @param {object} [schema.metadata] The metadata. + * + * @param {string} [schema.content] The content. + * + * @param {string} [schema.contentType] The content type. + * + * @param {string} [schema.location] The resource location. + * + * @param {object} [schema.tags] The 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 IntegrationAccountSchema} 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, integrationAccountName, schemaName, schema, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (schemaName === null || schemaName === undefined || typeof schemaName.valueOf() !== 'string') { + throw new Error('schemaName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (schema === null || schema === undefined) { + throw new Error('schema 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.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{schemaName}', encodeURIComponent(schemaName)); + 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 = '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 (schema !== null && schema !== undefined) { + let requestModelMapper = new client.models['IntegrationAccountSchema']().mapper(); + requestModel = client.serialize(requestModelMapper, schema, 'schema'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(schema, 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) { + 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['IntegrationAccountSchema']().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['IntegrationAccountSchema']().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 an integration account schema. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} schemaName The integration account schema 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. + * + * {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, integrationAccountName, schemaName, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (schemaName === null || schemaName === undefined || typeof schemaName.valueOf() !== 'string') { + throw new Error('schemaName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{schemaName}', encodeURIComponent(schemaName)); + 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 = '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 !== 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); + }); +} + +/** + * Get the content callback url. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} schemaName The integration account schema name. + * + * @param {object} listContentCallbackUrlParameter + * + * @param {date} [listContentCallbackUrlParameter.notAfter] The expiry time. + * + * @param {string} [listContentCallbackUrlParameter.keyType] The key type. + * Possible values include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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 WorkflowTriggerCallbackUrl} 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 _listContentCallbackUrl(resourceGroupName, integrationAccountName, schemaName, listContentCallbackUrlParameter, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (schemaName === null || schemaName === undefined || typeof schemaName.valueOf() !== 'string') { + throw new Error('schemaName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (listContentCallbackUrlParameter === null || listContentCallbackUrlParameter === undefined) { + throw new Error('listContentCallbackUrlParameter 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.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}/listContentCallbackUrl'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{schemaName}', encodeURIComponent(schemaName)); + 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 (listContentCallbackUrlParameter !== null && listContentCallbackUrlParameter !== undefined) { + let requestModelMapper = new client.models['GetCallbackUrlParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, listContentCallbackUrlParameter, 'listContentCallbackUrlParameter'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(listContentCallbackUrlParameter, 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['WorkflowTriggerCallbackUrl']().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 list of integration account schemas. + * + * @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 IntegrationAccountSchemaListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IntegrationAccountSchemaListResult']().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 IntegrationAccountSchemas. */ +class IntegrationAccountSchemas { + /** + * Create a IntegrationAccountSchemas. + * @param {LogicManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._listContentCallbackUrl = _listContentCallbackUrl; + this._listNext = _listNext; + } + + /** + * Gets a list of integration account schemas. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @param {string} [options.filter] The filter to apply on the operation. + * Options for filters include: SchemaType. + * + * @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, integrationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, integrationAccountName, 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 list of integration account schemas. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @param {string} [options.filter] The filter to apply on the operation. + * Options for filters include: SchemaType. + * + * @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 {IntegrationAccountSchemaListResult} - 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 IntegrationAccountSchemaListResult} 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, integrationAccountName, 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, integrationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, integrationAccountName, options, optionalCallback); + } + } + + /** + * Gets an integration account schema. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} schemaName The integration account schema 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, integrationAccountName, schemaName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, integrationAccountName, schemaName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets an integration account schema. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} schemaName The integration account schema 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 {IntegrationAccountSchema} - 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 IntegrationAccountSchema} 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, integrationAccountName, schemaName, 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, integrationAccountName, schemaName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, integrationAccountName, schemaName, options, optionalCallback); + } + } + + /** + * Creates or updates an integration account schema. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} schemaName The integration account schema name. + * + * @param {object} schema The integration account schema. + * + * @param {string} schema.schemaType The schema type. Possible values include: + * 'NotSpecified', 'Xml' + * + * @param {string} [schema.targetNamespace] The target namespace of the schema. + * + * @param {string} [schema.documentName] The document name. + * + * @param {string} [schema.fileName] The file name. + * + * @param {object} [schema.metadata] The metadata. + * + * @param {string} [schema.content] The content. + * + * @param {string} [schema.contentType] The content type. + * + * @param {string} [schema.location] The resource location. + * + * @param {object} [schema.tags] The 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, integrationAccountName, schemaName, schema, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, integrationAccountName, schemaName, schema, 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 updates an integration account schema. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} schemaName The integration account schema name. + * + * @param {object} schema The integration account schema. + * + * @param {string} schema.schemaType The schema type. Possible values include: + * 'NotSpecified', 'Xml' + * + * @param {string} [schema.targetNamespace] The target namespace of the schema. + * + * @param {string} [schema.documentName] The document name. + * + * @param {string} [schema.fileName] The file name. + * + * @param {object} [schema.metadata] The metadata. + * + * @param {string} [schema.content] The content. + * + * @param {string} [schema.contentType] The content type. + * + * @param {string} [schema.location] The resource location. + * + * @param {object} [schema.tags] The 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 {IntegrationAccountSchema} - 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 IntegrationAccountSchema} 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, integrationAccountName, schemaName, schema, 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, integrationAccountName, schemaName, schema, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, integrationAccountName, schemaName, schema, options, optionalCallback); + } + } + + /** + * Deletes an integration account schema. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} schemaName The integration account schema 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, integrationAccountName, schemaName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, integrationAccountName, schemaName, 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 integration account schema. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} schemaName The integration account schema 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 {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, integrationAccountName, schemaName, 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, integrationAccountName, schemaName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, integrationAccountName, schemaName, options, optionalCallback); + } + } + + /** + * Get the content callback url. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} schemaName The integration account schema name. + * + * @param {object} listContentCallbackUrlParameter + * + * @param {date} [listContentCallbackUrlParameter.notAfter] The expiry time. + * + * @param {string} [listContentCallbackUrlParameter.keyType] The key type. + * Possible values include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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. + */ + listContentCallbackUrlWithHttpOperationResponse(resourceGroupName, integrationAccountName, schemaName, listContentCallbackUrlParameter, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listContentCallbackUrl(resourceGroupName, integrationAccountName, schemaName, listContentCallbackUrlParameter, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the content callback url. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} schemaName The integration account schema name. + * + * @param {object} listContentCallbackUrlParameter + * + * @param {date} [listContentCallbackUrlParameter.notAfter] The expiry time. + * + * @param {string} [listContentCallbackUrlParameter.keyType] The key type. + * Possible values include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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 {WorkflowTriggerCallbackUrl} - 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 WorkflowTriggerCallbackUrl} 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. + */ + listContentCallbackUrl(resourceGroupName, integrationAccountName, schemaName, listContentCallbackUrlParameter, 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._listContentCallbackUrl(resourceGroupName, integrationAccountName, schemaName, listContentCallbackUrlParameter, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listContentCallbackUrl(resourceGroupName, integrationAccountName, schemaName, listContentCallbackUrlParameter, options, optionalCallback); + } + } + + /** + * Gets a list of integration account schemas. + * + * @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; + }); + }); + } + + /** + * Gets a list of integration account schemas. + * + * @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 {IntegrationAccountSchemaListResult} - 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 IntegrationAccountSchemaListResult} 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 = IntegrationAccountSchemas; diff --git a/lib/services/logicManagement/lib/operations/integrationAccountSessions.js b/lib/services/logicManagement/lib/operations/integrationAccountSessions.js new file mode 100644 index 0000000000..c0d438517e --- /dev/null +++ b/lib/services/logicManagement/lib/operations/integrationAccountSessions.js @@ -0,0 +1,1283 @@ +/* + * 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; + +/** + * Gets a list of integration account sessions. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @param {string} [options.filter] The filter to apply on the operation. + * Options for filters include: ChangedTime. + * + * @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 IntegrationAccountSessionListResult} 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, integrationAccountName, 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 top = (options && options.top !== undefined) ? options.top : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + // 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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.Logic/integrationAccounts/{integrationAccountName}/sessions'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + 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['IntegrationAccountSessionListResult']().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 an integration account session. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} sessionName The integration account session 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 IntegrationAccountSession} 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, integrationAccountName, sessionName, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sessionName === null || sessionName === undefined || typeof sessionName.valueOf() !== 'string') { + throw new Error('sessionName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{sessionName}', encodeURIComponent(sessionName)); + 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) { + 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['IntegrationAccountSession']().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 updates an integration account session. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} sessionName The integration account session name. + * + * @param {object} session The integration account session. + * + * @param {object} [session.content] The session content. + * + * @param {string} [session.location] The resource location. + * + * @param {object} [session.tags] The 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 IntegrationAccountSession} 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, integrationAccountName, sessionName, session, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sessionName === null || sessionName === undefined || typeof sessionName.valueOf() !== 'string') { + throw new Error('sessionName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (session === null || session === undefined) { + throw new Error('session 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.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{sessionName}', encodeURIComponent(sessionName)); + 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 = '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 (session !== null && session !== undefined) { + let requestModelMapper = new client.models['IntegrationAccountSession']().mapper(); + requestModel = client.serialize(requestModelMapper, session, 'session'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(session, 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['IntegrationAccountSession']().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['IntegrationAccountSession']().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 an integration account session. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} sessionName The integration account session 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. + * + * {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, integrationAccountName, sessionName, 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 (integrationAccountName === null || integrationAccountName === undefined || typeof integrationAccountName.valueOf() !== 'string') { + throw new Error('integrationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sessionName === null || sessionName === undefined || typeof sessionName.valueOf() !== 'string') { + throw new Error('sessionName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{integrationAccountName}', encodeURIComponent(integrationAccountName)); + requestUrl = requestUrl.replace('{sessionName}', encodeURIComponent(sessionName)); + 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 = '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 !== 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); + }); +} + +/** + * Gets a list of integration account sessions. + * + * @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 IntegrationAccountSessionListResult} 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['IntegrationAccountSessionListResult']().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 IntegrationAccountSessions. */ +class IntegrationAccountSessions { + /** + * Create a IntegrationAccountSessions. + * @param {LogicManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._listNext = _listNext; + } + + /** + * Gets a list of integration account sessions. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @param {string} [options.filter] The filter to apply on the operation. + * Options for filters include: ChangedTime. + * + * @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, integrationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, integrationAccountName, 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 list of integration account sessions. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.top] The number of items to be included in the + * result. + * + * @param {string} [options.filter] The filter to apply on the operation. + * Options for filters include: ChangedTime. + * + * @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 {IntegrationAccountSessionListResult} - 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 IntegrationAccountSessionListResult} 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, integrationAccountName, 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, integrationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, integrationAccountName, options, optionalCallback); + } + } + + /** + * Gets an integration account session. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} sessionName The integration account session 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, integrationAccountName, sessionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, integrationAccountName, sessionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets an integration account session. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} sessionName The integration account session 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 {IntegrationAccountSession} - 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 IntegrationAccountSession} 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, integrationAccountName, sessionName, 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, integrationAccountName, sessionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, integrationAccountName, sessionName, options, optionalCallback); + } + } + + /** + * Creates or updates an integration account session. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} sessionName The integration account session name. + * + * @param {object} session The integration account session. + * + * @param {object} [session.content] The session content. + * + * @param {string} [session.location] The resource location. + * + * @param {object} [session.tags] The 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, integrationAccountName, sessionName, session, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, integrationAccountName, sessionName, session, 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 updates an integration account session. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} sessionName The integration account session name. + * + * @param {object} session The integration account session. + * + * @param {object} [session.content] The session content. + * + * @param {string} [session.location] The resource location. + * + * @param {object} [session.tags] The 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 {IntegrationAccountSession} - 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 IntegrationAccountSession} 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, integrationAccountName, sessionName, session, 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, integrationAccountName, sessionName, session, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, integrationAccountName, sessionName, session, options, optionalCallback); + } + } + + /** + * Deletes an integration account session. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} sessionName The integration account session 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, integrationAccountName, sessionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, integrationAccountName, sessionName, 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 integration account session. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} integrationAccountName The integration account name. + * + * @param {string} sessionName The integration account session 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 {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, integrationAccountName, sessionName, 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, integrationAccountName, sessionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, integrationAccountName, sessionName, options, optionalCallback); + } + } + + /** + * Gets a list of integration account sessions. + * + * @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; + }); + }); + } + + /** + * Gets a list of integration account sessions. + * + * @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 {IntegrationAccountSessionListResult} - 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 IntegrationAccountSessionListResult} 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 = IntegrationAccountSessions; diff --git a/lib/services/logicManagement/lib/operations/integrationAccounts.js b/lib/services/logicManagement/lib/operations/integrationAccounts.js index 152cad7988..ac4c98a719 100644 --- a/lib/services/logicManagement/lib/operations/integrationAccounts.js +++ b/lib/services/logicManagement/lib/operations/integrationAccounts.js @@ -468,7 +468,7 @@ function _get(resourceGroupName, integrationAccountName, options, callback) { * @param {object} [integrationAccount.sku] The sku. * * @param {string} integrationAccount.sku.name The sku name. Possible values - * include: 'NotSpecified', 'Free', 'Standard' + * include: 'NotSpecified', 'Free', 'Basic', 'Standard' * * @param {string} [integrationAccount.location] The resource location. * @@ -661,7 +661,7 @@ function _createOrUpdate(resourceGroupName, integrationAccountName, integrationA * @param {object} [integrationAccount.sku] The sku. * * @param {string} integrationAccount.sku.name The sku name. Possible values - * include: 'NotSpecified', 'Free', 'Standard' + * include: 'NotSpecified', 'Free', 'Basic', 'Standard' * * @param {string} [integrationAccount.location] The resource location. * @@ -981,7 +981,7 @@ function _deleteMethod(resourceGroupName, integrationAccountName, options, callb * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _getCallbackUrl(resourceGroupName, integrationAccountName, parameters, options, callback) { +function _listCallbackUrl(resourceGroupName, integrationAccountName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1876,7 +1876,7 @@ class IntegrationAccounts { this._createOrUpdate = _createOrUpdate; this._update = _update; this._deleteMethod = _deleteMethod; - this._getCallbackUrl = _getCallbackUrl; + this._listCallbackUrl = _listCallbackUrl; this._listKeyVaultKeys = _listKeyVaultKeys; this._logTrackingEvents = _logTrackingEvents; this._regenerateAccessKey = _regenerateAccessKey; @@ -2159,7 +2159,7 @@ class IntegrationAccounts { * @param {object} [integrationAccount.sku] The sku. * * @param {string} integrationAccount.sku.name The sku name. Possible values - * include: 'NotSpecified', 'Free', 'Standard' + * include: 'NotSpecified', 'Free', 'Basic', 'Standard' * * @param {string} [integrationAccount.location] The resource location. * @@ -2205,7 +2205,7 @@ class IntegrationAccounts { * @param {object} [integrationAccount.sku] The sku. * * @param {string} integrationAccount.sku.name The sku name. Possible values - * include: 'NotSpecified', 'Free', 'Standard' + * include: 'NotSpecified', 'Free', 'Basic', 'Standard' * * @param {string} [integrationAccount.location] The resource location. * @@ -2273,7 +2273,7 @@ class IntegrationAccounts { * @param {object} [integrationAccount.sku] The sku. * * @param {string} integrationAccount.sku.name The sku name. Possible values - * include: 'NotSpecified', 'Free', 'Standard' + * include: 'NotSpecified', 'Free', 'Basic', 'Standard' * * @param {string} [integrationAccount.location] The resource location. * @@ -2319,7 +2319,7 @@ class IntegrationAccounts { * @param {object} [integrationAccount.sku] The sku. * * @param {string} integrationAccount.sku.name The sku name. Possible values - * include: 'NotSpecified', 'Free', 'Standard' + * include: 'NotSpecified', 'Free', 'Basic', 'Standard' * * @param {string} [integrationAccount.location] The resource location. * @@ -2482,11 +2482,11 @@ class IntegrationAccounts { * * @reject {Error} - The error object. */ - getCallbackUrlWithHttpOperationResponse(resourceGroupName, integrationAccountName, parameters, options) { + listCallbackUrlWithHttpOperationResponse(resourceGroupName, integrationAccountName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._getCallbackUrl(resourceGroupName, integrationAccountName, parameters, options, (err, result, request, response) => { + self._listCallbackUrl(resourceGroupName, integrationAccountName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2537,7 +2537,7 @@ class IntegrationAccounts { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - getCallbackUrl(resourceGroupName, integrationAccountName, parameters, options, optionalCallback) { + listCallbackUrl(resourceGroupName, integrationAccountName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2546,14 +2546,14 @@ class IntegrationAccounts { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._getCallbackUrl(resourceGroupName, integrationAccountName, parameters, options, (err, result, request, response) => { + self._listCallbackUrl(resourceGroupName, integrationAccountName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._getCallbackUrl(resourceGroupName, integrationAccountName, parameters, options, optionalCallback); + return self._listCallbackUrl(resourceGroupName, integrationAccountName, parameters, options, optionalCallback); } } diff --git a/lib/services/logicManagement/lib/operations/operations.js b/lib/services/logicManagement/lib/operations/operations.js new file mode 100644 index 0000000000..3d2acbff1c --- /dev/null +++ b/lib/services/logicManagement/lib/operations/operations.js @@ -0,0 +1,451 @@ +/* + * 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 available Logic REST API operations. + * + * @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 OperationListResult} 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.'); + } + // Validate + try { + 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('/') ? '' : '/') + 'providers/Microsoft.Logic/operations'; + 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) { + 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['OperationListResult']().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 available Logic REST API operations. + * + * @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 OperationListResult} 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['OperationListResult']().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 Operations. */ +class Operations { + /** + * Create a Operations. + * @param {LogicManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Lists all of the available Logic REST API operations. + * + * @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 available Logic REST API operations. + * + * @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 {OperationListResult} - 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 OperationListResult} 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 available Logic REST API operations. + * + * @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 available Logic REST API operations. + * + * @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 {OperationListResult} - 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 OperationListResult} 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 = Operations; diff --git a/lib/services/logicManagement/lib/operations/workflowRunActionScopeRepetitions.js b/lib/services/logicManagement/lib/operations/workflowRunActionScopeRepetitions.js new file mode 100644 index 0000000000..fb5467b86b --- /dev/null +++ b/lib/services/logicManagement/lib/operations/workflowRunActionScopeRepetitions.js @@ -0,0 +1,549 @@ +/* + * 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; + +/** + * List the workflow run action scoped repetitions. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} workflowName The workflow name. + * + * @param {string} runName The workflow run name. + * + * @param {string} actionName The workflow action 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 + * WorkflowRunActionRepetitionDefinitionCollection} 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, workflowName, runName, actionName, 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 (workflowName === null || workflowName === undefined || typeof workflowName.valueOf() !== 'string') { + throw new Error('workflowName cannot be null or undefined and it must be of type string.'); + } + if (runName === null || runName === undefined || typeof runName.valueOf() !== 'string') { + throw new Error('runName cannot be null or undefined and it must be of type string.'); + } + if (actionName === null || actionName === undefined || typeof actionName.valueOf() !== 'string') { + throw new Error('actionName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/scopeRepetitions'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{workflowName}', encodeURIComponent(workflowName)); + requestUrl = requestUrl.replace('{runName}', encodeURIComponent(runName)); + requestUrl = requestUrl.replace('{actionName}', encodeURIComponent(actionName)); + 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['WorkflowRunActionRepetitionDefinitionCollection']().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); + }); +} + +/** + * Get a workflow run action scoped repetition. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} workflowName The workflow name. + * + * @param {string} runName The workflow run name. + * + * @param {string} actionName The workflow action name. + * + * @param {string} repetitionName The workflow repetition. + * + * @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 WorkflowRunActionRepetitionDefinition} 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, workflowName, runName, actionName, repetitionName, 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 (workflowName === null || workflowName === undefined || typeof workflowName.valueOf() !== 'string') { + throw new Error('workflowName cannot be null or undefined and it must be of type string.'); + } + if (runName === null || runName === undefined || typeof runName.valueOf() !== 'string') { + throw new Error('runName cannot be null or undefined and it must be of type string.'); + } + if (actionName === null || actionName === undefined || typeof actionName.valueOf() !== 'string') { + throw new Error('actionName cannot be null or undefined and it must be of type string.'); + } + if (repetitionName === null || repetitionName === undefined || typeof repetitionName.valueOf() !== 'string') { + throw new Error('repetitionName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/scopeRepetitions/{repetitionName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{workflowName}', encodeURIComponent(workflowName)); + requestUrl = requestUrl.replace('{runName}', encodeURIComponent(runName)); + requestUrl = requestUrl.replace('{actionName}', encodeURIComponent(actionName)); + requestUrl = requestUrl.replace('{repetitionName}', encodeURIComponent(repetitionName)); + 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['WorkflowRunActionRepetitionDefinition']().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 WorkflowRunActionScopeRepetitions. */ +class WorkflowRunActionScopeRepetitions { + /** + * Create a WorkflowRunActionScopeRepetitions. + * @param {LogicManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + } + + /** + * List the workflow run action scoped repetitions. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} workflowName The workflow name. + * + * @param {string} runName The workflow run name. + * + * @param {string} actionName The workflow action 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. + */ + listWithHttpOperationResponse(resourceGroupName, workflowName, runName, actionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, workflowName, runName, actionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List the workflow run action scoped repetitions. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} workflowName The workflow name. + * + * @param {string} runName The workflow run name. + * + * @param {string} actionName The workflow action 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 {WorkflowRunActionRepetitionDefinitionCollection} - 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 + * WorkflowRunActionRepetitionDefinitionCollection} 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, workflowName, runName, actionName, 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, workflowName, runName, actionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, workflowName, runName, actionName, options, optionalCallback); + } + } + + /** + * Get a workflow run action scoped repetition. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} workflowName The workflow name. + * + * @param {string} runName The workflow run name. + * + * @param {string} actionName The workflow action name. + * + * @param {string} repetitionName The workflow repetition. + * + * @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, workflowName, runName, actionName, repetitionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, workflowName, runName, actionName, repetitionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a workflow run action scoped repetition. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} workflowName The workflow name. + * + * @param {string} runName The workflow run name. + * + * @param {string} actionName The workflow action name. + * + * @param {string} repetitionName The workflow repetition. + * + * @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 {WorkflowRunActionRepetitionDefinition} - 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 WorkflowRunActionRepetitionDefinition} 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, workflowName, runName, actionName, repetitionName, 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, workflowName, runName, actionName, repetitionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, workflowName, runName, actionName, repetitionName, options, optionalCallback); + } + } + +} + +module.exports = WorkflowRunActionScopeRepetitions; diff --git a/lib/services/logicManagement/lib/operations/workflowTriggers.js b/lib/services/logicManagement/lib/operations/workflowTriggers.js index c3c5c8ed91..3b17ce5aa4 100644 --- a/lib/services/logicManagement/lib/operations/workflowTriggers.js +++ b/lib/services/logicManagement/lib/operations/workflowTriggers.js @@ -86,7 +86,7 @@ function _list(resourceGroupName, workflowName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{workflowName}', encodeURIComponent(workflowName)); diff --git a/lib/services/logicManagement/lib/operations/workflowVersionTriggers.js b/lib/services/logicManagement/lib/operations/workflowVersionTriggers.js new file mode 100644 index 0000000000..78a48b377b --- /dev/null +++ b/lib/services/logicManagement/lib/operations/workflowVersionTriggers.js @@ -0,0 +1,319 @@ +/* + * 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; + +/** + * Get the callback url for a trigger of a workflow version. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} workflowName The workflow name. + * + * @param {string} versionId The workflow versionId. + * + * @param {string} triggerName The workflow trigger name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] The callback URL parameters. + * + * @param {date} [options.parameters.notAfter] The expiry time. + * + * @param {string} [options.parameters.keyType] The key type. Possible values + * include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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 WorkflowTriggerCallbackUrl} 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 _listCallbackUrl(resourceGroupName, workflowName, versionId, triggerName, 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 parameters = (options && options.parameters !== undefined) ? options.parameters : undefined; + // 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 (workflowName === null || workflowName === undefined || typeof workflowName.valueOf() !== 'string') { + throw new Error('workflowName cannot be null or undefined and it must be of type string.'); + } + if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') { + throw new Error('versionId cannot be null or undefined and it must be of type string.'); + } + if (triggerName === null || triggerName === undefined || typeof triggerName.valueOf() !== 'string') { + throw new Error('triggerName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/versions/{versionId}/triggers/{triggerName}/listCallbackUrl'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{workflowName}', encodeURIComponent(workflowName)); + requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId)); + requestUrl = requestUrl.replace('{triggerName}', encodeURIComponent(triggerName)); + 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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['GetCallbackUrlParameters']().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) { + 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['WorkflowTriggerCallbackUrl']().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 WorkflowVersionTriggers. */ +class WorkflowVersionTriggers { + /** + * Create a WorkflowVersionTriggers. + * @param {LogicManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listCallbackUrl = _listCallbackUrl; + } + + /** + * Get the callback url for a trigger of a workflow version. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} workflowName The workflow name. + * + * @param {string} versionId The workflow versionId. + * + * @param {string} triggerName The workflow trigger name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] The callback URL parameters. + * + * @param {date} [options.parameters.notAfter] The expiry time. + * + * @param {string} [options.parameters.keyType] The key type. Possible values + * include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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. + */ + listCallbackUrlWithHttpOperationResponse(resourceGroupName, workflowName, versionId, triggerName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listCallbackUrl(resourceGroupName, workflowName, versionId, triggerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the callback url for a trigger of a workflow version. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} workflowName The workflow name. + * + * @param {string} versionId The workflow versionId. + * + * @param {string} triggerName The workflow trigger name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] The callback URL parameters. + * + * @param {date} [options.parameters.notAfter] The expiry time. + * + * @param {string} [options.parameters.keyType] The key type. Possible values + * include: 'NotSpecified', 'Primary', 'Secondary' + * + * @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 {WorkflowTriggerCallbackUrl} - 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 WorkflowTriggerCallbackUrl} 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. + */ + listCallbackUrl(resourceGroupName, workflowName, versionId, triggerName, 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._listCallbackUrl(resourceGroupName, workflowName, versionId, triggerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listCallbackUrl(resourceGroupName, workflowName, versionId, triggerName, options, optionalCallback); + } + } + +} + +module.exports = WorkflowVersionTriggers; diff --git a/lib/services/logicManagement/lib/operations/workflowVersions.js b/lib/services/logicManagement/lib/operations/workflowVersions.js index 8834bbdf75..b2c1bdc7fa 100644 --- a/lib/services/logicManagement/lib/operations/workflowVersions.js +++ b/lib/services/logicManagement/lib/operations/workflowVersions.js @@ -321,186 +321,6 @@ function _get(resourceGroupName, workflowName, versionId, options, callback) { }); } -/** - * Get the callback url for a trigger of a workflow version. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} workflowName The workflow name. - * - * @param {string} versionId The workflow versionId. - * - * @param {string} triggerName The workflow trigger name. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.parameters] The callback URL parameters. - * - * @param {date} [options.parameters.notAfter] The expiry time. - * - * @param {string} [options.parameters.keyType] The key type. Possible values - * include: 'NotSpecified', 'Primary', 'Secondary' - * - * @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 WorkflowTriggerCallbackUrl} 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 _listCallbackUrl(resourceGroupName, workflowName, versionId, triggerName, 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 parameters = (options && options.parameters !== undefined) ? options.parameters : undefined; - // 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 (workflowName === null || workflowName === undefined || typeof workflowName.valueOf() !== 'string') { - throw new Error('workflowName cannot be null or undefined and it must be of type string.'); - } - if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') { - throw new Error('versionId cannot be null or undefined and it must be of type string.'); - } - if (triggerName === null || triggerName === undefined || typeof triggerName.valueOf() !== 'string') { - throw new Error('triggerName cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/versions/{versionId}/triggers/{triggerName}/listCallbackUrl'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{workflowName}', encodeURIComponent(workflowName)); - requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId)); - requestUrl = requestUrl.replace('{triggerName}', encodeURIComponent(triggerName)); - 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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['GetCallbackUrlParameters']().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) { - 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['WorkflowTriggerCallbackUrl']().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 list of workflow versions. * @@ -639,7 +459,6 @@ class WorkflowVersions { this.client = client; this._list = _list; this._get = _get; - this._listCallbackUrl = _listCallbackUrl; this._listNext = _listNext; } @@ -826,115 +645,6 @@ class WorkflowVersions { } } - /** - * Get the callback url for a trigger of a workflow version. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} workflowName The workflow name. - * - * @param {string} versionId The workflow versionId. - * - * @param {string} triggerName The workflow trigger name. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.parameters] The callback URL parameters. - * - * @param {date} [options.parameters.notAfter] The expiry time. - * - * @param {string} [options.parameters.keyType] The key type. Possible values - * include: 'NotSpecified', 'Primary', 'Secondary' - * - * @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. - */ - listCallbackUrlWithHttpOperationResponse(resourceGroupName, workflowName, versionId, triggerName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listCallbackUrl(resourceGroupName, workflowName, versionId, triggerName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Get the callback url for a trigger of a workflow version. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} workflowName The workflow name. - * - * @param {string} versionId The workflow versionId. - * - * @param {string} triggerName The workflow trigger name. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.parameters] The callback URL parameters. - * - * @param {date} [options.parameters.notAfter] The expiry time. - * - * @param {string} [options.parameters.keyType] The key type. Possible values - * include: 'NotSpecified', 'Primary', 'Secondary' - * - * @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 {WorkflowTriggerCallbackUrl} - 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 WorkflowTriggerCallbackUrl} 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. - */ - listCallbackUrl(resourceGroupName, workflowName, versionId, triggerName, 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._listCallbackUrl(resourceGroupName, workflowName, versionId, triggerName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listCallbackUrl(resourceGroupName, workflowName, versionId, triggerName, options, optionalCallback); - } - } - /** * Gets a list of workflow versions. * diff --git a/lib/services/logicManagement/lib/operations/workflows.js b/lib/services/logicManagement/lib/operations/workflows.js index d6a83485d9..eb1cccc46a 100644 --- a/lib/services/logicManagement/lib/operations/workflows.js +++ b/lib/services/logicManagement/lib/operations/workflows.js @@ -2089,7 +2089,7 @@ function _regenerateAccessKey(resourceGroupName, workflowName, keyType, options, * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _validateWorkflow(resourceGroupName, workflowName, validate, options, callback) { +function _validateByResourceGroup(resourceGroupName, workflowName, validate, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -2257,7 +2257,7 @@ function _validateWorkflow(resourceGroupName, workflowName, validate, options, c * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _validate(resourceGroupName, location, workflowName, workflow, options, callback) { +function _validateByLocation(resourceGroupName, location, workflowName, workflow, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -2656,8 +2656,8 @@ class Workflows { this._listSwagger = _listSwagger; this._move = _move; this._regenerateAccessKey = _regenerateAccessKey; - this._validateWorkflow = _validateWorkflow; - this._validate = _validate; + this._validateByResourceGroup = _validateByResourceGroup; + this._validateByLocation = _validateByLocation; this._listBySubscriptionNext = _listBySubscriptionNext; this._listByResourceGroupNext = _listByResourceGroupNext; } @@ -3990,11 +3990,11 @@ class Workflows { * * @reject {Error} - The error object. */ - validateWorkflowWithHttpOperationResponse(resourceGroupName, workflowName, validate, options) { + validateByResourceGroupWithHttpOperationResponse(resourceGroupName, workflowName, validate, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._validateWorkflow(resourceGroupName, workflowName, validate, options, (err, result, request, response) => { + self._validateByResourceGroup(resourceGroupName, workflowName, validate, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -4059,7 +4059,7 @@ class Workflows { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - validateWorkflow(resourceGroupName, workflowName, validate, options, optionalCallback) { + validateByResourceGroup(resourceGroupName, workflowName, validate, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -4068,14 +4068,14 @@ class Workflows { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._validateWorkflow(resourceGroupName, workflowName, validate, options, (err, result, request, response) => { + self._validateByResourceGroup(resourceGroupName, workflowName, validate, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._validateWorkflow(resourceGroupName, workflowName, validate, options, optionalCallback); + return self._validateByResourceGroup(resourceGroupName, workflowName, validate, options, optionalCallback); } } @@ -4121,11 +4121,11 @@ class Workflows { * * @reject {Error} - The error object. */ - validateWithHttpOperationResponse(resourceGroupName, location, workflowName, workflow, options) { + validateByLocationWithHttpOperationResponse(resourceGroupName, location, workflowName, workflow, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._validate(resourceGroupName, location, workflowName, workflow, options, (err, result, request, response) => { + self._validateByLocation(resourceGroupName, location, workflowName, workflow, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -4192,7 +4192,7 @@ class Workflows { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - validate(resourceGroupName, location, workflowName, workflow, options, optionalCallback) { + validateByLocation(resourceGroupName, location, workflowName, workflow, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -4201,14 +4201,14 @@ class Workflows { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._validate(resourceGroupName, location, workflowName, workflow, options, (err, result, request, response) => { + self._validateByLocation(resourceGroupName, location, workflowName, workflow, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._validate(resourceGroupName, location, workflowName, workflow, options, optionalCallback); + return self._validateByLocation(resourceGroupName, location, workflowName, workflow, options, optionalCallback); } } diff --git a/lib/services/logicManagement/package-lock.json b/lib/services/logicManagement/package-lock.json index 4e53859d41..e335194bfb 100644 --- a/lib/services/logicManagement/package-lock.json +++ b/lib/services/logicManagement/package-lock.json @@ -1,6 +1,6 @@ { "name": "azure-arm-logic", - "version": "2.0.0", + "version": "3.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/lib/services/logicManagement/package.json b/lib/services/logicManagement/package.json index bad32543fb..55cc9935e6 100644 --- a/lib/services/logicManagement/package.json +++ b/lib/services/logicManagement/package.json @@ -2,7 +2,7 @@ "name": "azure-arm-logic", "author": "Microsoft Corporation", "description": "LogicManagementClient Library with typescript type definitions for node", - "version": "2.0.0", + "version": "3.0.0", "dependencies": { "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5" @@ -14,7 +14,7 @@ "license": "MIT", "main": "./lib/logicManagementClient.js", "types": "./lib/logicManagementClient.d.ts", - "homepage": "https://github.com/azure/azure-sdk-for-node/lib/services/logicManagement", + "homepage": "https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/logicManagement", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-node.git"