azure_mgmt_event_grid 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/azure_mgmt_event_grid.rb +6 -0
  4. data/lib/generated/azure_mgmt_event_grid.rb +57 -0
  5. data/lib/generated/azure_mgmt_event_grid/event_grid_management_client.rb +143 -0
  6. data/lib/generated/azure_mgmt_event_grid/event_subscriptions.rb +1803 -0
  7. data/lib/generated/azure_mgmt_event_grid/models/event_hub_event_subscription_destination.rb +59 -0
  8. data/lib/generated/azure_mgmt_event_grid/models/event_subscription.rb +126 -0
  9. data/lib/generated/azure_mgmt_event_grid/models/event_subscription_destination.rb +46 -0
  10. data/lib/generated/azure_mgmt_event_grid/models/event_subscription_filter.rb +92 -0
  11. data/lib/generated/azure_mgmt_event_grid/models/event_subscription_full_url.rb +45 -0
  12. data/lib/generated/azure_mgmt_event_grid/models/event_subscription_provisioning_state.rb +20 -0
  13. data/lib/generated/azure_mgmt_event_grid/models/event_subscription_update_parameters.rb +78 -0
  14. data/lib/generated/azure_mgmt_event_grid/models/event_subscriptions_list_result.rb +52 -0
  15. data/lib/generated/azure_mgmt_event_grid/models/event_type.rb +88 -0
  16. data/lib/generated/azure_mgmt_event_grid/models/event_types_list_result.rb +52 -0
  17. data/lib/generated/azure_mgmt_event_grid/models/operation.rb +76 -0
  18. data/lib/generated/azure_mgmt_event_grid/models/operation_info.rb +74 -0
  19. data/lib/generated/azure_mgmt_event_grid/models/operation_origin.rb +17 -0
  20. data/lib/generated/azure_mgmt_event_grid/models/operations_list_result.rb +52 -0
  21. data/lib/generated/azure_mgmt_event_grid/models/resource.rb +67 -0
  22. data/lib/generated/azure_mgmt_event_grid/models/resource_region_type.rb +16 -0
  23. data/lib/generated/azure_mgmt_event_grid/models/topic.rb +103 -0
  24. data/lib/generated/azure_mgmt_event_grid/models/topic_provisioning_state.rb +20 -0
  25. data/lib/generated/azure_mgmt_event_grid/models/topic_regenerate_key_request.rb +44 -0
  26. data/lib/generated/azure_mgmt_event_grid/models/topic_shared_access_keys.rb +54 -0
  27. data/lib/generated/azure_mgmt_event_grid/models/topic_type_info.rb +128 -0
  28. data/lib/generated/azure_mgmt_event_grid/models/topic_type_provisioning_state.rb +20 -0
  29. data/lib/generated/azure_mgmt_event_grid/models/topic_types_list_result.rb +52 -0
  30. data/lib/generated/azure_mgmt_event_grid/models/topics_list_result.rb +52 -0
  31. data/lib/generated/azure_mgmt_event_grid/models/tracked_resource.rb +85 -0
  32. data/lib/generated/azure_mgmt_event_grid/models/web_hook_event_subscription_destination.rb +71 -0
  33. data/lib/generated/azure_mgmt_event_grid/module_definition.rb +8 -0
  34. data/lib/generated/azure_mgmt_event_grid/operations.rb +115 -0
  35. data/lib/generated/azure_mgmt_event_grid/topic_types.rb +296 -0
  36. data/lib/generated/azure_mgmt_event_grid/topics.rb +926 -0
  37. data/lib/generated/azure_mgmt_event_grid/version.rb +8 -0
  38. metadata +149 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9af67a07c123ae3ca5f502e7a6f9fd28da494f8f
