diff --git a/lib/services/notificationHubsManagement/LICENSE.txt b/lib/services/notificationHubsManagement/LICENSE.txt index 0313a903d7..5431ba98b9 100644 --- a/lib/services/notificationHubsManagement/LICENSE.txt +++ b/lib/services/notificationHubsManagement/LICENSE.txt @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2017 Microsoft - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +The MIT License (MIT) + +Copyright (c) 2018 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lib/services/notificationHubsManagement/lib/models/checkAvailabilityResult.js b/lib/services/notificationHubsManagement/lib/models/checkAvailabilityResult.js index abe205fb6a..69a1c93332 100644 --- a/lib/services/notificationHubsManagement/lib/models/checkAvailabilityResult.js +++ b/lib/services/notificationHubsManagement/lib/models/checkAvailabilityResult.js @@ -66,7 +66,7 @@ class CheckAvailabilityResult extends models['Resource'] { } }, location: { - required: true, + required: false, serializedName: 'location', type: { name: 'String' diff --git a/lib/services/notificationHubsManagement/lib/models/errorResponse.js b/lib/services/notificationHubsManagement/lib/models/errorResponse.js new file mode 100644 index 0000000000..169a4fcd06 --- /dev/null +++ b/lib/services/notificationHubsManagement/lib/models/errorResponse.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Error reponse indicates NotificationHubs service is not able to process the + * incoming request. The reason is provided in the error message. + * + */ +class ErrorResponse { + /** + * Create a ErrorResponse. + * @member {string} [code] Error code. + * @member {string} [message] Error message indicating why the operation + * failed. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorResponse + * + * @returns {object} metadata of ErrorResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorResponse', + type: { + name: 'Composite', + className: 'ErrorResponse', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorResponse; diff --git a/lib/services/notificationHubsManagement/lib/models/index.d.ts b/lib/services/notificationHubsManagement/lib/models/index.d.ts index 239166a0fb..cdfecd1bfc 100644 --- a/lib/services/notificationHubsManagement/lib/models/index.d.ts +++ b/lib/services/notificationHubsManagement/lib/models/index.d.ts @@ -18,32 +18,54 @@ export { CloudError } from 'ms-rest-azure'; /** * @class - * Initializes a new instance of the CheckNameAvailabilityRequestParameters class. + * Initializes a new instance of the OperationDisplay class. * @constructor - * Parameters supplied to the Check Name Availability for Namespace and - * NotificationHubs. + * The object that represents the operation. * - * @member {string} name Resource name - * @member {string} [type] Resource type + * @member {string} [provider] Service provider: Microsoft.NotificationHubs + * @member {string} [resource] Resource on which the operation is performed: + * Invoice, etc. + * @member {string} [operation] Operation type: Read, write, delete, etc. */ -export interface CheckNameAvailabilityRequestParameters { - name: string; - readonly type?: string; +export interface OperationDisplay { + readonly provider?: string; + readonly resource?: string; + readonly operation?: string; +} + +/** + * @class + * Initializes a new instance of the Operation class. + * @constructor + * A NotificationHubs REST API operation + * + * @member {string} [name] Operation name: {provider}/{resource}/{operation} + * @member {object} [display] The object that represents the operation. + * @member {string} [display.provider] Service provider: + * Microsoft.NotificationHubs + * @member {string} [display.resource] Resource on which the operation is + * performed: Invoice, etc. + * @member {string} [display.operation] Operation type: Read, write, delete, + * etc. + */ +export interface Operation { + readonly name?: string; + display?: OperationDisplay; } /** * @class - * Initializes a new instance of the CheckNameAvailabilityResponse class. + * Initializes a new instance of the ErrorResponse class. * @constructor - * @member {boolean} [nameAvailable] Checks if the namespace name is available - * @member {string} [reason] States the reason due to which the namespace name - * is not available - * @member {string} [message] The messsage returned when checking for namespace - * name availability + * Error reponse indicates NotificationHubs service is not able to process the + * incoming request. The reason is provided in the error message. + * + * @member {string} [code] Error code. + * @member {string} [message] Error message indicating why the operation + * failed. */ -export interface CheckNameAvailabilityResponse { - nameAvailable?: boolean; - reason?: string; +export interface ErrorResponse { + code?: string; message?: string; } @@ -107,7 +129,7 @@ export interface CheckAvailabilityParameters { * @member {string} [id] Resource Id * @member {string} [name] Resource name * @member {string} [type] Resource type - * @member {string} location Resource location + * @member {string} [location] Resource location * @member {object} [tags] Resource tags * @member {object} [sku] The sku of the created namespace * @member {string} [sku.name] Name of the notification hub sku. Possible @@ -121,7 +143,7 @@ export interface Resource extends BaseResource { readonly id?: string; readonly name?: string; readonly type?: string; - location: string; + location?: string; tags?: { [propertyName: string]: string }; sku?: Sku; } @@ -153,9 +175,11 @@ export interface CheckAvailabilityResult extends Resource { * Australia EastAustralia SoutheastCentral USEast USEast US 2West USNorth * Central USSouth Central USEast AsiaSoutheast AsiaBrazil SouthJapan EastJapan * WestNorth EuropeWest Europe + * @member {string} [metricId] Identifier for Azure Insights metrics * @member {string} [status] Status of the namespace. It can be any of these * values:1 = Created/Active2 = Creating3 = Suspended4 = Deleting * @member {date} [createdAt] The time the namespace was created. + * @member {date} [updatedAt] The time the namespace was updated. * @member {string} [serviceBusEndpoint] Endpoint you can use to perform * NotificationHub operations. * @member {string} [subscriptionId] The Id of the Azure subscription @@ -165,6 +189,7 @@ export interface CheckAvailabilityResult extends Resource { * enabled. * @member {boolean} [critical] Whether or not the namespace is set as * Critical. + * @member {string} [dataCenter] Data center for the namespace * @member {string} [namespaceType] The namespace type. Possible values * include: 'Messaging', 'NotificationHub' */ @@ -172,13 +197,16 @@ export interface NamespaceCreateOrUpdateParameters extends Resource { namespaceCreateOrUpdateParametersName?: string; provisioningState?: string; region?: string; + readonly metricId?: string; status?: string; createdAt?: Date; + updatedAt?: Date; serviceBusEndpoint?: string; subscriptionId?: string; scaleUnit?: string; enabled?: boolean; critical?: boolean; + dataCenter?: string; namespaceType?: string; } @@ -215,9 +243,11 @@ export interface NamespacePatchParameters { * Australia EastAustralia SoutheastCentral USEast USEast US 2West USNorth * Central USSouth Central USEast AsiaSoutheast AsiaBrazil SouthJapan EastJapan * WestNorth EuropeWest Europe + * @member {string} [metricId] Identifier for Azure Insights metrics * @member {string} [status] Status of the namespace. It can be any of these * values:1 = Created/Active2 = Creating3 = Suspended4 = Deleting * @member {date} [createdAt] The time the namespace was created. + * @member {date} [updatedAt] The time the namespace was updated. * @member {string} [serviceBusEndpoint] Endpoint you can use to perform * NotificationHub operations. * @member {string} [subscriptionId] The Id of the Azure subscription @@ -227,6 +257,7 @@ export interface NamespacePatchParameters { * enabled. * @member {boolean} [critical] Whether or not the namespace is set as * Critical. + * @member {string} [dataCenter] Data center for the namespace * @member {string} [namespaceType] The namespace type. Possible values * include: 'Messaging', 'NotificationHub' */ @@ -234,13 +265,16 @@ export interface NamespaceResource extends Resource { namespaceResourceName?: string; provisioningState?: string; region?: string; + readonly metricId?: string; status?: string; createdAt?: Date; + updatedAt?: Date; serviceBusEndpoint?: string; subscriptionId?: string; scaleUnit?: string; enabled?: boolean; critical?: boolean; + dataCenter?: string; namespaceType?: string; } @@ -251,9 +285,27 @@ export interface NamespaceResource extends Resource { * SharedAccessAuthorizationRule properties. * * @member {array} [rights] The rights associated with the rule. + * @member {string} [primaryKey] A base64-encoded 256-bit primary key for + * signing and validating the SAS token. + * @member {string} [secondaryKey] A base64-encoded 256-bit primary key for + * signing and validating the SAS token. + * @member {string} [keyName] A string that describes the authorization rule. + * @member {string} [claimType] A string that describes the claim type + * @member {string} [claimValue] A string that describes the claim value + * @member {string} [modifiedTime] The last modified time for this rule + * @member {string} [createdTime] The created time for this rule + * @member {number} [revision] The revision number for the rule */ export interface SharedAccessAuthorizationRuleProperties { rights?: string[]; + readonly primaryKey?: string; + readonly secondaryKey?: string; + readonly keyName?: string; + readonly claimType?: string; + readonly claimValue?: string; + readonly modifiedTime?: string; + readonly createdTime?: string; + readonly revision?: number; } /** @@ -264,8 +316,22 @@ export interface SharedAccessAuthorizationRuleProperties { * * @member {object} properties Properties of the Namespace AuthorizationRules. * @member {array} [properties.rights] The rights associated with the rule. + * @member {string} [properties.primaryKey] A base64-encoded 256-bit primary + * key for signing and validating the SAS token. + * @member {string} [properties.secondaryKey] A base64-encoded 256-bit primary + * key for signing and validating the SAS token. + * @member {string} [properties.keyName] A string that describes the + * authorization rule. + * @member {string} [properties.claimType] A string that describes the claim + * type + * @member {string} [properties.claimValue] A string that describes the claim + * value + * @member {string} [properties.modifiedTime] The last modified time for this + * rule + * @member {string} [properties.createdTime] The created time for this rule + * @member {number} [properties.revision] The revision number for the rule */ -export interface SharedAccessAuthorizationRuleCreateOrUpdateParameters extends Resource { +export interface SharedAccessAuthorizationRuleCreateOrUpdateParameters { properties: SharedAccessAuthorizationRuleProperties; } @@ -276,9 +342,27 @@ export interface SharedAccessAuthorizationRuleCreateOrUpdateParameters extends R * Description of a Namespace AuthorizationRules. * * @member {array} [rights] The rights associated with the rule. + * @member {string} [primaryKey] A base64-encoded 256-bit primary key for + * signing and validating the SAS token. + * @member {string} [secondaryKey] A base64-encoded 256-bit primary key for + * signing and validating the SAS token. + * @member {string} [keyName] A string that describes the authorization rule. + * @member {string} [claimType] A string that describes the claim type + * @member {string} [claimValue] A string that describes the claim value + * @member {string} [modifiedTime] The last modified time for this rule + * @member {string} [createdTime] The created time for this rule + * @member {number} [revision] The revision number for the rule */ export interface SharedAccessAuthorizationRuleResource extends Resource { rights?: string[]; + readonly primaryKey?: string; + readonly secondaryKey?: string; + readonly keyName?: string; + readonly claimType?: string; + readonly claimValue?: string; + readonly modifiedTime?: string; + readonly createdTime?: string; + readonly revision?: number; } /** @@ -630,6 +714,20 @@ export interface SubResource extends BaseResource { } +/** + * @class + * Initializes a new instance of the OperationListResult class. + * @constructor + * Result of the request to list NotificationHubs operations. It contains a + * list of operations and a URL link to get the next set of results. + * + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ +export interface OperationListResult extends Array { + readonly nextLink?: string; +} + /** * @class * Initializes a new instance of the NamespaceListResult class. diff --git a/lib/services/notificationHubsManagement/lib/models/index.js b/lib/services/notificationHubsManagement/lib/models/index.js index b3a63f3a8c..bfb01344dc 100644 --- a/lib/services/notificationHubsManagement/lib/models/index.js +++ b/lib/services/notificationHubsManagement/lib/models/index.js @@ -18,8 +18,9 @@ var msRestAzure = require('ms-rest-azure'); exports.BaseResource = msRestAzure.BaseResource; exports.CloudError = msRestAzure.CloudError; -exports.CheckNameAvailabilityRequestParameters = require('./checkNameAvailabilityRequestParameters'); -exports.CheckNameAvailabilityResponse = require('./checkNameAvailabilityResponse'); +exports.OperationDisplay = require('./operationDisplay'); +exports.Operation = require('./operation'); +exports.ErrorResponse = require('./errorResponse'); exports.Sku = require('./sku'); exports.CheckAvailabilityParameters = require('./checkAvailabilityParameters'); exports.Resource = require('./resource'); @@ -42,6 +43,7 @@ exports.NotificationHubCreateOrUpdateParameters = require('./notificationHubCrea exports.NotificationHubResource = require('./notificationHubResource'); exports.PnsCredentialsResource = require('./pnsCredentialsResource'); exports.SubResource = require('./subResource'); +exports.OperationListResult = require('./operationListResult'); exports.NamespaceListResult = require('./namespaceListResult'); exports.SharedAccessAuthorizationRuleListResult = require('./sharedAccessAuthorizationRuleListResult'); exports.NotificationHubListResult = require('./notificationHubListResult'); diff --git a/lib/services/notificationHubsManagement/lib/models/namespaceCreateOrUpdateParameters.js b/lib/services/notificationHubsManagement/lib/models/namespaceCreateOrUpdateParameters.js index b1b96944c0..e3cebb70cf 100644 --- a/lib/services/notificationHubsManagement/lib/models/namespaceCreateOrUpdateParameters.js +++ b/lib/services/notificationHubsManagement/lib/models/namespaceCreateOrUpdateParameters.js @@ -28,9 +28,11 @@ class NamespaceCreateOrUpdateParameters extends models['Resource'] { * Australia EastAustralia SoutheastCentral USEast USEast US 2West USNorth * Central USSouth Central USEast AsiaSoutheast AsiaBrazil SouthJapan * EastJapan WestNorth EuropeWest Europe + * @member {string} [metricId] Identifier for Azure Insights metrics * @member {string} [status] Status of the namespace. It can be any of these * values:1 = Created/Active2 = Creating3 = Suspended4 = Deleting * @member {date} [createdAt] The time the namespace was created. + * @member {date} [updatedAt] The time the namespace was updated. * @member {string} [serviceBusEndpoint] Endpoint you can use to perform * NotificationHub operations. * @member {string} [subscriptionId] The Id of the Azure subscription @@ -40,6 +42,7 @@ class NamespaceCreateOrUpdateParameters extends models['Resource'] { * enabled. * @member {boolean} [critical] Whether or not the namespace is set as * Critical. + * @member {string} [dataCenter] Data center for the namespace * @member {string} [namespaceType] The namespace type. Possible values * include: 'Messaging', 'NotificationHub' */ @@ -86,7 +89,7 @@ class NamespaceCreateOrUpdateParameters extends models['Resource'] { } }, location: { - required: true, + required: false, serializedName: 'location', type: { name: 'String' @@ -135,6 +138,14 @@ class NamespaceCreateOrUpdateParameters extends models['Resource'] { name: 'String' } }, + metricId: { + required: false, + readOnly: true, + serializedName: 'properties.metricId', + type: { + name: 'String' + } + }, status: { required: false, serializedName: 'properties.status', @@ -149,6 +160,13 @@ class NamespaceCreateOrUpdateParameters extends models['Resource'] { name: 'DateTime' } }, + updatedAt: { + required: false, + serializedName: 'properties.updatedAt', + type: { + name: 'DateTime' + } + }, serviceBusEndpoint: { required: false, serializedName: 'properties.serviceBusEndpoint', @@ -184,6 +202,13 @@ class NamespaceCreateOrUpdateParameters extends models['Resource'] { name: 'Boolean' } }, + dataCenter: { + required: false, + serializedName: 'properties.dataCenter', + type: { + name: 'String' + } + }, namespaceType: { required: false, serializedName: 'properties.namespaceType', diff --git a/lib/services/notificationHubsManagement/lib/models/namespaceResource.js b/lib/services/notificationHubsManagement/lib/models/namespaceResource.js index 1c4bd811f4..47c65bc993 100644 --- a/lib/services/notificationHubsManagement/lib/models/namespaceResource.js +++ b/lib/services/notificationHubsManagement/lib/models/namespaceResource.js @@ -27,9 +27,11 @@ class NamespaceResource extends models['Resource'] { * Australia EastAustralia SoutheastCentral USEast USEast US 2West USNorth * Central USSouth Central USEast AsiaSoutheast AsiaBrazil SouthJapan * EastJapan WestNorth EuropeWest Europe + * @member {string} [metricId] Identifier for Azure Insights metrics * @member {string} [status] Status of the namespace. It can be any of these * values:1 = Created/Active2 = Creating3 = Suspended4 = Deleting * @member {date} [createdAt] The time the namespace was created. + * @member {date} [updatedAt] The time the namespace was updated. * @member {string} [serviceBusEndpoint] Endpoint you can use to perform * NotificationHub operations. * @member {string} [subscriptionId] The Id of the Azure subscription @@ -39,6 +41,7 @@ class NamespaceResource extends models['Resource'] { * enabled. * @member {boolean} [critical] Whether or not the namespace is set as * Critical. + * @member {string} [dataCenter] Data center for the namespace * @member {string} [namespaceType] The namespace type. Possible values * include: 'Messaging', 'NotificationHub' */ @@ -85,7 +88,7 @@ class NamespaceResource extends models['Resource'] { } }, location: { - required: true, + required: false, serializedName: 'location', type: { name: 'String' @@ -134,6 +137,14 @@ class NamespaceResource extends models['Resource'] { name: 'String' } }, + metricId: { + required: false, + readOnly: true, + serializedName: 'properties.metricId', + type: { + name: 'String' + } + }, status: { required: false, serializedName: 'properties.status', @@ -148,6 +159,13 @@ class NamespaceResource extends models['Resource'] { name: 'DateTime' } }, + updatedAt: { + required: false, + serializedName: 'properties.updatedAt', + type: { + name: 'DateTime' + } + }, serviceBusEndpoint: { required: false, serializedName: 'properties.serviceBusEndpoint', @@ -183,6 +201,13 @@ class NamespaceResource extends models['Resource'] { name: 'Boolean' } }, + dataCenter: { + required: false, + serializedName: 'properties.dataCenter', + type: { + name: 'String' + } + }, namespaceType: { required: false, serializedName: 'properties.namespaceType', diff --git a/lib/services/notificationHubsManagement/lib/models/notificationHubCreateOrUpdateParameters.js b/lib/services/notificationHubsManagement/lib/models/notificationHubCreateOrUpdateParameters.js index ea7693c741..fee4097382 100644 --- a/lib/services/notificationHubsManagement/lib/models/notificationHubCreateOrUpdateParameters.js +++ b/lib/services/notificationHubsManagement/lib/models/notificationHubCreateOrUpdateParameters.js @@ -116,7 +116,7 @@ class NotificationHubCreateOrUpdateParameters extends models['Resource'] { } }, location: { - required: true, + required: false, serializedName: 'location', type: { name: 'String' diff --git a/lib/services/notificationHubsManagement/lib/models/notificationHubResource.js b/lib/services/notificationHubsManagement/lib/models/notificationHubResource.js index 036e5e1f37..d7f5c1885b 100644 --- a/lib/services/notificationHubsManagement/lib/models/notificationHubResource.js +++ b/lib/services/notificationHubsManagement/lib/models/notificationHubResource.js @@ -115,7 +115,7 @@ class NotificationHubResource extends models['Resource'] { } }, location: { - required: true, + required: false, serializedName: 'location', type: { name: 'String' diff --git a/lib/services/notificationHubsManagement/lib/models/operation.js b/lib/services/notificationHubsManagement/lib/models/operation.js new file mode 100644 index 0000000000..580bbb9070 --- /dev/null +++ b/lib/services/notificationHubsManagement/lib/models/operation.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A NotificationHubs REST API operation + * + */ +class Operation { + /** + * Create a Operation. + * @member {string} [name] Operation name: {provider}/{resource}/{operation} + * @member {object} [display] The object that represents the operation. + * @member {string} [display.provider] Service provider: + * Microsoft.NotificationHubs + * @member {string} [display.resource] Resource on which the operation is + * performed: Invoice, etc. + * @member {string} [display.operation] Operation type: Read, write, delete, + * etc. + */ + constructor() { + } + + /** + * Defines the metadata of Operation + * + * @returns {object} metadata of Operation + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation', + type: { + name: 'Composite', + className: 'Operation', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + serializedName: 'display', + type: { + name: 'Composite', + className: 'OperationDisplay' + } + } + } + } + }; + } +} + +module.exports = Operation; diff --git a/lib/services/notificationHubsManagement/lib/models/operationDisplay.js b/lib/services/notificationHubsManagement/lib/models/operationDisplay.js new file mode 100644 index 0000000000..df52b8662d --- /dev/null +++ b/lib/services/notificationHubsManagement/lib/models/operationDisplay.js @@ -0,0 +1,72 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The object that represents the operation. + * + */ +class OperationDisplay { + /** + * Create a OperationDisplay. + * @member {string} [provider] Service provider: Microsoft.NotificationHubs + * @member {string} [resource] Resource on which the operation is performed: + * Invoice, etc. + * @member {string} [operation] Operation type: Read, write, delete, etc. + */ + constructor() { + } + + /** + * Defines the metadata of OperationDisplay + * + * @returns {object} metadata of OperationDisplay + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation_display', + type: { + name: 'Composite', + className: 'OperationDisplay', + modelProperties: { + provider: { + required: false, + readOnly: true, + serializedName: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + readOnly: true, + serializedName: 'resource', + type: { + name: 'String' + } + }, + operation: { + required: false, + readOnly: true, + serializedName: 'operation', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationDisplay; diff --git a/lib/services/notificationHubsManagement/lib/models/operationListResult.js b/lib/services/notificationHubsManagement/lib/models/operationListResult.js new file mode 100644 index 0000000000..0339d6054e --- /dev/null +++ b/lib/services/notificationHubsManagement/lib/models/operationListResult.js @@ -0,0 +1,71 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Result of the request to list NotificationHubs operations. It contains a + * list of operations and a URL link to get the next set of results. + */ +class OperationListResult extends Array { + /** + * Create a OperationListResult. + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of OperationListResult + * + * @returns {object} metadata of OperationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationListResult', + type: { + name: 'Composite', + className: 'OperationListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationElementType', + type: { + name: 'Composite', + className: 'Operation' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationListResult; diff --git a/lib/services/notificationHubsManagement/lib/models/pnsCredentialsResource.js b/lib/services/notificationHubsManagement/lib/models/pnsCredentialsResource.js index 95e9e3d445..23dd757f44 100644 --- a/lib/services/notificationHubsManagement/lib/models/pnsCredentialsResource.js +++ b/lib/services/notificationHubsManagement/lib/models/pnsCredentialsResource.js @@ -110,7 +110,7 @@ class PnsCredentialsResource extends models['Resource'] { } }, location: { - required: true, + required: false, serializedName: 'location', type: { name: 'String' diff --git a/lib/services/notificationHubsManagement/lib/models/resource.js b/lib/services/notificationHubsManagement/lib/models/resource.js index 0cec78de51..3b09c4a2fc 100644 --- a/lib/services/notificationHubsManagement/lib/models/resource.js +++ b/lib/services/notificationHubsManagement/lib/models/resource.js @@ -22,7 +22,7 @@ class Resource extends models['BaseResource'] { * @member {string} [id] Resource Id * @member {string} [name] Resource name * @member {string} [type] Resource type - * @member {string} location Resource location + * @member {string} [location] Resource location * @member {object} [tags] Resource tags * @member {object} [sku] The sku of the created namespace * @member {string} [sku.name] Name of the notification hub sku. Possible @@ -75,7 +75,7 @@ class Resource extends models['BaseResource'] { } }, location: { - required: true, + required: false, serializedName: 'location', type: { name: 'String' diff --git a/lib/services/notificationHubsManagement/lib/models/sharedAccessAuthorizationRuleCreateOrUpdateParameters.js b/lib/services/notificationHubsManagement/lib/models/sharedAccessAuthorizationRuleCreateOrUpdateParameters.js index 341b5b99eb..7707928a67 100644 --- a/lib/services/notificationHubsManagement/lib/models/sharedAccessAuthorizationRuleCreateOrUpdateParameters.js +++ b/lib/services/notificationHubsManagement/lib/models/sharedAccessAuthorizationRuleCreateOrUpdateParameters.js @@ -15,17 +15,29 @@ const models = require('./index'); /** * Parameters supplied to the CreateOrUpdate Namespace AuthorizationRules. * - * @extends models['Resource'] */ -class SharedAccessAuthorizationRuleCreateOrUpdateParameters extends models['Resource'] { +class SharedAccessAuthorizationRuleCreateOrUpdateParameters { /** * Create a SharedAccessAuthorizationRuleCreateOrUpdateParameters. * @member {object} properties Properties of the Namespace * AuthorizationRules. * @member {array} [properties.rights] The rights associated with the rule. + * @member {string} [properties.primaryKey] A base64-encoded 256-bit primary + * key for signing and validating the SAS token. + * @member {string} [properties.secondaryKey] A base64-encoded 256-bit + * primary key for signing and validating the SAS token. + * @member {string} [properties.keyName] A string that describes the + * authorization rule. + * @member {string} [properties.claimType] A string that describes the claim + * type + * @member {string} [properties.claimValue] A string that describes the claim + * value + * @member {string} [properties.modifiedTime] The last modified time for this + * rule + * @member {string} [properties.createdTime] The created time for this rule + * @member {number} [properties.revision] The revision number for the rule */ constructor() { - super(); } /** @@ -42,59 +54,6 @@ class SharedAccessAuthorizationRuleCreateOrUpdateParameters extends models['Reso name: 'Composite', className: 'SharedAccessAuthorizationRuleCreateOrUpdateParameters', modelProperties: { - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - type: { - required: false, - readOnly: true, - serializedName: 'type', - type: { - name: 'String' - } - }, - location: { - required: true, - serializedName: 'location', - type: { - name: 'String' - } - }, - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - sku: { - required: false, - serializedName: 'sku', - type: { - name: 'Composite', - className: 'Sku' - } - }, properties: { required: true, serializedName: 'properties', diff --git a/lib/services/notificationHubsManagement/lib/models/sharedAccessAuthorizationRuleProperties.js b/lib/services/notificationHubsManagement/lib/models/sharedAccessAuthorizationRuleProperties.js index aef59caec7..a250cc060e 100644 --- a/lib/services/notificationHubsManagement/lib/models/sharedAccessAuthorizationRuleProperties.js +++ b/lib/services/notificationHubsManagement/lib/models/sharedAccessAuthorizationRuleProperties.js @@ -18,6 +18,16 @@ class SharedAccessAuthorizationRuleProperties { /** * Create a SharedAccessAuthorizationRuleProperties. * @member {array} [rights] The rights associated with the rule. + * @member {string} [primaryKey] A base64-encoded 256-bit primary key for + * signing and validating the SAS token. + * @member {string} [secondaryKey] A base64-encoded 256-bit primary key for + * signing and validating the SAS token. + * @member {string} [keyName] A string that describes the authorization rule. + * @member {string} [claimType] A string that describes the claim type + * @member {string} [claimValue] A string that describes the claim value + * @member {string} [modifiedTime] The last modified time for this rule + * @member {string} [createdTime] The created time for this rule + * @member {number} [revision] The revision number for the rule */ constructor() { } @@ -50,6 +60,70 @@ class SharedAccessAuthorizationRuleProperties { } } } + }, + primaryKey: { + required: false, + readOnly: true, + serializedName: 'primaryKey', + type: { + name: 'String' + } + }, + secondaryKey: { + required: false, + readOnly: true, + serializedName: 'secondaryKey', + type: { + name: 'String' + } + }, + keyName: { + required: false, + readOnly: true, + serializedName: 'keyName', + type: { + name: 'String' + } + }, + claimType: { + required: false, + readOnly: true, + serializedName: 'claimType', + type: { + name: 'String' + } + }, + claimValue: { + required: false, + readOnly: true, + serializedName: 'claimValue', + type: { + name: 'String' + } + }, + modifiedTime: { + required: false, + readOnly: true, + serializedName: 'modifiedTime', + type: { + name: 'String' + } + }, + createdTime: { + required: false, + readOnly: true, + serializedName: 'createdTime', + type: { + name: 'String' + } + }, + revision: { + required: false, + readOnly: true, + serializedName: 'revision', + type: { + name: 'Number' + } } } } diff --git a/lib/services/notificationHubsManagement/lib/models/sharedAccessAuthorizationRuleResource.js b/lib/services/notificationHubsManagement/lib/models/sharedAccessAuthorizationRuleResource.js index 5826f5886c..5b9f076d19 100644 --- a/lib/services/notificationHubsManagement/lib/models/sharedAccessAuthorizationRuleResource.js +++ b/lib/services/notificationHubsManagement/lib/models/sharedAccessAuthorizationRuleResource.js @@ -21,6 +21,16 @@ class SharedAccessAuthorizationRuleResource extends models['Resource'] { /** * Create a SharedAccessAuthorizationRuleResource. * @member {array} [rights] The rights associated with the rule. + * @member {string} [primaryKey] A base64-encoded 256-bit primary key for + * signing and validating the SAS token. + * @member {string} [secondaryKey] A base64-encoded 256-bit primary key for + * signing and validating the SAS token. + * @member {string} [keyName] A string that describes the authorization rule. + * @member {string} [claimType] A string that describes the claim type + * @member {string} [claimValue] A string that describes the claim value + * @member {string} [modifiedTime] The last modified time for this rule + * @member {string} [createdTime] The created time for this rule + * @member {number} [revision] The revision number for the rule */ constructor() { super(); @@ -65,7 +75,7 @@ class SharedAccessAuthorizationRuleResource extends models['Resource'] { } }, location: { - required: true, + required: false, serializedName: 'location', type: { name: 'String' @@ -107,6 +117,70 @@ class SharedAccessAuthorizationRuleResource extends models['Resource'] { } } } + }, + primaryKey: { + required: false, + readOnly: true, + serializedName: 'properties.primaryKey', + type: { + name: 'String' + } + }, + secondaryKey: { + required: false, + readOnly: true, + serializedName: 'properties.secondaryKey', + type: { + name: 'String' + } + }, + keyName: { + required: false, + readOnly: true, + serializedName: 'properties.keyName', + type: { + name: 'String' + } + }, + claimType: { + required: false, + readOnly: true, + serializedName: 'properties.claimType', + type: { + name: 'String' + } + }, + claimValue: { + required: false, + readOnly: true, + serializedName: 'properties.claimValue', + type: { + name: 'String' + } + }, + modifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.modifiedTime', + type: { + name: 'String' + } + }, + createdTime: { + required: false, + readOnly: true, + serializedName: 'properties.createdTime', + type: { + name: 'String' + } + }, + revision: { + required: false, + readOnly: true, + serializedName: 'properties.revision', + type: { + name: 'Number' + } } } } diff --git a/lib/services/notificationHubsManagement/lib/notificationHubsManagementClient.d.ts b/lib/services/notificationHubsManagement/lib/notificationHubsManagementClient.d.ts index 546a0857b9..9df705c5e9 100644 --- a/lib/services/notificationHubsManagement/lib/notificationHubsManagementClient.d.ts +++ b/lib/services/notificationHubsManagement/lib/notificationHubsManagementClient.d.ts @@ -10,9 +10,10 @@ import { ServiceClientCredentials } from 'ms-rest'; import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; import * as operations from "./operations"; -declare class NotificationHubsManagementClient extends AzureServiceClient { +export default class NotificationHubsManagementClient extends AzureServiceClient { /** * Initializes a new instance of the NotificationHubsManagementClient class. * @constructor @@ -55,10 +56,9 @@ declare class NotificationHubsManagementClient extends AzureServiceClient { generateClientRequestId: boolean; // Operation groups + operations: operations.Operations; namespaces: operations.Namespaces; - name: operations.Name; notificationHubs: operations.NotificationHubs; - hubs: operations.Hubs; } -export = NotificationHubsManagementClient; +export { NotificationHubsManagementClient, models as NotificationHubsManagementModels }; diff --git a/lib/services/notificationHubsManagement/lib/notificationHubsManagementClient.js b/lib/services/notificationHubsManagement/lib/notificationHubsManagementClient.js index e583acd842..990c3b9431 100644 --- a/lib/services/notificationHubsManagement/lib/notificationHubsManagementClient.js +++ b/lib/services/notificationHubsManagement/lib/notificationHubsManagementClient.js @@ -72,10 +72,9 @@ class NotificationHubsManagementClient extends ServiceClient { if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { this.generateClientRequestId = options.generateClientRequestId; } + this.operations = new operations.Operations(this); this.namespaces = new operations.Namespaces(this); - this.name = new operations.Name(this); this.notificationHubs = new operations.NotificationHubs(this); - this.hubs = new operations.Hubs(this); this.models = models; msRest.addSerializationMixin(this); } @@ -83,3 +82,6 @@ class NotificationHubsManagementClient extends ServiceClient { } module.exports = NotificationHubsManagementClient; +module.exports['default'] = NotificationHubsManagementClient; +module.exports.NotificationHubsManagementClient = NotificationHubsManagementClient; +module.exports.NotificationHubsManagementModels = models; diff --git a/lib/services/notificationHubsManagement/lib/operations/index.d.ts b/lib/services/notificationHubsManagement/lib/operations/index.d.ts index 576d658926..b64e70ba52 100644 --- a/lib/services/notificationHubsManagement/lib/operations/index.d.ts +++ b/lib/services/notificationHubsManagement/lib/operations/index.d.ts @@ -12,6 +12,123 @@ import { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationRes import * as models from '../models'; +/** + * @class + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the NotificationHubsManagementClient. + */ +export interface Operations { + + + /** + * Lists all of the available NotificationHubs REST API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the available NotificationHubs REST API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all of the available NotificationHubs REST API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the available NotificationHubs REST API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + /** * @class * Namespaces @@ -153,6 +270,8 @@ export interface Namespaces { * * @param {date} [parameters.createdAt] The time the namespace was created. * + * @param {date} [parameters.updatedAt] The time the namespace was updated. + * * @param {string} [parameters.serviceBusEndpoint] Endpoint you can use to * perform NotificationHub operations. * @@ -168,10 +287,12 @@ export interface Namespaces { * @param {boolean} [parameters.critical] Whether or not the namespace is set * as Critical. * + * @param {string} [parameters.dataCenter] Data center for the namespace + * * @param {string} [parameters.namespaceType] The namespace type. Possible * values include: 'Messaging', 'NotificationHub' * - * @param {string} parameters.location Resource location + * @param {string} [parameters.location] Resource location * * @param {object} [parameters.tags] Resource tags * @@ -229,6 +350,8 @@ export interface Namespaces { * * @param {date} [parameters.createdAt] The time the namespace was created. * + * @param {date} [parameters.updatedAt] The time the namespace was updated. + * * @param {string} [parameters.serviceBusEndpoint] Endpoint you can use to * perform NotificationHub operations. * @@ -244,10 +367,12 @@ export interface Namespaces { * @param {boolean} [parameters.critical] Whether or not the namespace is set * as Critical. * + * @param {string} [parameters.dataCenter] Data center for the namespace + * * @param {string} [parameters.namespaceType] The namespace type. Possible * values include: 'Messaging', 'NotificationHub' * - * @param {string} parameters.location Resource location + * @param {string} [parameters.location] Resource location * * @param {object} [parameters.tags] Resource tags * @@ -527,23 +652,6 @@ export interface Namespaces { * @param {array} [parameters.properties.rights] The rights associated with the * rule. * - * @param {string} parameters.location Resource location - * - * @param {object} [parameters.tags] Resource tags - * - * @param {object} [parameters.sku] The sku of the created namespace - * - * @param {string} parameters.sku.name Name of the notification hub sku. - * Possible values include: 'Free', 'Basic', 'Standard' - * - * @param {string} [parameters.sku.tier] The tier of particular sku - * - * @param {string} [parameters.sku.size] The Sku size - * - * @param {string} [parameters.sku.family] The Sku Family - * - * @param {number} [parameters.sku.capacity] The capacity of the resource - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -574,23 +682,6 @@ export interface Namespaces { * @param {array} [parameters.properties.rights] The rights associated with the * rule. * - * @param {string} parameters.location Resource location - * - * @param {object} [parameters.tags] Resource tags - * - * @param {object} [parameters.sku] The sku of the created namespace - * - * @param {string} parameters.sku.name Name of the notification hub sku. - * Possible values include: 'Free', 'Basic', 'Standard' - * - * @param {string} [parameters.sku.tier] The tier of particular sku - * - * @param {string} [parameters.sku.size] The Sku size - * - * @param {string} [parameters.sku.family] The Sku Family - * - * @param {number} [parameters.sku.capacity] The capacity of the resource - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -939,11 +1030,11 @@ export interface Namespaces { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listKeysWithHttpOperationResponse(resourceGroupName: string, namespaceName: string, authorizationRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listKeysWithHttpOperationResponse(resourceGroupName: string, namespaceName: string, authorizationRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets the Primary and Secondary ConnectionStrings to the namespace @@ -967,7 +1058,7 @@ export interface Namespaces { * * {Promise} A promise is returned. * - * @resolve {ResourceListKeys} - The deserialized result object. + * @resolve {SharedAccessAuthorizationRuleListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -975,16 +1066,17 @@ export interface Namespaces { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ResourceListKeys} [result] - The deserialized result object if an error did not occur. - * See {@link ResourceListKeys} for more information. + * {SharedAccessAuthorizationRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SharedAccessAuthorizationRuleListResult} 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. */ - listKeys(resourceGroupName: string, namespaceName: string, authorizationRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listKeys(resourceGroupName: string, namespaceName: string, authorizationRuleName: string, callback: ServiceCallback): void; - listKeys(resourceGroupName: string, namespaceName: string, authorizationRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listKeys(resourceGroupName: string, namespaceName: string, authorizationRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listKeys(resourceGroupName: string, namespaceName: string, authorizationRuleName: string, callback: ServiceCallback): void; + listKeys(resourceGroupName: string, namespaceName: string, authorizationRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1300,79 +1392,6 @@ export interface Namespaces { listAuthorizationRulesNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } -/** - * @class - * Name - * __NOTE__: An instance of this class is automatically created for an - * instance of the NotificationHubsManagementClient. - */ -export interface Name { - - - /** - * Checks the availability of the given service namespace across all Azure - * subscriptions. This is useful because the domain name is created based on - * the service namespace name. - * - * @param {object} parameters The namespace name. - * - * @param {string} parameters.name Resource 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. - */ - checkAvailabilityWithHttpOperationResponse(parameters: models.CheckNameAvailabilityRequestParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Checks the availability of the given service namespace across all Azure - * subscriptions. This is useful because the domain name is created based on - * the service namespace name. - * - * @param {object} parameters The namespace name. - * - * @param {string} parameters.name Resource 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 {CheckNameAvailabilityResponse} - 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. - * - * {CheckNameAvailabilityResponse} [result] - The deserialized result object if an error did not occur. - * See {@link CheckNameAvailabilityResponse} 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. - */ - checkAvailability(parameters: models.CheckNameAvailabilityRequestParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - checkAvailability(parameters: models.CheckNameAvailabilityRequestParameters, callback: ServiceCallback): void; - checkAvailability(parameters: models.CheckNameAvailabilityRequestParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - /** * @class * NotificationHubs @@ -1424,7 +1443,7 @@ export interface NotificationHubs { * * @reject {Error|ServiceError} - The error object. */ - checkAvailabilityWithHttpOperationResponse(resourceGroupName: string, namespaceName: string, parameters: models.CheckAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + checkNotificationHubAvailabilityWithHttpOperationResponse(resourceGroupName: string, namespaceName: string, parameters: models.CheckAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Checks the availability of the given notificationHub in a namespace. @@ -1485,9 +1504,9 @@ export interface NotificationHubs { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - checkAvailability(resourceGroupName: string, namespaceName: string, parameters: models.CheckAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - checkAvailability(resourceGroupName: string, namespaceName: string, parameters: models.CheckAvailabilityParameters, callback: ServiceCallback): void; - checkAvailability(resourceGroupName: string, namespaceName: string, parameters: models.CheckAvailabilityParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + checkNotificationHubAvailability(resourceGroupName: string, namespaceName: string, parameters: models.CheckAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkNotificationHubAvailability(resourceGroupName: string, namespaceName: string, parameters: models.CheckAvailabilityParameters, callback: ServiceCallback): void; + checkNotificationHubAvailability(resourceGroupName: string, namespaceName: string, parameters: models.CheckAvailabilityParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1589,7 +1608,7 @@ export interface NotificationHubs { * * @param {string} [parameters.baiduCredential.baiduSecretKey] Baidu Secret Key * - * @param {string} parameters.location Resource location + * @param {string} [parameters.location] Resource location * * @param {object} [parameters.tags] Resource tags * @@ -1718,7 +1737,7 @@ export interface NotificationHubs { * * @param {string} [parameters.baiduCredential.baiduSecretKey] Baidu Secret Key * - * @param {string} parameters.location Resource location + * @param {string} [parameters.location] Resource location * * @param {object} [parameters.tags] Resource tags * @@ -1913,23 +1932,6 @@ export interface NotificationHubs { * @param {array} [parameters.properties.rights] The rights associated with the * rule. * - * @param {string} parameters.location Resource location - * - * @param {object} [parameters.tags] Resource tags - * - * @param {object} [parameters.sku] The sku of the created namespace - * - * @param {string} parameters.sku.name Name of the notification hub sku. - * Possible values include: 'Free', 'Basic', 'Standard' - * - * @param {string} [parameters.sku.tier] The tier of particular sku - * - * @param {string} [parameters.sku.size] The Sku size - * - * @param {string} [parameters.sku.family] The Sku Family - * - * @param {number} [parameters.sku.capacity] The capacity of the resource - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1962,23 +1964,6 @@ export interface NotificationHubs { * @param {array} [parameters.properties.rights] The rights associated with the * rule. * - * @param {string} parameters.location Resource location - * - * @param {object} [parameters.tags] Resource tags - * - * @param {object} [parameters.sku] The sku of the created namespace - * - * @param {string} parameters.sku.name Name of the notification hub sku. - * Possible values include: 'Free', 'Basic', 'Standard' - * - * @param {string} [parameters.sku.tier] The tier of particular sku - * - * @param {string} [parameters.sku.size] The Sku size - * - * @param {string} [parameters.sku.family] The Sku Family - * - * @param {number} [parameters.sku.capacity] The capacity of the resource - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2603,80 +2588,3 @@ export interface NotificationHubs { listAuthorizationRulesNext(nextPageLink: string, callback: ServiceCallback): void; listAuthorizationRulesNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } - -/** - * @class - * Hubs - * __NOTE__: An instance of this class is automatically created for an - * instance of the NotificationHubsManagementClient. - */ -export interface Hubs { - - - /** - * Checks the availability of the given notificationHub in a namespace. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} namespaceName The namespace name. - * - * @param {object} parameters The notificationHub name. - * - * @param {string} parameters.name Resource 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. - */ - checkAvailabilityWithHttpOperationResponse(resourceGroupName: string, namespaceName: string, parameters: models.CheckNameAvailabilityRequestParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Checks the availability of the given notificationHub in a namespace. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} namespaceName The namespace name. - * - * @param {object} parameters The notificationHub name. - * - * @param {string} parameters.name Resource 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 {CheckNameAvailabilityResponse} - 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. - * - * {CheckNameAvailabilityResponse} [result] - The deserialized result object if an error did not occur. - * See {@link CheckNameAvailabilityResponse} 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. - */ - checkAvailability(resourceGroupName: string, namespaceName: string, parameters: models.CheckNameAvailabilityRequestParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - checkAvailability(resourceGroupName: string, namespaceName: string, parameters: models.CheckNameAvailabilityRequestParameters, callback: ServiceCallback): void; - checkAvailability(resourceGroupName: string, namespaceName: string, parameters: models.CheckNameAvailabilityRequestParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} diff --git a/lib/services/notificationHubsManagement/lib/operations/index.js b/lib/services/notificationHubsManagement/lib/operations/index.js index 4d829c9183..12476770b6 100644 --- a/lib/services/notificationHubsManagement/lib/operations/index.js +++ b/lib/services/notificationHubsManagement/lib/operations/index.js @@ -14,7 +14,6 @@ 'use strict'; +exports.Operations = require('./operations'); exports.Namespaces = require('./namespaces'); -exports.Name = require('./name'); exports.NotificationHubs = require('./notificationHubs'); -exports.Hubs = require('./hubs'); diff --git a/lib/services/notificationHubsManagement/lib/operations/namespaces.js b/lib/services/notificationHubsManagement/lib/operations/namespaces.js index 0b6e4b61fc..2c86313f30 100644 --- a/lib/services/notificationHubsManagement/lib/operations/namespaces.js +++ b/lib/services/notificationHubsManagement/lib/operations/namespaces.js @@ -219,6 +219,8 @@ function _checkAvailability(parameters, options, callback) { * * @param {date} [parameters.createdAt] The time the namespace was created. * + * @param {date} [parameters.updatedAt] The time the namespace was updated. + * * @param {string} [parameters.serviceBusEndpoint] Endpoint you can use to * perform NotificationHub operations. * @@ -234,10 +236,12 @@ function _checkAvailability(parameters, options, callback) { * @param {boolean} [parameters.critical] Whether or not the namespace is set * as Critical. * + * @param {string} [parameters.dataCenter] Data center for the namespace + * * @param {string} [parameters.namespaceType] The namespace type. Possible * values include: 'Messaging', 'NotificationHub' * - * @param {string} parameters.location Resource location + * @param {string} [parameters.location] Resource location * * @param {object} [parameters.tags] Resource tags * @@ -359,7 +363,7 @@ function _createOrUpdate(resourceGroupName, namespaceName, parameters, options, return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 201 && statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 201) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -388,7 +392,7 @@ function _createOrUpdate(resourceGroupName, namespaceName, parameters, options, let result = null; if (responseBody === '') responseBody = null; // Deserialize Response - if (statusCode === 201) { + if (statusCode === 200) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -405,7 +409,7 @@ function _createOrUpdate(resourceGroupName, namespaceName, parameters, options, } } // Deserialize Response - if (statusCode === 200) { + if (statusCode === 201) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -832,23 +836,6 @@ function _get(resourceGroupName, namespaceName, options, callback) { * @param {array} [parameters.properties.rights] The rights associated with the * rule. * - * @param {string} parameters.location Resource location - * - * @param {object} [parameters.tags] Resource tags - * - * @param {object} [parameters.sku] The sku of the created namespace - * - * @param {string} parameters.sku.name Name of the notification hub sku. - * Possible values include: 'Free', 'Basic', 'Standard' - * - * @param {string} [parameters.sku.tier] The tier of particular sku - * - * @param {string} [parameters.sku.size] The Sku size - * - * @param {string} [parameters.sku.family] The Sku Family - * - * @param {number} [parameters.sku.capacity] The capacity of the resource - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1109,7 +1096,7 @@ function _deleteAuthorizationRule(resourceGroupName, namespaceName, authorizatio return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 204 && statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -1737,7 +1724,8 @@ function _listAuthorizationRules(resourceGroupName, namespaceName, options, call * {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 ResourceListKeys} for more information. + * See {@link SharedAccessAuthorizationRuleListResult} for + * more information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -1852,7 +1840,7 @@ function _listKeys(resourceGroupName, namespaceName, authorizationRuleName, opti parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['ResourceListKeys']().mapper(); + let resultMapper = new client.models['SharedAccessAuthorizationRuleListResult']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -2138,7 +2126,7 @@ function _beginDeleteMethod(resourceGroupName, namespaceName, options, callback) return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 204 && statusCode !== 200 && statusCode !== 202) { + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -2740,6 +2728,8 @@ class Namespaces { * * @param {date} [parameters.createdAt] The time the namespace was created. * + * @param {date} [parameters.updatedAt] The time the namespace was updated. + * * @param {string} [parameters.serviceBusEndpoint] Endpoint you can use to * perform NotificationHub operations. * @@ -2755,10 +2745,12 @@ class Namespaces { * @param {boolean} [parameters.critical] Whether or not the namespace is set * as Critical. * + * @param {string} [parameters.dataCenter] Data center for the namespace + * * @param {string} [parameters.namespaceType] The namespace type. Possible * values include: 'Messaging', 'NotificationHub' * - * @param {string} parameters.location Resource location + * @param {string} [parameters.location] Resource location * * @param {object} [parameters.tags] Resource tags * @@ -2828,6 +2820,8 @@ class Namespaces { * * @param {date} [parameters.createdAt] The time the namespace was created. * + * @param {date} [parameters.updatedAt] The time the namespace was updated. + * * @param {string} [parameters.serviceBusEndpoint] Endpoint you can use to * perform NotificationHub operations. * @@ -2843,10 +2837,12 @@ class Namespaces { * @param {boolean} [parameters.critical] Whether or not the namespace is set * as Critical. * + * @param {string} [parameters.dataCenter] Data center for the namespace + * * @param {string} [parameters.namespaceType] The namespace type. Possible * values include: 'Messaging', 'NotificationHub' * - * @param {string} parameters.location Resource location + * @param {string} [parameters.location] Resource location * * @param {object} [parameters.tags] Resource tags * @@ -3222,23 +3218,6 @@ class Namespaces { * @param {array} [parameters.properties.rights] The rights associated with the * rule. * - * @param {string} parameters.location Resource location - * - * @param {object} [parameters.tags] Resource tags - * - * @param {object} [parameters.sku] The sku of the created namespace - * - * @param {string} parameters.sku.name Name of the notification hub sku. - * Possible values include: 'Free', 'Basic', 'Standard' - * - * @param {string} [parameters.sku.tier] The tier of particular sku - * - * @param {string} [parameters.sku.size] The Sku size - * - * @param {string} [parameters.sku.family] The Sku Family - * - * @param {number} [parameters.sku.capacity] The capacity of the resource - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3281,23 +3260,6 @@ class Namespaces { * @param {array} [parameters.properties.rights] The rights associated with the * rule. * - * @param {string} parameters.location Resource location - * - * @param {object} [parameters.tags] Resource tags - * - * @param {object} [parameters.sku] The sku of the created namespace - * - * @param {string} parameters.sku.name Name of the notification hub sku. - * Possible values include: 'Free', 'Basic', 'Standard' - * - * @param {string} [parameters.sku.tier] The tier of particular sku - * - * @param {string} [parameters.sku.size] The Sku size - * - * @param {string} [parameters.sku.family] The Sku Family - * - * @param {number} [parameters.sku.capacity] The capacity of the resource - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3796,7 +3758,7 @@ 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. */ @@ -3836,7 +3798,7 @@ class Namespaces { * * {Promise} A promise is returned * - * @resolve {ResourceListKeys} - The deserialized result object. + * @resolve {SharedAccessAuthorizationRuleListResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -3845,7 +3807,8 @@ 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 ResourceListKeys} for more information. + * See {@link SharedAccessAuthorizationRuleListResult} for + * more information. * * {object} [request] - The HTTP Request object if an error did not occur. * diff --git a/lib/services/notificationHubsManagement/lib/operations/notificationHubs.js b/lib/services/notificationHubsManagement/lib/operations/notificationHubs.js index 18045c28f4..b31f6599fe 100644 --- a/lib/services/notificationHubsManagement/lib/operations/notificationHubs.js +++ b/lib/services/notificationHubsManagement/lib/operations/notificationHubs.js @@ -64,7 +64,7 @@ const WebResource = msRest.WebResource; * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _checkAvailability(resourceGroupName, namespaceName, parameters, options, callback) { +function _checkNotificationHubAvailability(resourceGroupName, namespaceName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -300,7 +300,7 @@ function _checkAvailability(resourceGroupName, namespaceName, parameters, option * * @param {string} [parameters.baiduCredential.baiduSecretKey] Baidu Secret Key * - * @param {string} parameters.location Resource location + * @param {string} [parameters.location] Resource location * * @param {object} [parameters.tags] Resource tags * @@ -798,23 +798,6 @@ function _get(resourceGroupName, namespaceName, notificationHubName, options, ca * @param {array} [parameters.properties.rights] The rights associated with the * rule. * - * @param {string} parameters.location Resource location - * - * @param {object} [parameters.tags] Resource tags - * - * @param {object} [parameters.sku] The sku of the created namespace - * - * @param {string} parameters.sku.name Name of the notification hub sku. - * Possible values include: 'Free', 'Basic', 'Standard' - * - * @param {string} [parameters.sku.tier] The tier of particular sku - * - * @param {string} [parameters.sku.size] The Sku size - * - * @param {string} [parameters.sku.family] The Sku Family - * - * @param {number} [parameters.sku.capacity] The capacity of the resource - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1085,7 +1068,7 @@ function _deleteAuthorizationRule(resourceGroupName, namespaceName, notification return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 204 && statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -2331,7 +2314,7 @@ class NotificationHubs { */ constructor(client) { this.client = client; - this._checkAvailability = _checkAvailability; + this._checkNotificationHubAvailability = _checkNotificationHubAvailability; this._createOrUpdate = _createOrUpdate; this._deleteMethod = _deleteMethod; this._get = _get; @@ -2389,11 +2372,11 @@ class NotificationHubs { * * @reject {Error} - The error object. */ - checkAvailabilityWithHttpOperationResponse(resourceGroupName, namespaceName, parameters, options) { + checkNotificationHubAvailabilityWithHttpOperationResponse(resourceGroupName, namespaceName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._checkAvailability(resourceGroupName, namespaceName, parameters, options, (err, result, request, response) => { + self._checkNotificationHubAvailability(resourceGroupName, namespaceName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2462,7 +2445,7 @@ class NotificationHubs { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - checkAvailability(resourceGroupName, namespaceName, parameters, options, optionalCallback) { + checkNotificationHubAvailability(resourceGroupName, namespaceName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2471,14 +2454,14 @@ class NotificationHubs { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._checkAvailability(resourceGroupName, namespaceName, parameters, options, (err, result, request, response) => { + self._checkNotificationHubAvailability(resourceGroupName, namespaceName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._checkAvailability(resourceGroupName, namespaceName, parameters, options, optionalCallback); + return self._checkNotificationHubAvailability(resourceGroupName, namespaceName, parameters, options, optionalCallback); } } @@ -2581,7 +2564,7 @@ class NotificationHubs { * * @param {string} [parameters.baiduCredential.baiduSecretKey] Baidu Secret Key * - * @param {string} parameters.location Resource location + * @param {string} [parameters.location] Resource location * * @param {object} [parameters.tags] Resource tags * @@ -2722,7 +2705,7 @@ class NotificationHubs { * * @param {string} [parameters.baiduCredential.baiduSecretKey] Baidu Secret Key * - * @param {string} parameters.location Resource location + * @param {string} [parameters.location] Resource location * * @param {object} [parameters.tags] Resource tags * @@ -2986,23 +2969,6 @@ class NotificationHubs { * @param {array} [parameters.properties.rights] The rights associated with the * rule. * - * @param {string} parameters.location Resource location - * - * @param {object} [parameters.tags] Resource tags - * - * @param {object} [parameters.sku] The sku of the created namespace - * - * @param {string} parameters.sku.name Name of the notification hub sku. - * Possible values include: 'Free', 'Basic', 'Standard' - * - * @param {string} [parameters.sku.tier] The tier of particular sku - * - * @param {string} [parameters.sku.size] The Sku size - * - * @param {string} [parameters.sku.family] The Sku Family - * - * @param {number} [parameters.sku.capacity] The capacity of the resource - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3047,23 +3013,6 @@ class NotificationHubs { * @param {array} [parameters.properties.rights] The rights associated with the * rule. * - * @param {string} parameters.location Resource location - * - * @param {object} [parameters.tags] Resource tags - * - * @param {object} [parameters.sku] The sku of the created namespace - * - * @param {string} parameters.sku.name Name of the notification hub sku. - * Possible values include: 'Free', 'Basic', 'Standard' - * - * @param {string} [parameters.sku.tier] The tier of particular sku - * - * @param {string} [parameters.sku.size] The Sku size - * - * @param {string} [parameters.sku.family] The Sku Family - * - * @param {number} [parameters.sku.capacity] The capacity of the resource - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the diff --git a/lib/services/notificationHubsManagement/lib/operations/operations.js b/lib/services/notificationHubsManagement/lib/operations/operations.js new file mode 100644 index 0000000000..c55d2b457c --- /dev/null +++ b/lib/services/notificationHubsManagement/lib/operations/operations.js @@ -0,0 +1,451 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Lists all of the available NotificationHubs REST API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.NotificationHubs/operations'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all of the available NotificationHubs REST API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Operations. */ +class Operations { + /** + * Create a Operations. + * @param {NotificationHubsManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Lists all of the available NotificationHubs REST API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all of the available NotificationHubs REST API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Lists all of the available NotificationHubs REST API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all of the available NotificationHubs REST API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Operations; diff --git a/lib/services/notificationHubsManagement/package.json b/lib/services/notificationHubsManagement/package.json index f741ff4de1..0786e780b7 100644 --- a/lib/services/notificationHubsManagement/package.json +++ b/lib/services/notificationHubsManagement/package.json @@ -1,35 +1,25 @@ { "name": "azure-arm-notificationhubs", "author": "Microsoft Corporation", - "contributors": [ - "Borkar, Smitha " - ], + "description": "NotificationHubsManagementClient Library with typescript type definitions for node", "version": "1.1.0", - "description": "Microsoft Azure Notification Hubs Resource Provider Management Client Library for Node", - "tags": [ - "azure", - "sdk" - ], + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, "keywords": [ "node", "azure" ], + "license": "MIT", "main": "./lib/notificationHubsManagementClient.js", "types": "./lib/notificationHubsManagementClient.d.ts", - "license": "MIT", - "dependencies": { - "ms-rest": "^2.2.2", - "ms-rest-azure": "^2.3.3" - }, - "homepage": "http://github.com/Azure/azure-sdk-for-node", + "homepage": "http://github.com/azure/azure-sdk-for-node", "repository": { "type": "git", - "url": "git@github.com:Azure/azure-sdk-for-node.git" + "url": "https://github.com/azure/azure-sdk-for-node.git" }, "bugs": { "url": "http://github.com/Azure/azure-sdk-for-node/issues" - }, - "scripts": { - "test": "npm -s run-script jshint" } -} \ No newline at end of file +}