diff --git a/lib/services/serviceBusManagement2/lib/models/index.d.ts b/lib/services/serviceBusManagement2/lib/models/index.d.ts index c1e6072706..ca2cde4747 100644 --- a/lib/services/serviceBusManagement2/lib/models/index.d.ts +++ b/lib/services/serviceBusManagement2/lib/models/index.d.ts @@ -137,6 +137,19 @@ export interface SBNamespaceUpdateParameters extends ResourceNamespacePatch { readonly metricId?: string; } +/** + * @class + * Initializes a new instance of the SBNamespaceMigrate class. + * @constructor + * Namespace Migrate Object + * + * @member {string} targetNamespaceType Type of namespaces. Possible values + * include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', 'Relay' + */ +export interface SBNamespaceMigrate { + targetNamespaceType: string; +} + /** * @class * Initializes a new instance of the SBAuthorizationRule class. @@ -875,36 +888,6 @@ export interface MigrationConfigProperties extends Resource { readonly migrationState?: string; } -/** - * @class - * Initializes a new instance of the IpFilterRule class. - * @constructor - * Single item in a List or Get IpFilterRules operation - * - * @member {string} [ipMask] IP Mask - * @member {string} [action] The IP Filter Action. Possible values include: - * 'Accept', 'Reject' - * @member {string} [filterName] IP Filter name - */ -export interface IpFilterRule extends Resource { - ipMask?: string; - action?: string; - filterName?: string; -} - -/** - * @class - * Initializes a new instance of the VirtualNetworkRule class. - * @constructor - * Single item in a List or Get VirtualNetworkRules operation - * - * @member {string} [virtualNetworkSubnetId] Resource ID of Virtual Network - * Subnet - */ -export interface VirtualNetworkRule extends Resource { - virtualNetworkSubnetId?: string; -} - /** * @class @@ -946,32 +929,6 @@ export interface SBAuthorizationRuleListResult extends Array { - nextLink?: string; -} - -/** - * @class - * Initializes a new instance of the VirtualNetworkRuleListResult class. - * @constructor - * The response from the List namespace operation. - * - * @member {string} [nextLink] Link to the next set of results. Not empty if - * Value contains an incomplete list of VirtualNetwork Rules - */ -export interface VirtualNetworkRuleListResult extends Array { - nextLink?: string; -} - /** * @class * Initializes a new instance of the ArmDisasterRecoveryListResult class. diff --git a/lib/services/serviceBusManagement2/lib/models/index.js b/lib/services/serviceBusManagement2/lib/models/index.js index 5f6026f84e..06995f9860 100644 --- a/lib/services/serviceBusManagement2/lib/models/index.js +++ b/lib/services/serviceBusManagement2/lib/models/index.js @@ -24,6 +24,7 @@ exports.ResourceNamespacePatch = require('./resourceNamespacePatch'); exports.SBSku = require('./sBSku'); exports.SBNamespace = require('./sBNamespace'); exports.SBNamespaceUpdateParameters = require('./sBNamespaceUpdateParameters'); +exports.SBNamespaceMigrate = require('./sBNamespaceMigrate'); exports.SBAuthorizationRule = require('./sBAuthorizationRule'); exports.AuthorizationRuleProperties = require('./authorizationRuleProperties'); exports.AccessKeys = require('./accessKeys'); @@ -49,13 +50,9 @@ exports.CaptureDescription = require('./captureDescription'); exports.Eventhub = require('./eventhub'); exports.ArmDisasterRecovery = require('./armDisasterRecovery'); exports.MigrationConfigProperties = require('./migrationConfigProperties'); -exports.IpFilterRule = require('./ipFilterRule'); -exports.VirtualNetworkRule = require('./virtualNetworkRule'); exports.OperationListResult = require('./operationListResult'); exports.SBNamespaceListResult = require('./sBNamespaceListResult'); exports.SBAuthorizationRuleListResult = require('./sBAuthorizationRuleListResult'); -exports.IpFilterRuleListResult = require('./ipFilterRuleListResult'); -exports.VirtualNetworkRuleListResult = require('./virtualNetworkRuleListResult'); exports.ArmDisasterRecoveryListResult = require('./armDisasterRecoveryListResult'); exports.MigrationConfigListResult = require('./migrationConfigListResult'); exports.SBQueueListResult = require('./sBQueueListResult'); diff --git a/lib/services/serviceBusManagement2/lib/operations/index.d.ts b/lib/services/serviceBusManagement2/lib/operations/index.d.ts index 568b69e8a0..9118444b28 100644 --- a/lib/services/serviceBusManagement2/lib/operations/index.d.ts +++ b/lib/services/serviceBusManagement2/lib/operations/index.d.ts @@ -1053,159 +1053,17 @@ export interface Namespaces { /** - * Gets a list of IP Filter rules for a Namespace. + * This operation Migrate the given namespace to provided name type * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - */ - listIpFilterRulesWithHttpOperationResponse(resourceGroupName: string, namespaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets a list of IP Filter rules for a Namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {IpFilterRuleListResult} - 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. - * - * {IpFilterRuleListResult} [result] - The deserialized result object if an error did not occur. - * See {@link IpFilterRuleListResult} 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. - */ - listIpFilterRules(resourceGroupName: string, namespaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listIpFilterRules(resourceGroupName: string, namespaceName: string, callback: ServiceCallback): void; - listIpFilterRules(resourceGroupName: string, namespaceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Creates or updates an IpFilterRule for a Namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {string} ipFilterRuleName The IP Filter Rule name. - * - * @param {object} parameters The Namespace IpFilterRule. - * - * @param {string} [parameters.ipMask] IP Mask - * - * @param {string} [parameters.action] The IP Filter Action. Possible values - * include: 'Accept', 'Reject' - * - * @param {string} [parameters.filterName] IP Filter name - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - */ - createOrUpdateIpFilterRuleWithHttpOperationResponse(resourceGroupName: string, namespaceName: string, ipFilterRuleName: string, parameters: models.IpFilterRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Creates or updates an IpFilterRule for a Namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {string} ipFilterRuleName The IP Filter Rule name. - * - * @param {object} parameters The Namespace IpFilterRule. - * - * @param {string} [parameters.ipMask] IP Mask - * - * @param {string} [parameters.action] The IP Filter Action. Possible values - * include: 'Accept', 'Reject' - * - * @param {string} [parameters.filterName] IP Filter name - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {IpFilterRule} - 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. - * - * {IpFilterRule} [result] - The deserialized result object if an error did not occur. - * See {@link IpFilterRule} 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. - */ - createOrUpdateIpFilterRule(resourceGroupName: string, namespaceName: string, ipFilterRuleName: string, parameters: models.IpFilterRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdateIpFilterRule(resourceGroupName: string, namespaceName: string, ipFilterRuleName: string, parameters: models.IpFilterRule, callback: ServiceCallback): void; - createOrUpdateIpFilterRule(resourceGroupName: string, namespaceName: string, ipFilterRuleName: string, parameters: models.IpFilterRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Deletes an IpFilterRule for a Namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name + * @param {object} parameters Parameters supplied to migrate namespace type. * - * @param {string} ipFilterRuleName The IP Filter Rule name. + * @param {string} parameters.targetNamespaceType Type of namespaces. Possible + * values include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', 'Relay' * * @param {object} [options] Optional Parameters. * @@ -1218,283 +1076,20 @@ export interface Namespaces { * * @reject {Error|ServiceError} - The error object. */ - deleteIpFilterRuleWithHttpOperationResponse(resourceGroupName: string, namespaceName: string, ipFilterRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Deletes an IpFilterRule for a Namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {string} ipFilterRuleName The IP Filter Rule name. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {null} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - * - * {ServiceCallback} optionalCallback(err, result, request, response) - * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. - * - * {null} [result] - The deserialized result object if an error did not occur. - * - * {WebResource} [request] - The HTTP Request object if an error did not occur. - * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - deleteIpFilterRule(resourceGroupName: string, namespaceName: string, ipFilterRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteIpFilterRule(resourceGroupName: string, namespaceName: string, ipFilterRuleName: string, callback: ServiceCallback): void; - deleteIpFilterRule(resourceGroupName: string, namespaceName: string, ipFilterRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets an IpFilterRule for a Namespace by rule name. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {string} ipFilterRuleName The IP Filter Rule name. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - */ - getIpFilterRuleWithHttpOperationResponse(resourceGroupName: string, namespaceName: string, ipFilterRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets an IpFilterRule for a Namespace by rule name. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {string} ipFilterRuleName The IP Filter Rule name. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {IpFilterRule} - 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. - * - * {IpFilterRule} [result] - The deserialized result object if an error did not occur. - * See {@link IpFilterRule} 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. - */ - getIpFilterRule(resourceGroupName: string, namespaceName: string, ipFilterRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getIpFilterRule(resourceGroupName: string, namespaceName: string, ipFilterRuleName: string, callback: ServiceCallback): void; - getIpFilterRule(resourceGroupName: string, namespaceName: string, ipFilterRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets a list of VirtualNetwork rules for a Namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - */ - listVirtualNetworkRulesWithHttpOperationResponse(resourceGroupName: string, namespaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets a list of VirtualNetwork rules for a Namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {VirtualNetworkRuleListResult} - 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. - * - * {VirtualNetworkRuleListResult} [result] - The deserialized result object if an error did not occur. - * See {@link VirtualNetworkRuleListResult} 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. - */ - listVirtualNetworkRules(resourceGroupName: string, namespaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listVirtualNetworkRules(resourceGroupName: string, namespaceName: string, callback: ServiceCallback): void; - listVirtualNetworkRules(resourceGroupName: string, namespaceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Creates or updates an VirtualNetworkRule for a Namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {string} virtualNetworkRuleName The Virtual Network Rule name. - * - * @param {object} parameters The Namespace VirtualNetworkRule. - * - * @param {string} [parameters.virtualNetworkSubnetId] Resource ID of Virtual - * Network Subnet - * - * @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. - */ - createOrUpdateVirtualNetworkRuleWithHttpOperationResponse(resourceGroupName: string, namespaceName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Creates or updates an VirtualNetworkRule for a Namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {string} virtualNetworkRuleName The Virtual Network Rule name. - * - * @param {object} parameters The Namespace VirtualNetworkRule. - * - * @param {string} [parameters.virtualNetworkSubnetId] Resource ID of Virtual - * Network Subnet - * - * @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 {VirtualNetworkRule} - 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. - * - * {VirtualNetworkRule} [result] - The deserialized result object if an error did not occur. - * See {@link VirtualNetworkRule} 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. - */ - createOrUpdateVirtualNetworkRule(resourceGroupName: string, namespaceName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdateVirtualNetworkRule(resourceGroupName: string, namespaceName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, callback: ServiceCallback): void; - createOrUpdateVirtualNetworkRule(resourceGroupName: string, namespaceName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - + migrateWithHttpOperationResponse(resourceGroupName: string, namespaceName: string, parameters: models.SBNamespaceMigrate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes an VirtualNetworkRule for a Namespace. + * This operation Migrate the given namespace to provided name type * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} virtualNetworkRuleName The Virtual Network Rule name. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - */ - deleteVirtualNetworkRuleWithHttpOperationResponse(resourceGroupName: string, namespaceName: string, virtualNetworkRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Deletes an VirtualNetworkRule for a Namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name + * @param {object} parameters Parameters supplied to migrate namespace type. * - * @param {string} virtualNetworkRuleName The Virtual Network Rule name. + * @param {string} parameters.targetNamespaceType Type of namespaces. Possible + * values include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', 'Relay' * * @param {object} [options] Optional Parameters. * @@ -1522,74 +1117,9 @@ export interface Namespaces { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteVirtualNetworkRule(resourceGroupName: string, namespaceName: string, virtualNetworkRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteVirtualNetworkRule(resourceGroupName: string, namespaceName: string, virtualNetworkRuleName: string, callback: ServiceCallback): void; - deleteVirtualNetworkRule(resourceGroupName: string, namespaceName: string, virtualNetworkRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets an VirtualNetworkRule for a Namespace by rule name. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {string} virtualNetworkRuleName The Virtual Network Rule name. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - */ - getVirtualNetworkRuleWithHttpOperationResponse(resourceGroupName: string, namespaceName: string, virtualNetworkRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets an VirtualNetworkRule for a Namespace by rule name. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {string} virtualNetworkRuleName The Virtual Network Rule name. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {VirtualNetworkRule} - 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. - * - * {VirtualNetworkRule} [result] - The deserialized result object if an error did not occur. - * See {@link VirtualNetworkRule} 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. - */ - getVirtualNetworkRule(resourceGroupName: string, namespaceName: string, virtualNetworkRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getVirtualNetworkRule(resourceGroupName: string, namespaceName: string, virtualNetworkRuleName: string, callback: ServiceCallback): void; - getVirtualNetworkRule(resourceGroupName: string, namespaceName: string, virtualNetworkRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + migrate(resourceGroupName: string, namespaceName: string, parameters: models.SBNamespaceMigrate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + migrate(resourceGroupName: string, namespaceName: string, parameters: models.SBNamespaceMigrate, callback: ServiceCallback): void; + migrate(resourceGroupName: string, namespaceName: string, parameters: models.SBNamespaceMigrate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1927,122 +1457,6 @@ export interface Namespaces { listAuthorizationRulesNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; listAuthorizationRulesNext(nextPageLink: string, callback: ServiceCallback): void; listAuthorizationRulesNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets a list of IP Filter rules for a Namespace. - * - * @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. - */ - listIpFilterRulesNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets a list of IP Filter rules for a Namespace. - * - * @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 {IpFilterRuleListResult} - 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. - * - * {IpFilterRuleListResult} [result] - The deserialized result object if an error did not occur. - * See {@link IpFilterRuleListResult} 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. - */ - listIpFilterRulesNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listIpFilterRulesNext(nextPageLink: string, callback: ServiceCallback): void; - listIpFilterRulesNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets a list of VirtualNetwork rules for a Namespace. - * - * @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. - */ - listVirtualNetworkRulesNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets a list of VirtualNetwork rules for a Namespace. - * - * @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 {VirtualNetworkRuleListResult} - 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. - * - * {VirtualNetworkRuleListResult} [result] - The deserialized result object if an error did not occur. - * See {@link VirtualNetworkRuleListResult} 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. - */ - listVirtualNetworkRulesNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listVirtualNetworkRulesNext(nextPageLink: string, callback: ServiceCallback): void; - listVirtualNetworkRulesNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** diff --git a/lib/services/serviceBusManagement2/lib/operations/namespaces.js b/lib/services/serviceBusManagement2/lib/operations/namespaces.js index d74429a1a3..ce11ac55bf 100644 --- a/lib/services/serviceBusManagement2/lib/operations/namespaces.js +++ b/lib/services/serviceBusManagement2/lib/operations/namespaces.js @@ -2124,13 +2124,18 @@ function _regenerateKeys(resourceGroupName, namespaceName, authorizationRuleName } /** - * Gets a list of IP Filter rules for a Namespace. + * This operation Migrate the given namespace to provided name type * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * + * @param {object} parameters Parameters supplied to migrate namespace type. + * + * @param {string} parameters.targetNamespaceType Type of namespaces. Possible + * values include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', 'Relay' + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2142,15 +2147,13 @@ function _regenerateKeys(resourceGroupName, namespaceName, authorizationRuleName * * {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 IpFilterRuleListResult} for more - * information. + * {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 _listIpFilterRules(resourceGroupName, namespaceName, options, callback) { +function _migrate(resourceGroupName, namespaceName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -2194,6 +2197,9 @@ function _listIpFilterRules(resourceGroupName, namespaceName, options, callback) if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -2203,7 +2209,7 @@ function _listIpFilterRules(resourceGroupName, namespaceName, options, callback) // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{namespaceName}', encodeURIComponent(namespaceName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); @@ -2215,7 +2221,7 @@ function _listIpFilterRules(resourceGroupName, namespaceName, options, callback) // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'GET'; + httpRequest.method = 'POST'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -2233,7 +2239,21 @@ function _listIpFilterRules(resourceGroupName, namespaceName, options, callback) } } } - httpRequest.body = null; + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['SBNamespaceMigrate']().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) { @@ -2269,46 +2289,38 @@ function _listIpFilterRules(resourceGroupName, namespaceName, options, callback) // 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['IpFilterRuleListResult']().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 IpFilterRule for a Namespace. + * Creates or updates a service namespace. Once created, this namespace's + * resource manifest is immutable. This operation is idempotent. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * - * @param {string} namespaceName The namespace name + * @param {string} namespaceName The namespace name. + * + * @param {object} parameters Parameters supplied to create a namespace + * resource. * - * @param {string} ipFilterRuleName The IP Filter Rule name. + * @param {object} [parameters.sku] Porperties of Sku + * + * @param {string} parameters.sku.name Name of this SKU. Possible values + * include: 'Basic', 'Standard', 'Premium' * - * @param {object} parameters The Namespace IpFilterRule. + * @param {string} [parameters.sku.tier] The billing tier of this particular + * SKU. Possible values include: 'Basic', 'Standard', 'Premium' * - * @param {string} [parameters.ipMask] IP Mask + * @param {number} [parameters.sku.capacity] The specified messaging units for + * the tier. For Premium tier, capacity are 1,2 and 4. * - * @param {string} [parameters.action] The IP Filter Action. Possible values - * include: 'Accept', 'Reject' + * @param {string} parameters.location The Geo-location where the resource + * lives * - * @param {string} [parameters.filterName] IP Filter name + * @param {object} [parameters.tags] Resource tags * * @param {object} [options] Optional Parameters. * @@ -2322,13 +2334,13 @@ function _listIpFilterRules(resourceGroupName, namespaceName, options, callback) * {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 IpFilterRule} for more information. + * See {@link SBNamespace} 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 _createOrUpdateIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, parameters, options, callback) { +function _beginCreateOrUpdate(resourceGroupName, namespaceName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -2356,25 +2368,6 @@ function _createOrUpdateIpFilterRule(resourceGroupName, namespaceName, ipFilterR if (namespaceName === null || namespaceName === undefined || typeof namespaceName.valueOf() !== 'string') { throw new Error('namespaceName cannot be null or undefined and it must be of type string.'); } - if (namespaceName !== null && namespaceName !== undefined) { - if (namespaceName.length > 50) - { - throw new Error('"namespaceName" should satisfy the constraint - "MaxLength": 50'); - } - if (namespaceName.length < 6) - { - throw new Error('"namespaceName" should satisfy the constraint - "MinLength": 6'); - } - } - if (ipFilterRuleName === null || ipFilterRuleName === undefined || typeof ipFilterRuleName.valueOf() !== 'string') { - throw new Error('ipFilterRuleName cannot be null or undefined and it must be of type string.'); - } - if (ipFilterRuleName !== null && ipFilterRuleName !== undefined) { - if (ipFilterRuleName.length < 1) - { - throw new Error('"ipFilterRuleName" should satisfy the constraint - "MinLength": 1'); - } - } if (parameters === null || parameters === undefined) { throw new Error('parameters cannot be null or undefined.'); } @@ -2393,10 +2386,9 @@ function _createOrUpdateIpFilterRule(resourceGroupName, namespaceName, ipFilterR // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{namespaceName}', encodeURIComponent(namespaceName)); - requestUrl = requestUrl.replace('{ipFilterRuleName}', encodeURIComponent(ipFilterRuleName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); @@ -2429,7 +2421,7 @@ function _createOrUpdateIpFilterRule(resourceGroupName, namespaceName, ipFilterR let requestModel = null; try { if (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['IpFilterRule']().mapper(); + let requestModelMapper = new client.models['SBNamespace']().mapper(); requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); requestContent = JSON.stringify(requestModel); } @@ -2445,7 +2437,7 @@ function _createOrUpdateIpFilterRule(resourceGroupName, namespaceName, ipFilterR return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -2481,7 +2473,7 @@ function _createOrUpdateIpFilterRule(resourceGroupName, namespaceName, ipFilterR parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['IpFilterRule']().mapper(); + let resultMapper = new client.models['SBNamespace']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -2491,21 +2483,37 @@ function _createOrUpdateIpFilterRule(resourceGroupName, namespaceName, ipFilterR 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['SBNamespace']().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 IpFilterRule for a Namespace. + * Deletes an existing namespace. This operation also removes all associated + * resources under the namespace. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} ipFilterRuleName The IP Filter Rule name. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2523,7 +2531,7 @@ function _createOrUpdateIpFilterRule(resourceGroupName, namespaceName, ipFilterR * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _deleteIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, options, callback) { +function _beginDeleteMethod(resourceGroupName, namespaceName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -2561,15 +2569,6 @@ function _deleteIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, throw new Error('"namespaceName" should satisfy the constraint - "MinLength": 6'); } } - if (ipFilterRuleName === null || ipFilterRuleName === undefined || typeof ipFilterRuleName.valueOf() !== 'string') { - throw new Error('ipFilterRuleName cannot be null or undefined and it must be of type string.'); - } - if (ipFilterRuleName !== null && ipFilterRuleName !== undefined) { - if (ipFilterRuleName.length < 1) - { - throw new Error('"ipFilterRuleName" should satisfy the constraint - "MinLength": 1'); - } - } 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.'); } @@ -2585,10 +2584,9 @@ function _deleteIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{namespaceName}', encodeURIComponent(namespaceName)); - requestUrl = requestUrl.replace('{ipFilterRuleName}', encodeURIComponent(ipFilterRuleName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); @@ -2623,7 +2621,7 @@ function _deleteIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 204) { + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -2658,14 +2656,11 @@ function _deleteIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, } /** - * Gets an IpFilterRule for a Namespace by rule name. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name + * Gets all the available namespaces within the subscription, irrespective of + * the resource groups. * - * @param {string} ipFilterRuleName The IP Filter Rule name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -2679,13 +2674,13 @@ function _deleteIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, * {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 IpFilterRule} for more information. + * See {@link SBNamespaceListResult} 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 _getIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, options, callback) { +function _listNext(nextPageLink, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -2697,46 +2692,8 @@ function _getIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, op } // Validate try { - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (namespaceName === null || namespaceName === undefined || typeof namespaceName.valueOf() !== 'string') { - throw new Error('namespaceName cannot be null or undefined and it must be of type string.'); - } - if (namespaceName !== null && namespaceName !== undefined) { - if (namespaceName.length > 50) - { - throw new Error('"namespaceName" should satisfy the constraint - "MaxLength": 50'); - } - if (namespaceName.length < 6) - { - throw new Error('"namespaceName" should satisfy the constraint - "MinLength": 6'); - } - } - if (ipFilterRuleName === null || ipFilterRuleName === undefined || typeof ipFilterRuleName.valueOf() !== 'string') { - throw new Error('ipFilterRuleName cannot be null or undefined and it must be of type string.'); - } - if (ipFilterRuleName !== null && ipFilterRuleName !== undefined) { - if (ipFilterRuleName.length < 1) - { - throw new Error('"ipFilterRuleName" should satisfy the constraint - "MinLength": 1'); - } - } - 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.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 (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.'); @@ -2746,17 +2703,8 @@ function _getIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, op } // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{namespaceName}', encodeURIComponent(namespaceName)); - requestUrl = requestUrl.replace('{ipFilterRuleName}', encodeURIComponent(ipFilterRuleName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); - if (queryParameters.length > 0) { - requestUrl += '?' + queryParameters.join('&'); - } + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); // Create HTTP transport objects let httpRequest = new WebResource(); @@ -2821,7 +2769,7 @@ function _getIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, op parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['IpFilterRule']().mapper(); + let resultMapper = new client.models['SBNamespaceListResult']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -2837,12 +2785,10 @@ function _getIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, op } /** - * Gets a list of VirtualNetwork rules for a Namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. + * Gets the available namespaces within a resource group. * - * @param {string} namespaceName The namespace name + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -2856,14 +2802,13 @@ function _getIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, op * {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 VirtualNetworkRuleListResult} for more - * information. + * See {@link SBNamespaceListResult} 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 _listVirtualNetworkRules(resourceGroupName, namespaceName, options, callback) { +function _listByResourceGroupNext(nextPageLink, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -2875,37 +2820,8 @@ function _listVirtualNetworkRules(resourceGroupName, namespaceName, options, cal } // Validate try { - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (namespaceName === null || namespaceName === undefined || typeof namespaceName.valueOf() !== 'string') { - throw new Error('namespaceName cannot be null or undefined and it must be of type string.'); - } - if (namespaceName !== null && namespaceName !== undefined) { - if (namespaceName.length > 50) - { - throw new Error('"namespaceName" should satisfy the constraint - "MaxLength": 50'); - } - if (namespaceName.length < 6) - { - throw new Error('"namespaceName" should satisfy the constraint - "MinLength": 6'); - } - } - 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.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 (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.'); @@ -2915,16 +2831,8 @@ function _listVirtualNetworkRules(resourceGroupName, namespaceName, options, cal } // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{namespaceName}', encodeURIComponent(namespaceName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); - if (queryParameters.length > 0) { - requestUrl += '?' + queryParameters.join('&'); - } + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); // Create HTTP transport objects let httpRequest = new WebResource(); @@ -2989,7 +2897,7 @@ function _listVirtualNetworkRules(resourceGroupName, namespaceName, options, cal parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['VirtualNetworkRuleListResult']().mapper(); + let resultMapper = new client.models['SBNamespaceListResult']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -3005,19 +2913,10 @@ function _listVirtualNetworkRules(resourceGroupName, namespaceName, options, cal } /** - * Creates or updates an VirtualNetworkRule for a Namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {string} virtualNetworkRuleName The Virtual Network Rule name. - * - * @param {object} parameters The Namespace VirtualNetworkRule. + * Gets the authorization rules for a namespace. * - * @param {string} [parameters.virtualNetworkSubnetId] Resource ID of Virtual - * Network Subnet + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -3031,13 +2930,14 @@ function _listVirtualNetworkRules(resourceGroupName, namespaceName, options, cal * {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 VirtualNetworkRule} for more information. + * See {@link SBAuthorizationRuleListResult} 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 _createOrUpdateVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, parameters, options, callback) { +function _listAuthorizationRulesNext(nextPageLink, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -3049,265 +2949,23 @@ function _createOrUpdateVirtualNetworkRule(resourceGroupName, namespaceName, vir } // Validate try { - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (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 (namespaceName === null || namespaceName === undefined || typeof namespaceName.valueOf() !== 'string') { - throw new Error('namespaceName cannot be null or undefined and it must be of type string.'); - } - if (namespaceName !== null && namespaceName !== undefined) { - if (namespaceName.length > 50) - { - throw new Error('"namespaceName" should satisfy the constraint - "MaxLength": 50'); - } - if (namespaceName.length < 6) - { - throw new Error('"namespaceName" should satisfy the constraint - "MinLength": 6'); - } - } - if (virtualNetworkRuleName === null || virtualNetworkRuleName === undefined || typeof virtualNetworkRuleName.valueOf() !== 'string') { - throw new Error('virtualNetworkRuleName cannot be null or undefined and it must be of type string.'); - } - if (virtualNetworkRuleName !== null && virtualNetworkRuleName !== undefined) { - if (virtualNetworkRuleName.length < 1) - { - throw new Error('"virtualNetworkRuleName" should satisfy the constraint - "MinLength": 1'); - } - } - if (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - 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.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{namespaceName}', encodeURIComponent(namespaceName)); - requestUrl = requestUrl.replace('{virtualNetworkRuleName}', encodeURIComponent(virtualNetworkRuleName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - 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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['VirtualNetworkRule']().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) { - 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['VirtualNetworkRule']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); - deserializationError.request = msRest.stripRequest(httpRequest); - deserializationError.response = msRest.stripResponse(response); - return callback(deserializationError); - } - } - - return callback(null, result, httpRequest, response); - }); -} - -/** - * Deletes an VirtualNetworkRule for a Namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {string} virtualNetworkRuleName The Virtual Network Rule 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 _deleteVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, 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 (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 (namespaceName === null || namespaceName === undefined || typeof namespaceName.valueOf() !== 'string') { - throw new Error('namespaceName cannot be null or undefined and it must be of type string.'); - } - if (namespaceName !== null && namespaceName !== undefined) { - if (namespaceName.length > 50) - { - throw new Error('"namespaceName" should satisfy the constraint - "MaxLength": 50'); - } - if (namespaceName.length < 6) - { - throw new Error('"namespaceName" should satisfy the constraint - "MinLength": 6'); - } - } - if (virtualNetworkRuleName === null || virtualNetworkRuleName === undefined || typeof virtualNetworkRuleName.valueOf() !== 'string') { - throw new Error('virtualNetworkRuleName cannot be null or undefined and it must be of type string.'); - } - if (virtualNetworkRuleName !== null && virtualNetworkRuleName !== undefined) { - if (virtualNetworkRuleName.length < 1) - { - throw new Error('"virtualNetworkRuleName" should satisfy the constraint - "MinLength": 1'); - } - } - 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.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); + 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.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{namespaceName}', encodeURIComponent(namespaceName)); - requestUrl = requestUrl.replace('{virtualNetworkRuleName}', encodeURIComponent(virtualNetworkRuleName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); - if (queryParameters.length > 0) { - requestUrl += '?' + queryParameters.join('&'); - } + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'DELETE'; + httpRequest.method = 'GET'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -3332,7 +2990,7 @@ function _deleteVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetw return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 204) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -3358,1933 +3016,70 @@ function _deleteVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetw } return callback(error); } - // Create Result - let result = null; - if (responseBody === '') responseBody = null; - - return callback(null, result, httpRequest, response); - }); -} - -/** - * Gets an VirtualNetworkRule for a Namespace by rule name. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {string} virtualNetworkRuleName The Virtual Network Rule 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 VirtualNetworkRule} 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 _getVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, 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 (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 (namespaceName === null || namespaceName === undefined || typeof namespaceName.valueOf() !== 'string') { - throw new Error('namespaceName cannot be null or undefined and it must be of type string.'); - } - if (namespaceName !== null && namespaceName !== undefined) { - if (namespaceName.length > 50) - { - throw new Error('"namespaceName" should satisfy the constraint - "MaxLength": 50'); - } - if (namespaceName.length < 6) - { - throw new Error('"namespaceName" should satisfy the constraint - "MinLength": 6'); - } - } - if (virtualNetworkRuleName === null || virtualNetworkRuleName === undefined || typeof virtualNetworkRuleName.valueOf() !== 'string') { - throw new Error('virtualNetworkRuleName cannot be null or undefined and it must be of type string.'); - } - if (virtualNetworkRuleName !== null && virtualNetworkRuleName !== undefined) { - if (virtualNetworkRuleName.length < 1) - { - throw new Error('"virtualNetworkRuleName" should satisfy the constraint - "MinLength": 1'); - } - } - 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.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{namespaceName}', encodeURIComponent(namespaceName)); - requestUrl = requestUrl.replace('{virtualNetworkRuleName}', encodeURIComponent(virtualNetworkRuleName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - 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['VirtualNetworkRule']().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 a service namespace. Once created, this namespace's - * resource manifest is immutable. This operation is idempotent. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name. - * - * @param {object} parameters Parameters supplied to create a namespace - * resource. - * - * @param {object} [parameters.sku] Porperties of Sku - * - * @param {string} parameters.sku.name Name of this SKU. Possible values - * include: 'Basic', 'Standard', 'Premium' - * - * @param {string} [parameters.sku.tier] The billing tier of this particular - * SKU. Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.sku.capacity] The specified messaging units for - * the tier. For Premium tier, capacity are 1,2 and 4. - * - * @param {string} parameters.location The Geo-location where the resource - * lives - * - * @param {object} [parameters.tags] Resource tags - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {function} callback - The callback. - * - * @returns {function} callback(err, result, request, response) - * - * {Error} err - The Error object if an error occurred, null otherwise. - * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link SBNamespace} for more information. - * - * {object} [request] - The HTTP Request object if an error did not occur. - * - * {stream} [response] - The HTTP Response stream if an error did not occur. - */ -function _beginCreateOrUpdate(resourceGroupName, namespaceName, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (namespaceName === null || namespaceName === undefined || typeof namespaceName.valueOf() !== 'string') { - throw new Error('namespaceName cannot be null or undefined and it must be of type string.'); - } - if (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.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.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{namespaceName}', encodeURIComponent(namespaceName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - 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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['SBNamespace']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorResponse']().mapper(); - error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); - } - } catch (defaultError) { - error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + - `- "${responseBody}" for the default response.`; - return callback(error); - } - return callback(error); - } - // Create Result - let result = null; - if (responseBody === '') responseBody = null; - // Deserialize Response - if (statusCode === 200) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['SBNamespace']().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['SBNamespace']().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 existing namespace. This operation also removes all associated - * resources under the namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace 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 _beginDeleteMethod(resourceGroupName, namespaceName, 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 (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 (namespaceName === null || namespaceName === undefined || typeof namespaceName.valueOf() !== 'string') { - throw new Error('namespaceName cannot be null or undefined and it must be of type string.'); - } - if (namespaceName !== null && namespaceName !== undefined) { - if (namespaceName.length > 50) - { - throw new Error('"namespaceName" should satisfy the constraint - "MaxLength": 50'); - } - if (namespaceName.length < 6) - { - throw new Error('"namespaceName" should satisfy the constraint - "MinLength": 6'); - } - } - 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.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{namespaceName}', encodeURIComponent(namespaceName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - 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 !== 202 && statusCode !== 204) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorResponse']().mapper(); - error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); - } - } catch (defaultError) { - error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + - `- "${responseBody}" for the default response.`; - return callback(error); - } - return callback(error); - } - // Create Result - let result = null; - if (responseBody === '') responseBody = null; - - return callback(null, result, httpRequest, response); - }); -} - -/** - * Gets all the available namespaces within the subscription, irrespective of - * the resource groups. - * - * @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 SBNamespaceListResult} 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['SBNamespaceListResult']().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 available namespaces within a resource group. - * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {function} callback - The callback. - * - * @returns {function} callback(err, result, request, response) - * - * {Error} err - The Error object if an error occurred, null otherwise. - * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link SBNamespaceListResult} for more information. - * - * {object} [request] - The HTTP Request object if an error did not occur. - * - * {stream} [response] - The HTTP Response stream if an error did not occur. - */ -function _listByResourceGroupNext(nextPageLink, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { - throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let requestUrl = '{nextLink}'; - requestUrl = requestUrl.replace('{nextLink}', nextPageLink); - - // Create HTTP transport objects - let httpRequest = new WebResource(); - httpRequest.method = 'GET'; - httpRequest.url = requestUrl; - httpRequest.headers = {}; - // Set Headers - httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; - if (this.client.generateClientRequestId) { - httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); - } - if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { - httpRequest.headers['accept-language'] = this.client.acceptLanguage; - } - if(options) { - for(let headerName in options['customHeaders']) { - if (options['customHeaders'].hasOwnProperty(headerName)) { - httpRequest.headers[headerName] = options['customHeaders'][headerName]; - } - } - } - httpRequest.body = null; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorResponse']().mapper(); - error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); - } - } catch (defaultError) { - error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + - `- "${responseBody}" for the default response.`; - return callback(error); - } - return callback(error); - } - // Create Result - let result = null; - if (responseBody === '') responseBody = null; - // Deserialize Response - if (statusCode === 200) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['SBNamespaceListResult']().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 authorization rules for a namespace. - * - * @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 SBAuthorizationRuleListResult} 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 _listAuthorizationRulesNext(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['SBAuthorizationRuleListResult']().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 IP Filter rules for a Namespace. - * - * @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 IpFilterRuleListResult} 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 _listIpFilterRulesNext(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['IpFilterRuleListResult']().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 VirtualNetwork rules for a Namespace. - * - * @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 VirtualNetworkRuleListResult} 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 _listVirtualNetworkRulesNext(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['VirtualNetworkRuleListResult']().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 Namespaces. */ -class Namespaces { - /** - * Create a Namespaces. - * @param {ServiceBusManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._checkNameAvailabilityMethod = _checkNameAvailabilityMethod; - this._list = _list; - this._listByResourceGroup = _listByResourceGroup; - this._createOrUpdate = _createOrUpdate; - this._deleteMethod = _deleteMethod; - this._get = _get; - this._update = _update; - this._listAuthorizationRules = _listAuthorizationRules; - this._createOrUpdateAuthorizationRule = _createOrUpdateAuthorizationRule; - this._deleteAuthorizationRule = _deleteAuthorizationRule; - this._getAuthorizationRule = _getAuthorizationRule; - this._listKeys = _listKeys; - this._regenerateKeys = _regenerateKeys; - this._listIpFilterRules = _listIpFilterRules; - this._createOrUpdateIpFilterRule = _createOrUpdateIpFilterRule; - this._deleteIpFilterRule = _deleteIpFilterRule; - this._getIpFilterRule = _getIpFilterRule; - this._listVirtualNetworkRules = _listVirtualNetworkRules; - this._createOrUpdateVirtualNetworkRule = _createOrUpdateVirtualNetworkRule; - this._deleteVirtualNetworkRule = _deleteVirtualNetworkRule; - this._getVirtualNetworkRule = _getVirtualNetworkRule; - this._beginCreateOrUpdate = _beginCreateOrUpdate; - this._beginDeleteMethod = _beginDeleteMethod; - this._listNext = _listNext; - this._listByResourceGroupNext = _listByResourceGroupNext; - this._listAuthorizationRulesNext = _listAuthorizationRulesNext; - this._listIpFilterRulesNext = _listIpFilterRulesNext; - this._listVirtualNetworkRulesNext = _listVirtualNetworkRulesNext; - } - - /** - * Check the give namespace name availability. - * - * @param {object} parameters Parameters to check availability of the given - * namespace name - * - * @param {string} parameters.name The Name to check the namespce name - * availability and The namespace name can contain only letters, numbers, and - * hyphens. The namespace must start with a letter, and it must end with a - * letter or number. - * - * @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. - */ - checkNameAvailabilityMethodWithHttpOperationResponse(parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._checkNameAvailabilityMethod(parameters, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Check the give namespace name availability. - * - * @param {object} parameters Parameters to check availability of the given - * namespace name - * - * @param {string} parameters.name The Name to check the namespce name - * availability and The namespace name can contain only letters, numbers, and - * hyphens. The namespace must start with a letter, and it must end with a - * letter or number. - * - * @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 {CheckNameAvailabilityResult} - 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 CheckNameAvailabilityResult} 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. - */ - checkNameAvailabilityMethod(parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._checkNameAvailabilityMethod(parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._checkNameAvailabilityMethod(parameters, options, optionalCallback); - } - } - - /** - * Gets all the available namespaces within the subscription, irrespective of - * the resource groups. - * - * @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 all the available namespaces within the subscription, irrespective of - * the resource groups. - * - * @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 {SBNamespaceListResult} - 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 SBNamespaceListResult} 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 available namespaces within a resource group. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error} - The error object. - */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Gets the available namespaces within a resource group. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {function} [optionalCallback] - The optional callback. - * - * @returns {function|Promise} If a callback was passed as the last parameter - * then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned - * - * @resolve {SBNamespaceListResult} - 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 SBNamespaceListResult} for more information. - * - * {object} [request] - The HTTP Request object if an error did not occur. - * - * {stream} [response] - The HTTP Response stream if an error did not occur. - */ - listByResourceGroup(resourceGroupName, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listByResourceGroup(resourceGroupName, options, optionalCallback); - } - } - - /** - * Creates or updates a service namespace. Once created, this namespace's - * resource manifest is immutable. This operation is idempotent. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name. - * - * @param {object} parameters Parameters supplied to create a namespace - * resource. - * - * @param {object} [parameters.sku] Porperties of Sku - * - * @param {string} parameters.sku.name Name of this SKU. Possible values - * include: 'Basic', 'Standard', 'Premium' - * - * @param {string} [parameters.sku.tier] The billing tier of this particular - * SKU. Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.sku.capacity] The specified messaging units for - * the tier. For Premium tier, capacity are 1,2 and 4. - * - * @param {string} parameters.location The Geo-location where the resource - * lives - * - * @param {object} [parameters.tags] Resource tags - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error} - The error object. - */ - createOrUpdateWithHttpOperationResponse(resourceGroupName, namespaceName, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, namespaceName, parameters, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Creates or updates a service namespace. Once created, this namespace's - * resource manifest is immutable. This operation is idempotent. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name. - * - * @param {object} parameters Parameters supplied to create a namespace - * resource. - * - * @param {object} [parameters.sku] Porperties of Sku - * - * @param {string} parameters.sku.name Name of this SKU. Possible values - * include: 'Basic', 'Standard', 'Premium' - * - * @param {string} [parameters.sku.tier] The billing tier of this particular - * SKU. Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.sku.capacity] The specified messaging units for - * the tier. For Premium tier, capacity are 1,2 and 4. - * - * @param {string} parameters.location The Geo-location where the resource - * lives - * - * @param {object} [parameters.tags] Resource tags - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {function} [optionalCallback] - The optional callback. - * - * @returns {function|Promise} If a callback was passed as the last parameter - * then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned - * - * @resolve {SBNamespace} - 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 SBNamespace} 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, namespaceName, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, namespaceName, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._createOrUpdate(resourceGroupName, namespaceName, parameters, options, optionalCallback); - } - } - - /** - * Deletes an existing namespace. This operation also removes all associated - * resources under the namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace 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, namespaceName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, namespaceName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Deletes an existing namespace. This operation also removes all associated - * resources under the namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace 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, namespaceName, 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, namespaceName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._deleteMethod(resourceGroupName, namespaceName, options, optionalCallback); - } - } - - /** - * Gets a description for the specified namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace 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, namespaceName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceGroupName, namespaceName, 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 description for the specified namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace 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 {SBNamespace} - 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 SBNamespace} 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, namespaceName, 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, namespaceName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(resourceGroupName, namespaceName, options, optionalCallback); + // 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['SBAuthorizationRuleListResult']().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); + } } - } - /** - * Updates a service namespace. Once created, this namespace's resource - * manifest is immutable. This operation is idempotent. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {object} parameters Parameters supplied to update a namespace - * resource. - * - * @param {object} [parameters.sku] Porperties of Sku - * - * @param {string} parameters.sku.name Name of this SKU. Possible values - * include: 'Basic', 'Standard', 'Premium' - * - * @param {string} [parameters.sku.tier] The billing tier of this particular - * SKU. Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.sku.capacity] The specified messaging units for - * the tier. For Premium tier, capacity are 1,2 and 4. - * - * @param {string} [parameters.location] Resource location - * - * @param {object} [parameters.tags] Resource tags - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error} - The error object. - */ - updateWithHttpOperationResponse(resourceGroupName, namespaceName, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._update(resourceGroupName, namespaceName, parameters, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } + return callback(null, result, httpRequest, response); + }); +} +/** Class representing a Namespaces. */ +class Namespaces { /** - * Updates a service namespace. Once created, this namespace's resource - * manifest is immutable. This operation is idempotent. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {object} parameters Parameters supplied to update a namespace - * resource. - * - * @param {object} [parameters.sku] Porperties of Sku - * - * @param {string} parameters.sku.name Name of this SKU. Possible values - * include: 'Basic', 'Standard', 'Premium' - * - * @param {string} [parameters.sku.tier] The billing tier of this particular - * SKU. Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.sku.capacity] The specified messaging units for - * the tier. For Premium tier, capacity are 1,2 and 4. - * - * @param {string} [parameters.location] Resource location - * - * @param {object} [parameters.tags] Resource tags - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {function} [optionalCallback] - The optional callback. - * - * @returns {function|Promise} If a callback was passed as the last parameter - * then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned - * - * @resolve {SBNamespace} - 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 SBNamespace} 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. + * Create a Namespaces. + * @param {ServiceBusManagementClient} client Reference to the service client. */ - update(resourceGroupName, namespaceName, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._update(resourceGroupName, namespaceName, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._update(resourceGroupName, namespaceName, parameters, options, optionalCallback); - } + constructor(client) { + this.client = client; + this._checkNameAvailabilityMethod = _checkNameAvailabilityMethod; + this._list = _list; + this._listByResourceGroup = _listByResourceGroup; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._update = _update; + this._listAuthorizationRules = _listAuthorizationRules; + this._createOrUpdateAuthorizationRule = _createOrUpdateAuthorizationRule; + this._deleteAuthorizationRule = _deleteAuthorizationRule; + this._getAuthorizationRule = _getAuthorizationRule; + this._listKeys = _listKeys; + this._regenerateKeys = _regenerateKeys; + this._migrate = _migrate; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._listNext = _listNext; + this._listByResourceGroupNext = _listByResourceGroupNext; + this._listAuthorizationRulesNext = _listAuthorizationRulesNext; } /** - * Gets the authorization rules for a namespace. + * Check the give namespace name availability. * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. + * @param {object} parameters Parameters to check availability of the given + * namespace name * - * @param {string} namespaceName The namespace name + * @param {string} parameters.name The Name to check the namespce name + * availability and The namespace name can contain only letters, numbers, and + * hyphens. The namespace must start with a letter, and it must end with a + * letter or number. * * @param {object} [options] Optional Parameters. * @@ -5293,15 +3088,15 @@ class Namespaces { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listAuthorizationRulesWithHttpOperationResponse(resourceGroupName, namespaceName, options) { + checkNameAvailabilityMethodWithHttpOperationResponse(parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listAuthorizationRules(resourceGroupName, namespaceName, options, (err, result, request, response) => { + self._checkNameAvailabilityMethod(parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -5312,12 +3107,15 @@ class Namespaces { } /** - * Gets the authorization rules for a namespace. + * Check the give namespace name availability. * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. + * @param {object} parameters Parameters to check availability of the given + * namespace name * - * @param {string} namespaceName The namespace name + * @param {string} parameters.name The Name to check the namespce name + * availability and The namespace name can contain only letters, numbers, and + * hyphens. The namespace must start with a letter, and it must end with a + * letter or number. * * @param {object} [options] Optional Parameters. * @@ -5331,7 +3129,7 @@ class Namespaces { * * {Promise} A promise is returned * - * @resolve {SBAuthorizationRuleListResult} - The deserialized result object. + * @resolve {CheckNameAvailabilityResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -5340,14 +3138,14 @@ class Namespaces { * {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 SBAuthorizationRuleListResult} for more + * See {@link CheckNameAvailabilityResult} 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. */ - listAuthorizationRules(resourceGroupName, namespaceName, options, optionalCallback) { + checkNameAvailabilityMethod(parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -5356,30 +3154,20 @@ class Namespaces { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listAuthorizationRules(resourceGroupName, namespaceName, options, (err, result, request, response) => { + self._checkNameAvailabilityMethod(parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listAuthorizationRules(resourceGroupName, namespaceName, options, optionalCallback); + return self._checkNameAvailabilityMethod(parameters, options, optionalCallback); } } /** - * Creates or updates an authorization rule for a namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {string} authorizationRuleName The authorizationrule name. - * - * @param {object} parameters The shared access authorization rule. - * - * @param {array} parameters.rights The rights associated with the rule. + * Gets all the available namespaces within the subscription, irrespective of + * the resource groups. * * @param {object} [options] Optional Parameters. * @@ -5388,37 +3176,27 @@ class Namespaces { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - createOrUpdateAuthorizationRuleWithHttpOperationResponse(resourceGroupName, namespaceName, authorizationRuleName, parameters, options) { + listWithHttpOperationResponse(options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, parameters, options, (err, result, request, response) => { + 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; - }); - }); - } - - /** - * Creates or updates an authorization rule for a namespace. - * - * @param {string} resourceGroupName Name of the Resource group within the - * Azure subscription. - * - * @param {string} namespaceName The namespace name - * - * @param {string} authorizationRuleName The authorizationrule name. - * - * @param {object} parameters The shared access authorization rule. - * - * @param {array} parameters.rights The rights associated with the rule. + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the available namespaces within the subscription, irrespective of + * the resource groups. * * @param {object} [options] Optional Parameters. * @@ -5432,7 +3210,7 @@ class Namespaces { * * {Promise} A promise is returned * - * @resolve {SBAuthorizationRule} - The deserialized result object. + * @resolve {SBNamespaceListResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -5441,13 +3219,13 @@ class Namespaces { * {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 SBAuthorizationRule} for more information. + * See {@link SBNamespaceListResult} 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. */ - createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, parameters, options, optionalCallback) { + list(options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -5456,27 +3234,23 @@ class Namespaces { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, parameters, options, (err, result, request, response) => { + self._list(options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, parameters, options, optionalCallback); + return self._list(options, optionalCallback); } } /** - * Deletes a namespace authorization rule. + * Gets the available namespaces within a resource group. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * - * @param {string} namespaceName The namespace name - * - * @param {string} authorizationRuleName The authorizationrule name. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -5484,15 +3258,15 @@ class Namespaces { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - deleteAuthorizationRuleWithHttpOperationResponse(resourceGroupName, namespaceName, authorizationRuleName, options) { + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._deleteAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, options, (err, result, request, response) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -5503,15 +3277,11 @@ class Namespaces { } /** - * Deletes a namespace authorization rule. + * Gets the available namespaces within a resource group. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * - * @param {string} namespaceName The namespace name - * - * @param {string} authorizationRuleName The authorizationrule name. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -5524,7 +3294,7 @@ class Namespaces { * * {Promise} A promise is returned * - * @resolve {null} - The deserialized result object. + * @resolve {SBNamespaceListResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -5532,13 +3302,14 @@ class Namespaces { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SBNamespaceListResult} 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. */ - deleteAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, options, optionalCallback) { + listByResourceGroup(resourceGroupName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -5547,26 +3318,44 @@ class Namespaces { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._deleteAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, options, (err, result, request, response) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._deleteAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, options, optionalCallback); + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); } } /** - * Gets an authorization rule for a namespace by rule name. + * Creates or updates a service namespace. Once created, this namespace's + * resource manifest is immutable. This operation is idempotent. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * - * @param {string} namespaceName The namespace name + * @param {string} namespaceName The namespace name. * - * @param {string} authorizationRuleName The authorizationrule name. + * @param {object} parameters Parameters supplied to create a namespace + * resource. + * + * @param {object} [parameters.sku] Porperties of Sku + * + * @param {string} parameters.sku.name Name of this SKU. Possible values + * include: 'Basic', 'Standard', 'Premium' + * + * @param {string} [parameters.sku.tier] The billing tier of this particular + * SKU. Possible values include: 'Basic', 'Standard', 'Premium' + * + * @param {number} [parameters.sku.capacity] The specified messaging units for + * the tier. For Premium tier, capacity are 1,2 and 4. + * + * @param {string} parameters.location The Geo-location where the resource + * lives + * + * @param {object} [parameters.tags] Resource tags * * @param {object} [options] Optional Parameters. * @@ -5575,15 +3364,15 @@ class Namespaces { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - getAuthorizationRuleWithHttpOperationResponse(resourceGroupName, namespaceName, authorizationRuleName, options) { + createOrUpdateWithHttpOperationResponse(resourceGroupName, namespaceName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._getAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, options, (err, result, request, response) => { + self._createOrUpdate(resourceGroupName, namespaceName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -5594,14 +3383,32 @@ class Namespaces { } /** - * Gets an authorization rule for a namespace by rule name. + * Creates or updates a service namespace. Once created, this namespace's + * resource manifest is immutable. This operation is idempotent. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * - * @param {string} namespaceName The namespace name + * @param {string} namespaceName The namespace name. * - * @param {string} authorizationRuleName The authorizationrule name. + * @param {object} parameters Parameters supplied to create a namespace + * resource. + * + * @param {object} [parameters.sku] Porperties of Sku + * + * @param {string} parameters.sku.name Name of this SKU. Possible values + * include: 'Basic', 'Standard', 'Premium' + * + * @param {string} [parameters.sku.tier] The billing tier of this particular + * SKU. Possible values include: 'Basic', 'Standard', 'Premium' + * + * @param {number} [parameters.sku.capacity] The specified messaging units for + * the tier. For Premium tier, capacity are 1,2 and 4. + * + * @param {string} parameters.location The Geo-location where the resource + * lives + * + * @param {object} [parameters.tags] Resource tags * * @param {object} [options] Optional Parameters. * @@ -5615,7 +3422,7 @@ class Namespaces { * * {Promise} A promise is returned * - * @resolve {SBAuthorizationRule} - The deserialized result object. + * @resolve {SBNamespace} - The deserialized result object. * * @reject {Error} - The error object. * @@ -5624,13 +3431,13 @@ class Namespaces { * {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 SBAuthorizationRule} for more information. + * See {@link SBNamespace} 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. */ - getAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, options, optionalCallback) { + createOrUpdate(resourceGroupName, namespaceName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -5639,27 +3446,26 @@ class Namespaces { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._getAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, options, (err, result, request, response) => { + self._createOrUpdate(resourceGroupName, namespaceName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._getAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, options, optionalCallback); + return self._createOrUpdate(resourceGroupName, namespaceName, parameters, options, optionalCallback); } } /** - * Gets the primary and secondary connection strings for the namespace. + * Deletes an existing namespace. This operation also removes all associated + * resources under the namespace. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} authorizationRuleName The authorizationrule name. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -5667,15 +3473,15 @@ class Namespaces { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listKeysWithHttpOperationResponse(resourceGroupName, namespaceName, authorizationRuleName, options) { + deleteMethodWithHttpOperationResponse(resourceGroupName, namespaceName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listKeys(resourceGroupName, namespaceName, authorizationRuleName, options, (err, result, request, response) => { + self._deleteMethod(resourceGroupName, namespaceName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -5686,15 +3492,14 @@ class Namespaces { } /** - * Gets the primary and secondary connection strings for the namespace. + * Deletes an existing namespace. This operation also removes all associated + * resources under the namespace. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} authorizationRuleName The authorizationrule name. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -5707,7 +3512,7 @@ class Namespaces { * * {Promise} A promise is returned * - * @resolve {AccessKeys} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -5715,14 +3520,13 @@ class Namespaces { * * {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 AccessKeys} for more information. + * {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. */ - listKeys(resourceGroupName, namespaceName, authorizationRuleName, options, optionalCallback) { + deleteMethod(resourceGroupName, namespaceName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -5731,36 +3535,25 @@ class Namespaces { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listKeys(resourceGroupName, namespaceName, authorizationRuleName, options, (err, result, request, response) => { + self._deleteMethod(resourceGroupName, namespaceName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listKeys(resourceGroupName, namespaceName, authorizationRuleName, options, optionalCallback); + return self._deleteMethod(resourceGroupName, namespaceName, options, optionalCallback); } } /** - * Regenerates the primary or secondary connection strings for the namespace. + * Gets a description for the specified namespace. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} authorizationRuleName The authorizationrule name. - * - * @param {object} parameters Parameters supplied to regenerate the - * authorization rule. - * - * @param {string} parameters.keyType The access key to regenerate. Possible - * values include: 'PrimaryKey', 'SecondaryKey' - * - * @param {string} [parameters.key] Optional, if the key value provided, is - * reset for KeyType value or autogenerate Key value set for keyType - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -5768,15 +3561,15 @@ class Namespaces { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - regenerateKeysWithHttpOperationResponse(resourceGroupName, namespaceName, authorizationRuleName, parameters, options) { + getWithHttpOperationResponse(resourceGroupName, namespaceName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._regenerateKeys(resourceGroupName, namespaceName, authorizationRuleName, parameters, options, (err, result, request, response) => { + self._get(resourceGroupName, namespaceName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -5787,24 +3580,13 @@ class Namespaces { } /** - * Regenerates the primary or secondary connection strings for the namespace. + * Gets a description for the specified namespace. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} authorizationRuleName The authorizationrule name. - * - * @param {object} parameters Parameters supplied to regenerate the - * authorization rule. - * - * @param {string} parameters.keyType The access key to regenerate. Possible - * values include: 'PrimaryKey', 'SecondaryKey' - * - * @param {string} [parameters.key] Optional, if the key value provided, is - * reset for KeyType value or autogenerate Key value set for keyType - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -5817,7 +3599,7 @@ class Namespaces { * * {Promise} A promise is returned * - * @resolve {AccessKeys} - The deserialized result object. + * @resolve {SBNamespace} - The deserialized result object. * * @reject {Error} - The error object. * @@ -5826,13 +3608,13 @@ class Namespaces { * {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 AccessKeys} for more information. + * See {@link SBNamespace} 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. */ - regenerateKeys(resourceGroupName, namespaceName, authorizationRuleName, parameters, options, optionalCallback) { + get(resourceGroupName, namespaceName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -5841,25 +3623,44 @@ class Namespaces { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._regenerateKeys(resourceGroupName, namespaceName, authorizationRuleName, parameters, options, (err, result, request, response) => { + self._get(resourceGroupName, namespaceName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._regenerateKeys(resourceGroupName, namespaceName, authorizationRuleName, parameters, options, optionalCallback); + return self._get(resourceGroupName, namespaceName, options, optionalCallback); } } /** - * Gets a list of IP Filter rules for a Namespace. + * Updates a service namespace. Once created, this namespace's resource + * manifest is immutable. This operation is idempotent. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * + * @param {object} parameters Parameters supplied to update a namespace + * resource. + * + * @param {object} [parameters.sku] Porperties of Sku + * + * @param {string} parameters.sku.name Name of this SKU. Possible values + * include: 'Basic', 'Standard', 'Premium' + * + * @param {string} [parameters.sku.tier] The billing tier of this particular + * SKU. Possible values include: 'Basic', 'Standard', 'Premium' + * + * @param {number} [parameters.sku.capacity] The specified messaging units for + * the tier. For Premium tier, capacity are 1,2 and 4. + * + * @param {string} [parameters.location] Resource location + * + * @param {object} [parameters.tags] Resource tags + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -5867,15 +3668,15 @@ class Namespaces { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listIpFilterRulesWithHttpOperationResponse(resourceGroupName, namespaceName, options) { + updateWithHttpOperationResponse(resourceGroupName, namespaceName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listIpFilterRules(resourceGroupName, namespaceName, options, (err, result, request, response) => { + self._update(resourceGroupName, namespaceName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -5886,13 +3687,32 @@ class Namespaces { } /** - * Gets a list of IP Filter rules for a Namespace. + * Updates a service namespace. Once created, this namespace's resource + * manifest is immutable. This operation is idempotent. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * + * @param {object} parameters Parameters supplied to update a namespace + * resource. + * + * @param {object} [parameters.sku] Porperties of Sku + * + * @param {string} parameters.sku.name Name of this SKU. Possible values + * include: 'Basic', 'Standard', 'Premium' + * + * @param {string} [parameters.sku.tier] The billing tier of this particular + * SKU. Possible values include: 'Basic', 'Standard', 'Premium' + * + * @param {number} [parameters.sku.capacity] The specified messaging units for + * the tier. For Premium tier, capacity are 1,2 and 4. + * + * @param {string} [parameters.location] Resource location + * + * @param {object} [parameters.tags] Resource tags + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -5905,7 +3725,7 @@ class Namespaces { * * {Promise} A promise is returned * - * @resolve {IpFilterRuleListResult} - The deserialized result object. + * @resolve {SBNamespace} - The deserialized result object. * * @reject {Error} - The error object. * @@ -5914,14 +3734,13 @@ class Namespaces { * {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 IpFilterRuleListResult} for more - * information. + * See {@link SBNamespace} 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. */ - listIpFilterRules(resourceGroupName, namespaceName, options, optionalCallback) { + update(resourceGroupName, namespaceName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -5930,36 +3749,25 @@ class Namespaces { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listIpFilterRules(resourceGroupName, namespaceName, options, (err, result, request, response) => { + self._update(resourceGroupName, namespaceName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listIpFilterRules(resourceGroupName, namespaceName, options, optionalCallback); + return self._update(resourceGroupName, namespaceName, parameters, options, optionalCallback); } } /** - * Creates or updates an IpFilterRule for a Namespace. + * Gets the authorization rules for a namespace. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} ipFilterRuleName The IP Filter Rule name. - * - * @param {object} parameters The Namespace IpFilterRule. - * - * @param {string} [parameters.ipMask] IP Mask - * - * @param {string} [parameters.action] The IP Filter Action. Possible values - * include: 'Accept', 'Reject' - * - * @param {string} [parameters.filterName] IP Filter name - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -5967,15 +3775,15 @@ class Namespaces { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - createOrUpdateIpFilterRuleWithHttpOperationResponse(resourceGroupName, namespaceName, ipFilterRuleName, parameters, options) { + listAuthorizationRulesWithHttpOperationResponse(resourceGroupName, namespaceName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._createOrUpdateIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, parameters, options, (err, result, request, response) => { + self._listAuthorizationRules(resourceGroupName, namespaceName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -5986,24 +3794,13 @@ class Namespaces { } /** - * Creates or updates an IpFilterRule for a Namespace. + * Gets the authorization rules for a namespace. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} ipFilterRuleName The IP Filter Rule name. - * - * @param {object} parameters The Namespace IpFilterRule. - * - * @param {string} [parameters.ipMask] IP Mask - * - * @param {string} [parameters.action] The IP Filter Action. Possible values - * include: 'Accept', 'Reject' - * - * @param {string} [parameters.filterName] IP Filter name - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -6016,7 +3813,7 @@ class Namespaces { * * {Promise} A promise is returned * - * @resolve {IpFilterRule} - The deserialized result object. + * @resolve {SBAuthorizationRuleListResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -6025,13 +3822,14 @@ class Namespaces { * {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 IpFilterRule} for more information. + * See {@link SBAuthorizationRuleListResult} 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. */ - createOrUpdateIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, parameters, options, optionalCallback) { + listAuthorizationRules(resourceGroupName, namespaceName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -6040,26 +3838,30 @@ class Namespaces { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._createOrUpdateIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, parameters, options, (err, result, request, response) => { + self._listAuthorizationRules(resourceGroupName, namespaceName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._createOrUpdateIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, parameters, options, optionalCallback); + return self._listAuthorizationRules(resourceGroupName, namespaceName, options, optionalCallback); } } /** - * Deletes an IpFilterRule for a Namespace. + * Creates or updates an authorization rule for a namespace. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * - * @param {string} namespaceName The namespace name + * @param {string} namespaceName The namespace name + * + * @param {string} authorizationRuleName The authorizationrule name. + * + * @param {object} parameters The shared access authorization rule. * - * @param {string} ipFilterRuleName The IP Filter Rule name. + * @param {array} parameters.rights The rights associated with the rule. * * @param {object} [options] Optional Parameters. * @@ -6068,15 +3870,15 @@ class Namespaces { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - deleteIpFilterRuleWithHttpOperationResponse(resourceGroupName, namespaceName, ipFilterRuleName, options) { + createOrUpdateAuthorizationRuleWithHttpOperationResponse(resourceGroupName, namespaceName, authorizationRuleName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._deleteIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, options, (err, result, request, response) => { + self._createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -6087,14 +3889,18 @@ class Namespaces { } /** - * Deletes an IpFilterRule for a Namespace. + * Creates or updates an authorization rule for a namespace. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} ipFilterRuleName The IP Filter Rule name. + * @param {string} authorizationRuleName The authorizationrule name. + * + * @param {object} parameters The shared access authorization rule. + * + * @param {array} parameters.rights The rights associated with the rule. * * @param {object} [options] Optional Parameters. * @@ -6108,7 +3914,7 @@ class Namespaces { * * {Promise} A promise is returned * - * @resolve {null} - The deserialized result object. + * @resolve {SBAuthorizationRule} - The deserialized result object. * * @reject {Error} - The error object. * @@ -6116,13 +3922,14 @@ class Namespaces { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SBAuthorizationRule} 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. */ - deleteIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, options, optionalCallback) { + createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -6131,26 +3938,26 @@ class Namespaces { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._deleteIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, options, (err, result, request, response) => { + self._createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._deleteIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, options, optionalCallback); + return self._createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, parameters, options, optionalCallback); } } /** - * Gets an IpFilterRule for a Namespace by rule name. + * Deletes a namespace authorization rule. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} ipFilterRuleName The IP Filter Rule name. + * @param {string} authorizationRuleName The authorizationrule name. * * @param {object} [options] Optional Parameters. * @@ -6159,15 +3966,15 @@ class Namespaces { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - getIpFilterRuleWithHttpOperationResponse(resourceGroupName, namespaceName, ipFilterRuleName, options) { + deleteAuthorizationRuleWithHttpOperationResponse(resourceGroupName, namespaceName, authorizationRuleName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._getIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, options, (err, result, request, response) => { + self._deleteAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -6178,14 +3985,14 @@ class Namespaces { } /** - * Gets an IpFilterRule for a Namespace by rule name. + * Deletes a namespace authorization rule. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} ipFilterRuleName The IP Filter Rule name. + * @param {string} authorizationRuleName The authorizationrule name. * * @param {object} [options] Optional Parameters. * @@ -6199,7 +4006,7 @@ class Namespaces { * * {Promise} A promise is returned * - * @resolve {IpFilterRule} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -6207,14 +4014,13 @@ class Namespaces { * * {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 IpFilterRule} for more information. + * {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. */ - getIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, options, optionalCallback) { + deleteAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -6223,25 +4029,27 @@ class Namespaces { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._getIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, options, (err, result, request, response) => { + self._deleteAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._getIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, options, optionalCallback); + return self._deleteAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, options, optionalCallback); } } /** - * Gets a list of VirtualNetwork rules for a Namespace. + * Gets an authorization rule for a namespace by rule name. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * + * @param {string} authorizationRuleName The authorizationrule name. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -6249,15 +4057,15 @@ class Namespaces { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listVirtualNetworkRulesWithHttpOperationResponse(resourceGroupName, namespaceName, options) { + getAuthorizationRuleWithHttpOperationResponse(resourceGroupName, namespaceName, authorizationRuleName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listVirtualNetworkRules(resourceGroupName, namespaceName, options, (err, result, request, response) => { + self._getAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -6268,13 +4076,15 @@ class Namespaces { } /** - * Gets a list of VirtualNetwork rules for a Namespace. + * Gets an authorization rule for a namespace by rule name. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * + * @param {string} authorizationRuleName The authorizationrule name. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -6287,7 +4097,7 @@ class Namespaces { * * {Promise} A promise is returned * - * @resolve {VirtualNetworkRuleListResult} - The deserialized result object. + * @resolve {SBAuthorizationRule} - The deserialized result object. * * @reject {Error} - The error object. * @@ -6296,14 +4106,13 @@ class Namespaces { * {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 VirtualNetworkRuleListResult} for more - * information. + * See {@link SBAuthorizationRule} 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. */ - listVirtualNetworkRules(resourceGroupName, namespaceName, options, optionalCallback) { + getAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -6312,31 +4121,26 @@ class Namespaces { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listVirtualNetworkRules(resourceGroupName, namespaceName, options, (err, result, request, response) => { + self._getAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listVirtualNetworkRules(resourceGroupName, namespaceName, options, optionalCallback); + return self._getAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, options, optionalCallback); } } /** - * Creates or updates an VirtualNetworkRule for a Namespace. + * Gets the primary and secondary connection strings for the namespace. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} virtualNetworkRuleName The Virtual Network Rule name. - * - * @param {object} parameters The Namespace VirtualNetworkRule. - * - * @param {string} [parameters.virtualNetworkSubnetId] Resource ID of Virtual - * Network Subnet + * @param {string} authorizationRuleName The authorizationrule name. * * @param {object} [options] Optional Parameters. * @@ -6345,15 +4149,15 @@ class Namespaces { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - createOrUpdateVirtualNetworkRuleWithHttpOperationResponse(resourceGroupName, namespaceName, virtualNetworkRuleName, parameters, options) { + listKeysWithHttpOperationResponse(resourceGroupName, namespaceName, authorizationRuleName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._createOrUpdateVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, parameters, options, (err, result, request, response) => { + self._listKeys(resourceGroupName, namespaceName, authorizationRuleName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -6364,19 +4168,14 @@ class Namespaces { } /** - * Creates or updates an VirtualNetworkRule for a Namespace. + * Gets the primary and secondary connection strings for the namespace. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} virtualNetworkRuleName The Virtual Network Rule name. - * - * @param {object} parameters The Namespace VirtualNetworkRule. - * - * @param {string} [parameters.virtualNetworkSubnetId] Resource ID of Virtual - * Network Subnet + * @param {string} authorizationRuleName The authorizationrule name. * * @param {object} [options] Optional Parameters. * @@ -6390,7 +4189,7 @@ class Namespaces { * * {Promise} A promise is returned * - * @resolve {VirtualNetworkRule} - The deserialized result object. + * @resolve {AccessKeys} - The deserialized result object. * * @reject {Error} - The error object. * @@ -6399,13 +4198,13 @@ class Namespaces { * {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 VirtualNetworkRule} for more information. + * See {@link AccessKeys} 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. */ - createOrUpdateVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, parameters, options, optionalCallback) { + listKeys(resourceGroupName, namespaceName, authorizationRuleName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -6414,26 +4213,35 @@ class Namespaces { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._createOrUpdateVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, parameters, options, (err, result, request, response) => { + self._listKeys(resourceGroupName, namespaceName, authorizationRuleName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._createOrUpdateVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, parameters, options, optionalCallback); + return self._listKeys(resourceGroupName, namespaceName, authorizationRuleName, options, optionalCallback); } } /** - * Deletes an VirtualNetworkRule for a Namespace. + * Regenerates the primary or secondary connection strings for the namespace. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} virtualNetworkRuleName The Virtual Network Rule name. + * @param {string} authorizationRuleName The authorizationrule name. + * + * @param {object} parameters Parameters supplied to regenerate the + * authorization rule. + * + * @param {string} parameters.keyType The access key to regenerate. Possible + * values include: 'PrimaryKey', 'SecondaryKey' + * + * @param {string} [parameters.key] Optional, if the key value provided, is + * reset for KeyType value or autogenerate Key value set for keyType * * @param {object} [options] Optional Parameters. * @@ -6442,15 +4250,15 @@ class Namespaces { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - deleteVirtualNetworkRuleWithHttpOperationResponse(resourceGroupName, namespaceName, virtualNetworkRuleName, options) { + regenerateKeysWithHttpOperationResponse(resourceGroupName, namespaceName, authorizationRuleName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._deleteVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, options, (err, result, request, response) => { + self._regenerateKeys(resourceGroupName, namespaceName, authorizationRuleName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -6461,14 +4269,23 @@ class Namespaces { } /** - * Deletes an VirtualNetworkRule for a Namespace. + * Regenerates the primary or secondary connection strings for the namespace. * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} virtualNetworkRuleName The Virtual Network Rule name. + * @param {string} authorizationRuleName The authorizationrule name. + * + * @param {object} parameters Parameters supplied to regenerate the + * authorization rule. + * + * @param {string} parameters.keyType The access key to regenerate. Possible + * values include: 'PrimaryKey', 'SecondaryKey' + * + * @param {string} [parameters.key] Optional, if the key value provided, is + * reset for KeyType value or autogenerate Key value set for keyType * * @param {object} [options] Optional Parameters. * @@ -6482,7 +4299,7 @@ class Namespaces { * * {Promise} A promise is returned * - * @resolve {null} - The deserialized result object. + * @resolve {AccessKeys} - The deserialized result object. * * @reject {Error} - The error object. * @@ -6490,13 +4307,14 @@ class Namespaces { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link AccessKeys} 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. */ - deleteVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, options, optionalCallback) { + regenerateKeys(resourceGroupName, namespaceName, authorizationRuleName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -6505,26 +4323,29 @@ class Namespaces { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._deleteVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, options, (err, result, request, response) => { + self._regenerateKeys(resourceGroupName, namespaceName, authorizationRuleName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._deleteVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, options, optionalCallback); + return self._regenerateKeys(resourceGroupName, namespaceName, authorizationRuleName, parameters, options, optionalCallback); } } /** - * Gets an VirtualNetworkRule for a Namespace by rule name. + * This operation Migrate the given namespace to provided name type * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} virtualNetworkRuleName The Virtual Network Rule name. + * @param {object} parameters Parameters supplied to migrate namespace type. + * + * @param {string} parameters.targetNamespaceType Type of namespaces. Possible + * values include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', 'Relay' * * @param {object} [options] Optional Parameters. * @@ -6533,15 +4354,15 @@ class Namespaces { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - getVirtualNetworkRuleWithHttpOperationResponse(resourceGroupName, namespaceName, virtualNetworkRuleName, options) { + migrateWithHttpOperationResponse(resourceGroupName, namespaceName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._getVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, options, (err, result, request, response) => { + self._migrate(resourceGroupName, namespaceName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -6552,14 +4373,17 @@ class Namespaces { } /** - * Gets an VirtualNetworkRule for a Namespace by rule name. + * This operation Migrate the given namespace to provided name type * * @param {string} resourceGroupName Name of the Resource group within the * Azure subscription. * * @param {string} namespaceName The namespace name * - * @param {string} virtualNetworkRuleName The Virtual Network Rule name. + * @param {object} parameters Parameters supplied to migrate namespace type. + * + * @param {string} parameters.targetNamespaceType Type of namespaces. Possible + * values include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', 'Relay' * * @param {object} [options] Optional Parameters. * @@ -6573,7 +4397,7 @@ class Namespaces { * * {Promise} A promise is returned * - * @resolve {VirtualNetworkRule} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -6581,14 +4405,13 @@ class Namespaces { * * {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 VirtualNetworkRule} for more information. + * {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. */ - getVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, options, optionalCallback) { + migrate(resourceGroupName, namespaceName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -6597,14 +4420,14 @@ class Namespaces { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._getVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, options, (err, result, request, response) => { + self._migrate(resourceGroupName, namespaceName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._getVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, options, optionalCallback); + return self._migrate(resourceGroupName, namespaceName, parameters, options, optionalCallback); } } @@ -7080,176 +4903,6 @@ class Namespaces { } } - /** - * Gets a list of IP Filter rules for a Namespace. - * - * @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. - */ - listIpFilterRulesNextWithHttpOperationResponse(nextPageLink, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listIpFilterRulesNext(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 IP Filter rules for a Namespace. - * - * @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 {IpFilterRuleListResult} - 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 IpFilterRuleListResult} 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. - */ - listIpFilterRulesNext(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._listIpFilterRulesNext(nextPageLink, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listIpFilterRulesNext(nextPageLink, options, optionalCallback); - } - } - - /** - * Gets a list of VirtualNetwork rules for a Namespace. - * - * @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. - */ - listVirtualNetworkRulesNextWithHttpOperationResponse(nextPageLink, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listVirtualNetworkRulesNext(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 VirtualNetwork rules for a Namespace. - * - * @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 {VirtualNetworkRuleListResult} - 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 VirtualNetworkRuleListResult} 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. - */ - listVirtualNetworkRulesNext(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._listVirtualNetworkRulesNext(nextPageLink, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listVirtualNetworkRulesNext(nextPageLink, options, optionalCallback); - } - } - } module.exports = Namespaces;