diff --git a/lib/services/eventgridManagement/README.md b/lib/services/eventgridManagement/README.md index 634dae5877..73fe7ec966 100644 --- a/lib/services/eventgridManagement/README.md +++ b/lib/services/eventgridManagement/README.md @@ -18,7 +18,7 @@ npm install azure-arm-eventgrid ## How to use -### Authentication, client creation and get eventSubscriptions as an example. +### Authentication, client creation and get domains as an example. ```javascript const msRestAzure = require("ms-rest-azure"); @@ -26,9 +26,9 @@ const EventGridManagementClient = require("azure-arm-eventgrid"); msRestAzure.interactiveLogin().then((creds) => { const subscriptionId = ""; const client = new EventGridManagementClient(creds, subscriptionId); - const scope = "testscope"; - const eventSubscriptionName = "testeventSubscriptionName"; - return client.eventSubscriptions.get(scope, eventSubscriptionName).then((result) => { + const resourceGroupName = "testresourceGroupName"; + const domainName = "testdomainName"; + return client.domains.get(resourceGroupName, domainName).then((result) => { console.log("The result is:"); console.log(result); }); diff --git a/lib/services/eventgridManagement/lib/eventGridManagementClient.d.ts b/lib/services/eventgridManagement/lib/eventGridManagementClient.d.ts index 03519d10f0..49705230e9 100644 --- a/lib/services/eventgridManagement/lib/eventGridManagementClient.d.ts +++ b/lib/services/eventgridManagement/lib/eventGridManagementClient.d.ts @@ -56,6 +56,8 @@ export default class EventGridManagementClient extends AzureServiceClient { generateClientRequestId: boolean; // Operation groups + domains: operations.Domains; + domainTopics: operations.DomainTopics; eventSubscriptions: operations.EventSubscriptions; operations: operations.Operations; topics: operations.Topics; diff --git a/lib/services/eventgridManagement/lib/eventGridManagementClient.js b/lib/services/eventgridManagement/lib/eventGridManagementClient.js index 0b4ca2dd9a..6e01befdac 100644 --- a/lib/services/eventgridManagement/lib/eventGridManagementClient.js +++ b/lib/services/eventgridManagement/lib/eventGridManagementClient.js @@ -50,7 +50,7 @@ class EventGridManagementClient extends ServiceClient { super(credentials, options); - this.apiVersion = '2018-05-01-preview'; + this.apiVersion = '2018-09-15-preview'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; @@ -72,6 +72,8 @@ class EventGridManagementClient extends ServiceClient { if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { this.generateClientRequestId = options.generateClientRequestId; } + this.domains = new operations.Domains(this); + this.domainTopics = new operations.DomainTopics(this); this.eventSubscriptions = new operations.EventSubscriptions(this); this.operations = new operations.Operations(this); this.topics = new operations.Topics(this); diff --git a/lib/services/eventgridManagement/lib/models/advancedFilter.js b/lib/services/eventgridManagement/lib/models/advancedFilter.js new file mode 100644 index 0000000000..26b3959da0 --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/advancedFilter.js @@ -0,0 +1,68 @@ +/* + * 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'; + +/** + * Represents an advanced filter that can be used to filter events based on + * various event envelope/data fields. + * + */ +class AdvancedFilter { + /** + * Create a AdvancedFilter. + * @member {string} [key] The filter key. Represents an event property with + * upto two levels of nesting. + * @member {string} operatorType Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of AdvancedFilter + * + * @returns {object} metadata of AdvancedFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'AdvancedFilter', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'operatorType', + clientName: 'operatorType' + }, + uberParent: 'AdvancedFilter', + className: 'AdvancedFilter', + modelProperties: { + key: { + required: false, + serializedName: 'key', + type: { + name: 'String' + } + }, + operatorType: { + required: true, + serializedName: 'operatorType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AdvancedFilter; diff --git a/lib/services/eventgridManagement/lib/models/boolEqualsAdvancedFilter.js b/lib/services/eventgridManagement/lib/models/boolEqualsAdvancedFilter.js new file mode 100644 index 0000000000..09675d2caa --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/boolEqualsAdvancedFilter.js @@ -0,0 +1,76 @@ +/* + * 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'); + +/** + * BoolEquals Filter + * + * @extends models['AdvancedFilter'] + */ +class BoolEqualsAdvancedFilter extends models['AdvancedFilter'] { + /** + * Create a BoolEqualsAdvancedFilter. + * @member {boolean} [value] The filter value + */ + constructor() { + super(); + } + + /** + * Defines the metadata of BoolEqualsAdvancedFilter + * + * @returns {object} metadata of BoolEqualsAdvancedFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'BoolEquals', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'operatorType', + clientName: 'operatorType' + }, + uberParent: 'AdvancedFilter', + className: 'BoolEqualsAdvancedFilter', + modelProperties: { + key: { + required: false, + serializedName: 'key', + type: { + name: 'String' + } + }, + operatorType: { + required: true, + serializedName: 'operatorType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + value: { + required: false, + serializedName: 'value', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = BoolEqualsAdvancedFilter; diff --git a/lib/services/eventgridManagement/lib/models/domain.js b/lib/services/eventgridManagement/lib/models/domain.js new file mode 100644 index 0000000000..5b0c27960c --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/domain.js @@ -0,0 +1,140 @@ +/* + * 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'); + +/** + * EventGrid Domain + * + * @extends models['TrackedResource'] + */ +class Domain extends models['TrackedResource'] { + /** + * Create a Domain. + * @member {string} [provisioningState] Provisioning state of the domain. + * Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + * 'Canceled', 'Failed' + * @member {string} [endpoint] Endpoint for the domain. + * @member {string} [inputSchema] This determines the format that Event Grid + * should expect for incoming events published to the domain. Possible values + * include: 'EventGridSchema', 'CustomEventSchema', 'CloudEventV01Schema' + * @member {object} [inputSchemaMapping] Information about the + * InputSchemaMapping which specified the info about mapping event payload. + * @member {string} [inputSchemaMapping.inputSchemaMappingType] Polymorphic + * Discriminator + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Domain + * + * @returns {object} metadata of Domain + * + */ + mapper() { + return { + required: false, + serializedName: 'Domain', + type: { + name: 'Composite', + className: 'Domain', + 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' + } + } + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + endpoint: { + required: false, + readOnly: true, + serializedName: 'properties.endpoint', + type: { + name: 'String' + } + }, + inputSchema: { + required: false, + serializedName: 'properties.inputSchema', + type: { + name: 'String' + } + }, + inputSchemaMapping: { + required: false, + serializedName: 'properties.inputSchemaMapping', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'inputSchemaMappingType', + clientName: 'inputSchemaMappingType' + }, + uberParent: 'InputSchemaMapping', + className: 'InputSchemaMapping' + } + } + } + } + }; + } +} + +module.exports = Domain; diff --git a/lib/services/eventgridManagement/lib/models/domainRegenerateKeyRequest.js b/lib/services/eventgridManagement/lib/models/domainRegenerateKeyRequest.js new file mode 100644 index 0000000000..12c49d8951 --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/domainRegenerateKeyRequest.js @@ -0,0 +1,52 @@ +/* + * 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'; + +/** + * Domain regenerate share access key request + * + */ +class DomainRegenerateKeyRequest { + /** + * Create a DomainRegenerateKeyRequest. + * @member {string} keyName Key name to regenerate key1 or key2 + */ + constructor() { + } + + /** + * Defines the metadata of DomainRegenerateKeyRequest + * + * @returns {object} metadata of DomainRegenerateKeyRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'DomainRegenerateKeyRequest', + type: { + name: 'Composite', + className: 'DomainRegenerateKeyRequest', + modelProperties: { + keyName: { + required: true, + serializedName: 'keyName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DomainRegenerateKeyRequest; diff --git a/lib/services/eventgridManagement/lib/models/domainSharedAccessKeys.js b/lib/services/eventgridManagement/lib/models/domainSharedAccessKeys.js new file mode 100644 index 0000000000..317b305a99 --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/domainSharedAccessKeys.js @@ -0,0 +1,60 @@ +/* + * 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'; + +/** + * Shared access keys of the Domain + * + */ +class DomainSharedAccessKeys { + /** + * Create a DomainSharedAccessKeys. + * @member {string} [key1] Shared access key1 for the domain. + * @member {string} [key2] Shared access key2 for the domain. + */ + constructor() { + } + + /** + * Defines the metadata of DomainSharedAccessKeys + * + * @returns {object} metadata of DomainSharedAccessKeys + * + */ + mapper() { + return { + required: false, + serializedName: 'DomainSharedAccessKeys', + type: { + name: 'Composite', + className: 'DomainSharedAccessKeys', + modelProperties: { + key1: { + required: false, + serializedName: 'key1', + type: { + name: 'String' + } + }, + key2: { + required: false, + serializedName: 'key2', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DomainSharedAccessKeys; diff --git a/lib/services/eventgridManagement/lib/models/domainTopic.js b/lib/services/eventgridManagement/lib/models/domainTopic.js new file mode 100644 index 0000000000..82c82b58f6 --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/domainTopic.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'; + +const models = require('./index'); + +/** + * Domain Topic + * + * @extends models['Resource'] + */ +class DomainTopic extends models['Resource'] { + /** + * Create a DomainTopic. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DomainTopic + * + * @returns {object} metadata of DomainTopic + * + */ + mapper() { + return { + required: false, + serializedName: 'DomainTopic', + type: { + name: 'Composite', + className: 'DomainTopic', + 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' + } + } + } + } + }; + } +} + +module.exports = DomainTopic; diff --git a/lib/services/eventgridManagement/lib/models/domainTopicsListResult.js b/lib/services/eventgridManagement/lib/models/domainTopicsListResult.js new file mode 100644 index 0000000000..2d1fcc369a --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/domainTopicsListResult.js @@ -0,0 +1,59 @@ +/* + * 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 List Domain Topics operation + */ +class DomainTopicsListResult extends Array { + /** + * Create a DomainTopicsListResult. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DomainTopicsListResult + * + * @returns {object} metadata of DomainTopicsListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'DomainTopicsListResult', + type: { + name: 'Composite', + className: 'DomainTopicsListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DomainTopicElementType', + type: { + name: 'Composite', + className: 'DomainTopic' + } + } + } + } + } + } + }; + } +} + +module.exports = DomainTopicsListResult; diff --git a/lib/services/eventgridManagement/lib/models/domainUpdateParameters.js b/lib/services/eventgridManagement/lib/models/domainUpdateParameters.js new file mode 100644 index 0000000000..7188ca4084 --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/domainUpdateParameters.js @@ -0,0 +1,59 @@ +/* + * 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'; + +/** + * Properties of the Domain update + * + */ +class DomainUpdateParameters { + /** + * Create a DomainUpdateParameters. + * @member {object} [tags] Tags of the domains resource + */ + constructor() { + } + + /** + * Defines the metadata of DomainUpdateParameters + * + * @returns {object} metadata of DomainUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'DomainUpdateParameters', + type: { + name: 'Composite', + className: 'DomainUpdateParameters', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = DomainUpdateParameters; diff --git a/lib/services/eventgridManagement/lib/models/domainsListResult.js b/lib/services/eventgridManagement/lib/models/domainsListResult.js new file mode 100644 index 0000000000..f75a6a3382 --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/domainsListResult.js @@ -0,0 +1,59 @@ +/* + * 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 List Domains operation + */ +class DomainsListResult extends Array { + /** + * Create a DomainsListResult. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DomainsListResult + * + * @returns {object} metadata of DomainsListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'DomainsListResult', + type: { + name: 'Composite', + className: 'DomainsListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DomainElementType', + type: { + name: 'Composite', + className: 'Domain' + } + } + } + } + } + } + }; + } +} + +module.exports = DomainsListResult; diff --git a/lib/services/eventgridManagement/lib/models/eventSubscription.js b/lib/services/eventgridManagement/lib/models/eventSubscription.js index 1da68c6113..b7dacf48f5 100644 --- a/lib/services/eventgridManagement/lib/models/eventSubscription.js +++ b/lib/services/eventgridManagement/lib/models/eventSubscription.js @@ -43,11 +43,13 @@ class EventSubscription extends models['Resource'] { * @member {boolean} [filter.isSubjectCaseSensitive] Specifies if the * SubjectBeginsWith and SubjectEndsWith properties of the filter * should be compared in a case sensitive manner. + * @member {array} [filter.advancedFilters] A list of advanced filters. * @member {array} [labels] List of user defined labels. + * @member {date} [expirationTimeUtc] Expiration time of the event + * subscription. * @member {string} [eventDeliverySchema] The event delivery schema for the * event subscription. Possible values include: 'EventGridSchema', - * 'InputEventSchema', 'CloudEventV01Schema'. Default value: - * 'InputEventSchema' . + * 'CloudEventV01Schema', 'CustomInputSchema' * @member {object} [retryPolicy] The retry policy for events. This can be * used to configure maximum number of delivery attempts and time to live for * events. @@ -153,10 +155,16 @@ class EventSubscription extends models['Resource'] { } } }, + expirationTimeUtc: { + required: false, + serializedName: 'properties.expirationTimeUtc', + type: { + name: 'DateTime' + } + }, eventDeliverySchema: { required: false, serializedName: 'properties.eventDeliverySchema', - defaultValue: 'InputEventSchema', type: { name: 'String' } diff --git a/lib/services/eventgridManagement/lib/models/eventSubscriptionFilter.js b/lib/services/eventgridManagement/lib/models/eventSubscriptionFilter.js index 338d0e2ba1..831e72dd7b 100644 --- a/lib/services/eventgridManagement/lib/models/eventSubscriptionFilter.js +++ b/lib/services/eventgridManagement/lib/models/eventSubscriptionFilter.js @@ -31,6 +31,7 @@ class EventSubscriptionFilter { * @member {boolean} [isSubjectCaseSensitive] Specifies if the * SubjectBeginsWith and SubjectEndsWith properties of the filter * should be compared in a case sensitive manner. Default value: false . + * @member {array} [advancedFilters] A list of advanced filters. */ constructor() { } @@ -84,6 +85,26 @@ class EventSubscriptionFilter { type: { name: 'Boolean' } + }, + advancedFilters: { + required: false, + serializedName: 'advancedFilters', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AdvancedFilterElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'operatorType', + clientName: 'operatorType' + }, + uberParent: 'AdvancedFilter', + className: 'AdvancedFilter' + } + } + } } } } diff --git a/lib/services/eventgridManagement/lib/models/eventSubscriptionUpdateParameters.js b/lib/services/eventgridManagement/lib/models/eventSubscriptionUpdateParameters.js index d70cc1d5f0..8aacf20691 100644 --- a/lib/services/eventgridManagement/lib/models/eventSubscriptionUpdateParameters.js +++ b/lib/services/eventgridManagement/lib/models/eventSubscriptionUpdateParameters.js @@ -36,10 +36,13 @@ class EventSubscriptionUpdateParameters { * @member {boolean} [filter.isSubjectCaseSensitive] Specifies if the * SubjectBeginsWith and SubjectEndsWith properties of the filter * should be compared in a case sensitive manner. + * @member {array} [filter.advancedFilters] A list of advanced filters. * @member {array} [labels] List of user defined labels. + * @member {date} [expirationTimeUtc] Information about the expiration time + * for the event subscription. * @member {string} [eventDeliverySchema] The event delivery schema for the * event subscription. Possible values include: 'EventGridSchema', - * 'InputEventSchema', 'CloudEventV01Schema' + * 'CloudEventV01Schema', 'CustomInputSchema' * @member {object} [retryPolicy] The retry policy for events. This can be * used to configure maximum number of delivery attempts and time to live for * events. @@ -104,6 +107,13 @@ class EventSubscriptionUpdateParameters { } } }, + expirationTimeUtc: { + required: false, + serializedName: 'expirationTimeUtc', + type: { + name: 'DateTime' + } + }, eventDeliverySchema: { required: false, serializedName: 'eventDeliverySchema', diff --git a/lib/services/eventgridManagement/lib/models/index.d.ts b/lib/services/eventgridManagement/lib/models/index.d.ts index 5638897eaa..dc3904772d 100644 --- a/lib/services/eventgridManagement/lib/models/index.d.ts +++ b/lib/services/eventgridManagement/lib/models/index.d.ts @@ -16,6 +16,124 @@ export { BaseResource } from 'ms-rest-azure'; export { CloudError } from 'ms-rest-azure'; +/** + * @class + * Initializes a new instance of the InputSchemaMapping class. + * @constructor + * By default, Event Grid expects events to be in the Event Grid event schema. + * Specifying an input schema mapping enables publishing to Event Grid using a + * custom input schema. Currently, the only supported type of + * InputSchemaMapping is 'JsonInputSchemaMapping'. + * + * @member {string} inputSchemaMappingType Polymorphic Discriminator + */ +export interface InputSchemaMapping { + inputSchemaMappingType: string; +} + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * Definition of a Resource + * + * @member {string} [id] Fully qualified identifier of the resource + * @member {string} [name] Name of the resource + * @member {string} [type] Type of the resource + */ +export interface Resource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the TrackedResource class. + * @constructor + * Definition of a Tracked Resource + * + * @member {string} location Location of the resource + * @member {object} [tags] Tags of the resource + */ +export interface TrackedResource extends Resource { + location: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the Domain class. + * @constructor + * EventGrid Domain + * + * @member {string} [provisioningState] Provisioning state of the domain. + * Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + * 'Canceled', 'Failed' + * @member {string} [endpoint] Endpoint for the domain. + * @member {string} [inputSchema] This determines the format that Event Grid + * should expect for incoming events published to the domain. Possible values + * include: 'EventGridSchema', 'CustomEventSchema', 'CloudEventV01Schema' + * @member {object} [inputSchemaMapping] Information about the + * InputSchemaMapping which specified the info about mapping event payload. + * @member {string} [inputSchemaMapping.inputSchemaMappingType] Polymorphic + * Discriminator + */ +export interface Domain extends TrackedResource { + readonly provisioningState?: string; + readonly endpoint?: string; + inputSchema?: string; + inputSchemaMapping?: InputSchemaMapping; +} + +/** + * @class + * Initializes a new instance of the DomainUpdateParameters class. + * @constructor + * Properties of the Domain update + * + * @member {object} [tags] Tags of the domains resource + */ +export interface DomainUpdateParameters { + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the DomainSharedAccessKeys class. + * @constructor + * Shared access keys of the Domain + * + * @member {string} [key1] Shared access key1 for the domain. + * @member {string} [key2] Shared access key2 for the domain. + */ +export interface DomainSharedAccessKeys { + key1?: string; + key2?: string; +} + +/** + * @class + * Initializes a new instance of the DomainRegenerateKeyRequest class. + * @constructor + * Domain regenerate share access key request + * + * @member {string} keyName Key name to regenerate key1 or key2 + */ +export interface DomainRegenerateKeyRequest { + keyName: string; +} + +/** + * @class + * Initializes a new instance of the DomainTopic class. + * @constructor + * Domain Topic + * + */ +export interface DomainTopic extends Resource { +} + /** * @class * Initializes a new instance of the EventSubscriptionDestination class. @@ -28,6 +146,22 @@ export interface EventSubscriptionDestination { endpointType: string; } +/** + * @class + * Initializes a new instance of the AdvancedFilter class. + * @constructor + * Represents an advanced filter that can be used to filter events based on + * various event envelope/data fields. + * + * @member {string} [key] The filter key. Represents an event property with + * upto two levels of nesting. + * @member {string} operatorType Polymorphic Discriminator + */ +export interface AdvancedFilter { + key?: string; + operatorType: string; +} + /** * @class * Initializes a new instance of the EventSubscriptionFilter class. @@ -48,12 +182,14 @@ export interface EventSubscriptionDestination { * @member {boolean} [isSubjectCaseSensitive] Specifies if the * SubjectBeginsWith and SubjectEndsWith properties of the filter * should be compared in a case sensitive manner. Default value: false . + * @member {array} [advancedFilters] A list of advanced filters. */ export interface EventSubscriptionFilter { subjectBeginsWith?: string; subjectEndsWith?: string; includedEventTypes?: string[]; isSubjectCaseSensitive?: boolean; + advancedFilters?: AdvancedFilter[]; } /** @@ -90,18 +226,14 @@ export interface DeadLetterDestination { /** * @class - * Initializes a new instance of the Resource class. + * Initializes a new instance of the NumberInAdvancedFilter class. * @constructor - * Definition of a Resource + * NumberIn filter * - * @member {string} [id] Fully qualified identifier of the resource - * @member {string} [name] Name of the resource - * @member {string} [type] Type of the resource + * @member {array} [values] The set of filter values */ -export interface Resource extends BaseResource { - readonly id?: string; - readonly name?: string; - readonly type?: string; +export interface NumberInAdvancedFilter extends AdvancedFilter { + values?: number[]; } /** @@ -120,6 +252,138 @@ export interface StorageBlobDeadLetterDestination extends DeadLetterDestination blobContainerName?: string; } +/** + * @class + * Initializes a new instance of the NumberNotInAdvancedFilter class. + * @constructor + * NumberNotIn Filter + * + * @member {array} [values] The set of filter values + */ +export interface NumberNotInAdvancedFilter extends AdvancedFilter { + values?: number[]; +} + +/** + * @class + * Initializes a new instance of the NumberLessThanAdvancedFilter class. + * @constructor + * NumberLessThan Filter + * + * @member {number} [value] The filter value + */ +export interface NumberLessThanAdvancedFilter extends AdvancedFilter { + value?: number; +} + +/** + * @class + * Initializes a new instance of the NumberGreaterThanAdvancedFilter class. + * @constructor + * NumberGreaterThan Filter + * + * @member {number} [value] The filter value + */ +export interface NumberGreaterThanAdvancedFilter extends AdvancedFilter { + value?: number; +} + +/** + * @class + * Initializes a new instance of the NumberLessThanOrEqualsAdvancedFilter class. + * @constructor + * NumberLessThanOrEquals Filter + * + * @member {number} [value] The filter value + */ +export interface NumberLessThanOrEqualsAdvancedFilter extends AdvancedFilter { + value?: number; +} + +/** + * @class + * Initializes a new instance of the NumberGreaterThanOrEqualsAdvancedFilter class. + * @constructor + * NumberGreaterThanOrEquals Filter + * + * @member {number} [value] The filter value + */ +export interface NumberGreaterThanOrEqualsAdvancedFilter extends AdvancedFilter { + value?: number; +} + +/** + * @class + * Initializes a new instance of the BoolEqualsAdvancedFilter class. + * @constructor + * BoolEquals Filter + * + * @member {boolean} [value] The filter value + */ +export interface BoolEqualsAdvancedFilter extends AdvancedFilter { + value?: boolean; +} + +/** + * @class + * Initializes a new instance of the StringInAdvancedFilter class. + * @constructor + * StringIn Filter + * + * @member {array} [values] The set of filter values + */ +export interface StringInAdvancedFilter extends AdvancedFilter { + values?: string[]; +} + +/** + * @class + * Initializes a new instance of the StringNotInAdvancedFilter class. + * @constructor + * StringNotIn Filter + * + * @member {array} [values] The set of filter values + */ +export interface StringNotInAdvancedFilter extends AdvancedFilter { + values?: string[]; +} + +/** + * @class + * Initializes a new instance of the StringBeginsWithAdvancedFilter class. + * @constructor + * StringBeginsWith Filter + * + * @member {array} [values] The set of filter values + */ +export interface StringBeginsWithAdvancedFilter extends AdvancedFilter { + values?: string[]; +} + +/** + * @class + * Initializes a new instance of the StringEndsWithAdvancedFilter class. + * @constructor + * StringEndsWith Filter + * + * @member {array} [values] The set of filter values + */ +export interface StringEndsWithAdvancedFilter extends AdvancedFilter { + values?: string[]; +} + +/** + * @class + * Initializes a new instance of the StringContainsAdvancedFilter class. + * @constructor + * StringContains Filter + * + * @member {array} [values] The set of filter values + */ +export interface StringContainsAdvancedFilter extends AdvancedFilter { + values?: string[]; +} + /** * @class * Initializes a new instance of the WebHookEventSubscriptionDestination class. @@ -208,11 +472,13 @@ export interface HybridConnectionEventSubscriptionDestination extends EventSubsc * @member {boolean} [filter.isSubjectCaseSensitive] Specifies if the * SubjectBeginsWith and SubjectEndsWith properties of the filter * should be compared in a case sensitive manner. + * @member {array} [filter.advancedFilters] A list of advanced filters. * @member {array} [labels] List of user defined labels. + * @member {date} [expirationTimeUtc] Expiration time of the event + * subscription. * @member {string} [eventDeliverySchema] The event delivery schema for the * event subscription. Possible values include: 'EventGridSchema', - * 'InputEventSchema', 'CloudEventV01Schema'. Default value: 'InputEventSchema' - * . + * 'CloudEventV01Schema', 'CustomInputSchema' * @member {object} [retryPolicy] The retry policy for events. This can be used * to configure maximum number of delivery attempts and time to live for * events. @@ -231,6 +497,7 @@ export interface EventSubscription extends Resource { destination?: EventSubscriptionDestination; filter?: EventSubscriptionFilter; labels?: string[]; + expirationTimeUtc?: Date; eventDeliverySchema?: string; retryPolicy?: RetryPolicy; deadLetterDestination?: DeadLetterDestination; @@ -261,10 +528,13 @@ export interface EventSubscription extends Resource { * @member {boolean} [filter.isSubjectCaseSensitive] Specifies if the * SubjectBeginsWith and SubjectEndsWith properties of the filter * should be compared in a case sensitive manner. + * @member {array} [filter.advancedFilters] A list of advanced filters. * @member {array} [labels] List of user defined labels. + * @member {date} [expirationTimeUtc] Information about the expiration time for + * the event subscription. * @member {string} [eventDeliverySchema] The event delivery schema for the * event subscription. Possible values include: 'EventGridSchema', - * 'InputEventSchema', 'CloudEventV01Schema' + * 'CloudEventV01Schema', 'CustomInputSchema' * @member {object} [retryPolicy] The retry policy for events. This can be used * to configure maximum number of delivery attempts and time to live for * events. @@ -281,6 +551,7 @@ export interface EventSubscriptionUpdateParameters { destination?: EventSubscriptionDestination; filter?: EventSubscriptionFilter; labels?: string[]; + expirationTimeUtc?: Date; eventDeliverySchema?: string; retryPolicy?: RetryPolicy; deadLetterDestination?: DeadLetterDestination; @@ -339,21 +610,6 @@ export interface Operation { properties?: any; } -/** - * @class - * Initializes a new instance of the InputSchemaMapping class. - * @constructor - * By default, Event Grid expects events to be in the Event Grid event schema. - * Specifying an input schema mapping enables publishing to Event Grid using a - * custom input schema. Currently, the only supported type of - * InputSchemaMapping is 'JsonInputSchemaMapping'. - * - * @member {string} inputSchemaMappingType Polymorphic Discriminator - */ -export interface InputSchemaMapping { - inputSchemaMappingType: string; -} - /** * @class * Initializes a new instance of the JsonField class. @@ -442,20 +698,6 @@ export interface JsonInputSchemaMapping extends InputSchemaMapping { dataVersion?: JsonFieldWithDefault; } -/** - * @class - * Initializes a new instance of the TrackedResource class. - * @constructor - * Definition of a Tracked Resource - * - * @member {string} location Location of the resource - * @member {object} [tags] Tags of the resource - */ -export interface TrackedResource extends Resource { - location: string; - tags?: { [propertyName: string]: string }; -} - /** * @class * Initializes a new instance of the Topic class. @@ -565,6 +807,26 @@ export interface TopicTypeInfo extends Resource { } +/** + * @class + * Initializes a new instance of the DomainsListResult class. + * @constructor + * Result of the List Domains operation + * + */ +export interface DomainsListResult extends Array { +} + +/** + * @class + * Initializes a new instance of the DomainTopicsListResult class. + * @constructor + * Result of the List Domain Topics operation + * + */ +export interface DomainTopicsListResult extends Array { +} + /** * @class * Initializes a new instance of the EventSubscriptionsListResult class. diff --git a/lib/services/eventgridManagement/lib/models/index.js b/lib/services/eventgridManagement/lib/models/index.js index 6861313f86..d8e161899b 100644 --- a/lib/services/eventgridManagement/lib/models/index.js +++ b/lib/services/eventgridManagement/lib/models/index.js @@ -18,12 +18,32 @@ var msRestAzure = require('ms-rest-azure'); exports.BaseResource = msRestAzure.BaseResource; exports.CloudError = msRestAzure.CloudError; +exports.InputSchemaMapping = require('./inputSchemaMapping'); +exports.Resource = require('./resource'); +exports.TrackedResource = require('./trackedResource'); +exports.Domain = require('./domain'); +exports.DomainUpdateParameters = require('./domainUpdateParameters'); +exports.DomainSharedAccessKeys = require('./domainSharedAccessKeys'); +exports.DomainRegenerateKeyRequest = require('./domainRegenerateKeyRequest'); +exports.DomainTopic = require('./domainTopic'); exports.EventSubscriptionDestination = require('./eventSubscriptionDestination'); +exports.AdvancedFilter = require('./advancedFilter'); exports.EventSubscriptionFilter = require('./eventSubscriptionFilter'); exports.RetryPolicy = require('./retryPolicy'); exports.DeadLetterDestination = require('./deadLetterDestination'); -exports.Resource = require('./resource'); +exports.NumberInAdvancedFilter = require('./numberInAdvancedFilter'); exports.StorageBlobDeadLetterDestination = require('./storageBlobDeadLetterDestination'); +exports.NumberNotInAdvancedFilter = require('./numberNotInAdvancedFilter'); +exports.NumberLessThanAdvancedFilter = require('./numberLessThanAdvancedFilter'); +exports.NumberGreaterThanAdvancedFilter = require('./numberGreaterThanAdvancedFilter'); +exports.NumberLessThanOrEqualsAdvancedFilter = require('./numberLessThanOrEqualsAdvancedFilter'); +exports.NumberGreaterThanOrEqualsAdvancedFilter = require('./numberGreaterThanOrEqualsAdvancedFilter'); +exports.BoolEqualsAdvancedFilter = require('./boolEqualsAdvancedFilter'); +exports.StringInAdvancedFilter = require('./stringInAdvancedFilter'); +exports.StringNotInAdvancedFilter = require('./stringNotInAdvancedFilter'); +exports.StringBeginsWithAdvancedFilter = require('./stringBeginsWithAdvancedFilter'); +exports.StringEndsWithAdvancedFilter = require('./stringEndsWithAdvancedFilter'); +exports.StringContainsAdvancedFilter = require('./stringContainsAdvancedFilter'); exports.WebHookEventSubscriptionDestination = require('./webHookEventSubscriptionDestination'); exports.EventHubEventSubscriptionDestination = require('./eventHubEventSubscriptionDestination'); exports.StorageQueueEventSubscriptionDestination = require('./storageQueueEventSubscriptionDestination'); @@ -33,30 +53,43 @@ exports.EventSubscriptionUpdateParameters = require('./eventSubscriptionUpdatePa exports.EventSubscriptionFullUrl = require('./eventSubscriptionFullUrl'); exports.OperationInfo = require('./operationInfo'); exports.Operation = require('./operation'); -exports.InputSchemaMapping = require('./inputSchemaMapping'); exports.JsonField = require('./jsonField'); exports.JsonFieldWithDefault = require('./jsonFieldWithDefault'); exports.JsonInputSchemaMapping = require('./jsonInputSchemaMapping'); -exports.TrackedResource = require('./trackedResource'); exports.Topic = require('./topic'); exports.TopicUpdateParameters = require('./topicUpdateParameters'); exports.TopicSharedAccessKeys = require('./topicSharedAccessKeys'); exports.TopicRegenerateKeyRequest = require('./topicRegenerateKeyRequest'); exports.EventType = require('./eventType'); exports.TopicTypeInfo = require('./topicTypeInfo'); +exports.DomainsListResult = require('./domainsListResult'); +exports.DomainTopicsListResult = require('./domainTopicsListResult'); exports.EventSubscriptionsListResult = require('./eventSubscriptionsListResult'); exports.OperationsListResult = require('./operationsListResult'); exports.TopicsListResult = require('./topicsListResult'); exports.EventTypesListResult = require('./eventTypesListResult'); exports.TopicTypesListResult = require('./topicTypesListResult'); exports.discriminators = { + 'InputSchemaMapping' : exports.InputSchemaMapping, 'EventSubscriptionDestination' : exports.EventSubscriptionDestination, + 'AdvancedFilter' : exports.AdvancedFilter, 'DeadLetterDestination' : exports.DeadLetterDestination, + 'AdvancedFilter.NumberIn' : exports.NumberInAdvancedFilter, 'DeadLetterDestination.StorageBlob' : exports.StorageBlobDeadLetterDestination, + 'AdvancedFilter.NumberNotIn' : exports.NumberNotInAdvancedFilter, + 'AdvancedFilter.NumberLessThan' : exports.NumberLessThanAdvancedFilter, + 'AdvancedFilter.NumberGreaterThan' : exports.NumberGreaterThanAdvancedFilter, + 'AdvancedFilter.NumberLessThanOrEquals' : exports.NumberLessThanOrEqualsAdvancedFilter, + 'AdvancedFilter.NumberGreaterThanOrEquals' : exports.NumberGreaterThanOrEqualsAdvancedFilter, + 'AdvancedFilter.BoolEquals' : exports.BoolEqualsAdvancedFilter, + 'AdvancedFilter.StringIn' : exports.StringInAdvancedFilter, + 'AdvancedFilter.StringNotIn' : exports.StringNotInAdvancedFilter, + 'AdvancedFilter.StringBeginsWith' : exports.StringBeginsWithAdvancedFilter, + 'AdvancedFilter.StringEndsWith' : exports.StringEndsWithAdvancedFilter, + 'AdvancedFilter.StringContains' : exports.StringContainsAdvancedFilter, 'EventSubscriptionDestination.WebHook' : exports.WebHookEventSubscriptionDestination, 'EventSubscriptionDestination.EventHub' : exports.EventHubEventSubscriptionDestination, 'EventSubscriptionDestination.StorageQueue' : exports.StorageQueueEventSubscriptionDestination, 'EventSubscriptionDestination.HybridConnection' : exports.HybridConnectionEventSubscriptionDestination, - 'InputSchemaMapping' : exports.InputSchemaMapping, 'InputSchemaMapping.Json' : exports.JsonInputSchemaMapping }; diff --git a/lib/services/eventgridManagement/lib/models/numberGreaterThanAdvancedFilter.js b/lib/services/eventgridManagement/lib/models/numberGreaterThanAdvancedFilter.js new file mode 100644 index 0000000000..1ee255d67d --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/numberGreaterThanAdvancedFilter.js @@ -0,0 +1,76 @@ +/* + * 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'); + +/** + * NumberGreaterThan Filter + * + * @extends models['AdvancedFilter'] + */ +class NumberGreaterThanAdvancedFilter extends models['AdvancedFilter'] { + /** + * Create a NumberGreaterThanAdvancedFilter. + * @member {number} [value] The filter value + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NumberGreaterThanAdvancedFilter + * + * @returns {object} metadata of NumberGreaterThanAdvancedFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'NumberGreaterThan', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'operatorType', + clientName: 'operatorType' + }, + uberParent: 'AdvancedFilter', + className: 'NumberGreaterThanAdvancedFilter', + modelProperties: { + key: { + required: false, + serializedName: 'key', + type: { + name: 'String' + } + }, + operatorType: { + required: true, + serializedName: 'operatorType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + value: { + required: false, + serializedName: 'value', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = NumberGreaterThanAdvancedFilter; diff --git a/lib/services/eventgridManagement/lib/models/numberGreaterThanOrEqualsAdvancedFilter.js b/lib/services/eventgridManagement/lib/models/numberGreaterThanOrEqualsAdvancedFilter.js new file mode 100644 index 0000000000..0c177ce542 --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/numberGreaterThanOrEqualsAdvancedFilter.js @@ -0,0 +1,76 @@ +/* + * 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'); + +/** + * NumberGreaterThanOrEquals Filter + * + * @extends models['AdvancedFilter'] + */ +class NumberGreaterThanOrEqualsAdvancedFilter extends models['AdvancedFilter'] { + /** + * Create a NumberGreaterThanOrEqualsAdvancedFilter. + * @member {number} [value] The filter value + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NumberGreaterThanOrEqualsAdvancedFilter + * + * @returns {object} metadata of NumberGreaterThanOrEqualsAdvancedFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'NumberGreaterThanOrEquals', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'operatorType', + clientName: 'operatorType' + }, + uberParent: 'AdvancedFilter', + className: 'NumberGreaterThanOrEqualsAdvancedFilter', + modelProperties: { + key: { + required: false, + serializedName: 'key', + type: { + name: 'String' + } + }, + operatorType: { + required: true, + serializedName: 'operatorType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + value: { + required: false, + serializedName: 'value', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = NumberGreaterThanOrEqualsAdvancedFilter; diff --git a/lib/services/eventgridManagement/lib/models/numberInAdvancedFilter.js b/lib/services/eventgridManagement/lib/models/numberInAdvancedFilter.js new file mode 100644 index 0000000000..dc04d0749b --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/numberInAdvancedFilter.js @@ -0,0 +1,83 @@ +/* + * 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'); + +/** + * NumberIn filter + * + * @extends models['AdvancedFilter'] + */ +class NumberInAdvancedFilter extends models['AdvancedFilter'] { + /** + * Create a NumberInAdvancedFilter. + * @member {array} [values] The set of filter values + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NumberInAdvancedFilter + * + * @returns {object} metadata of NumberInAdvancedFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'NumberIn', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'operatorType', + clientName: 'operatorType' + }, + uberParent: 'AdvancedFilter', + className: 'NumberInAdvancedFilter', + modelProperties: { + key: { + required: false, + serializedName: 'key', + type: { + name: 'String' + } + }, + operatorType: { + required: true, + serializedName: 'operatorType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + values: { + required: false, + serializedName: 'values', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + } + } + } + }; + } +} + +module.exports = NumberInAdvancedFilter; diff --git a/lib/services/eventgridManagement/lib/models/numberLessThanAdvancedFilter.js b/lib/services/eventgridManagement/lib/models/numberLessThanAdvancedFilter.js new file mode 100644 index 0000000000..6b660906f7 --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/numberLessThanAdvancedFilter.js @@ -0,0 +1,76 @@ +/* + * 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'); + +/** + * NumberLessThan Filter + * + * @extends models['AdvancedFilter'] + */ +class NumberLessThanAdvancedFilter extends models['AdvancedFilter'] { + /** + * Create a NumberLessThanAdvancedFilter. + * @member {number} [value] The filter value + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NumberLessThanAdvancedFilter + * + * @returns {object} metadata of NumberLessThanAdvancedFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'NumberLessThan', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'operatorType', + clientName: 'operatorType' + }, + uberParent: 'AdvancedFilter', + className: 'NumberLessThanAdvancedFilter', + modelProperties: { + key: { + required: false, + serializedName: 'key', + type: { + name: 'String' + } + }, + operatorType: { + required: true, + serializedName: 'operatorType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + value: { + required: false, + serializedName: 'value', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = NumberLessThanAdvancedFilter; diff --git a/lib/services/eventgridManagement/lib/models/numberLessThanOrEqualsAdvancedFilter.js b/lib/services/eventgridManagement/lib/models/numberLessThanOrEqualsAdvancedFilter.js new file mode 100644 index 0000000000..ebd5ba8ab6 --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/numberLessThanOrEqualsAdvancedFilter.js @@ -0,0 +1,76 @@ +/* + * 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'); + +/** + * NumberLessThanOrEquals Filter + * + * @extends models['AdvancedFilter'] + */ +class NumberLessThanOrEqualsAdvancedFilter extends models['AdvancedFilter'] { + /** + * Create a NumberLessThanOrEqualsAdvancedFilter. + * @member {number} [value] The filter value + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NumberLessThanOrEqualsAdvancedFilter + * + * @returns {object} metadata of NumberLessThanOrEqualsAdvancedFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'NumberLessThanOrEquals', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'operatorType', + clientName: 'operatorType' + }, + uberParent: 'AdvancedFilter', + className: 'NumberLessThanOrEqualsAdvancedFilter', + modelProperties: { + key: { + required: false, + serializedName: 'key', + type: { + name: 'String' + } + }, + operatorType: { + required: true, + serializedName: 'operatorType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + value: { + required: false, + serializedName: 'value', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = NumberLessThanOrEqualsAdvancedFilter; diff --git a/lib/services/eventgridManagement/lib/models/numberNotInAdvancedFilter.js b/lib/services/eventgridManagement/lib/models/numberNotInAdvancedFilter.js new file mode 100644 index 0000000000..2390c476e6 --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/numberNotInAdvancedFilter.js @@ -0,0 +1,83 @@ +/* + * 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'); + +/** + * NumberNotIn Filter + * + * @extends models['AdvancedFilter'] + */ +class NumberNotInAdvancedFilter extends models['AdvancedFilter'] { + /** + * Create a NumberNotInAdvancedFilter. + * @member {array} [values] The set of filter values + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NumberNotInAdvancedFilter + * + * @returns {object} metadata of NumberNotInAdvancedFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'NumberNotIn', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'operatorType', + clientName: 'operatorType' + }, + uberParent: 'AdvancedFilter', + className: 'NumberNotInAdvancedFilter', + modelProperties: { + key: { + required: false, + serializedName: 'key', + type: { + name: 'String' + } + }, + operatorType: { + required: true, + serializedName: 'operatorType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + values: { + required: false, + serializedName: 'values', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + } + } + } + }; + } +} + +module.exports = NumberNotInAdvancedFilter; diff --git a/lib/services/eventgridManagement/lib/models/stringBeginsWithAdvancedFilter.js b/lib/services/eventgridManagement/lib/models/stringBeginsWithAdvancedFilter.js new file mode 100644 index 0000000000..acf6ec67c6 --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/stringBeginsWithAdvancedFilter.js @@ -0,0 +1,83 @@ +/* + * 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'); + +/** + * StringBeginsWith Filter + * + * @extends models['AdvancedFilter'] + */ +class StringBeginsWithAdvancedFilter extends models['AdvancedFilter'] { + /** + * Create a StringBeginsWithAdvancedFilter. + * @member {array} [values] The set of filter values + */ + constructor() { + super(); + } + + /** + * Defines the metadata of StringBeginsWithAdvancedFilter + * + * @returns {object} metadata of StringBeginsWithAdvancedFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'StringBeginsWith', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'operatorType', + clientName: 'operatorType' + }, + uberParent: 'AdvancedFilter', + className: 'StringBeginsWithAdvancedFilter', + modelProperties: { + key: { + required: false, + serializedName: 'key', + type: { + name: 'String' + } + }, + operatorType: { + required: true, + serializedName: 'operatorType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + values: { + required: false, + serializedName: 'values', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = StringBeginsWithAdvancedFilter; diff --git a/lib/services/eventgridManagement/lib/models/stringContainsAdvancedFilter.js b/lib/services/eventgridManagement/lib/models/stringContainsAdvancedFilter.js new file mode 100644 index 0000000000..ef7b522776 --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/stringContainsAdvancedFilter.js @@ -0,0 +1,83 @@ +/* + * 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'); + +/** + * StringContains Filter + * + * @extends models['AdvancedFilter'] + */ +class StringContainsAdvancedFilter extends models['AdvancedFilter'] { + /** + * Create a StringContainsAdvancedFilter. + * @member {array} [values] The set of filter values + */ + constructor() { + super(); + } + + /** + * Defines the metadata of StringContainsAdvancedFilter + * + * @returns {object} metadata of StringContainsAdvancedFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'StringContains', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'operatorType', + clientName: 'operatorType' + }, + uberParent: 'AdvancedFilter', + className: 'StringContainsAdvancedFilter', + modelProperties: { + key: { + required: false, + serializedName: 'key', + type: { + name: 'String' + } + }, + operatorType: { + required: true, + serializedName: 'operatorType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + values: { + required: false, + serializedName: 'values', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = StringContainsAdvancedFilter; diff --git a/lib/services/eventgridManagement/lib/models/stringEndsWithAdvancedFilter.js b/lib/services/eventgridManagement/lib/models/stringEndsWithAdvancedFilter.js new file mode 100644 index 0000000000..c9df18365b --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/stringEndsWithAdvancedFilter.js @@ -0,0 +1,83 @@ +/* + * 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'); + +/** + * StringEndsWith Filter + * + * @extends models['AdvancedFilter'] + */ +class StringEndsWithAdvancedFilter extends models['AdvancedFilter'] { + /** + * Create a StringEndsWithAdvancedFilter. + * @member {array} [values] The set of filter values + */ + constructor() { + super(); + } + + /** + * Defines the metadata of StringEndsWithAdvancedFilter + * + * @returns {object} metadata of StringEndsWithAdvancedFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'StringEndsWith', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'operatorType', + clientName: 'operatorType' + }, + uberParent: 'AdvancedFilter', + className: 'StringEndsWithAdvancedFilter', + modelProperties: { + key: { + required: false, + serializedName: 'key', + type: { + name: 'String' + } + }, + operatorType: { + required: true, + serializedName: 'operatorType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + values: { + required: false, + serializedName: 'values', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = StringEndsWithAdvancedFilter; diff --git a/lib/services/eventgridManagement/lib/models/stringInAdvancedFilter.js b/lib/services/eventgridManagement/lib/models/stringInAdvancedFilter.js new file mode 100644 index 0000000000..b14610102b --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/stringInAdvancedFilter.js @@ -0,0 +1,83 @@ +/* + * 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'); + +/** + * StringIn Filter + * + * @extends models['AdvancedFilter'] + */ +class StringInAdvancedFilter extends models['AdvancedFilter'] { + /** + * Create a StringInAdvancedFilter. + * @member {array} [values] The set of filter values + */ + constructor() { + super(); + } + + /** + * Defines the metadata of StringInAdvancedFilter + * + * @returns {object} metadata of StringInAdvancedFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'StringIn', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'operatorType', + clientName: 'operatorType' + }, + uberParent: 'AdvancedFilter', + className: 'StringInAdvancedFilter', + modelProperties: { + key: { + required: false, + serializedName: 'key', + type: { + name: 'String' + } + }, + operatorType: { + required: true, + serializedName: 'operatorType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + values: { + required: false, + serializedName: 'values', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = StringInAdvancedFilter; diff --git a/lib/services/eventgridManagement/lib/models/stringNotInAdvancedFilter.js b/lib/services/eventgridManagement/lib/models/stringNotInAdvancedFilter.js new file mode 100644 index 0000000000..2e7e7fea92 --- /dev/null +++ b/lib/services/eventgridManagement/lib/models/stringNotInAdvancedFilter.js @@ -0,0 +1,83 @@ +/* + * 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'); + +/** + * StringNotIn Filter + * + * @extends models['AdvancedFilter'] + */ +class StringNotInAdvancedFilter extends models['AdvancedFilter'] { + /** + * Create a StringNotInAdvancedFilter. + * @member {array} [values] The set of filter values + */ + constructor() { + super(); + } + + /** + * Defines the metadata of StringNotInAdvancedFilter + * + * @returns {object} metadata of StringNotInAdvancedFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'StringNotIn', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'operatorType', + clientName: 'operatorType' + }, + uberParent: 'AdvancedFilter', + className: 'StringNotInAdvancedFilter', + modelProperties: { + key: { + required: false, + serializedName: 'key', + type: { + name: 'String' + } + }, + operatorType: { + required: true, + serializedName: 'operatorType', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + values: { + required: false, + serializedName: 'values', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = StringNotInAdvancedFilter; diff --git a/lib/services/eventgridManagement/lib/operations/domainTopics.js b/lib/services/eventgridManagement/lib/operations/domainTopics.js new file mode 100644 index 0000000000..c4668fb24b --- /dev/null +++ b/lib/services/eventgridManagement/lib/operations/domainTopics.js @@ -0,0 +1,523 @@ +/* + * 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; + +/** + * @summary Get a domain topic + * + * Get properties of a domain topic + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {string} topicName Name of the topic + * + * @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 DomainTopic} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, domainName, topicName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (domainName === null || domainName === undefined || typeof domainName.valueOf() !== 'string') { + throw new Error('domainName cannot be null or undefined and it must be of type string.'); + } + if (topicName === null || topicName === undefined || typeof topicName.valueOf() !== 'string') { + throw new Error('topicName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{domainName}', encodeURIComponent(domainName)); + requestUrl = requestUrl.replace('{topicName}', encodeURIComponent(topicName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DomainTopic']().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); + }); +} + +/** + * @summary List domain topics. + * + * List all the topics in a domain. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Domain name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DomainTopicsListResult} 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 _listByDomain(resourceGroupName, domainName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (domainName === null || domainName === undefined || typeof domainName.valueOf() !== 'string') { + throw new Error('domainName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{domainName}', encodeURIComponent(domainName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DomainTopicsListResult']().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 DomainTopics. */ +class DomainTopics { + /** + * Create a DomainTopics. + * @param {EventGridManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._listByDomain = _listByDomain; + } + + /** + * @summary Get a domain topic + * + * Get properties of a domain topic + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {string} topicName Name of the topic + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, domainName, topicName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, domainName, topicName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Get a domain topic + * + * Get properties of a domain topic + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {string} topicName Name of the topic + * + * @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 {DomainTopic} - 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 DomainTopic} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, domainName, topicName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, domainName, topicName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, domainName, topicName, options, optionalCallback); + } + } + + /** + * @summary List domain topics. + * + * List all the topics in a domain. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Domain name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByDomainWithHttpOperationResponse(resourceGroupName, domainName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDomain(resourceGroupName, domainName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List domain topics. + * + * List all the topics in a domain. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Domain name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DomainTopicsListResult} - 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 DomainTopicsListResult} 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. + */ + listByDomain(resourceGroupName, domainName, 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._listByDomain(resourceGroupName, domainName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDomain(resourceGroupName, domainName, options, optionalCallback); + } + } + +} + +module.exports = DomainTopics; diff --git a/lib/services/eventgridManagement/lib/operations/domains.js b/lib/services/eventgridManagement/lib/operations/domains.js new file mode 100644 index 0000000000..f63e7a4a2b --- /dev/null +++ b/lib/services/eventgridManagement/lib/operations/domains.js @@ -0,0 +1,2607 @@ +/* + * 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; + +/** + * @summary Get a domain + * + * Get properties of a domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @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 Domain} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, domainName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (domainName === null || domainName === undefined || typeof domainName.valueOf() !== 'string') { + throw new Error('domainName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{domainName}', encodeURIComponent(domainName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Domain']().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); + }); +} + + +/** + * @summary Create a domain + * + * Asynchronously creates a new domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainInfo Domain information + * + * @param {string} [domainInfo.inputSchema] This determines the format that + * Event Grid should expect for incoming events published to the domain. + * Possible values include: 'EventGridSchema', 'CustomEventSchema', + * 'CloudEventV01Schema' + * + * @param {object} [domainInfo.inputSchemaMapping] Information about the + * InputSchemaMapping which specified the info about mapping event payload. + * + * @param {string} domainInfo.inputSchemaMapping.inputSchemaMappingType + * Polymorphic Discriminator + * + * @param {string} domainInfo.location Location of the resource + * + * @param {object} [domainInfo.tags] Tags of the resource + * + * @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 Domain} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, domainName, domainInfo, 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.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, domainName, domainInfo, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Domain']().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); + }); + }); +} + + +/** + * @summary Delete a domain + * + * Delete existing domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, domainName, 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.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, domainName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * @summary Update a domain + * + * Asynchronously updates a domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainUpdateParameters Domain update information + * + * @param {object} [domainUpdateParameters.tags] Tags of the domains resource + * + * @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 Domain} 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 _update(resourceGroupName, domainName, domainUpdateParameters, 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.'); + } + + // Send request + this.beginUpdate(resourceGroupName, domainName, domainUpdateParameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Domain']().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); + }); + }); +} + +/** + * @summary List domains under an Azure subscription + * + * List all the domains under an Azure subscription + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DomainsListResult} 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 _listBySubscription(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DomainsListResult']().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); + }); +} + +/** + * @summary List domains under a resource group + * + * List all the domains under a resource group + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DomainsListResult} 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 _listByResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DomainsListResult']().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); + }); +} + +/** + * @summary List keys for a domain + * + * List the two keys used to publish to a domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @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 DomainSharedAccessKeys} 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 _listSharedAccessKeys(resourceGroupName, domainName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (domainName === null || domainName === undefined || typeof domainName.valueOf() !== 'string') { + throw new Error('domainName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/listKeys'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{domainName}', encodeURIComponent(domainName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DomainSharedAccessKeys']().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); + }); +} + +/** + * @summary Regenerate key for a domain + * + * Regenerate a shared access key for a domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} regenerateKeyRequest Request body to regenerate key + * + * @param {string} regenerateKeyRequest.keyName Key name to regenerate key1 or + * key2 + * + * @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 DomainSharedAccessKeys} 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 _regenerateKey(resourceGroupName, domainName, regenerateKeyRequest, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (domainName === null || domainName === undefined || typeof domainName.valueOf() !== 'string') { + throw new Error('domainName cannot be null or undefined and it must be of type string.'); + } + if (regenerateKeyRequest === null || regenerateKeyRequest === undefined) { + throw new Error('regenerateKeyRequest cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/regenerateKey'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{domainName}', encodeURIComponent(domainName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (regenerateKeyRequest !== null && regenerateKeyRequest !== undefined) { + let requestModelMapper = new client.models['DomainRegenerateKeyRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, regenerateKeyRequest, 'regenerateKeyRequest'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(regenerateKeyRequest, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DomainSharedAccessKeys']().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); + }); +} + +/** + * @summary Create a domain + * + * Asynchronously creates a new domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainInfo Domain information + * + * @param {string} [domainInfo.inputSchema] This determines the format that + * Event Grid should expect for incoming events published to the domain. + * Possible values include: 'EventGridSchema', 'CustomEventSchema', + * 'CloudEventV01Schema' + * + * @param {object} [domainInfo.inputSchemaMapping] Information about the + * InputSchemaMapping which specified the info about mapping event payload. + * + * @param {string} domainInfo.inputSchemaMapping.inputSchemaMappingType + * Polymorphic Discriminator + * + * @param {string} domainInfo.location Location of the resource + * + * @param {object} [domainInfo.tags] Tags of the resource + * + * @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 Domain} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, domainName, domainInfo, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (domainName === null || domainName === undefined || typeof domainName.valueOf() !== 'string') { + throw new Error('domainName cannot be null or undefined and it must be of type string.'); + } + if (domainInfo === null || domainInfo === undefined) { + throw new Error('domainInfo cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{domainName}', encodeURIComponent(domainName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (domainInfo !== null && domainInfo !== undefined) { + let requestModelMapper = new client.models['Domain']().mapper(); + requestModel = client.serialize(requestModelMapper, domainInfo, 'domainInfo'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(domainInfo, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Domain']().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); + }); +} + +/** + * @summary Delete a domain + * + * Delete existing domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, domainName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (domainName === null || domainName === undefined || typeof domainName.valueOf() !== 'string') { + throw new Error('domainName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{domainName}', encodeURIComponent(domainName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary Update a domain + * + * Asynchronously updates a domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainUpdateParameters Domain update information + * + * @param {object} [domainUpdateParameters.tags] Tags of the domains resource + * + * @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 Domain} 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 _beginUpdate(resourceGroupName, domainName, domainUpdateParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (domainName === null || domainName === undefined || typeof domainName.valueOf() !== 'string') { + throw new Error('domainName cannot be null or undefined and it must be of type string.'); + } + if (domainUpdateParameters === null || domainUpdateParameters === undefined) { + throw new Error('domainUpdateParameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{domainName}', encodeURIComponent(domainName)); + 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 = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (domainUpdateParameters !== null && domainUpdateParameters !== undefined) { + let requestModelMapper = new client.models['DomainUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, domainUpdateParameters, 'domainUpdateParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(domainUpdateParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Domain']().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 Domains. */ +class Domains { + /** + * Create a Domains. + * @param {EventGridManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._listBySubscription = _listBySubscription; + this._listByResourceGroup = _listByResourceGroup; + this._listSharedAccessKeys = _listSharedAccessKeys; + this._regenerateKey = _regenerateKey; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginUpdate = _beginUpdate; + } + + /** + * @summary Get a domain + * + * Get properties of a domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, domainName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, domainName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Get a domain + * + * Get properties of a domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @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 {Domain} - 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 Domain} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, domainName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, domainName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, domainName, options, optionalCallback); + } + } + + /** + * @summary Create a domain + * + * Asynchronously creates a new domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainInfo Domain information + * + * @param {string} [domainInfo.inputSchema] This determines the format that + * Event Grid should expect for incoming events published to the domain. + * Possible values include: 'EventGridSchema', 'CustomEventSchema', + * 'CloudEventV01Schema' + * + * @param {object} [domainInfo.inputSchemaMapping] Information about the + * InputSchemaMapping which specified the info about mapping event payload. + * + * @param {string} domainInfo.inputSchemaMapping.inputSchemaMappingType + * Polymorphic Discriminator + * + * @param {string} domainInfo.location Location of the resource + * + * @param {object} [domainInfo.tags] Tags of the resource + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, domainName, domainInfo, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, domainName, domainInfo, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Create a domain + * + * Asynchronously creates a new domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainInfo Domain information + * + * @param {string} [domainInfo.inputSchema] This determines the format that + * Event Grid should expect for incoming events published to the domain. + * Possible values include: 'EventGridSchema', 'CustomEventSchema', + * 'CloudEventV01Schema' + * + * @param {object} [domainInfo.inputSchemaMapping] Information about the + * InputSchemaMapping which specified the info about mapping event payload. + * + * @param {string} domainInfo.inputSchemaMapping.inputSchemaMappingType + * Polymorphic Discriminator + * + * @param {string} domainInfo.location Location of the resource + * + * @param {object} [domainInfo.tags] Tags of the resource + * + * @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 {Domain} - 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 Domain} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, domainName, domainInfo, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, domainName, domainInfo, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, domainName, domainInfo, options, optionalCallback); + } + } + + /** + * @summary Delete a domain + * + * Delete existing domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, domainName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, domainName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Delete a domain + * + * Delete existing domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, domainName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, domainName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, domainName, options, optionalCallback); + } + } + + /** + * @summary Update a domain + * + * Asynchronously updates a domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainUpdateParameters Domain update information + * + * @param {object} [domainUpdateParameters.tags] Tags of the domains resource + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, domainName, domainUpdateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, domainName, domainUpdateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Update a domain + * + * Asynchronously updates a domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainUpdateParameters Domain update information + * + * @param {object} [domainUpdateParameters.tags] Tags of the domains resource + * + * @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 {Domain} - 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 Domain} 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. + */ + update(resourceGroupName, domainName, domainUpdateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, domainName, domainUpdateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, domainName, domainUpdateParameters, options, optionalCallback); + } + } + + /** + * @summary List domains under an Azure subscription + * + * List all the domains under an Azure subscription + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBySubscriptionWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List domains under an Azure subscription + * + * List all the domains under an Azure subscription + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DomainsListResult} - 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 DomainsListResult} 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. + */ + listBySubscription(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._listBySubscription(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscription(options, optionalCallback); + } + } + + /** + * @summary List domains under a resource group + * + * List all the domains under a resource group + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List domains under a resource group + * + * List all the domains under a resource group + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DomainsListResult} - 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 DomainsListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary List keys for a domain + * + * List the two keys used to publish to a domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @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. + */ + listSharedAccessKeysWithHttpOperationResponse(resourceGroupName, domainName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listSharedAccessKeys(resourceGroupName, domainName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List keys for a domain + * + * List the two keys used to publish to a domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @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 {DomainSharedAccessKeys} - 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 DomainSharedAccessKeys} 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. + */ + listSharedAccessKeys(resourceGroupName, domainName, 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._listSharedAccessKeys(resourceGroupName, domainName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listSharedAccessKeys(resourceGroupName, domainName, options, optionalCallback); + } + } + + /** + * @summary Regenerate key for a domain + * + * Regenerate a shared access key for a domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} regenerateKeyRequest Request body to regenerate key + * + * @param {string} regenerateKeyRequest.keyName Key name to regenerate key1 or + * key2 + * + * @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. + */ + regenerateKeyWithHttpOperationResponse(resourceGroupName, domainName, regenerateKeyRequest, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._regenerateKey(resourceGroupName, domainName, regenerateKeyRequest, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Regenerate key for a domain + * + * Regenerate a shared access key for a domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} regenerateKeyRequest Request body to regenerate key + * + * @param {string} regenerateKeyRequest.keyName Key name to regenerate key1 or + * key2 + * + * @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 {DomainSharedAccessKeys} - 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 DomainSharedAccessKeys} 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. + */ + regenerateKey(resourceGroupName, domainName, regenerateKeyRequest, 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._regenerateKey(resourceGroupName, domainName, regenerateKeyRequest, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._regenerateKey(resourceGroupName, domainName, regenerateKeyRequest, options, optionalCallback); + } + } + + /** + * @summary Create a domain + * + * Asynchronously creates a new domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainInfo Domain information + * + * @param {string} [domainInfo.inputSchema] This determines the format that + * Event Grid should expect for incoming events published to the domain. + * Possible values include: 'EventGridSchema', 'CustomEventSchema', + * 'CloudEventV01Schema' + * + * @param {object} [domainInfo.inputSchemaMapping] Information about the + * InputSchemaMapping which specified the info about mapping event payload. + * + * @param {string} domainInfo.inputSchemaMapping.inputSchemaMappingType + * Polymorphic Discriminator + * + * @param {string} domainInfo.location Location of the resource + * + * @param {object} [domainInfo.tags] Tags of the resource + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, domainName, domainInfo, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, domainName, domainInfo, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Create a domain + * + * Asynchronously creates a new domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainInfo Domain information + * + * @param {string} [domainInfo.inputSchema] This determines the format that + * Event Grid should expect for incoming events published to the domain. + * Possible values include: 'EventGridSchema', 'CustomEventSchema', + * 'CloudEventV01Schema' + * + * @param {object} [domainInfo.inputSchemaMapping] Information about the + * InputSchemaMapping which specified the info about mapping event payload. + * + * @param {string} domainInfo.inputSchemaMapping.inputSchemaMappingType + * Polymorphic Discriminator + * + * @param {string} domainInfo.location Location of the resource + * + * @param {object} [domainInfo.tags] Tags of the resource + * + * @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 {Domain} - 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 Domain} 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. + */ + beginCreateOrUpdate(resourceGroupName, domainName, domainInfo, 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._beginCreateOrUpdate(resourceGroupName, domainName, domainInfo, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, domainName, domainInfo, options, optionalCallback); + } + } + + /** + * @summary Delete a domain + * + * Delete existing domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @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. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, domainName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, domainName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Delete a domain + * + * Delete existing domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, domainName, 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._beginDeleteMethod(resourceGroupName, domainName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, domainName, options, optionalCallback); + } + } + + /** + * @summary Update a domain + * + * Asynchronously updates a domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainUpdateParameters Domain update information + * + * @param {object} [domainUpdateParameters.tags] Tags of the domains resource + * + * @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. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName, domainName, domainUpdateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, domainName, domainUpdateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Update a domain + * + * Asynchronously updates a domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainUpdateParameters Domain update information + * + * @param {object} [domainUpdateParameters.tags] Tags of the domains resource + * + * @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 {Domain} - 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 Domain} 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. + */ + beginUpdate(resourceGroupName, domainName, domainUpdateParameters, 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._beginUpdate(resourceGroupName, domainName, domainUpdateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdate(resourceGroupName, domainName, domainUpdateParameters, options, optionalCallback); + } + } + +} + +module.exports = Domains; diff --git a/lib/services/eventgridManagement/lib/operations/eventSubscriptions.js b/lib/services/eventgridManagement/lib/operations/eventSubscriptions.js index d96562e777..dd8e35341a 100644 --- a/lib/services/eventgridManagement/lib/operations/eventSubscriptions.js +++ b/lib/services/eventgridManagement/lib/operations/eventSubscriptions.js @@ -222,11 +222,17 @@ function _get(scope, eventSubscriptionName, options, callback) { * filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionInfo.filter.advancedFilters] A list of + * advanced filters. + * * @param {array} [eventSubscriptionInfo.labels] List of user defined labels. * + * @param {date} [eventSubscriptionInfo.expirationTimeUtc] Expiration time of + * the event subscription. + * * @param {string} [eventSubscriptionInfo.eventDeliverySchema] The event * delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionInfo.retryPolicy] The retry policy for * events. This can be used to configure maximum number of delivery attempts @@ -443,12 +449,18 @@ function _deleteMethod(scope, eventSubscriptionName, options, callback) { * if the SubjectBeginsWith and SubjectEndsWith properties of the filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionUpdateParameters.filter.advancedFilters] A + * list of advanced filters. + * * @param {array} [eventSubscriptionUpdateParameters.labels] List of user * defined labels. * + * @param {date} [eventSubscriptionUpdateParameters.expirationTimeUtc] + * Information about the expiration time for the event subscription. + * * @param {string} [eventSubscriptionUpdateParameters.eventDeliverySchema] The * event delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionUpdateParameters.retryPolicy] The retry * policy for events. This can be used to configure maximum number of delivery @@ -2031,6 +2043,162 @@ function _listByResource(resourceGroupName, providerNamespace, resourceTypeName, }); } +/** + * @summary List all event subscriptions for a specific domain topic + * + * List all event subscriptions that have been created for a specific domain + * topic + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the top level domain + * + * @param {string} topicName Name of the domain topic + * + * @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 EventSubscriptionsListResult} 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 _listByDomainTopic(resourceGroupName, domainName, topicName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (domainName === null || domainName === undefined || typeof domainName.valueOf() !== 'string') { + throw new Error('domainName cannot be null or undefined and it must be of type string.'); + } + if (topicName === null || topicName === undefined || typeof topicName.valueOf() !== 'string') { + throw new Error('topicName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/providers/Microsoft.EventGrid/eventSubscriptions'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{domainName}', encodeURIComponent(domainName)); + requestUrl = requestUrl.replace('{topicName}', encodeURIComponent(topicName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['EventSubscriptionsListResult']().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); + }); +} + /** * @summary Create or update an event subscription * @@ -2086,11 +2254,17 @@ function _listByResource(resourceGroupName, providerNamespace, resourceTypeName, * filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionInfo.filter.advancedFilters] A list of + * advanced filters. + * * @param {array} [eventSubscriptionInfo.labels] List of user defined labels. * + * @param {date} [eventSubscriptionInfo.expirationTimeUtc] Expiration time of + * the event subscription. + * * @param {string} [eventSubscriptionInfo.eventDeliverySchema] The event * delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionInfo.retryPolicy] The retry policy for * events. This can be used to configure maximum number of delivery attempts @@ -2447,12 +2621,18 @@ function _beginDeleteMethod(scope, eventSubscriptionName, options, callback) { * if the SubjectBeginsWith and SubjectEndsWith properties of the filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionUpdateParameters.filter.advancedFilters] A + * list of advanced filters. + * * @param {array} [eventSubscriptionUpdateParameters.labels] List of user * defined labels. * + * @param {date} [eventSubscriptionUpdateParameters.expirationTimeUtc] + * Information about the expiration time for the event subscription. + * * @param {string} [eventSubscriptionUpdateParameters.eventDeliverySchema] The * event delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionUpdateParameters.retryPolicy] The retry * policy for events. This can be used to configure maximum number of delivery @@ -2646,6 +2826,7 @@ class EventSubscriptions { this._listRegionalBySubscriptionForTopicType = _listRegionalBySubscriptionForTopicType; this._listRegionalByResourceGroupForTopicType = _listRegionalByResourceGroupForTopicType; this._listByResource = _listByResource; + this._listByDomainTopic = _listByDomainTopic; this._beginCreateOrUpdate = _beginCreateOrUpdate; this._beginDeleteMethod = _beginDeleteMethod; this._beginUpdate = _beginUpdate; @@ -2814,11 +2995,17 @@ class EventSubscriptions { * filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionInfo.filter.advancedFilters] A list of + * advanced filters. + * * @param {array} [eventSubscriptionInfo.labels] List of user defined labels. * + * @param {date} [eventSubscriptionInfo.expirationTimeUtc] Expiration time of + * the event subscription. + * * @param {string} [eventSubscriptionInfo.eventDeliverySchema] The event * delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionInfo.retryPolicy] The retry policy for * events. This can be used to configure maximum number of delivery attempts @@ -2916,11 +3103,17 @@ class EventSubscriptions { * filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionInfo.filter.advancedFilters] A list of + * advanced filters. + * * @param {array} [eventSubscriptionInfo.labels] List of user defined labels. * + * @param {date} [eventSubscriptionInfo.expirationTimeUtc] Expiration time of + * the event subscription. + * * @param {string} [eventSubscriptionInfo.eventDeliverySchema] The event * delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionInfo.retryPolicy] The retry policy for * events. This can be used to configure maximum number of delivery attempts @@ -3146,12 +3339,18 @@ class EventSubscriptions { * if the SubjectBeginsWith and SubjectEndsWith properties of the filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionUpdateParameters.filter.advancedFilters] A + * list of advanced filters. + * * @param {array} [eventSubscriptionUpdateParameters.labels] List of user * defined labels. * + * @param {date} [eventSubscriptionUpdateParameters.expirationTimeUtc] + * Information about the expiration time for the event subscription. + * * @param {string} [eventSubscriptionUpdateParameters.eventDeliverySchema] The * event delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionUpdateParameters.retryPolicy] The retry * policy for events. This can be used to configure maximum number of delivery @@ -3251,12 +3450,18 @@ class EventSubscriptions { * if the SubjectBeginsWith and SubjectEndsWith properties of the filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionUpdateParameters.filter.advancedFilters] A + * list of advanced filters. + * * @param {array} [eventSubscriptionUpdateParameters.labels] List of user * defined labels. * + * @param {date} [eventSubscriptionUpdateParameters.expirationTimeUtc] + * Information about the expiration time for the event subscription. + * * @param {string} [eventSubscriptionUpdateParameters.eventDeliverySchema] The * event delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionUpdateParameters.retryPolicy] The retry * policy for events. This can be used to configure maximum number of delivery @@ -4282,6 +4487,105 @@ class EventSubscriptions { } } + /** + * @summary List all event subscriptions for a specific domain topic + * + * List all event subscriptions that have been created for a specific domain + * topic + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the top level domain + * + * @param {string} topicName Name of the domain topic + * + * @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. + */ + listByDomainTopicWithHttpOperationResponse(resourceGroupName, domainName, topicName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDomainTopic(resourceGroupName, domainName, topicName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary List all event subscriptions for a specific domain topic + * + * List all event subscriptions that have been created for a specific domain + * topic + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the top level domain + * + * @param {string} topicName Name of the domain topic + * + * @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 {EventSubscriptionsListResult} - 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 EventSubscriptionsListResult} 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. + */ + listByDomainTopic(resourceGroupName, domainName, topicName, 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._listByDomainTopic(resourceGroupName, domainName, topicName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDomainTopic(resourceGroupName, domainName, topicName, options, optionalCallback); + } + } + /** * @summary Create or update an event subscription * @@ -4337,11 +4641,17 @@ class EventSubscriptions { * filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionInfo.filter.advancedFilters] A list of + * advanced filters. + * * @param {array} [eventSubscriptionInfo.labels] List of user defined labels. * + * @param {date} [eventSubscriptionInfo.expirationTimeUtc] Expiration time of + * the event subscription. + * * @param {string} [eventSubscriptionInfo.eventDeliverySchema] The event * delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionInfo.retryPolicy] The retry policy for * events. This can be used to configure maximum number of delivery attempts @@ -4439,11 +4749,17 @@ class EventSubscriptions { * filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionInfo.filter.advancedFilters] A list of + * advanced filters. + * * @param {array} [eventSubscriptionInfo.labels] List of user defined labels. * + * @param {date} [eventSubscriptionInfo.expirationTimeUtc] Expiration time of + * the event subscription. + * * @param {string} [eventSubscriptionInfo.eventDeliverySchema] The event * delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionInfo.retryPolicy] The retry policy for * events. This can be used to configure maximum number of delivery attempts @@ -4669,12 +4985,18 @@ class EventSubscriptions { * if the SubjectBeginsWith and SubjectEndsWith properties of the filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionUpdateParameters.filter.advancedFilters] A + * list of advanced filters. + * * @param {array} [eventSubscriptionUpdateParameters.labels] List of user * defined labels. * + * @param {date} [eventSubscriptionUpdateParameters.expirationTimeUtc] + * Information about the expiration time for the event subscription. + * * @param {string} [eventSubscriptionUpdateParameters.eventDeliverySchema] The * event delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionUpdateParameters.retryPolicy] The retry * policy for events. This can be used to configure maximum number of delivery @@ -4774,12 +5096,18 @@ class EventSubscriptions { * if the SubjectBeginsWith and SubjectEndsWith properties of the filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionUpdateParameters.filter.advancedFilters] A + * list of advanced filters. + * * @param {array} [eventSubscriptionUpdateParameters.labels] List of user * defined labels. * + * @param {date} [eventSubscriptionUpdateParameters.expirationTimeUtc] + * Information about the expiration time for the event subscription. + * * @param {string} [eventSubscriptionUpdateParameters.eventDeliverySchema] The * event delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionUpdateParameters.retryPolicy] The retry * policy for events. This can be used to configure maximum number of delivery diff --git a/lib/services/eventgridManagement/lib/operations/index.d.ts b/lib/services/eventgridManagement/lib/operations/index.d.ts index 1e46bdfe3e..fa186ffc72 100644 --- a/lib/services/eventgridManagement/lib/operations/index.d.ts +++ b/lib/services/eventgridManagement/lib/operations/index.d.ts @@ -12,6 +12,954 @@ import { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationRes import * as models from '../models'; +/** + * @class + * Domains + * __NOTE__: An instance of this class is automatically created for an + * instance of the EventGridManagementClient. + */ +export interface Domains { + + + /** + * @summary Get a domain + * + * Get properties of a domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, domainName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Get a domain + * + * Get properties of a domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @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 {Domain} - 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. + * + * {Domain} [result] - The deserialized result object if an error did not occur. + * See {@link Domain} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, domainName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, domainName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, domainName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Create a domain + * + * Asynchronously creates a new domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainInfo Domain information + * + * @param {string} [domainInfo.inputSchema] This determines the format that + * Event Grid should expect for incoming events published to the domain. + * Possible values include: 'EventGridSchema', 'CustomEventSchema', + * 'CloudEventV01Schema' + * + * @param {object} [domainInfo.inputSchemaMapping] Information about the + * InputSchemaMapping which specified the info about mapping event payload. + * + * @param {string} domainInfo.inputSchemaMapping.inputSchemaMappingType + * Polymorphic Discriminator + * + * @param {string} domainInfo.location Location of the resource + * + * @param {object} [domainInfo.tags] Tags of the resource + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, domainName: string, domainInfo: models.Domain, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Create a domain + * + * Asynchronously creates a new domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainInfo Domain information + * + * @param {string} [domainInfo.inputSchema] This determines the format that + * Event Grid should expect for incoming events published to the domain. + * Possible values include: 'EventGridSchema', 'CustomEventSchema', + * 'CloudEventV01Schema' + * + * @param {object} [domainInfo.inputSchemaMapping] Information about the + * InputSchemaMapping which specified the info about mapping event payload. + * + * @param {string} domainInfo.inputSchemaMapping.inputSchemaMappingType + * Polymorphic Discriminator + * + * @param {string} domainInfo.location Location of the resource + * + * @param {object} [domainInfo.tags] Tags of the resource + * + * @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 {Domain} - 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. + * + * {Domain} [result] - The deserialized result object if an error did not occur. + * See {@link Domain} 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. + */ + createOrUpdate(resourceGroupName: string, domainName: string, domainInfo: models.Domain, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, domainName: string, domainInfo: models.Domain, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, domainName: string, domainInfo: models.Domain, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Delete a domain + * + * Delete existing domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, domainName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Delete a domain + * + * Delete existing domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, domainName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, domainName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, domainName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Update a domain + * + * Asynchronously updates a domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainUpdateParameters Domain update information + * + * @param {object} [domainUpdateParameters.tags] Tags of the domains resource + * + * @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. + */ + updateWithHttpOperationResponse(resourceGroupName: string, domainName: string, domainUpdateParameters: models.DomainUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Update a domain + * + * Asynchronously updates a domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainUpdateParameters Domain update information + * + * @param {object} [domainUpdateParameters.tags] Tags of the domains resource + * + * @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 {Domain} - 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. + * + * {Domain} [result] - The deserialized result object if an error did not occur. + * See {@link Domain} 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. + */ + update(resourceGroupName: string, domainName: string, domainUpdateParameters: models.DomainUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, domainName: string, domainUpdateParameters: models.DomainUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, domainName: string, domainUpdateParameters: models.DomainUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List domains under an Azure subscription + * + * List all the domains under an Azure subscription + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listBySubscriptionWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List domains under an Azure subscription + * + * List all the domains under an Azure subscription + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DomainsListResult} - 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. + * + * {DomainsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DomainsListResult} 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. + */ + listBySubscription(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscription(callback: ServiceCallback): void; + listBySubscription(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List domains under a resource group + * + * List all the domains under a resource group + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List domains under a resource group + * + * List all the domains under a resource group + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DomainsListResult} - 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. + * + * {DomainsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DomainsListResult} 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. + */ + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List keys for a domain + * + * List the two keys used to publish to a domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @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. + */ + listSharedAccessKeysWithHttpOperationResponse(resourceGroupName: string, domainName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List keys for a domain + * + * List the two keys used to publish to a domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @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 {DomainSharedAccessKeys} - 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. + * + * {DomainSharedAccessKeys} [result] - The deserialized result object if an error did not occur. + * See {@link DomainSharedAccessKeys} 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. + */ + listSharedAccessKeys(resourceGroupName: string, domainName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listSharedAccessKeys(resourceGroupName: string, domainName: string, callback: ServiceCallback): void; + listSharedAccessKeys(resourceGroupName: string, domainName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Regenerate key for a domain + * + * Regenerate a shared access key for a domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} regenerateKeyRequest Request body to regenerate key + * + * @param {string} regenerateKeyRequest.keyName Key name to regenerate key1 or + * key2 + * + * @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. + */ + regenerateKeyWithHttpOperationResponse(resourceGroupName: string, domainName: string, regenerateKeyRequest: models.DomainRegenerateKeyRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Regenerate key for a domain + * + * Regenerate a shared access key for a domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} regenerateKeyRequest Request body to regenerate key + * + * @param {string} regenerateKeyRequest.keyName Key name to regenerate key1 or + * key2 + * + * @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 {DomainSharedAccessKeys} - 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. + * + * {DomainSharedAccessKeys} [result] - The deserialized result object if an error did not occur. + * See {@link DomainSharedAccessKeys} 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. + */ + regenerateKey(resourceGroupName: string, domainName: string, regenerateKeyRequest: models.DomainRegenerateKeyRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + regenerateKey(resourceGroupName: string, domainName: string, regenerateKeyRequest: models.DomainRegenerateKeyRequest, callback: ServiceCallback): void; + regenerateKey(resourceGroupName: string, domainName: string, regenerateKeyRequest: models.DomainRegenerateKeyRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Create a domain + * + * Asynchronously creates a new domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainInfo Domain information + * + * @param {string} [domainInfo.inputSchema] This determines the format that + * Event Grid should expect for incoming events published to the domain. + * Possible values include: 'EventGridSchema', 'CustomEventSchema', + * 'CloudEventV01Schema' + * + * @param {object} [domainInfo.inputSchemaMapping] Information about the + * InputSchemaMapping which specified the info about mapping event payload. + * + * @param {string} domainInfo.inputSchemaMapping.inputSchemaMappingType + * Polymorphic Discriminator + * + * @param {string} domainInfo.location Location of the resource + * + * @param {object} [domainInfo.tags] Tags of the resource + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, domainName: string, domainInfo: models.Domain, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Create a domain + * + * Asynchronously creates a new domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainInfo Domain information + * + * @param {string} [domainInfo.inputSchema] This determines the format that + * Event Grid should expect for incoming events published to the domain. + * Possible values include: 'EventGridSchema', 'CustomEventSchema', + * 'CloudEventV01Schema' + * + * @param {object} [domainInfo.inputSchemaMapping] Information about the + * InputSchemaMapping which specified the info about mapping event payload. + * + * @param {string} domainInfo.inputSchemaMapping.inputSchemaMappingType + * Polymorphic Discriminator + * + * @param {string} domainInfo.location Location of the resource + * + * @param {object} [domainInfo.tags] Tags of the resource + * + * @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 {Domain} - 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. + * + * {Domain} [result] - The deserialized result object if an error did not occur. + * See {@link Domain} 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. + */ + beginCreateOrUpdate(resourceGroupName: string, domainName: string, domainInfo: models.Domain, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, domainName: string, domainInfo: models.Domain, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, domainName: string, domainInfo: models.Domain, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Delete a domain + * + * Delete existing domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @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. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, domainName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Delete a domain + * + * Delete existing domain + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, domainName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, domainName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, domainName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Update a domain + * + * Asynchronously updates a domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainUpdateParameters Domain update information + * + * @param {object} [domainUpdateParameters.tags] Tags of the domains resource + * + * @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. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, domainName: string, domainUpdateParameters: models.DomainUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Update a domain + * + * Asynchronously updates a domain with the specified parameters. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {object} domainUpdateParameters Domain update information + * + * @param {object} [domainUpdateParameters.tags] Tags of the domains resource + * + * @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 {Domain} - 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. + * + * {Domain} [result] - The deserialized result object if an error did not occur. + * See {@link Domain} 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. + */ + beginUpdate(resourceGroupName: string, domainName: string, domainUpdateParameters: models.DomainUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, domainName: string, domainUpdateParameters: models.DomainUpdateParameters, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, domainName: string, domainUpdateParameters: models.DomainUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DomainTopics + * __NOTE__: An instance of this class is automatically created for an + * instance of the EventGridManagementClient. + */ +export interface DomainTopics { + + + /** + * @summary Get a domain topic + * + * Get properties of a domain topic + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {string} topicName Name of the topic + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, domainName: string, topicName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Get a domain topic + * + * Get properties of a domain topic + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the domain + * + * @param {string} topicName Name of the topic + * + * @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 {DomainTopic} - 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. + * + * {DomainTopic} [result] - The deserialized result object if an error did not occur. + * See {@link DomainTopic} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, domainName: string, topicName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, domainName: string, topicName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, domainName: string, topicName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary List domain topics. + * + * List all the topics in a domain. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Domain 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. + */ + listByDomainWithHttpOperationResponse(resourceGroupName: string, domainName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List domain topics. + * + * List all the topics in a domain. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Domain 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 {DomainTopicsListResult} - 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. + * + * {DomainTopicsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DomainTopicsListResult} 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. + */ + listByDomain(resourceGroupName: string, domainName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDomain(resourceGroupName: string, domainName: string, callback: ServiceCallback): void; + listByDomain(resourceGroupName: string, domainName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + /** * @class * EventSubscriptions @@ -157,11 +1105,17 @@ export interface EventSubscriptions { * filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionInfo.filter.advancedFilters] A list of + * advanced filters. + * * @param {array} [eventSubscriptionInfo.labels] List of user defined labels. * + * @param {date} [eventSubscriptionInfo.expirationTimeUtc] Expiration time of + * the event subscription. + * * @param {string} [eventSubscriptionInfo.eventDeliverySchema] The event * delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionInfo.retryPolicy] The retry policy for * events. This can be used to configure maximum number of delivery attempts @@ -247,11 +1201,17 @@ export interface EventSubscriptions { * filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionInfo.filter.advancedFilters] A list of + * advanced filters. + * * @param {array} [eventSubscriptionInfo.labels] List of user defined labels. * + * @param {date} [eventSubscriptionInfo.expirationTimeUtc] Expiration time of + * the event subscription. + * * @param {string} [eventSubscriptionInfo.eventDeliverySchema] The event * delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionInfo.retryPolicy] The retry policy for * events. This can be used to configure maximum number of delivery attempts @@ -435,12 +1395,18 @@ export interface EventSubscriptions { * if the SubjectBeginsWith and SubjectEndsWith properties of the filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionUpdateParameters.filter.advancedFilters] A + * list of advanced filters. + * * @param {array} [eventSubscriptionUpdateParameters.labels] List of user * defined labels. * + * @param {date} [eventSubscriptionUpdateParameters.expirationTimeUtc] + * Information about the expiration time for the event subscription. + * * @param {string} [eventSubscriptionUpdateParameters.eventDeliverySchema] The * event delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionUpdateParameters.retryPolicy] The retry * policy for events. This can be used to configure maximum number of delivery @@ -528,12 +1494,18 @@ export interface EventSubscriptions { * if the SubjectBeginsWith and SubjectEndsWith properties of the filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionUpdateParameters.filter.advancedFilters] A + * list of advanced filters. + * * @param {array} [eventSubscriptionUpdateParameters.labels] List of user * defined labels. * + * @param {date} [eventSubscriptionUpdateParameters.expirationTimeUtc] + * Information about the expiration time for the event subscription. + * * @param {string} [eventSubscriptionUpdateParameters.eventDeliverySchema] The * event delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionUpdateParameters.retryPolicy] The retry * policy for events. This can be used to configure maximum number of delivery @@ -1274,6 +2246,78 @@ export interface EventSubscriptions { listByResource(resourceGroupName: string, providerNamespace: string, resourceTypeName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * @summary List all event subscriptions for a specific domain topic + * + * List all event subscriptions that have been created for a specific domain + * topic + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the top level domain + * + * @param {string} topicName Name of the domain topic + * + * @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. + */ + listByDomainTopicWithHttpOperationResponse(resourceGroupName: string, domainName: string, topicName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary List all event subscriptions for a specific domain topic + * + * List all event subscriptions that have been created for a specific domain + * topic + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. + * + * @param {string} domainName Name of the top level domain + * + * @param {string} topicName Name of the domain topic + * + * @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 {EventSubscriptionsListResult} - 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. + * + * {EventSubscriptionsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link EventSubscriptionsListResult} 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. + */ + listByDomainTopic(resourceGroupName: string, domainName: string, topicName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDomainTopic(resourceGroupName: string, domainName: string, topicName: string, callback: ServiceCallback): void; + listByDomainTopic(resourceGroupName: string, domainName: string, topicName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * @summary Create or update an event subscription * @@ -1329,11 +2373,17 @@ export interface EventSubscriptions { * filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionInfo.filter.advancedFilters] A list of + * advanced filters. + * * @param {array} [eventSubscriptionInfo.labels] List of user defined labels. * + * @param {date} [eventSubscriptionInfo.expirationTimeUtc] Expiration time of + * the event subscription. + * * @param {string} [eventSubscriptionInfo.eventDeliverySchema] The event * delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionInfo.retryPolicy] The retry policy for * events. This can be used to configure maximum number of delivery attempts @@ -1419,11 +2469,17 @@ export interface EventSubscriptions { * filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionInfo.filter.advancedFilters] A list of + * advanced filters. + * * @param {array} [eventSubscriptionInfo.labels] List of user defined labels. * + * @param {date} [eventSubscriptionInfo.expirationTimeUtc] Expiration time of + * the event subscription. + * * @param {string} [eventSubscriptionInfo.eventDeliverySchema] The event * delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionInfo.retryPolicy] The retry policy for * events. This can be used to configure maximum number of delivery attempts @@ -1607,12 +2663,18 @@ export interface EventSubscriptions { * if the SubjectBeginsWith and SubjectEndsWith properties of the filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionUpdateParameters.filter.advancedFilters] A + * list of advanced filters. + * * @param {array} [eventSubscriptionUpdateParameters.labels] List of user * defined labels. * + * @param {date} [eventSubscriptionUpdateParameters.expirationTimeUtc] + * Information about the expiration time for the event subscription. + * * @param {string} [eventSubscriptionUpdateParameters.eventDeliverySchema] The * event delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionUpdateParameters.retryPolicy] The retry * policy for events. This can be used to configure maximum number of delivery @@ -1700,12 +2762,18 @@ export interface EventSubscriptions { * if the SubjectBeginsWith and SubjectEndsWith properties of the filter * should be compared in a case sensitive manner. * + * @param {array} [eventSubscriptionUpdateParameters.filter.advancedFilters] A + * list of advanced filters. + * * @param {array} [eventSubscriptionUpdateParameters.labels] List of user * defined labels. * + * @param {date} [eventSubscriptionUpdateParameters.expirationTimeUtc] + * Information about the expiration time for the event subscription. + * * @param {string} [eventSubscriptionUpdateParameters.eventDeliverySchema] The * event delivery schema for the event subscription. Possible values include: - * 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' + * 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' * * @param {object} [eventSubscriptionUpdateParameters.retryPolicy] The retry * policy for events. This can be used to configure maximum number of delivery diff --git a/lib/services/eventgridManagement/lib/operations/index.js b/lib/services/eventgridManagement/lib/operations/index.js index 4b3d0fac59..6ca7250658 100644 --- a/lib/services/eventgridManagement/lib/operations/index.js +++ b/lib/services/eventgridManagement/lib/operations/index.js @@ -14,6 +14,8 @@ 'use strict'; +exports.Domains = require('./domains'); +exports.DomainTopics = require('./domainTopics'); exports.EventSubscriptions = require('./eventSubscriptions'); exports.Operations = require('./operations'); exports.Topics = require('./topics'); diff --git a/lib/services/eventgridManagement/package.json b/lib/services/eventgridManagement/package.json index e9ca34da44..ba85ce0ac7 100644 --- a/lib/services/eventgridManagement/package.json +++ b/lib/services/eventgridManagement/package.json @@ -14,7 +14,7 @@ "license": "MIT", "main": "./lib/eventGridManagementClient.js", "types": "./lib/eventGridManagementClient.d.ts", - "homepage": "https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/eventgridManagement", + "homepage": "https://github.com/azure/azure-sdk-for-node", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-node.git"