4
+ data.tar.gz: 6ca314d7ee0bbe87358bbe3b36f2d5a3997a1ff2
5
+ SHA512:
6
+ metadata.gz: 009b14ed5d491b2afa21f89d5e98d4afc8da776c7a562fe56eed4d4f20a961511d8e54fd7504c4e8ca8aca9432bf62c5546541604d7c456ec3cc41e5c5bdd9c4
7
+ data.tar.gz: 570030d900d28e38efb4676dacc278f95b942b9dcec9cd31144709a421eb927b3d65e591b3077402acef22759f4275a01c617fc343b34a9a7810325998b38be5
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ require 'generated/azure_mgmt_event_grid'
6
+ require 'generated/azure_mgmt_event_grid'
@@ -0,0 +1,57 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require 'generated/azure_mgmt_event_grid/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::ARM::EventGrid
23
+ autoload :EventSubscriptions, 'generated/azure_mgmt_event_grid/event_subscriptions.rb'
24
+ autoload :Operations, 'generated/azure_mgmt_event_grid/operations.rb'
25
+ autoload :Topics, 'generated/azure_mgmt_event_grid/topics.rb'
26
+ autoload :TopicTypes, 'generated/azure_mgmt_event_grid/topic_types.rb'
27
+ autoload :EventGridManagementClient, 'generated/azure_mgmt_event_grid/event_grid_management_client.rb'
28
+
29
+ module Models
30
+ autoload :Operation, 'generated/azure_mgmt_event_grid/models/operation.rb'
31
+ autoload :OperationsListResult, 'generated/azure_mgmt_event_grid/models/operations_list_result.rb'
32
+ autoload :EventSubscriptionFilter, 'generated/azure_mgmt_event_grid/models/event_subscription_filter.rb'
33
+ autoload :EventSubscriptionDestination, 'generated/azure_mgmt_event_grid/models/event_subscription_destination.rb'
34
+ autoload :OperationInfo, 'generated/azure_mgmt_event_grid/models/operation_info.rb'
35
+ autoload :EventTypesListResult, 'generated/azure_mgmt_event_grid/models/event_types_list_result.rb'
36
+ autoload :TopicSharedAccessKeys, 'generated/azure_mgmt_event_grid/models/topic_shared_access_keys.rb'
37
+ autoload :EventSubscriptionUpdateParameters, 'generated/azure_mgmt_event_grid/models/event_subscription_update_parameters.rb'
38
+ autoload :Resource, 'generated/azure_mgmt_event_grid/models/resource.rb'
39
+ autoload :EventSubscriptionsListResult, 'generated/azure_mgmt_event_grid/models/event_subscriptions_list_result.rb'
40
+ autoload :EventSubscriptionFullUrl, 'generated/azure_mgmt_event_grid/models/event_subscription_full_url.rb'
41
+ autoload :TopicTypesListResult, 'generated/azure_mgmt_event_grid/models/topic_types_list_result.rb'
42
+ autoload :TopicRegenerateKeyRequest, 'generated/azure_mgmt_event_grid/models/topic_regenerate_key_request.rb'
43
+ autoload :TopicsListResult, 'generated/azure_mgmt_event_grid/models/topics_list_result.rb'
44
+ autoload :WebHookEventSubscriptionDestination, 'generated/azure_mgmt_event_grid/models/web_hook_event_subscription_destination.rb'
45
+ autoload :EventHubEventSubscriptionDestination, 'generated/azure_mgmt_event_grid/models/event_hub_event_subscription_destination.rb'
46
+ autoload :EventSubscription, 'generated/azure_mgmt_event_grid/models/event_subscription.rb'
47
+ autoload :TrackedResource, 'generated/azure_mgmt_event_grid/models/tracked_resource.rb'
48
+ autoload :Topic, 'generated/azure_mgmt_event_grid/models/topic.rb'
49
+ autoload :EventType, 'generated/azure_mgmt_event_grid/models/event_type.rb'
50
+ autoload :TopicTypeInfo, 'generated/azure_mgmt_event_grid/models/topic_type_info.rb'
51
+ autoload :EventSubscriptionProvisioningState, 'generated/azure_mgmt_event_grid/models/event_subscription_provisioning_state.rb'
52
+ autoload :OperationOrigin, 'generated/azure_mgmt_event_grid/models/operation_origin.rb'
53
+ autoload :TopicProvisioningState, 'generated/azure_mgmt_event_grid/models/topic_provisioning_state.rb'
54
+ autoload :ResourceRegionType, 'generated/azure_mgmt_event_grid/models/resource_region_type.rb'
55
+ autoload :TopicTypeProvisioningState, 'generated/azure_mgmt_event_grid/models/topic_type_provisioning_state.rb'
56
+ end
57
+ end
@@ -0,0 +1,143 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::EventGrid
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class EventGridManagementClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] Subscription credentials that uniquely identify a
21
+ # Microsoft Azure subscription. The subscription ID forms part of the URI
22
+ # for every service call.
23
+ attr_accessor :subscription_id
24
+
25
+ # @return [String] Version of the API to be used with the client request.
26
+ attr_reader :api_version
27
+
28
+ # @return [String] Gets or sets the preferred language for the response.
29
+ attr_accessor :accept_language
30
+
31
+ # @return [Integer] Gets or sets the retry timeout in seconds for Long
32
+ # Running Operations. Default value is 30.
33
+ attr_accessor :long_running_operation_retry_timeout
34
+
35
+ # @return [Boolean] When set to true a unique x-ms-client-request-id value
36
+ # is generated and included in each request. Default is true.
37
+ attr_accessor :generate_client_request_id
38
+
39
+ # @return [EventSubscriptions] event_subscriptions
40
+ attr_reader :event_subscriptions
41
+
42
+ # @return [Operations] operations
43
+ attr_reader :operations
44
+
45
+ # @return [Topics] topics
46
+ attr_reader :topics
47
+
48
+ # @return [TopicTypes] topic_types
49
+ attr_reader :topic_types
50
+
51
+ #
52
+ # Creates initializes a new instance of the EventGridManagementClient class.
53
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
54
+ # @param base_url [String] the base URI of the service.
55
+ # @param options [Array] filters to be applied to the HTTP requests.
56
+ #
57
+ def initialize(credentials = nil, base_url = nil, options = nil)
58
+ super(credentials, options)
59
+ @base_url = base_url || 'https://management.azure.com'
60
+
61
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
62
+ @credentials = credentials
63
+
64
+ @event_subscriptions = EventSubscriptions.new(self)
65
+ @operations = Operations.new(self)
66
+ @topics = Topics.new(self)
67
+ @topic_types = TopicTypes.new(self)
68
+ @api_version = '2017-09-15-preview'
69
+ @accept_language = 'en-US'
70
+ @long_running_operation_retry_timeout = 30
71
+ @generate_client_request_id = true
72
+ add_telemetry
73
+ end
74
+
75
+ #
76
+ # Makes a request and returns the body of the response.
77
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
78
+ # @param path [String] the path, relative to {base_url}.
79
+ # @param options [Hash{String=>String}] specifying any request options like :body.
80
+ # @return [Hash{String=>String}] containing the body of the response.
81
+ # Example:
82
+ #
83
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
84
+ # path = "/path"
85
+ # options = {
86
+ # body: request_content,
87
+ # query_params: {'api-version' => '2016-02-01'}
88
+ # }
89
+ # result = @client.make_request(:put, path, options)
90
+ #
91
+ def make_request(method, path, options = {})
92
+ result = make_request_with_http_info(method, path, options)
93
+ result.body unless result.nil?
94
+ end
95
+
96
+ #
97
+ # Makes a request and returns the operation response.
98
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
99
+ # @param path [String] the path, relative to {base_url}.
100
+ # @param options [Hash{String=>String}] specifying any request options like :body.
101
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
102
+ #
103
+ def make_request_with_http_info(method, path, options = {})
104
+ result = make_request_async(method, path, options).value!
105
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
106
+ result
107
+ end
108
+
109
+ #
110
+ # Makes a request asynchronously.
111
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
112
+ # @param path [String] the path, relative to {base_url}.
113
+ # @param options [Hash{String=>String}] specifying any request options like :body.
114
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
115
+ #
116
+ def make_request_async(method, path, options = {})
117
+ fail ArgumentError, 'method is nil' if method.nil?
118
+ fail ArgumentError, 'path is nil' if path.nil?
119
+
120
+ request_url = options[:base_url] || @base_url
121
+
122
+ request_headers = @request_headers
123
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
124
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
125
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
126
+
127
+ super(request_url, method, path, options)
128
+ end
129
+
130
+
131
+ private
132
+ #
133
+ # Adds telemetry information.
134
+ #
135
+ def add_telemetry
136
+ sdk_information = 'azure_mgmt_event_grid'
137
+ if defined? Azure::ARM::EventGrid::VERSION
138
+ sdk_information = "#{sdk_information}/#{Azure::ARM::EventGrid::VERSION}"
139
+ end
140
+ add_user_agent_information(sdk_information)
141
+ end
142
+ end
143
+ end
@@ -0,0 +1,1803 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::EventGrid
7
+ #
8
+ # Azure EventGrid Management Client
9
+ #
10
+ class EventSubscriptions
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the EventSubscriptions class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [EventGridManagementClient] reference to the EventGridManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Get an event subscription
26
+ #
27
+ # Get properties of an event subscription
28
+ #
29
+ # @param scope [String] The scope of the event subscription. The scope can be a
30
+ # subscription, or a resource group, or a top level resource belonging to a
31
+ # resource provider namespace, or an EventGrid topic. For example, use
32
+ # '/subscriptions/{subscriptionId}/' for a subscription,
33
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
34
+ # resource group, and
35
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
36
+ # for a resource, and
37
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
38
+ # for an EventGrid topic.
39
+ # @param event_subscription_name [String] Name of the event subscription
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [EventSubscription] operation results.
44
+ #
45
+ def get(scope, event_subscription_name, custom_headers = nil)
46
+ response = get_async(scope, event_subscription_name, custom_headers).value!
47
+ response.body unless response.nil?
48
+ end
49
+
50
+ #
51
+ # Get an event subscription
52
+ #
53
+ # Get properties of an event subscription
54
+ #
55
+ # @param scope [String] The scope of the event subscription. The scope can be a
56
+ # subscription, or a resource group, or a top level resource belonging to a
57
+ # resource provider namespace, or an EventGrid topic. For example, use
58
+ # '/subscriptions/{subscriptionId}/' for a subscription,
59
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
60
+ # resource group, and
61
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
62
+ # for a resource, and
63
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
64
+ # for an EventGrid topic.
65
+ # @param event_subscription_name [String] Name of the event subscription
66
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
67
+ # will be added to the HTTP request.
68
+ #
69
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
70
+ #
71
+ def get_with_http_info(scope, event_subscription_name, custom_headers = nil)
72
+ get_async(scope, event_subscription_name, custom_headers).value!
73
+ end
74
+
75
+ #
76
+ # Get an event subscription
77
+ #
78
+ # Get properties of an event subscription
79
+ #
80
+ # @param scope [String] The scope of the event subscription. The scope can be a
81
+ # subscription, or a resource group, or a top level resource belonging to a
82
+ # resource provider namespace, or an EventGrid topic. For example, use
83
+ # '/subscriptions/{subscriptionId}/' for a subscription,
84
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
85
+ # resource group, and
86
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
87
+ # for a resource, and
88
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
89
+ # for an EventGrid topic.
90
+ # @param event_subscription_name [String] Name of the event subscription
91
+ # @param [Hash{String => String}] A hash of custom headers that will be added
92
+ # to the HTTP request.
93
+ #
94
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
95
+ #
96
+ def get_async(scope, event_subscription_name, custom_headers = nil)
97
+ fail ArgumentError, 'scope is nil' if scope.nil?
98
+ fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil?
99
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
100
+
101
+
102
+ request_headers = {}
103
+
104
+ # Set Headers
105
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
106
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
107
+ path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'
108
+
109
+ request_url = @base_url || @client.base_url
110
+
111
+ options = {
112
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
113
+ path_params: {'eventSubscriptionName' => event_subscription_name},
114
+ skip_encoding_path_params: {'scope' => scope},
115
+ query_params: {'api-version' => @client.api_version},
116
+ headers: request_headers.merge(custom_headers || {}),
117
+ base_url: request_url
118
+ }
119
+ promise = @client.make_request_async(:get, path_template, options)
120
+
121
+ promise = promise.then do |result|
122
+ http_response = result.response
123
+ status_code = http_response.status
124
+ response_content = http_response.body
125
+ unless status_code == 200
126
+ error_model = JSON.load(response_content)
127
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
128
+ end
129
+
130
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
131
+ # Deserialize Response
132
+ if status_code == 200
133
+ begin
134
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
135
+ result_mapper = Azure::ARM::EventGrid::Models::EventSubscription.mapper()
136
+ result.body = @client.deserialize(result_mapper, parsed_response)
137
+ rescue Exception => e
138
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
139
+ end
140
+ end
141
+
142
+ result
143
+ end
144
+
145
+ promise.execute
146
+ end
147
+
148
+ #
149
+ # Create an event subscription
150
+ #
151
+ # Asynchronously creates a new event subscription to the specified scope.
152
+ # Existing event subscriptions cannot be updated with this API and should
153
+ # instead use the Update event subscription API.
154
+ #
155
+ # @param scope [String] The scope of the resource to which the event
156
+ # subscription needs to be created. The scope can be a subscription, or a
157
+ # resource group, or a top level resource belonging to a resource provider
158
+ # namespace, or an EventGrid topic. For example, use
159
+ # '/subscriptions/{subscriptionId}/' for a subscription,
160
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
161
+ # resource group, and
162
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
163
+ # for a resource, and
164
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
165
+ # for an EventGrid topic.
166
+ # @param event_subscription_name [String] Name of the event subscription to be
167
+ # created. Event subscription names must be between 3 and 64 characters in
168
+ # length and use alphanumeric letters only.
169
+ # @param event_subscription_info [EventSubscription] Event subscription
170
+ # properties containing the destination and filter information
171
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
172
+ # will be added to the HTTP request.
173
+ #
174
+ # @return [EventSubscription] operation results.
175
+ #
176
+ def create(scope, event_subscription_name, event_subscription_info, custom_headers = nil)
177
+ response = create_async(scope, event_subscription_name, event_subscription_info, custom_headers).value!
178
+ response.body unless response.nil?
179
+ end
180
+
181
+ #
182
+ # @param scope [String] The scope of the resource to which the event
183
+ # subscription needs to be created. The scope can be a subscription, or a
184
+ # resource group, or a top level resource belonging to a resource provider
185
+ # namespace, or an EventGrid topic. For example, use
186
+ # '/subscriptions/{subscriptionId}/' for a subscription,
187
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
188
+ # resource group, and
189
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
190
+ # for a resource, and
191
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
192
+ # for an EventGrid topic.
193
+ # @param event_subscription_name [String] Name of the event subscription to be
194
+ # created. Event subscription names must be between 3 and 64 characters in
195
+ # length and use alphanumeric letters only.
196
+ # @param event_subscription_info [EventSubscription] Event subscription
197
+ # properties containing the destination and filter information
198
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
199
+ # will be added to the HTTP request.
200
+ #
201
+ # @return [Concurrent::Promise] promise which provides async access to http
202
+ # response.
203
+ #
204
+ def create_async(scope, event_subscription_name, event_subscription_info, custom_headers = nil)
205
+ # Send request
206
+ promise = begin_create_async(scope, event_subscription_name, event_subscription_info, custom_headers)
207
+
208
+ promise = promise.then do |response|
209
+ # Defining deserialization method.
210
+ deserialize_method = lambda do |parsed_response|
211
+ result_mapper = Azure::ARM::EventGrid::Models::EventSubscription.mapper()
212
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
213
+ end
214
+
215
+ # Waiting for response.
216
+ @client.get_long_running_operation_result(response, deserialize_method)
217
+ end
218
+
219
+ promise
220
+ end
221
+
222
+ #
223
+ # Delete an event subscription
224
+ #
225
+ # Delete an existing event subscription
226
+ #
227
+ # @param scope [String] The scope of the event subscription. The scope can be a
228
+ # subscription, or a resource group, or a top level resource belonging to a
229
+ # resource provider namespace, or an EventGrid topic. For example, use
230
+ # '/subscriptions/{subscriptionId}/' for a subscription,
231
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
232
+ # resource group, and
233
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
234
+ # for a resource, and
235
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
236
+ # for an EventGrid topic.
237
+ # @param event_subscription_name [String] Name of the event subscription
238
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
239
+ # will be added to the HTTP request.
240
+ #
241
+ def delete(scope, event_subscription_name, custom_headers = nil)
242
+ response = delete_async(scope, event_subscription_name, custom_headers).value!
243
+ nil
244
+ end
245
+
246
+ #
247
+ # @param scope [String] The scope of the event subscription. The scope can be a
248
+ # subscription, or a resource group, or a top level resource belonging to a
249
+ # resource provider namespace, or an EventGrid topic. For example, use
250
+ # '/subscriptions/{subscriptionId}/' for a subscription,
251
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
252
+ # resource group, and
253
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
254
+ # for a resource, and
255
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
256
+ # for an EventGrid topic.
257
+ # @param event_subscription_name [String] Name of the event subscription
258
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
259
+ # will be added to the HTTP request.
260
+ #
261
+ # @return [Concurrent::Promise] promise which provides async access to http
262
+ # response.
263
+ #
264
+ def delete_async(scope, event_subscription_name, custom_headers = nil)
265
+ # Send request
266
+ promise = begin_delete_async(scope, event_subscription_name, custom_headers)
267
+
268
+ promise = promise.then do |response|
269
+ # Defining deserialization method.
270
+ deserialize_method = lambda do |parsed_response|
271
+ end
272
+
273
+ # Waiting for response.
274
+ @client.get_long_running_operation_result(response, deserialize_method)
275
+ end
276
+
277
+ promise
278
+ end
279
+
280
+ #
281
+ # Update an event subscription
282
+ #
283
+ # Asynchronously updates an existing event subscription.
284
+ #
285
+ # @param scope [String] The scope of existing event subscription. The scope can
286
+ # be a subscription, or a resource group, or a top level resource belonging to
287
+ # a resource provider namespace, or an EventGrid topic. For example, use
288
+ # '/subscriptions/{subscriptionId}/' for a subscription,
289
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
290
+ # resource group, and
291
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
292
+ # for a resource, and
293
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
294
+ # for an EventGrid topic.
295
+ # @param event_subscription_name [String] Name of the event subscription to be
296
+ # created
297
+ # @param event_subscription_update_parameters
298
+ # [EventSubscriptionUpdateParameters] Updated event subscription information
299
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
300
+ # will be added to the HTTP request.
301
+ #
302
+ # @return [EventSubscription] operation results.
303
+ #
304
+ def update(scope, event_subscription_name, event_subscription_update_parameters, custom_headers = nil)
305
+ response = update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers).value!
306
+ response.body unless response.nil?
307
+ end
308
+
309
+ #
310
+ # @param scope [String] The scope of existing event subscription. The scope can
311
+ # be a subscription, or a resource group, or a top level resource belonging to
312
+ # a resource provider namespace, or an EventGrid topic. For example, use
313
+ # '/subscriptions/{subscriptionId}/' for a subscription,
314
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
315
+ # resource group, and
316
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
317
+ # for a resource, and
318
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
319
+ # for an EventGrid topic.
320
+ # @param event_subscription_name [String] Name of the event subscription to be
321
+ # created
322
+ # @param event_subscription_update_parameters
323
+ # [EventSubscriptionUpdateParameters] Updated event subscription information
324
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
325
+ # will be added to the HTTP request.
326
+ #
327
+ # @return [Concurrent::Promise] promise which provides async access to http
328
+ # response.
329
+ #
330
+ def update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers = nil)
331
+ # Send request
332
+ promise = begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers)
333
+
334
+ promise = promise.then do |response|
335
+ # Defining deserialization method.
336
+ deserialize_method = lambda do |parsed_response|
337
+ result_mapper = Azure::ARM::EventGrid::Models::EventSubscription.mapper()
338
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
339
+ end
340
+
341
+ # Waiting for response.
342
+ @client.get_long_running_operation_result(response, deserialize_method)
343
+ end
344
+
345
+ promise
346
+ end
347
+
348
+ #
349
+ # Get full URL of an event subscription
350
+ #
351
+ # Get the full endpoint URL for an event subscription
352
+ #
353
+ # @param scope [String] The scope of the event subscription. The scope can be a
354
+ # subscription, or a resource group, or a top level resource belonging to a
355
+ # resource provider namespace, or an EventGrid topic. For example, use
356
+ # '/subscriptions/{subscriptionId}/' for a subscription,
357
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
358
+ # resource group, and
359
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
360
+ # for a resource, and
361
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
362
+ # for an EventGrid topic.
363
+ # @param event_subscription_name [String] Name of the event subscription
364
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
365
+ # will be added to the HTTP request.
366
+ #
367
+ # @return [EventSubscriptionFullUrl] operation results.
368
+ #
369
+ def get_full_url(scope, event_subscription_name, custom_headers = nil)
370
+ response = get_full_url_async(scope, event_subscription_name, custom_headers).value!
371
+ response.body unless response.nil?
372
+ end
373
+
374
+ #
375
+ # Get full URL of an event subscription
376
+ #
377
+ # Get the full endpoint URL for an event subscription
378
+ #
379
+ # @param scope [String] The scope of the event subscription. The scope can be a
380
+ # subscription, or a resource group, or a top level resource belonging to a
381
+ # resource provider namespace, or an EventGrid topic. For example, use
382
+ # '/subscriptions/{subscriptionId}/' for a subscription,
383
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
384
+ # resource group, and
385
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
386
+ # for a resource, and
387
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
388
+ # for an EventGrid topic.
389
+ # @param event_subscription_name [String] Name of the event subscription
390
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
391
+ # will be added to the HTTP request.
392
+ #
393
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
394
+ #
395
+ def get_full_url_with_http_info(scope, event_subscription_name, custom_headers = nil)
396
+ get_full_url_async(scope, event_subscription_name, custom_headers).value!
397
+ end
398
+
399
+ #
400
+ # Get full URL of an event subscription
401
+ #
402
+ # Get the full endpoint URL for an event subscription
403
+ #
404
+ # @param scope [String] The scope of the event subscription. The scope can be a
405
+ # subscription, or a resource group, or a top level resource belonging to a
406
+ # resource provider namespace, or an EventGrid topic. For example, use
407
+ # '/subscriptions/{subscriptionId}/' for a subscription,
408
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
409
+ # resource group, and
410
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
411
+ # for a resource, and
412
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
413
+ # for an EventGrid topic.
414
+ # @param event_subscription_name [String] Name of the event subscription
415
+ # @param [Hash{String => String}] A hash of custom headers that will be added
416
+ # to the HTTP request.
417
+ #
418
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
419
+ #
420
+ def get_full_url_async(scope, event_subscription_name, custom_headers = nil)
421
+ fail ArgumentError, 'scope is nil' if scope.nil?
422
+ fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil?
423
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
424
+
425
+
426
+ request_headers = {}
427
+
428
+ # Set Headers
429
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
430
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
431
+ path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl'
432
+
433
+ request_url = @base_url || @client.base_url
434
+
435
+ options = {
436
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
437
+ path_params: {'eventSubscriptionName' => event_subscription_name},
438
+ skip_encoding_path_params: {'scope' => scope},
439
+ query_params: {'api-version' => @client.api_version},
440
+ headers: request_headers.merge(custom_headers || {}),
441
+ base_url: request_url
442
+ }
443
+ promise = @client.make_request_async(:post, path_template, options)
444
+
445
+ promise = promise.then do |result|
446
+ http_response = result.response
447
+ status_code = http_response.status
448
+ response_content = http_response.body
449
+ unless status_code == 200
450
+ error_model = JSON.load(response_content)
451
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
452
+ end
453
+
454
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
455
+ # Deserialize Response
456
+ if status_code == 200
457
+ begin
458
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
459
+ result_mapper = Azure::ARM::EventGrid::Models::EventSubscriptionFullUrl.mapper()
460
+ result.body = @client.deserialize(result_mapper, parsed_response)
461
+ rescue Exception => e
462
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
463
+ end
464
+ end
465
+
466
+ result
467
+ end
468
+
469
+ promise.execute
470
+ end
471
+
472
+ #
473
+ # Get an aggregated list of all global event subscriptions under an Azure
474
+ # subscription
475
+ #
476
+ # List all aggregated global event subscriptions under a specific Azure
477
+ # subscription
478
+ #
479
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
480
+ # will be added to the HTTP request.
481
+ #
482
+ # @return [EventSubscriptionsListResult] operation results.
483
+ #
484
+ def list_global_by_subscription(custom_headers = nil)
485
+ response = list_global_by_subscription_async(custom_headers).value!
486
+ response.body unless response.nil?
487
+ end
488
+
489
+ #
490
+ # Get an aggregated list of all global event subscriptions under an Azure
491
+ # subscription
492
+ #
493
+ # List all aggregated global event subscriptions under a specific Azure
494
+ # subscription
495
+ #
496
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
497
+ # will be added to the HTTP request.
498
+ #
499
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
500
+ #
501
+ def list_global_by_subscription_with_http_info(custom_headers = nil)
502
+ list_global_by_subscription_async(custom_headers).value!
503
+ end
504
+
505
+ #
506
+ # Get an aggregated list of all global event subscriptions under an Azure
507
+ # subscription
508
+ #
509
+ # List all aggregated global event subscriptions under a specific Azure
510
+ # subscription
511
+ #
512
+ # @param [Hash{String => String}] A hash of custom headers that will be added
513
+ # to the HTTP request.
514
+ #
515
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
516
+ #
517
+ def list_global_by_subscription_async(custom_headers = nil)
518
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
519
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
520
+
521
+
522
+ request_headers = {}
523
+
524
+ # Set Headers
525
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
526
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
527
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions'
528
+
529
+ request_url = @base_url || @client.base_url
530
+
531
+ options = {
532
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
533
+ path_params: {'subscriptionId' => @client.subscription_id},
534
+ query_params: {'api-version' => @client.api_version},
535
+ headers: request_headers.merge(custom_headers || {}),
536
+ base_url: request_url
537
+ }
538
+ promise = @client.make_request_async(:get, path_template, options)
539
+
540
+ promise = promise.then do |result|
541
+ http_response = result.response
542
+ status_code = http_response.status
543
+ response_content = http_response.body
544
+ unless status_code == 200
545
+ error_model = JSON.load(response_content)
546
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
547
+ end
548
+
549
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
550
+ # Deserialize Response
551
+ if status_code == 200
552
+ begin
553
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
554
+ result_mapper = Azure::ARM::EventGrid::Models::EventSubscriptionsListResult.mapper()
555
+ result.body = @client.deserialize(result_mapper, parsed_response)
556
+ rescue Exception => e
557
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
558
+ end
559
+ end
560
+
561
+ result
562
+ end
563
+
564
+ promise.execute
565
+ end
566
+
567
+ #
568
+ # List all global event subscriptions for a topic type
569
+ #
570
+ # List all global event subscriptions under an Azure subscription for a topic
571
+ # type.
572
+ #
573
+ # @param topic_type_name [String] Name of the topic type
574
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
575
+ # will be added to the HTTP request.
576
+ #
577
+ # @return [EventSubscriptionsListResult] operation results.
578
+ #
579
+ def list_global_by_subscription_for_topic_type(topic_type_name, custom_headers = nil)
580
+ response = list_global_by_subscription_for_topic_type_async(topic_type_name, custom_headers).value!
581
+ response.body unless response.nil?
582
+ end
583
+
584
+ #
585
+ # List all global event subscriptions for a topic type
586
+ #
587
+ # List all global event subscriptions under an Azure subscription for a topic
588
+ # type.
589
+ #
590
+ # @param topic_type_name [String] Name of the topic type
591
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
592
+ # will be added to the HTTP request.
593
+ #
594
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
595
+ #
596
+ def list_global_by_subscription_for_topic_type_with_http_info(topic_type_name, custom_headers = nil)
597
+ list_global_by_subscription_for_topic_type_async(topic_type_name, custom_headers).value!
598
+ end
599
+
600
+ #
601
+ # List all global event subscriptions for a topic type
602
+ #
603
+ # List all global event subscriptions under an Azure subscription for a topic
604
+ # type.
605
+ #
606
+ # @param topic_type_name [String] Name of the topic type
607
+ # @param [Hash{String => String}] A hash of custom headers that will be added
608
+ # to the HTTP request.
609
+ #
610
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
611
+ #
612
+ def list_global_by_subscription_for_topic_type_async(topic_type_name, custom_headers = nil)
613
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
614
+ fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil?
615
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
616
+
617
+
618
+ request_headers = {}
619
+
620
+ # Set Headers
621
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
622
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
623
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'
624
+
625
+ request_url = @base_url || @client.base_url
626
+
627
+ options = {
628
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
629
+ path_params: {'subscriptionId' => @client.subscription_id,'topicTypeName' => topic_type_name},
630
+ query_params: {'api-version' => @client.api_version},
631
+ headers: request_headers.merge(custom_headers || {}),
632
+ base_url: request_url
633
+ }
634
+ promise = @client.make_request_async(:get, path_template, options)
635
+
636
+ promise = promise.then do |result|
637
+ http_response = result.response
638
+ status_code = http_response.status
639
+ response_content = http_response.body
640
+ unless status_code == 200
641
+ error_model = JSON.load(response_content)
642
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
643
+ end
644
+
645
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
646
+ # Deserialize Response
647
+ if status_code == 200
648
+ begin
649
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
650
+ result_mapper = Azure::ARM::EventGrid::Models::EventSubscriptionsListResult.mapper()
651
+ result.body = @client.deserialize(result_mapper, parsed_response)
652
+ rescue Exception => e
653
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
654
+ end
655
+ end
656
+
657
+ result
658
+ end
659
+
660
+ promise.execute
661
+ end
662
+
663
+ #
664
+ # List all global event subscriptions under an Azure subscription and resource
665
+ # group
666
+ #
667
+ # List all global event subscriptions under a specific Azure subscription and
668
+ # resource group
669
+ #
670
+ # @param resource_group_name [String] The name of the resource group within the
671
+ # user's subscription.
672
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
673
+ # will be added to the HTTP request.
674
+ #
675
+ # @return [EventSubscriptionsListResult] operation results.
676
+ #
677
+ def list_global_by_resource_group(resource_group_name, custom_headers = nil)
678
+ response = list_global_by_resource_group_async(resource_group_name, custom_headers).value!
679
+ response.body unless response.nil?
680
+ end
681
+
682
+ #
683
+ # List all global event subscriptions under an Azure subscription and resource
684
+ # group
685
+ #
686
+ # List all global event subscriptions under a specific Azure subscription and
687
+ # resource group
688
+ #
689
+ # @param resource_group_name [String] The name of the resource group within the
690
+ # user's subscription.
691
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
692
+ # will be added to the HTTP request.
693
+ #
694
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
695
+ #
696
+ def list_global_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
697
+ list_global_by_resource_group_async(resource_group_name, custom_headers).value!
698
+ end
699
+
700
+ #
701
+ # List all global event subscriptions under an Azure subscription and resource
702
+ # group
703
+ #
704
+ # List all global event subscriptions under a specific Azure subscription and
705
+ # resource group
706
+ #
707
+ # @param resource_group_name [String] The name of the resource group within the
708
+ # user's subscription.
709
+ # @param [Hash{String => String}] A hash of custom headers that will be added
710
+ # to the HTTP request.
711
+ #
712
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
713
+ #
714
+ def list_global_by_resource_group_async(resource_group_name, custom_headers = nil)
715
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
716
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
717
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
718
+
719
+
720
+ request_headers = {}
721
+
722
+ # Set Headers
723
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
724
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
725
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/eventSubscriptions'
726
+
727
+ request_url = @base_url || @client.base_url
728
+
729
+ options = {
730
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
731
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
732
+ query_params: {'api-version' => @client.api_version},
733
+ headers: request_headers.merge(custom_headers || {}),
734
+ base_url: request_url
735
+ }
736
+ promise = @client.make_request_async(:get, path_template, options)
737
+
738
+ promise = promise.then do |result|
739
+ http_response = result.response
740
+ status_code = http_response.status
741
+ response_content = http_response.body
742
+ unless status_code == 200
743
+ error_model = JSON.load(response_content)
744
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
745
+ end
746
+
747
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
748
+ # Deserialize Response
749
+ if status_code == 200
750
+ begin
751
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
752
+ result_mapper = Azure::ARM::EventGrid::Models::EventSubscriptionsListResult.mapper()
753
+ result.body = @client.deserialize(result_mapper, parsed_response)
754
+ rescue Exception => e
755
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
756
+ end
757
+ end
758
+
759
+ result
760
+ end
761
+
762
+ promise.execute
763
+ end
764
+
765
+ #
766
+ # List all global event subscriptions under a resource group for a topic type
767
+ #
768
+ # List all global event subscriptions under a resource group for a specific
769
+ # topic type.
770
+ #
771
+ # @param resource_group_name [String] The name of the resource group within the
772
+ # user's subscription.
773
+ # @param topic_type_name [String] Name of the topic type
774
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
775
+ # will be added to the HTTP request.
776
+ #
777
+ # @return [EventSubscriptionsListResult] operation results.
778
+ #
779
+ def list_global_by_resource_group_for_topic_type(resource_group_name, topic_type_name, custom_headers = nil)
780
+ response = list_global_by_resource_group_for_topic_type_async(resource_group_name, topic_type_name, custom_headers).value!
781
+ response.body unless response.nil?
782
+ end
783
+
784
+ #
785
+ # List all global event subscriptions under a resource group for a topic type
786
+ #
787
+ # List all global event subscriptions under a resource group for a specific
788
+ # topic type.
789
+ #
790
+ # @param resource_group_name [String] The name of the resource group within the
791
+ # user's subscription.
792
+ # @param topic_type_name [String] Name of the topic type
793
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
794
+ # will be added to the HTTP request.
795
+ #
796
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
797
+ #
798
+ def list_global_by_resource_group_for_topic_type_with_http_info(resource_group_name, topic_type_name, custom_headers = nil)
799
+ list_global_by_resource_group_for_topic_type_async(resource_group_name, topic_type_name, custom_headers).value!
800
+ end
801
+
802
+ #
803
+ # List all global event subscriptions under a resource group for a topic type
804
+ #
805
+ # List all global event subscriptions under a resource group for a specific
806
+ # topic type.
807
+ #
808
+ # @param resource_group_name [String] The name of the resource group within the
809
+ # user's subscription.
810
+ # @param topic_type_name [String] Name of the topic type
811
+ # @param [Hash{String => String}] A hash of custom headers that will be added
812
+ # to the HTTP request.
813
+ #
814
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
815
+ #
816
+ def list_global_by_resource_group_for_topic_type_async(resource_group_name, topic_type_name, custom_headers = nil)
817
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
818
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
819
+ fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil?
820
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
821
+
822
+
823
+ request_headers = {}
824
+
825
+ # Set Headers
826
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
827
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
828
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'
829
+
830
+ request_url = @base_url || @client.base_url
831
+
832
+ options = {
833
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
834
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicTypeName' => topic_type_name},
835
+ query_params: {'api-version' => @client.api_version},
836
+ headers: request_headers.merge(custom_headers || {}),
837
+ base_url: request_url
838
+ }
839
+ promise = @client.make_request_async(:get, path_template, options)
840
+
841
+ promise = promise.then do |result|
842
+ http_response = result.response
843
+ status_code = http_response.status
844
+ response_content = http_response.body
845
+ unless status_code == 200
846
+ error_model = JSON.load(response_content)
847
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
848
+ end
849
+
850
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
851
+ # Deserialize Response
852
+ if status_code == 200
853
+ begin
854
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
855
+ result_mapper = Azure::ARM::EventGrid::Models::EventSubscriptionsListResult.mapper()
856
+ result.body = @client.deserialize(result_mapper, parsed_response)
857
+ rescue Exception => e
858
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
859
+ end
860
+ end
861
+
862
+ result
863
+ end
864
+
865
+ promise.execute
866
+ end
867
+
868
+ #
869
+ # List all regional event subscriptions under an Azure subscription
870
+ #
871
+ # List all event subscriptions from the given location under a specific Azure
872
+ # subscription
873
+ #
874
+ # @param location [String] Name of the location
875
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
876
+ # will be added to the HTTP request.
877
+ #
878
+ # @return [EventSubscriptionsListResult] operation results.
879
+ #
880
+ def list_regional_by_subscription(location, custom_headers = nil)
881
+ response = list_regional_by_subscription_async(location, custom_headers).value!
882
+ response.body unless response.nil?
883
+ end
884
+
885
+ #
886
+ # List all regional event subscriptions under an Azure subscription
887
+ #
888
+ # List all event subscriptions from the given location under a specific Azure
889
+ # subscription
890
+ #
891
+ # @param location [String] Name of the location
892
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
893
+ # will be added to the HTTP request.
894
+ #
895
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
896
+ #
897
+ def list_regional_by_subscription_with_http_info(location, custom_headers = nil)
898
+ list_regional_by_subscription_async(location, custom_headers).value!
899
+ end
900
+
901
+ #
902
+ # List all regional event subscriptions under an Azure subscription
903
+ #
904
+ # List all event subscriptions from the given location under a specific Azure
905
+ # subscription
906
+ #
907
+ # @param location [String] Name of the location
908
+ # @param [Hash{String => String}] A hash of custom headers that will be added
909
+ # to the HTTP request.
910
+ #
911
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
912
+ #
913
+ def list_regional_by_subscription_async(location, custom_headers = nil)
914
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
915
+ fail ArgumentError, 'location is nil' if location.nil?
916
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
917
+
918
+
919
+ request_headers = {}
920
+
921
+ # Set Headers
922
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
923
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
924
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions'
925
+
926
+ request_url = @base_url || @client.base_url
927
+
928
+ options = {
929
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
930
+ path_params: {'subscriptionId' => @client.subscription_id,'location' => location},
931
+ query_params: {'api-version' => @client.api_version},
932
+ headers: request_headers.merge(custom_headers || {}),
933
+ base_url: request_url
934
+ }
935
+ promise = @client.make_request_async(:get, path_template, options)
936
+
937
+ promise = promise.then do |result|
938
+ http_response = result.response
939
+ status_code = http_response.status
940
+ response_content = http_response.body
941
+ unless status_code == 200
942
+ error_model = JSON.load(response_content)
943
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
944
+ end
945
+
946
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
947
+ # Deserialize Response
948
+ if status_code == 200
949
+ begin
950
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
951
+ result_mapper = Azure::ARM::EventGrid::Models::EventSubscriptionsListResult.mapper()
952
+ result.body = @client.deserialize(result_mapper, parsed_response)
953
+ rescue Exception => e
954
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
955
+ end
956
+ end
957
+
958
+ result
959
+ end
960
+
961
+ promise.execute
962
+ end
963
+
964
+ #
965
+ # List all regional event subscriptions under an Azure subscription and
966
+ # resource group
967
+ #
968
+ # List all event subscriptions from the given location under a specific Azure
969
+ # subscription and resource group
970
+ #
971
+ # @param resource_group_name [String] The name of the resource group within the
972
+ # user's subscription.
973
+ # @param location [String] Name of the location
974
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
975
+ # will be added to the HTTP request.
976
+ #
977
+ # @return [EventSubscriptionsListResult] operation results.
978
+ #
979
+ def list_regional_by_resource_group(resource_group_name, location, custom_headers = nil)
980
+ response = list_regional_by_resource_group_async(resource_group_name, location, custom_headers).value!
981
+ response.body unless response.nil?
982
+ end
983
+
984
+ #
985
+ # List all regional event subscriptions under an Azure subscription and
986
+ # resource group
987
+ #
988
+ # List all event subscriptions from the given location under a specific Azure
989
+ # subscription and resource group
990
+ #
991
+ # @param resource_group_name [String] The name of the resource group within the
992
+ # user's subscription.
993
+ # @param location [String] Name of the location
994
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
995
+ # will be added to the HTTP request.
996
+ #
997
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
998
+ #
999
+ def list_regional_by_resource_group_with_http_info(resource_group_name, location, custom_headers = nil)
1000
+ list_regional_by_resource_group_async(resource_group_name, location, custom_headers).value!
1001
+ end
1002
+
1003
+ #
1004
+ # List all regional event subscriptions under an Azure subscription and
1005
+ # resource group
1006
+ #
1007
+ # List all event subscriptions from the given location under a specific Azure
1008
+ # subscription and resource group
1009
+ #
1010
+ # @param resource_group_name [String] The name of the resource group within the
1011
+ # user's subscription.
1012
+ # @param location [String] Name of the location
1013
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1014
+ # to the HTTP request.
1015
+ #
1016
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1017
+ #
1018
+ def list_regional_by_resource_group_async(resource_group_name, location, custom_headers = nil)
1019
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1020
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1021
+ fail ArgumentError, 'location is nil' if location.nil?
1022
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1023
+
1024
+
1025
+ request_headers = {}
1026
+
1027
+ # Set Headers
1028
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1029
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1030
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions'
1031
+
1032
+ request_url = @base_url || @client.base_url
1033
+
1034
+ options = {
1035
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1036
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'location' => location},
1037
+ query_params: {'api-version' => @client.api_version},
1038
+ headers: request_headers.merge(custom_headers || {}),
1039
+ base_url: request_url
1040
+ }
1041
+ promise = @client.make_request_async(:get, path_template, options)
1042
+
1043
+ promise = promise.then do |result|
1044
+ http_response = result.response
1045
+ status_code = http_response.status
1046
+ response_content = http_response.body
1047
+ unless status_code == 200
1048
+ error_model = JSON.load(response_content)
1049
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1050
+ end
1051
+
1052
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1053
+ # Deserialize Response
1054
+ if status_code == 200
1055
+ begin
1056
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1057
+ result_mapper = Azure::ARM::EventGrid::Models::EventSubscriptionsListResult.mapper()
1058
+ result.body = @client.deserialize(result_mapper, parsed_response)
1059
+ rescue Exception => e
1060
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1061
+ end
1062
+ end
1063
+
1064
+ result
1065
+ end
1066
+
1067
+ promise.execute
1068
+ end
1069
+
1070
+ #
1071
+ # List all regional event subscriptions under an Azure subscription for a topic
1072
+ # type
1073
+ #
1074
+ # List all event subscriptions from the given location under a specific Azure
1075
+ # subscription and topic type.
1076
+ #
1077
+ # @param location [String] Name of the location
1078
+ # @param topic_type_name [String] Name of the topic type
1079
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1080
+ # will be added to the HTTP request.
1081
+ #
1082
+ # @return [EventSubscriptionsListResult] operation results.
1083
+ #
1084
+ def list_regional_by_subscription_for_topic_type(location, topic_type_name, custom_headers = nil)
1085
+ response = list_regional_by_subscription_for_topic_type_async(location, topic_type_name, custom_headers).value!
1086
+ response.body unless response.nil?
1087
+ end
1088
+
1089
+ #
1090
+ # List all regional event subscriptions under an Azure subscription for a topic
1091
+ # type
1092
+ #
1093
+ # List all event subscriptions from the given location under a specific Azure
1094
+ # subscription and topic type.
1095
+ #
1096
+ # @param location [String] Name of the location
1097
+ # @param topic_type_name [String] Name of the topic type
1098
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1099
+ # will be added to the HTTP request.
1100
+ #
1101
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1102
+ #
1103
+ def list_regional_by_subscription_for_topic_type_with_http_info(location, topic_type_name, custom_headers = nil)
1104
+ list_regional_by_subscription_for_topic_type_async(location, topic_type_name, custom_headers).value!
1105
+ end
1106
+
1107
+ #
1108
+ # List all regional event subscriptions under an Azure subscription for a topic
1109
+ # type
1110
+ #
1111
+ # List all event subscriptions from the given location under a specific Azure
1112
+ # subscription and topic type.
1113
+ #
1114
+ # @param location [String] Name of the location
1115
+ # @param topic_type_name [String] Name of the topic type
1116
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1117
+ # to the HTTP request.
1118
+ #
1119
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1120
+ #
1121
+ def list_regional_by_subscription_for_topic_type_async(location, topic_type_name, custom_headers = nil)
1122
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1123
+ fail ArgumentError, 'location is nil' if location.nil?
1124
+ fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil?
1125
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1126
+
1127
+
1128
+ request_headers = {}
1129
+
1130
+ # Set Headers
1131
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1132
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1133
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'
1134
+
1135
+ request_url = @base_url || @client.base_url
1136
+
1137
+ options = {
1138
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1139
+ path_params: {'subscriptionId' => @client.subscription_id,'location' => location,'topicTypeName' => topic_type_name},
1140
+ query_params: {'api-version' => @client.api_version},
1141
+ headers: request_headers.merge(custom_headers || {}),
1142
+ base_url: request_url
1143
+ }
1144
+ promise = @client.make_request_async(:get, path_template, options)
1145
+
1146
+ promise = promise.then do |result|
1147
+ http_response = result.response
1148
+ status_code = http_response.status
1149
+ response_content = http_response.body
1150
+ unless status_code == 200
1151
+ error_model = JSON.load(response_content)
1152
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1153
+ end
1154
+
1155
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1156
+ # Deserialize Response
1157
+ if status_code == 200
1158
+ begin
1159
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1160
+ result_mapper = Azure::ARM::EventGrid::Models::EventSubscriptionsListResult.mapper()
1161
+ result.body = @client.deserialize(result_mapper, parsed_response)
1162
+ rescue Exception => e
1163
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1164
+ end
1165
+ end
1166
+
1167
+ result
1168
+ end
1169
+
1170
+ promise.execute
1171
+ end
1172
+
1173
+ #
1174
+ # List all regional event subscriptions under an Azure subscription and
1175
+ # resource group for a topic type
1176
+ #
1177
+ # List all event subscriptions from the given location under a specific Azure
1178
+ # subscription and resource group and topic type
1179
+ #
1180
+ # @param resource_group_name [String] The name of the resource group within the
1181
+ # user's subscription.
1182
+ # @param location [String] Name of the location
1183
+ # @param topic_type_name [String] Name of the topic type
1184
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1185
+ # will be added to the HTTP request.
1186
+ #
1187
+ # @return [EventSubscriptionsListResult] operation results.
1188
+ #
1189
+ def list_regional_by_resource_group_for_topic_type(resource_group_name, location, topic_type_name, custom_headers = nil)
1190
+ response = list_regional_by_resource_group_for_topic_type_async(resource_group_name, location, topic_type_name, custom_headers).value!
1191
+ response.body unless response.nil?
1192
+ end
1193
+
1194
+ #
1195
+ # List all regional event subscriptions under an Azure subscription and
1196
+ # resource group for a topic type
1197
+ #
1198
+ # List all event subscriptions from the given location under a specific Azure
1199
+ # subscription and resource group and topic type
1200
+ #
1201
+ # @param resource_group_name [String] The name of the resource group within the
1202
+ # user's subscription.
1203
+ # @param location [String] Name of the location
1204
+ # @param topic_type_name [String] Name of the topic type
1205
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1206
+ # will be added to the HTTP request.
1207
+ #
1208
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1209
+ #
1210
+ def list_regional_by_resource_group_for_topic_type_with_http_info(resource_group_name, location, topic_type_name, custom_headers = nil)
1211
+ list_regional_by_resource_group_for_topic_type_async(resource_group_name, location, topic_type_name, custom_headers).value!
1212
+ end
1213
+
1214
+ #
1215
+ # List all regional event subscriptions under an Azure subscription and
1216
+ # resource group for a topic type
1217
+ #
1218
+ # List all event subscriptions from the given location under a specific Azure
1219
+ # subscription and resource group and topic type
1220
+ #
1221
+ # @param resource_group_name [String] The name of the resource group within the
1222
+ # user's subscription.
1223
+ # @param location [String] Name of the location
1224
+ # @param topic_type_name [String] Name of the topic type
1225
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1226
+ # to the HTTP request.
1227
+ #
1228
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1229
+ #
1230
+ def list_regional_by_resource_group_for_topic_type_async(resource_group_name, location, topic_type_name, custom_headers = nil)
1231
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1232
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1233
+ fail ArgumentError, 'location is nil' if location.nil?
1234
+ fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil?
1235
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1236
+
1237
+
1238
+ request_headers = {}
1239
+
1240
+ # Set Headers
1241
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1242
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1243
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'
1244
+
1245
+ request_url = @base_url || @client.base_url
1246
+
1247
+ options = {
1248
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1249
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'location' => location,'topicTypeName' => topic_type_name},
1250
+ query_params: {'api-version' => @client.api_version},
1251
+ headers: request_headers.merge(custom_headers || {}),
1252
+ base_url: request_url
1253
+ }
1254
+ promise = @client.make_request_async(:get, path_template, options)
1255
+
1256
+ promise = promise.then do |result|
1257
+ http_response = result.response
1258
+ status_code = http_response.status
1259
+ response_content = http_response.body
1260
+ unless status_code == 200
1261
+ error_model = JSON.load(response_content)
1262
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1263
+ end
1264
+
1265
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1266
+ # Deserialize Response
1267
+ if status_code == 200
1268
+ begin
1269
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1270
+ result_mapper = Azure::ARM::EventGrid::Models::EventSubscriptionsListResult.mapper()
1271
+ result.body = @client.deserialize(result_mapper, parsed_response)
1272
+ rescue Exception => e
1273
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1274
+ end
1275
+ end
1276
+
1277
+ result
1278
+ end
1279
+
1280
+ promise.execute
1281
+ end
1282
+
1283
+ #
1284
+ # List all event subscriptions for a specific topic
1285
+ #
1286
+ # List all event subscriptions that have been created for a specific topic
1287
+ #
1288
+ # @param resource_group_name [String] The name of the resource group within the
1289
+ # user's subscription.
1290
+ # @param provider_namespace [String] Namespace of the provider of the topic
1291
+ # @param resource_type_name [String] Name of the resource type
1292
+ # @param resource_name [String] Name of the resource
1293
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1294
+ # will be added to the HTTP request.
1295
+ #
1296
+ # @return [EventSubscriptionsListResult] operation results.
1297
+ #
1298
+ def list_by_resource(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers = nil)
1299
+ response = list_by_resource_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers).value!
1300
+ response.body unless response.nil?
1301
+ end
1302
+
1303
+ #
1304
+ # List all event subscriptions for a specific topic
1305
+ #
1306
+ # List all event subscriptions that have been created for a specific topic
1307
+ #
1308
+ # @param resource_group_name [String] The name of the resource group within the
1309
+ # user's subscription.
1310
+ # @param provider_namespace [String] Namespace of the provider of the topic
1311
+ # @param resource_type_name [String] Name of the resource type
1312
+ # @param resource_name [String] Name of the resource
1313
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1314
+ # will be added to the HTTP request.
1315
+ #
1316
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1317
+ #
1318
+ def list_by_resource_with_http_info(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers = nil)
1319
+ list_by_resource_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers).value!
1320
+ end
1321
+
1322
+ #
1323
+ # List all event subscriptions for a specific topic
1324
+ #
1325
+ # List all event subscriptions that have been created for a specific topic
1326
+ #
1327
+ # @param resource_group_name [String] The name of the resource group within the
1328
+ # user's subscription.
1329
+ # @param provider_namespace [String] Namespace of the provider of the topic
1330
+ # @param resource_type_name [String] Name of the resource type
1331
+ # @param resource_name [String] Name of the resource
1332
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1333
+ # to the HTTP request.
1334
+ #
1335
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1336
+ #
1337
+ def list_by_resource_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers = nil)
1338
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1339
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1340
+ fail ArgumentError, 'provider_namespace is nil' if provider_namespace.nil?
1341
+ fail ArgumentError, 'resource_type_name is nil' if resource_type_name.nil?
1342
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1343
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1344
+
1345
+
1346
+ request_headers = {}
1347
+
1348
+ # Set Headers
1349
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1350
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1351
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions'
1352
+
1353
+ request_url = @base_url || @client.base_url
1354
+
1355
+ options = {
1356
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1357
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'providerNamespace' => provider_namespace,'resourceTypeName' => resource_type_name,'resourceName' => resource_name},
1358
+ query_params: {'api-version' => @client.api_version},
1359
+ headers: request_headers.merge(custom_headers || {}),
1360
+ base_url: request_url
1361
+ }
1362
+ promise = @client.make_request_async(:get, path_template, options)
1363
+
1364
+ promise = promise.then do |result|
1365
+ http_response = result.response
1366
+ status_code = http_response.status
1367
+ response_content = http_response.body
1368
+ unless status_code == 200
1369
+ error_model = JSON.load(response_content)
1370
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1371
+ end
1372
+
1373
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1374
+ # Deserialize Response
1375
+ if status_code == 200
1376
+ begin
1377
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1378
+ result_mapper = Azure::ARM::EventGrid::Models::EventSubscriptionsListResult.mapper()
1379
+ result.body = @client.deserialize(result_mapper, parsed_response)
1380
+ rescue Exception => e
1381
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1382
+ end
1383
+ end
1384
+
1385
+ result
1386
+ end
1387
+
1388
+ promise.execute
1389
+ end
1390
+
1391
+ #
1392
+ # Create an event subscription
1393
+ #
1394
+ # Asynchronously creates a new event subscription to the specified scope.
1395
+ # Existing event subscriptions cannot be updated with this API and should
1396
+ # instead use the Update event subscription API.
1397
+ #
1398
+ # @param scope [String] The scope of the resource to which the event
1399
+ # subscription needs to be created. The scope can be a subscription, or a
1400
+ # resource group, or a top level resource belonging to a resource provider
1401
+ # namespace, or an EventGrid topic. For example, use
1402
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1403
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1404
+ # resource group, and
1405
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1406
+ # for a resource, and
1407
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1408
+ # for an EventGrid topic.
1409
+ # @param event_subscription_name [String] Name of the event subscription to be
1410
+ # created. Event subscription names must be between 3 and 64 characters in
1411
+ # length and use alphanumeric letters only.
1412
+ # @param event_subscription_info [EventSubscription] Event subscription
1413
+ # properties containing the destination and filter information
1414
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1415
+ # will be added to the HTTP request.
1416
+ #
1417
+ # @return [EventSubscription] operation results.
1418
+ #
1419
+ def begin_create(scope, event_subscription_name, event_subscription_info, custom_headers = nil)
1420
+ response = begin_create_async(scope, event_subscription_name, event_subscription_info, custom_headers).value!
1421
+ response.body unless response.nil?
1422
+ end
1423
+
1424
+ #
1425
+ # Create an event subscription
1426
+ #
1427
+ # Asynchronously creates a new event subscription to the specified scope.
1428
+ # Existing event subscriptions cannot be updated with this API and should
1429
+ # instead use the Update event subscription API.
1430
+ #
1431
+ # @param scope [String] The scope of the resource to which the event
1432
+ # subscription needs to be created. The scope can be a subscription, or a
1433
+ # resource group, or a top level resource belonging to a resource provider
1434
+ # namespace, or an EventGrid topic. For example, use
1435
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1436
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1437
+ # resource group, and
1438
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1439
+ # for a resource, and
1440
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1441
+ # for an EventGrid topic.
1442
+ # @param event_subscription_name [String] Name of the event subscription to be
1443
+ # created. Event subscription names must be between 3 and 64 characters in
1444
+ # length and use alphanumeric letters only.
1445
+ # @param event_subscription_info [EventSubscription] Event subscription
1446
+ # properties containing the destination and filter information
1447
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1448
+ # will be added to the HTTP request.
1449
+ #
1450
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1451
+ #
1452
+ def begin_create_with_http_info(scope, event_subscription_name, event_subscription_info, custom_headers = nil)
1453
+ begin_create_async(scope, event_subscription_name, event_subscription_info, custom_headers).value!
1454
+ end
1455
+
1456
+ #
1457
+ # Create an event subscription
1458
+ #
1459
+ # Asynchronously creates a new event subscription to the specified scope.
1460
+ # Existing event subscriptions cannot be updated with this API and should
1461
+ # instead use the Update event subscription API.
1462
+ #
1463
+ # @param scope [String] The scope of the resource to which the event
1464
+ # subscription needs to be created. The scope can be a subscription, or a
1465
+ # resource group, or a top level resource belonging to a resource provider
1466
+ # namespace, or an EventGrid topic. For example, use
1467
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1468
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1469
+ # resource group, and
1470
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1471
+ # for a resource, and
1472
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1473
+ # for an EventGrid topic.
1474
+ # @param event_subscription_name [String] Name of the event subscription to be
1475
+ # created. Event subscription names must be between 3 and 64 characters in
1476
+ # length and use alphanumeric letters only.
1477
+ # @param event_subscription_info [EventSubscription] Event subscription
1478
+ # properties containing the destination and filter information
1479
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1480
+ # to the HTTP request.
1481
+ #
1482
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1483
+ #
1484
+ def begin_create_async(scope, event_subscription_name, event_subscription_info, custom_headers = nil)
1485
+ fail ArgumentError, 'scope is nil' if scope.nil?
1486
+ fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil?
1487
+ fail ArgumentError, 'event_subscription_info is nil' if event_subscription_info.nil?
1488
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1489
+
1490
+
1491
+ request_headers = {}
1492
+
1493
+ # Set Headers
1494
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1495
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1496
+
1497
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1498
+
1499
+ # Serialize Request
1500
+ request_mapper = Azure::ARM::EventGrid::Models::EventSubscription.mapper()
1501
+ request_content = @client.serialize(request_mapper, event_subscription_info)
1502
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1503
+
1504
+ path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'
1505
+
1506
+ request_url = @base_url || @client.base_url
1507
+
1508
+ options = {
1509
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1510
+ path_params: {'eventSubscriptionName' => event_subscription_name},
1511
+ skip_encoding_path_params: {'scope' => scope},
1512
+ query_params: {'api-version' => @client.api_version},
1513
+ body: request_content,
1514
+ headers: request_headers.merge(custom_headers || {}),
1515
+ base_url: request_url
1516
+ }
1517
+ promise = @client.make_request_async(:put, path_template, options)
1518
+
1519
+ promise = promise.then do |result|
1520
+ http_response = result.response
1521
+ status_code = http_response.status
1522
+ response_content = http_response.body
1523
+ unless status_code == 201
1524
+ error_model = JSON.load(response_content)
1525
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1526
+ end
1527
+
1528
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1529
+ # Deserialize Response
1530
+ if status_code == 201
1531
+ begin
1532
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1533
+ result_mapper = Azure::ARM::EventGrid::Models::EventSubscription.mapper()
1534
+ result.body = @client.deserialize(result_mapper, parsed_response)
1535
+ rescue Exception => e
1536
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1537
+ end
1538
+ end
1539
+
1540
+ result
1541
+ end
1542
+
1543
+ promise.execute
1544
+ end
1545
+
1546
+ #
1547
+ # Delete an event subscription
1548
+ #
1549
+ # Delete an existing event subscription
1550
+ #
1551
+ # @param scope [String] The scope of the event subscription. The scope can be a
1552
+ # subscription, or a resource group, or a top level resource belonging to a
1553
+ # resource provider namespace, or an EventGrid topic. For example, use
1554
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1555
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1556
+ # resource group, and
1557
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1558
+ # for a resource, and
1559
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1560
+ # for an EventGrid topic.
1561
+ # @param event_subscription_name [String] Name of the event subscription
1562
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1563
+ # will be added to the HTTP request.
1564
+ #
1565
+ #
1566
+ def begin_delete(scope, event_subscription_name, custom_headers = nil)
1567
+ response = begin_delete_async(scope, event_subscription_name, custom_headers).value!
1568
+ nil
1569
+ end
1570
+
1571
+ #
1572
+ # Delete an event subscription
1573
+ #
1574
+ # Delete an existing event subscription
1575
+ #
1576
+ # @param scope [String] The scope of the event subscription. The scope can be a
1577
+ # subscription, or a resource group, or a top level resource belonging to a
1578
+ # resource provider namespace, or an EventGrid topic. For example, use
1579
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1580
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1581
+ # resource group, and
1582
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1583
+ # for a resource, and
1584
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1585
+ # for an EventGrid topic.
1586
+ # @param event_subscription_name [String] Name of the event subscription
1587
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1588
+ # will be added to the HTTP request.
1589
+ #
1590
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1591
+ #
1592
+ def begin_delete_with_http_info(scope, event_subscription_name, custom_headers = nil)
1593
+ begin_delete_async(scope, event_subscription_name, custom_headers).value!
1594
+ end
1595
+
1596
+ #
1597
+ # Delete an event subscription
1598
+ #
1599
+ # Delete an existing event subscription
1600
+ #
1601
+ # @param scope [String] The scope of the event subscription. The scope can be a
1602
+ # subscription, or a resource group, or a top level resource belonging to a
1603
+ # resource provider namespace, or an EventGrid topic. For example, use
1604
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1605
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1606
+ # resource group, and
1607
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1608
+ # for a resource, and
1609
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1610
+ # for an EventGrid topic.
1611
+ # @param event_subscription_name [String] Name of the event subscription
1612
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1613
+ # to the HTTP request.
1614
+ #
1615
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1616
+ #
1617
+ def begin_delete_async(scope, event_subscription_name, custom_headers = nil)
1618
+ fail ArgumentError, 'scope is nil' if scope.nil?
1619
+ fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil?
1620
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1621
+
1622
+
1623
+ request_headers = {}
1624
+
1625
+ # Set Headers
1626
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1627
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1628
+ path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'
1629
+
1630
+ request_url = @base_url || @client.base_url
1631
+
1632
+ options = {
1633
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1634
+ path_params: {'eventSubscriptionName' => event_subscription_name},
1635
+ skip_encoding_path_params: {'scope' => scope},
1636
+ query_params: {'api-version' => @client.api_version},
1637
+ headers: request_headers.merge(custom_headers || {}),
1638
+ base_url: request_url
1639
+ }
1640
+ promise = @client.make_request_async(:delete, path_template, options)
1641
+
1642
+ promise = promise.then do |result|
1643
+ http_response = result.response
1644
+ status_code = http_response.status
1645
+ response_content = http_response.body
1646
+ unless status_code == 200 || status_code == 202 || status_code == 204
1647
+ error_model = JSON.load(response_content)
1648
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1649
+ end
1650
+
1651
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1652
+
1653
+ result
1654
+ end
1655
+
1656
+ promise.execute
1657
+ end
1658
+
1659
+ #
1660
+ # Update an event subscription
1661
+ #
1662
+ # Asynchronously updates an existing event subscription.
1663
+ #
1664
+ # @param scope [String] The scope of existing event subscription. The scope can
1665
+ # be a subscription, or a resource group, or a top level resource belonging to
1666
+ # a resource provider namespace, or an EventGrid topic. For example, use
1667
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1668
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1669
+ # resource group, and
1670
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1671
+ # for a resource, and
1672
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1673
+ # for an EventGrid topic.
1674
+ # @param event_subscription_name [String] Name of the event subscription to be
1675
+ # created
1676
+ # @param event_subscription_update_parameters
1677
+ # [EventSubscriptionUpdateParameters] Updated event subscription information
1678
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1679
+ # will be added to the HTTP request.
1680
+ #
1681
+ # @return [EventSubscription] operation results.
1682
+ #
1683
+ def begin_update(scope, event_subscription_name, event_subscription_update_parameters, custom_headers = nil)
1684
+ response = begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers).value!
1685
+ response.body unless response.nil?
1686
+ end
1687
+
1688
+ #
1689
+ # Update an event subscription
1690
+ #
1691
+ # Asynchronously updates an existing event subscription.
1692
+ #
1693
+ # @param scope [String] The scope of existing event subscription. The scope can
1694
+ # be a subscription, or a resource group, or a top level resource belonging to
1695
+ # a resource provider namespace, or an EventGrid topic. For example, use
1696
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1697
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1698
+ # resource group, and
1699
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1700
+ # for a resource, and
1701
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1702
+ # for an EventGrid topic.
1703
+ # @param event_subscription_name [String] Name of the event subscription to be
1704
+ # created
1705
+ # @param event_subscription_update_parameters
1706
+ # [EventSubscriptionUpdateParameters] Updated event subscription information
1707
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1708
+ # will be added to the HTTP request.
1709
+ #
1710
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1711
+ #
1712
+ def begin_update_with_http_info(scope, event_subscription_name, event_subscription_update_parameters, custom_headers = nil)
1713
+ begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers).value!
1714
+ end
1715
+
1716
+ #
1717
+ # Update an event subscription
1718
+ #
1719
+ # Asynchronously updates an existing event subscription.
1720
+ #
1721
+ # @param scope [String] The scope of existing event subscription. The scope can
1722
+ # be a subscription, or a resource group, or a top level resource belonging to
1723
+ # a resource provider namespace, or an EventGrid topic. For example, use
1724
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1725
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1726
+ # resource group, and
1727
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1728
+ # for a resource, and
1729
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1730
+ # for an EventGrid topic.
1731
+ # @param event_subscription_name [String] Name of the event subscription to be
1732
+ # created
1733
+ # @param event_subscription_update_parameters
1734
+ # [EventSubscriptionUpdateParameters] Updated event subscription information
1735
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1736
+ # to the HTTP request.
1737
+ #
1738
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1739
+ #
1740
+ def begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers = nil)
1741
+ fail ArgumentError, 'scope is nil' if scope.nil?
1742
+ fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil?
1743
+ fail ArgumentError, 'event_subscription_update_parameters is nil' if event_subscription_update_parameters.nil?
1744
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1745
+
1746
+
1747
+ request_headers = {}
1748
+
1749
+ # Set Headers
1750
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1751
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1752
+
1753
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1754
+
1755
+ # Serialize Request
1756
+ request_mapper = Azure::ARM::EventGrid::Models::EventSubscriptionUpdateParameters.mapper()
1757
+ request_content = @client.serialize(request_mapper, event_subscription_update_parameters)
1758
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1759
+
1760
+ path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'
1761
+
1762
+ request_url = @base_url || @client.base_url
1763
+
1764
+ options = {
1765
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1766
+ path_params: {'eventSubscriptionName' => event_subscription_name},
1767
+ skip_encoding_path_params: {'scope' => scope},
1768
+ query_params: {'api-version' => @client.api_version},
1769
+ body: request_content,
1770
+ headers: request_headers.merge(custom_headers || {}),
1771
+ base_url: request_url
1772
+ }
1773
+ promise = @client.make_request_async(:patch, path_template, options)
1774
+
1775
+ promise = promise.then do |result|
1776
+ http_response = result.response
1777
+ status_code = http_response.status
1778
+ response_content = http_response.body
1779
+ unless status_code == 201
1780
+ error_model = JSON.load(response_content)
1781
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1782
+ end
1783
+
1784
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1785
+ # Deserialize Response
1786
+ if status_code == 201
1787
+ begin
1788
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1789
+ result_mapper = Azure::ARM::EventGrid::Models::EventSubscription.mapper()
1790
+ result.body = @client.deserialize(result_mapper, parsed_response)
1791
+ rescue Exception => e
1792
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1793
+ end
1794
+ end
1795
+
1796
+ result
1797
+ end
1798
+
1799
+ promise.execute
1800
+ end
1801
+
1802
+ end
1803
+ end