From e253f8ca19528f899e4018298437e7c20fba1f93 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 7 Nov 2018 15:39:26 +0000 Subject: [PATCH 1/2] Generated from 3f99e72342d5d4f194ff74c8c553657530955783 Remove security contact phone field mandatory fields --- .../securityManagement/lib/models/index.d.ts | 4 ++-- .../securityManagement/lib/models/securityContact.js | 4 ++-- .../securityManagement/lib/operations/index.d.ts | 8 ++++---- .../lib/operations/securityContacts.js | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/services/securityManagement/lib/models/index.d.ts b/lib/services/securityManagement/lib/models/index.d.ts index 3ba73f882f..d111111539 100644 --- a/lib/services/securityManagement/lib/models/index.d.ts +++ b/lib/services/securityManagement/lib/models/index.d.ts @@ -51,7 +51,7 @@ export interface Kind { * Contact details for security issues * * @member {string} email The email of this security contact - * @member {string} phone The phone number of this security contact + * @member {string} [phone] The phone number of this security contact * @member {string} alertNotifications Whether to send security alerts * notifications to the security contact. Possible values include: 'On', 'Off' * @member {string} alertsToAdmins Whether to send security alerts @@ -59,7 +59,7 @@ export interface Kind { */ export interface SecurityContact extends Resource { email: string; - phone: string; + phone?: string; alertNotifications: string; alertsToAdmins: string; } diff --git a/lib/services/securityManagement/lib/models/securityContact.js b/lib/services/securityManagement/lib/models/securityContact.js index 4cc7464cd1..ce7257074e 100644 --- a/lib/services/securityManagement/lib/models/securityContact.js +++ b/lib/services/securityManagement/lib/models/securityContact.js @@ -21,7 +21,7 @@ class SecurityContact extends models['Resource'] { /** * Create a SecurityContact. * @member {string} email The email of this security contact - * @member {string} phone The phone number of this security contact + * @member {string} [phone] The phone number of this security contact * @member {string} alertNotifications Whether to send security alerts * notifications to the security contact. Possible values include: 'On', * 'Off' @@ -78,7 +78,7 @@ class SecurityContact extends models['Resource'] { } }, phone: { - required: true, + required: false, serializedName: 'properties.phone', type: { name: 'String' diff --git a/lib/services/securityManagement/lib/operations/index.d.ts b/lib/services/securityManagement/lib/operations/index.d.ts index 9ed3963307..d9d642c3b7 100644 --- a/lib/services/securityManagement/lib/operations/index.d.ts +++ b/lib/services/securityManagement/lib/operations/index.d.ts @@ -621,7 +621,7 @@ export interface SecurityContacts { * * @param {string} securityContact.email The email of this security contact * - * @param {string} securityContact.phone The phone number of this security + * @param {string} [securityContact.phone] The phone number of this security * contact * * @param {string} securityContact.alertNotifications Whether to send security @@ -654,7 +654,7 @@ export interface SecurityContacts { * * @param {string} securityContact.email The email of this security contact * - * @param {string} securityContact.phone The phone number of this security + * @param {string} [securityContact.phone] The phone number of this security * contact * * @param {string} securityContact.alertNotifications Whether to send security @@ -760,7 +760,7 @@ export interface SecurityContacts { * * @param {string} securityContact.email The email of this security contact * - * @param {string} securityContact.phone The phone number of this security + * @param {string} [securityContact.phone] The phone number of this security * contact * * @param {string} securityContact.alertNotifications Whether to send security @@ -793,7 +793,7 @@ export interface SecurityContacts { * * @param {string} securityContact.email The email of this security contact * - * @param {string} securityContact.phone The phone number of this security + * @param {string} [securityContact.phone] The phone number of this security * contact * * @param {string} securityContact.alertNotifications Whether to send security diff --git a/lib/services/securityManagement/lib/operations/securityContacts.js b/lib/services/securityManagement/lib/operations/securityContacts.js index 16573b51e1..3a1c24cc8d 100644 --- a/lib/services/securityManagement/lib/operations/securityContacts.js +++ b/lib/services/securityManagement/lib/operations/securityContacts.js @@ -303,7 +303,7 @@ function _get(securityContactName, options, callback) { * * @param {string} securityContact.email The email of this security contact * - * @param {string} securityContact.phone The phone number of this security + * @param {string} [securityContact.phone] The phone number of this security * contact * * @param {string} securityContact.alertNotifications Whether to send security @@ -603,7 +603,7 @@ function _deleteMethod(securityContactName, options, callback) { * * @param {string} securityContact.email The email of this security contact * - * @param {string} securityContact.phone The phone number of this security + * @param {string} [securityContact.phone] The phone number of this security * contact * * @param {string} securityContact.alertNotifications Whether to send security @@ -1081,7 +1081,7 @@ class SecurityContacts { * * @param {string} securityContact.email The email of this security contact * - * @param {string} securityContact.phone The phone number of this security + * @param {string} [securityContact.phone] The phone number of this security * contact * * @param {string} securityContact.alertNotifications Whether to send security @@ -1126,7 +1126,7 @@ class SecurityContacts { * * @param {string} securityContact.email The email of this security contact * - * @param {string} securityContact.phone The phone number of this security + * @param {string} [securityContact.phone] The phone number of this security * contact * * @param {string} securityContact.alertNotifications Whether to send security @@ -1274,7 +1274,7 @@ class SecurityContacts { * * @param {string} securityContact.email The email of this security contact * - * @param {string} securityContact.phone The phone number of this security + * @param {string} [securityContact.phone] The phone number of this security * contact * * @param {string} securityContact.alertNotifications Whether to send security @@ -1319,7 +1319,7 @@ class SecurityContacts { * * @param {string} securityContact.email The email of this security contact * - * @param {string} securityContact.phone The phone number of this security + * @param {string} [securityContact.phone] The phone number of this security * contact * * @param {string} securityContact.alertNotifications Whether to send security From e49e78a66339673f97e361b30161fa928e525e09 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 12 Nov 2018 18:37:40 +0000 Subject: [PATCH 2/2] Generated from e94d9f5b16a429a3f1d2270a981be7218f06fd36 Update security contact examples - refactored - second iteration --- .../lib/models/allowedConnectionsList.js | 69 + .../lib/models/allowedConnectionsResource.js | 108 ++ .../lib/models/connectableResource.js | 89 ++ .../lib/models/connectedResource.js | 72 + .../securityManagement/lib/models/index.d.ts | 71 + .../securityManagement/lib/models/index.js | 4 + .../lib/operations/allowedConnections.js | 1168 +++++++++++++++++ .../lib/operations/index.d.ts | 299 +++++ .../lib/operations/index.js | 1 + .../lib/securityCenter.d.ts | 1 + .../securityManagement/lib/securityCenter.js | 1 + 11 files changed, 1883 insertions(+) create mode 100644 lib/services/securityManagement/lib/models/allowedConnectionsList.js create mode 100644 lib/services/securityManagement/lib/models/allowedConnectionsResource.js create mode 100644 lib/services/securityManagement/lib/models/connectableResource.js create mode 100644 lib/services/securityManagement/lib/models/connectedResource.js create mode 100644 lib/services/securityManagement/lib/operations/allowedConnections.js diff --git a/lib/services/securityManagement/lib/models/allowedConnectionsList.js b/lib/services/securityManagement/lib/models/allowedConnectionsList.js new file mode 100644 index 0000000000..7c7cf3c642 --- /dev/null +++ b/lib/services/securityManagement/lib/models/allowedConnectionsList.js @@ -0,0 +1,69 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * List of all possible traffic between Azure resources + */ +class AllowedConnectionsList extends Array { + /** + * Create a AllowedConnectionsList. + * @member {string} [nextLink] The URI to fetch the next page. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AllowedConnectionsList + * + * @returns {object} metadata of AllowedConnectionsList + * + */ + mapper() { + return { + required: false, + serializedName: 'AllowedConnectionsList', + type: { + name: 'Composite', + className: 'AllowedConnectionsList', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AllowedConnectionsResourceElementType', + type: { + name: 'Composite', + className: 'AllowedConnectionsResource' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AllowedConnectionsList; diff --git a/lib/services/securityManagement/lib/models/allowedConnectionsResource.js b/lib/services/securityManagement/lib/models/allowedConnectionsResource.js new file mode 100644 index 0000000000..5e2cf970bf --- /dev/null +++ b/lib/services/securityManagement/lib/models/allowedConnectionsResource.js @@ -0,0 +1,108 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The resource whose properties describes the allowed traffic between Azure + * resources + * + */ +class AllowedConnectionsResource { + /** + * Create a AllowedConnectionsResource. + * @member {string} [id] Resource Id + * @member {string} [name] Resource name + * @member {string} [type] Resource type + * @member {string} [location] Location where the resource is stored + * @member {date} [calculatedDateTime] The UTC time on which the allowed + * connections resource was calculated + * @member {array} [connectableResources] List of connectable resources + */ + constructor() { + } + + /** + * Defines the metadata of AllowedConnectionsResource + * + * @returns {object} metadata of AllowedConnectionsResource + * + */ + mapper() { + return { + required: false, + serializedName: 'AllowedConnectionsResource', + type: { + name: 'Composite', + className: 'AllowedConnectionsResource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + readOnly: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + calculatedDateTime: { + required: false, + readOnly: true, + serializedName: 'properties.calculatedDateTime', + type: { + name: 'DateTime' + } + }, + connectableResources: { + required: false, + readOnly: true, + serializedName: 'properties.connectableResources', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ConnectableResourceElementType', + type: { + name: 'Composite', + className: 'ConnectableResource' + } + } + } + } + } + } + }; + } +} + +module.exports = AllowedConnectionsResource; diff --git a/lib/services/securityManagement/lib/models/connectableResource.js b/lib/services/securityManagement/lib/models/connectableResource.js new file mode 100644 index 0000000000..29f7c08bce --- /dev/null +++ b/lib/services/securityManagement/lib/models/connectableResource.js @@ -0,0 +1,89 @@ +/* + * 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'; + +/** + * Describes the allowed inbound and outbound traffic of an Azure resource + * + */ +class ConnectableResource { + /** + * Create a ConnectableResource. + * @member {string} [id] The Azure resource id + * @member {array} [inboundConnectedResources] The list of Azure resources + * that the resource has inbound allowed connection from + * @member {array} [outboundConnectedResources] The list of Azure resources + * that the resource has outbound allowed connection to + */ + constructor() { + } + + /** + * Defines the metadata of ConnectableResource + * + * @returns {object} metadata of ConnectableResource + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectableResource', + type: { + name: 'Composite', + className: 'ConnectableResource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + inboundConnectedResources: { + required: false, + readOnly: true, + serializedName: 'inboundConnectedResources', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ConnectedResourceElementType', + type: { + name: 'Composite', + className: 'ConnectedResource' + } + } + } + }, + outboundConnectedResources: { + required: false, + readOnly: true, + serializedName: 'outboundConnectedResources', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ConnectedResourceElementType', + type: { + name: 'Composite', + className: 'ConnectedResource' + } + } + } + } + } + } + }; + } +} + +module.exports = ConnectableResource; diff --git a/lib/services/securityManagement/lib/models/connectedResource.js b/lib/services/securityManagement/lib/models/connectedResource.js new file mode 100644 index 0000000000..06a6399542 --- /dev/null +++ b/lib/services/securityManagement/lib/models/connectedResource.js @@ -0,0 +1,72 @@ +/* + * 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'; + +/** + * Describes properties of a connected resource + * + */ +class ConnectedResource { + /** + * Create a ConnectedResource. + * @member {string} [connectedResourceId] The Azure resource id of the + * connected resource + * @member {string} [tcpPorts] The allowed tcp ports + * @member {string} [udpPorts] The allowed udp ports + */ + constructor() { + } + + /** + * Defines the metadata of ConnectedResource + * + * @returns {object} metadata of ConnectedResource + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectedResource', + type: { + name: 'Composite', + className: 'ConnectedResource', + modelProperties: { + connectedResourceId: { + required: false, + readOnly: true, + serializedName: 'connectedResourceId', + type: { + name: 'String' + } + }, + tcpPorts: { + required: false, + readOnly: true, + serializedName: 'tcpPorts', + type: { + name: 'String' + } + }, + udpPorts: { + required: false, + readOnly: true, + serializedName: 'udpPorts', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ConnectedResource; diff --git a/lib/services/securityManagement/lib/models/index.d.ts b/lib/services/securityManagement/lib/models/index.d.ts index d111111539..d12fa7ba87 100644 --- a/lib/services/securityManagement/lib/models/index.d.ts +++ b/lib/services/securityManagement/lib/models/index.d.ts @@ -911,6 +911,65 @@ export interface AadConnectivityState1 { connectivityState?: string; } +/** + * @class + * Initializes a new instance of the ConnectedResource class. + * @constructor + * Describes properties of a connected resource + * + * @member {string} [connectedResourceId] The Azure resource id of the + * connected resource + * @member {string} [tcpPorts] The allowed tcp ports + * @member {string} [udpPorts] The allowed udp ports + */ +export interface ConnectedResource { + readonly connectedResourceId?: string; + readonly tcpPorts?: string; + readonly udpPorts?: string; +} + +/** + * @class + * Initializes a new instance of the ConnectableResource class. + * @constructor + * Describes the allowed inbound and outbound traffic of an Azure resource + * + * @member {string} [id] The Azure resource id + * @member {array} [inboundConnectedResources] The list of Azure resources that + * the resource has inbound allowed connection from + * @member {array} [outboundConnectedResources] The list of Azure resources + * that the resource has outbound allowed connection to + */ +export interface ConnectableResource { + readonly id?: string; + readonly inboundConnectedResources?: ConnectedResource[]; + readonly outboundConnectedResources?: ConnectedResource[]; +} + +/** + * @class + * Initializes a new instance of the AllowedConnectionsResource class. + * @constructor + * The resource whose properties describes the allowed traffic between Azure + * resources + * + * @member {string} [id] Resource Id + * @member {string} [name] Resource name + * @member {string} [type] Resource type + * @member {string} [location] Location where the resource is stored + * @member {date} [calculatedDateTime] The UTC time on which the allowed + * connections resource was calculated + * @member {array} [connectableResources] List of connectable resources + */ +export interface AllowedConnectionsResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; + readonly location?: string; + readonly calculatedDateTime?: Date; + readonly connectableResources?: ConnectableResource[]; +} + /** * @class @@ -1083,3 +1142,15 @@ export interface ExternalSecuritySolutionList extends Array { readonly nextLink?: string; } + +/** + * @class + * Initializes a new instance of the AllowedConnectionsList class. + * @constructor + * List of all possible traffic between Azure resources + * + * @member {string} [nextLink] The URI to fetch the next page. + */ +export interface AllowedConnectionsList extends Array { + readonly nextLink?: string; +} diff --git a/lib/services/securityManagement/lib/models/index.js b/lib/services/securityManagement/lib/models/index.js index 146a810266..750d5ba0d8 100644 --- a/lib/services/securityManagement/lib/models/index.js +++ b/lib/services/securityManagement/lib/models/index.js @@ -68,6 +68,9 @@ exports.AadSolutionProperties = require('./aadSolutionProperties'); exports.AadExternalSecuritySolution = require('./aadExternalSecuritySolution'); exports.ExternalSecuritySolutionKind1 = require('./externalSecuritySolutionKind1'); exports.AadConnectivityState1 = require('./aadConnectivityState1'); +exports.ConnectedResource = require('./connectedResource'); +exports.ConnectableResource = require('./connectableResource'); +exports.AllowedConnectionsResource = require('./allowedConnectionsResource'); exports.PricingList = require('./pricingList'); exports.SecurityContactList = require('./securityContactList'); exports.WorkspaceSettingList = require('./workspaceSettingList'); @@ -83,6 +86,7 @@ exports.DiscoveredSecuritySolutionList = require('./discoveredSecuritySolutionLi exports.JitNetworkAccessPoliciesList = require('./jitNetworkAccessPoliciesList'); exports.ExternalSecuritySolutionList = require('./externalSecuritySolutionList'); exports.TopologyList = require('./topologyList'); +exports.AllowedConnectionsList = require('./allowedConnectionsList'); exports.discriminators = { 'Setting' : exports.Setting, 'Setting.DataExportSetting' : exports.DataExportSetting, diff --git a/lib/services/securityManagement/lib/operations/allowedConnections.js b/lib/services/securityManagement/lib/operations/allowedConnections.js new file mode 100644 index 0000000000..7a633b90a5 --- /dev/null +++ b/lib/services/securityManagement/lib/operations/allowedConnections.js @@ -0,0 +1,1168 @@ +/* + * 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 the list of all possible traffic between resources for the subscription + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link AllowedConnectionsList} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-06-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId !== null && this.client.subscriptionId !== undefined) { + if (this.client.subscriptionId.match(/^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$/) === null) + { + throw new Error('"this.client.subscriptionId" should satisfy the constraint - "Pattern": /^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$/'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['AllowedConnectionsList']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the list of all possible traffic between resources for the subscription + * and location. + * + * @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 AllowedConnectionsList} 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 _listByHomeRegion(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-06-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId !== null && this.client.subscriptionId !== undefined) { + if (this.client.subscriptionId.match(/^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$/) === null) + { + throw new Error('"this.client.subscriptionId" should satisfy the constraint - "Pattern": /^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$/'); + } + } + if (this.client.ascLocation === null || this.client.ascLocation === undefined || typeof this.client.ascLocation.valueOf() !== 'string') { + throw new Error('this.client.ascLocation cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{ascLocation}', encodeURIComponent(this.client.ascLocation)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['AllowedConnectionsList']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the list of all possible traffic between resources for the subscription + * and location, based on connection type. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} connectionType The type of allowed connections (Internal, + * External). Possible values include: 'Internal', 'External' + * + * @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 AllowedConnectionsResource} 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, connectionType, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-06-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId !== null && this.client.subscriptionId !== undefined) { + if (this.client.subscriptionId.match(/^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$/) === null) + { + throw new Error('"this.client.subscriptionId" should satisfy the constraint - "Pattern": /^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$/'); + } + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (this.client.ascLocation === null || this.client.ascLocation === undefined || typeof this.client.ascLocation.valueOf() !== 'string') { + throw new Error('this.client.ascLocation cannot be null or undefined and it must be of type string.'); + } + if (connectionType === null || connectionType === undefined || typeof connectionType.valueOf() !== 'string') { + throw new Error('connectionType 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.Security/locations/{ascLocation}/allowedConnections/{connectionType}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{ascLocation}', encodeURIComponent(this.client.ascLocation)); + requestUrl = requestUrl.replace('{connectionType}', encodeURIComponent(connectionType)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['AllowedConnectionsResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the list of all possible traffic between resources for the subscription + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link AllowedConnectionsList} 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['AllowedConnectionsList']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the list of all possible traffic between resources for the subscription + * and location. + * + * @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 AllowedConnectionsList} 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 _listByHomeRegionNext(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['AllowedConnectionsList']().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 AllowedConnections. */ +class AllowedConnections { + /** + * Create a AllowedConnections. + * @param {SecurityCenter} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listByHomeRegion = _listByHomeRegion; + this._get = _get; + this._listNext = _listNext; + this._listByHomeRegionNext = _listByHomeRegionNext; + } + + /** + * Gets the list of all possible traffic between resources for the subscription + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the list of all possible traffic between resources for the subscription + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {AllowedConnectionsList} - 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 AllowedConnectionsList} 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); + } + } + + /** + * Gets the list of all possible traffic between resources for the subscription + * and location. + * + * @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. + */ + listByHomeRegionWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByHomeRegion(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the list of all possible traffic between resources for the subscription + * and location. + * + * @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 {AllowedConnectionsList} - 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 AllowedConnectionsList} 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. + */ + listByHomeRegion(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._listByHomeRegion(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByHomeRegion(options, optionalCallback); + } + } + + /** + * Gets the list of all possible traffic between resources for the subscription + * and location, based on connection type. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} connectionType The type of allowed connections (Internal, + * External). Possible values include: 'Internal', 'External' + * + * @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, connectionType, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, connectionType, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the list of all possible traffic between resources for the subscription + * and location, based on connection type. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} connectionType The type of allowed connections (Internal, + * External). Possible values include: 'Internal', 'External' + * + * @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 {AllowedConnectionsResource} - 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 AllowedConnectionsResource} 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, connectionType, 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, connectionType, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, connectionType, options, optionalCallback); + } + } + + /** + * Gets the list of all possible traffic between resources for the subscription + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the list of all possible traffic between resources for the subscription + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {AllowedConnectionsList} - 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 AllowedConnectionsList} 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); + } + } + + /** + * Gets the list of all possible traffic between resources for the subscription + * and location. + * + * @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. + */ + listByHomeRegionNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByHomeRegionNext(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 the list of all possible traffic between resources for the subscription + * and location. + * + * @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 {AllowedConnectionsList} - 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 AllowedConnectionsList} 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. + */ + listByHomeRegionNext(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._listByHomeRegionNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByHomeRegionNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = AllowedConnections; diff --git a/lib/services/securityManagement/lib/operations/index.d.ts b/lib/services/securityManagement/lib/operations/index.d.ts index d9d642c3b7..0adb512f20 100644 --- a/lib/services/securityManagement/lib/operations/index.d.ts +++ b/lib/services/securityManagement/lib/operations/index.d.ts @@ -5634,3 +5634,302 @@ export interface Topology { listByHomeRegionNext(nextPageLink: string, callback: ServiceCallback): void; listByHomeRegionNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } + +/** + * @class + * AllowedConnections + * __NOTE__: An instance of this class is automatically created for an + * instance of the SecurityCenter. + */ +export interface AllowedConnections { + + + /** + * Gets the list of all possible traffic between resources for the subscription + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the list of all possible traffic between resources for the subscription + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {AllowedConnectionsList} - 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. + * + * {AllowedConnectionsList} [result] - The deserialized result object if an error did not occur. + * See {@link AllowedConnectionsList} 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; + + + /** + * Gets the list of all possible traffic between resources for the subscription + * and location. + * + * @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. + */ + listByHomeRegionWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the list of all possible traffic between resources for the subscription + * and location. + * + * @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 {AllowedConnectionsList} - 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. + * + * {AllowedConnectionsList} [result] - The deserialized result object if an error did not occur. + * See {@link AllowedConnectionsList} 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. + */ + listByHomeRegion(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByHomeRegion(callback: ServiceCallback): void; + listByHomeRegion(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the list of all possible traffic between resources for the subscription + * and location, based on connection type. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} connectionType The type of allowed connections (Internal, + * External). Possible values include: 'Internal', 'External' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, connectionType: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the list of all possible traffic between resources for the subscription + * and location, based on connection type. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} connectionType The type of allowed connections (Internal, + * External). Possible values include: 'Internal', 'External' + * + * @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 {AllowedConnectionsResource} - 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. + * + * {AllowedConnectionsResource} [result] - The deserialized result object if an error did not occur. + * See {@link AllowedConnectionsResource} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, connectionType: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, connectionType: string, callback: ServiceCallback): void; + get(resourceGroupName: string, connectionType: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the list of all possible traffic between resources for the subscription + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the list of all possible traffic between resources for the subscription + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {AllowedConnectionsList} - 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. + * + * {AllowedConnectionsList} [result] - The deserialized result object if an error did not occur. + * See {@link AllowedConnectionsList} 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; + + + /** + * Gets the list of all possible traffic between resources for the subscription + * and location. + * + * @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. + */ + listByHomeRegionNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the list of all possible traffic between resources for the subscription + * and location. + * + * @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 {AllowedConnectionsList} - 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. + * + * {AllowedConnectionsList} [result] - The deserialized result object if an error did not occur. + * See {@link AllowedConnectionsList} 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. + */ + listByHomeRegionNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByHomeRegionNext(nextPageLink: string, callback: ServiceCallback): void; + listByHomeRegionNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/securityManagement/lib/operations/index.js b/lib/services/securityManagement/lib/operations/index.js index 3aa0be689d..d14a107507 100644 --- a/lib/services/securityManagement/lib/operations/index.js +++ b/lib/services/securityManagement/lib/operations/index.js @@ -30,3 +30,4 @@ exports.DiscoveredSecuritySolutions = require('./discoveredSecuritySolutions'); exports.JitNetworkAccessPolicies = require('./jitNetworkAccessPolicies'); exports.ExternalSecuritySolutions = require('./externalSecuritySolutions'); exports.Topology = require('./topology'); +exports.AllowedConnections = require('./allowedConnections'); diff --git a/lib/services/securityManagement/lib/securityCenter.d.ts b/lib/services/securityManagement/lib/securityCenter.d.ts index aba46d93ed..d229d77689 100644 --- a/lib/services/securityManagement/lib/securityCenter.d.ts +++ b/lib/services/securityManagement/lib/securityCenter.d.ts @@ -74,6 +74,7 @@ export default class SecurityCenter extends AzureServiceClient { jitNetworkAccessPolicies: operations.JitNetworkAccessPolicies; externalSecuritySolutions: operations.ExternalSecuritySolutions; topology: operations.Topology; + allowedConnections: operations.AllowedConnections; } export { SecurityCenter, models as SecurityCenterModels }; diff --git a/lib/services/securityManagement/lib/securityCenter.js b/lib/services/securityManagement/lib/securityCenter.js index c0348ad76f..f5fb9130ac 100644 --- a/lib/services/securityManagement/lib/securityCenter.js +++ b/lib/services/securityManagement/lib/securityCenter.js @@ -92,6 +92,7 @@ class SecurityCenter extends ServiceClient { this.jitNetworkAccessPolicies = new operations.JitNetworkAccessPolicies(this); this.externalSecuritySolutions = new operations.ExternalSecuritySolutions(this); this.topology = new operations.Topology(this); + this.allowedConnections = new operations.AllowedConnections(this); this.models = models; msRest.addSerializationMixin(this); }