azure_mgmt_event_grid 0.17.1 → 0.17.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb +1 -1
  3. data/lib/2017-09-15-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb +1 -1
  4. data/lib/2018-01-01/generated/azure_mgmt_event_grid/event_grid_management_client.rb +1 -1
  5. data/lib/2018-05-01-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb +1 -1
  6. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid.rb +91 -0
  7. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/domain_topics.rb +231 -0
  8. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/domains.rb +986 -0
  9. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb +153 -0
  10. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb +1917 -0
  11. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/advanced_filter.rb +70 -0
  12. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/bool_equals_advanced_filter.rb +69 -0
  13. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/dead_letter_destination.rb +50 -0
  14. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/domain.rb +140 -0
  15. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/domain_provisioning_state.rb +20 -0
  16. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/domain_regenerate_key_request.rb +46 -0
  17. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/domain_shared_access_keys.rb +57 -0
  18. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/domain_topic.rb +62 -0
  19. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/domain_topics_list_result.rb +55 -0
  20. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/domain_update_parameters.rb +54 -0
  21. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/domains_list_result.rb +55 -0
  22. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/event_delivery_schema.rb +17 -0
  23. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/event_hub_event_subscription_destination.rb +62 -0
  24. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/event_subscription.rb +189 -0
  25. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/event_subscription_destination.rb +49 -0
  26. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/event_subscription_filter.rb +120 -0
  27. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/event_subscription_full_url.rb +47 -0
  28. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/event_subscription_provisioning_state.rb +21 -0
  29. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/event_subscription_update_parameters.rb +137 -0
  30. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/event_subscriptions_list_result.rb +55 -0
  31. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/event_type.rb +95 -0
  32. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/event_types_list_result.rb +55 -0
  33. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/hybrid_connection_event_subscription_destination.rb +64 -0
  34. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/input_schema.rb +17 -0
  35. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/input_schema_mapping.rb +49 -0
  36. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/json_field.rb +50 -0
  37. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/json_field_with_default.rb +65 -0
  38. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/json_input_schema_mapping.rb +130 -0
  39. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/number_greater_than_advanced_filter.rb +69 -0
  40. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/number_greater_than_or_equals_advanced_filter.rb +69 -0
  41. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/number_in_advanced_filter.rb +77 -0
  42. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/number_less_than_advanced_filter.rb +69 -0
  43. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/number_less_than_or_equals_advanced_filter.rb +69 -0
  44. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/number_not_in_advanced_filter.rb +77 -0
  45. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/operation.rb +80 -0
  46. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/operation_info.rb +79 -0
  47. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/operations_list_result.rb +55 -0
  48. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/resource.rb +80 -0
  49. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/resource_region_type.rb +16 -0
  50. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/retry_policy.rb +57 -0
  51. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/storage_blob_dead_letter_destination.rb +74 -0
  52. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/storage_queue_event_subscription_destination.rb +75 -0
  53. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/string_begins_with_advanced_filter.rb +77 -0
  54. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/string_contains_advanced_filter.rb +77 -0
  55. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/string_ends_with_advanced_filter.rb +77 -0
  56. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/string_in_advanced_filter.rb +77 -0
  57. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/string_not_in_advanced_filter.rb +77 -0
  58. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/topic.rb +144 -0
  59. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/topic_provisioning_state.rb +20 -0
  60. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/topic_regenerate_key_request.rb +46 -0
  61. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/topic_shared_access_keys.rb +57 -0
  62. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/topic_type_info.rb +139 -0
  63. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/topic_type_provisioning_state.rb +20 -0
  64. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/topic_types_list_result.rb +55 -0
  65. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/topic_update_parameters.rb +54 -0
  66. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/topics_list_result.rb +55 -0
  67. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/tracked_resource.rb +92 -0
  68. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/web_hook_event_subscription_destination.rb +75 -0
  69. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/module_definition.rb +9 -0
  70. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/operations.rb +116 -0
  71. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/topic_types.rb +299 -0
  72. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/topics.rb +1095 -0
  73. data/lib/azure_mgmt_event_grid.rb +1 -0
  74. data/lib/profiles/latest/modules/eventgrid_profile_module.rb +187 -99
  75. data/lib/version.rb +1 -1
  76. metadata +69 -2
@@ -0,0 +1,153 @@
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::EventGrid::Mgmt::V2018_09_15_preview
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] The preferred language for the response.
29
+ attr_accessor :accept_language
30
+
31
+ # @return [Integer] The retry timeout in seconds for Long Running
32
+ # Operations. Default value is 30.
33
+ attr_accessor :long_running_operation_retry_timeout
34
+
35
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
36
+ # generated. When set to true a unique x-ms-client-request-id value is
37
+ # generated and included in each request. Default is true.
38
+ attr_accessor :generate_client_request_id
39
+
40
+ # @return [Domains] domains
41
+ attr_reader :domains
42
+
43
+ # @return [DomainTopics] domain_topics
44
+ attr_reader :domain_topics
45
+
46
+ # @return [EventSubscriptions] event_subscriptions
47
+ attr_reader :event_subscriptions
48
+
49
+ # @return [Operations] operations
50
+ attr_reader :operations
51
+
52
+ # @return [Topics] topics
53
+ attr_reader :topics
54
+
55
+ # @return [TopicTypes] topic_types
56
+ attr_reader :topic_types
57
+
58
+ #
59
+ # Creates initializes a new instance of the EventGridManagementClient class.
60
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
61
+ # @param base_url [String] the base URI of the service.
62
+ # @param options [Array] filters to be applied to the HTTP requests.
63
+ #
64
+ def initialize(credentials = nil, base_url = nil, options = nil)
65
+ super(credentials, options)
66
+ @base_url = base_url || 'https://management.azure.com'
67
+
68
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
69
+ @credentials = credentials
70
+
71
+ @domains = Domains.new(self)
72
+ @domain_topics = DomainTopics.new(self)
73
+ @event_subscriptions = EventSubscriptions.new(self)
74
+ @operations = Operations.new(self)
75
+ @topics = Topics.new(self)
76
+ @topic_types = TopicTypes.new(self)
77
+ @api_version = '2018-09-15-preview'
78
+ @accept_language = 'en-US'
79
+ @long_running_operation_retry_timeout = 30
80
+ @generate_client_request_id = true
81
+ add_telemetry
82
+ end
83
+
84
+ #
85
+ # Makes a request and returns the body of the response.
86
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
87
+ # @param path [String] the path, relative to {base_url}.
88
+ # @param options [Hash{String=>String}] specifying any request options like :body.
89
+ # @return [Hash{String=>String}] containing the body of the response.
90
+ # Example:
91
+ #
92
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
93
+ # path = "/path"
94
+ # options = {
95
+ # body: request_content,
96
+ # query_params: {'api-version' => '2016-02-01'}
97
+ # }
98
+ # result = @client.make_request(:put, path, options)
99
+ #
100
+ def make_request(method, path, options = {})
101
+ result = make_request_with_http_info(method, path, options)
102
+ result.body unless result.nil?
103
+ end
104
+
105
+ #
106
+ # Makes a request and returns the operation response.
107
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
108
+ # @param path [String] the path, relative to {base_url}.
109
+ # @param options [Hash{String=>String}] specifying any request options like :body.
110
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
111
+ #
112
+ def make_request_with_http_info(method, path, options = {})
113
+ result = make_request_async(method, path, options).value!
114
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
115
+ result
116
+ end
117
+
118
+ #
119
+ # Makes a request asynchronously.
120
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
121
+ # @param path [String] the path, relative to {base_url}.
122
+ # @param options [Hash{String=>String}] specifying any request options like :body.
123
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
124
+ #
125
+ def make_request_async(method, path, options = {})
126
+ fail ArgumentError, 'method is nil' if method.nil?
127
+ fail ArgumentError, 'path is nil' if path.nil?
128
+
129
+ request_url = options[:base_url] || @base_url
130
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
131
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
132
+ end
133
+
134
+ request_headers = @request_headers
135
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
136
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
137
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
138
+
139
+ super(request_url, method, path, options)
140
+ end
141
+
142
+
143
+ private
144
+ #
145
+ # Adds telemetry information.
146
+ #
147
+ def add_telemetry
148
+ sdk_information = 'azure_mgmt_event_grid'
149
+ sdk_information = "#{sdk_information}/0.17.2"
150
+ add_user_agent_information(sdk_information)
151
+ end
152
+ end
153
+ end
@@ -0,0 +1,1917 @@
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::EventGrid::Mgmt::V2018_09_15_preview
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: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: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
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
104
+
105
+ # Set Headers
106
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
107
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
108
+ path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'
109
+
110
+ request_url = @base_url || @client.base_url
111
+
112
+ options = {
113
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
114
+ path_params: {'eventSubscriptionName' => event_subscription_name},
115
+ skip_encoding_path_params: {'scope' => scope},
116
+ query_params: {'api-version' => @client.api_version},
117
+ headers: request_headers.merge(custom_headers || {}),
118
+ base_url: request_url
119
+ }
120
+ promise = @client.make_request_async(:get, path_template, options)
121
+
122
+ promise = promise.then do |result|
123
+ http_response = result.response
124
+ status_code = http_response.status
125
+ response_content = http_response.body
126
+ unless status_code == 200
127
+ error_model = JSON.load(response_content)
128
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
129
+ end
130
+
131
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
132
+ # Deserialize Response
133
+ if status_code == 200
134
+ begin
135
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
136
+ result_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::Models::EventSubscription.mapper()
137
+ result.body = @client.deserialize(result_mapper, parsed_response)
138
+ rescue Exception => e
139
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
140
+ end
141
+ end
142
+
143
+ result
144
+ end
145
+
146
+ promise.execute
147
+ end
148
+
149
+ #
150
+ # Create or update an event subscription
151
+ #
152
+ # Asynchronously creates a new event subscription or updates an existing event
153
+ # subscription based on the specified scope.
154
+ #
155
+ # @param scope [String] The identifier of the resource to which the event
156
+ # subscription needs to be created or updated. The scope can be a subscription,
157
+ # or a 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. Event
167
+ # subscription names must be between 3 and 64 characters in length and should
168
+ # 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_or_update(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
177
+ response = create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers:custom_headers).value!
178
+ response.body unless response.nil?
179
+ end
180
+
181
+ #
182
+ # @param scope [String] The identifier of the resource to which the event
183
+ # subscription needs to be created or updated. The scope can be a subscription,
184
+ # or a 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. Event
194
+ # subscription names must be between 3 and 64 characters in length and should
195
+ # 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_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
205
+ # Send request
206
+ promise = begin_create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers:custom_headers)
207
+
208
+ promise = promise.then do |response|
209
+ # Defining deserialization method.
210
+ deserialize_method = lambda do |parsed_response|
211
+ result_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::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: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: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
+ # updated
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: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
+ # updated
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:custom_headers)
333
+
334
+ promise = promise.then do |response|
335
+ # Defining deserialization method.
336
+ deserialize_method = lambda do |parsed_response|
337
+ result_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::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: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: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
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
428
+
429
+ # Set Headers
430
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
431
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
432
+ path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl'
433
+
434
+ request_url = @base_url || @client.base_url
435
+
436
+ options = {
437
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
438
+ path_params: {'eventSubscriptionName' => event_subscription_name},
439
+ skip_encoding_path_params: {'scope' => scope},
440
+ query_params: {'api-version' => @client.api_version},
441
+ headers: request_headers.merge(custom_headers || {}),
442
+ base_url: request_url
443
+ }
444
+ promise = @client.make_request_async(:post, path_template, options)
445
+
446
+ promise = promise.then do |result|
447
+ http_response = result.response
448
+ status_code = http_response.status
449
+ response_content = http_response.body
450
+ unless status_code == 200
451
+ error_model = JSON.load(response_content)
452
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
453
+ end
454
+
455
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
456
+ # Deserialize Response
457
+ if status_code == 200
458
+ begin
459
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
460
+ result_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::Models::EventSubscriptionFullUrl.mapper()
461
+ result.body = @client.deserialize(result_mapper, parsed_response)
462
+ rescue Exception => e
463
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
464
+ end
465
+ end
466
+
467
+ result
468
+ end
469
+
470
+ promise.execute
471
+ end
472
+
473
+ #
474
+ # Get an aggregated list of all global event subscriptions under an Azure
475
+ # subscription
476
+ #
477
+ # List all aggregated global event subscriptions under a specific Azure
478
+ # subscription
479
+ #
480
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
481
+ # will be added to the HTTP request.
482
+ #
483
+ # @return [EventSubscriptionsListResult] operation results.
484
+ #
485
+ def list_global_by_subscription(custom_headers:nil)
486
+ response = list_global_by_subscription_async(custom_headers:custom_headers).value!
487
+ response.body unless response.nil?
488
+ end
489
+
490
+ #
491
+ # Get an aggregated list of all global event subscriptions under an Azure
492
+ # subscription
493
+ #
494
+ # List all aggregated global event subscriptions under a specific Azure
495
+ # subscription
496
+ #
497
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
498
+ # will be added to the HTTP request.
499
+ #
500
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
501
+ #
502
+ def list_global_by_subscription_with_http_info(custom_headers:nil)
503
+ list_global_by_subscription_async(custom_headers:custom_headers).value!
504
+ end
505
+
506
+ #
507
+ # Get an aggregated list of all global event subscriptions under an Azure
508
+ # subscription
509
+ #
510
+ # List all aggregated global event subscriptions under a specific Azure
511
+ # subscription
512
+ #
513
+ # @param [Hash{String => String}] A hash of custom headers that will be added
514
+ # to the HTTP request.
515
+ #
516
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
517
+ #
518
+ def list_global_by_subscription_async(custom_headers:nil)
519
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
520
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
521
+
522
+
523
+ request_headers = {}
524
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
525
+
526
+ # Set Headers
527
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
528
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
529
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions'
530
+
531
+ request_url = @base_url || @client.base_url
532
+
533
+ options = {
534
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
535
+ path_params: {'subscriptionId' => @client.subscription_id},
536
+ query_params: {'api-version' => @client.api_version},
537
+ headers: request_headers.merge(custom_headers || {}),
538
+ base_url: request_url
539
+ }
540
+ promise = @client.make_request_async(:get, path_template, options)
541
+
542
+ promise = promise.then do |result|
543
+ http_response = result.response
544
+ status_code = http_response.status
545
+ response_content = http_response.body
546
+ unless status_code == 200
547
+ error_model = JSON.load(response_content)
548
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
549
+ end
550
+
551
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
552
+ # Deserialize Response
553
+ if status_code == 200
554
+ begin
555
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
556
+ result_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::Models::EventSubscriptionsListResult.mapper()
557
+ result.body = @client.deserialize(result_mapper, parsed_response)
558
+ rescue Exception => e
559
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
560
+ end
561
+ end
562
+
563
+ result
564
+ end
565
+
566
+ promise.execute
567
+ end
568
+
569
+ #
570
+ # List all global event subscriptions for a topic type
571
+ #
572
+ # List all global event subscriptions under an Azure subscription for a topic
573
+ # type.
574
+ #
575
+ # @param topic_type_name [String] Name of the topic type
576
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
577
+ # will be added to the HTTP request.
578
+ #
579
+ # @return [EventSubscriptionsListResult] operation results.
580
+ #
581
+ def list_global_by_subscription_for_topic_type(topic_type_name, custom_headers:nil)
582
+ response = list_global_by_subscription_for_topic_type_async(topic_type_name, custom_headers:custom_headers).value!
583
+ response.body unless response.nil?
584
+ end
585
+
586
+ #
587
+ # List all global event subscriptions for a topic type
588
+ #
589
+ # List all global event subscriptions under an Azure subscription for a topic
590
+ # type.
591
+ #
592
+ # @param topic_type_name [String] Name of the topic type
593
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
594
+ # will be added to the HTTP request.
595
+ #
596
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
597
+ #
598
+ def list_global_by_subscription_for_topic_type_with_http_info(topic_type_name, custom_headers:nil)
599
+ list_global_by_subscription_for_topic_type_async(topic_type_name, custom_headers:custom_headers).value!
600
+ end
601
+
602
+ #
603
+ # List all global event subscriptions for a topic type
604
+ #
605
+ # List all global event subscriptions under an Azure subscription for a topic
606
+ # type.
607
+ #
608
+ # @param topic_type_name [String] Name of the topic type
609
+ # @param [Hash{String => String}] A hash of custom headers that will be added
610
+ # to the HTTP request.
611
+ #
612
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
613
+ #
614
+ def list_global_by_subscription_for_topic_type_async(topic_type_name, custom_headers:nil)
615
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
616
+ fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil?
617
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
618
+
619
+
620
+ request_headers = {}
621
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
622
+
623
+ # Set Headers
624
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
625
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
626
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'
627
+
628
+ request_url = @base_url || @client.base_url
629
+
630
+ options = {
631
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
632
+ path_params: {'subscriptionId' => @client.subscription_id,'topicTypeName' => topic_type_name},
633
+ query_params: {'api-version' => @client.api_version},
634
+ headers: request_headers.merge(custom_headers || {}),
635
+ base_url: request_url
636
+ }
637
+ promise = @client.make_request_async(:get, path_template, options)
638
+
639
+ promise = promise.then do |result|
640
+ http_response = result.response
641
+ status_code = http_response.status
642
+ response_content = http_response.body
643
+ unless status_code == 200
644
+ error_model = JSON.load(response_content)
645
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
646
+ end
647
+
648
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
649
+ # Deserialize Response
650
+ if status_code == 200
651
+ begin
652
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
653
+ result_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::Models::EventSubscriptionsListResult.mapper()
654
+ result.body = @client.deserialize(result_mapper, parsed_response)
655
+ rescue Exception => e
656
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
657
+ end
658
+ end
659
+
660
+ result
661
+ end
662
+
663
+ promise.execute
664
+ end
665
+
666
+ #
667
+ # List all global event subscriptions under an Azure subscription and resource
668
+ # group
669
+ #
670
+ # List all global event subscriptions under a specific Azure subscription and
671
+ # resource group
672
+ #
673
+ # @param resource_group_name [String] The name of the resource group within the
674
+ # user's subscription.
675
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
676
+ # will be added to the HTTP request.
677
+ #
678
+ # @return [EventSubscriptionsListResult] operation results.
679
+ #
680
+ def list_global_by_resource_group(resource_group_name, custom_headers:nil)
681
+ response = list_global_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
682
+ response.body unless response.nil?
683
+ end
684
+
685
+ #
686
+ # List all global event subscriptions under an Azure subscription and resource
687
+ # group
688
+ #
689
+ # List all global event subscriptions under a specific Azure subscription and
690
+ # resource group
691
+ #
692
+ # @param resource_group_name [String] The name of the resource group within the
693
+ # user's subscription.
694
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
695
+ # will be added to the HTTP request.
696
+ #
697
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
698
+ #
699
+ def list_global_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
700
+ list_global_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
701
+ end
702
+
703
+ #
704
+ # List all global event subscriptions under an Azure subscription and resource
705
+ # group
706
+ #
707
+ # List all global event subscriptions under a specific Azure subscription and
708
+ # resource group
709
+ #
710
+ # @param resource_group_name [String] The name of the resource group within the
711
+ # user's subscription.
712
+ # @param [Hash{String => String}] A hash of custom headers that will be added
713
+ # to the HTTP request.
714
+ #
715
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
716
+ #
717
+ def list_global_by_resource_group_async(resource_group_name, custom_headers:nil)
718
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
719
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
720
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
721
+
722
+
723
+ request_headers = {}
724
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
725
+
726
+ # Set Headers
727
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
728
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
729
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/eventSubscriptions'
730
+
731
+ request_url = @base_url || @client.base_url
732
+
733
+ options = {
734
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
735
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
736
+ query_params: {'api-version' => @client.api_version},
737
+ headers: request_headers.merge(custom_headers || {}),
738
+ base_url: request_url
739
+ }
740
+ promise = @client.make_request_async(:get, path_template, options)
741
+
742
+ promise = promise.then do |result|
743
+ http_response = result.response
744
+ status_code = http_response.status
745
+ response_content = http_response.body
746
+ unless status_code == 200
747
+ error_model = JSON.load(response_content)
748
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
749
+ end
750
+
751
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
752
+ # Deserialize Response
753
+ if status_code == 200
754
+ begin
755
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
756
+ result_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::Models::EventSubscriptionsListResult.mapper()
757
+ result.body = @client.deserialize(result_mapper, parsed_response)
758
+ rescue Exception => e
759
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
760
+ end
761
+ end
762
+
763
+ result
764
+ end
765
+
766
+ promise.execute
767
+ end
768
+
769
+ #
770
+ # List all global event subscriptions under a resource group for a topic type
771
+ #
772
+ # List all global event subscriptions under a resource group for a specific
773
+ # topic type.
774
+ #
775
+ # @param resource_group_name [String] The name of the resource group within the
776
+ # user's subscription.
777
+ # @param topic_type_name [String] Name of the topic type
778
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
779
+ # will be added to the HTTP request.
780
+ #
781
+ # @return [EventSubscriptionsListResult] operation results.
782
+ #
783
+ def list_global_by_resource_group_for_topic_type(resource_group_name, topic_type_name, custom_headers:nil)
784
+ response = list_global_by_resource_group_for_topic_type_async(resource_group_name, topic_type_name, custom_headers:custom_headers).value!
785
+ response.body unless response.nil?
786
+ end
787
+
788
+ #
789
+ # List all global event subscriptions under a resource group for a topic type
790
+ #
791
+ # List all global event subscriptions under a resource group for a specific
792
+ # topic type.
793
+ #
794
+ # @param resource_group_name [String] The name of the resource group within the
795
+ # user's subscription.
796
+ # @param topic_type_name [String] Name of the topic type
797
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
798
+ # will be added to the HTTP request.
799
+ #
800
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
801
+ #
802
+ def list_global_by_resource_group_for_topic_type_with_http_info(resource_group_name, topic_type_name, custom_headers:nil)
803
+ list_global_by_resource_group_for_topic_type_async(resource_group_name, topic_type_name, custom_headers:custom_headers).value!
804
+ end
805
+
806
+ #
807
+ # List all global event subscriptions under a resource group for a topic type
808
+ #
809
+ # List all global event subscriptions under a resource group for a specific
810
+ # topic type.
811
+ #
812
+ # @param resource_group_name [String] The name of the resource group within the
813
+ # user's subscription.
814
+ # @param topic_type_name [String] Name of the topic type
815
+ # @param [Hash{String => String}] A hash of custom headers that will be added
816
+ # to the HTTP request.
817
+ #
818
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
819
+ #
820
+ def list_global_by_resource_group_for_topic_type_async(resource_group_name, topic_type_name, custom_headers:nil)
821
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
822
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
823
+ fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil?
824
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
825
+
826
+
827
+ request_headers = {}
828
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
829
+
830
+ # Set Headers
831
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
832
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
833
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'
834
+
835
+ request_url = @base_url || @client.base_url
836
+
837
+ options = {
838
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
839
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicTypeName' => topic_type_name},
840
+ query_params: {'api-version' => @client.api_version},
841
+ headers: request_headers.merge(custom_headers || {}),
842
+ base_url: request_url
843
+ }
844
+ promise = @client.make_request_async(:get, path_template, options)
845
+
846
+ promise = promise.then do |result|
847
+ http_response = result.response
848
+ status_code = http_response.status
849
+ response_content = http_response.body
850
+ unless status_code == 200
851
+ error_model = JSON.load(response_content)
852
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
853
+ end
854
+
855
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
856
+ # Deserialize Response
857
+ if status_code == 200
858
+ begin
859
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
860
+ result_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::Models::EventSubscriptionsListResult.mapper()
861
+ result.body = @client.deserialize(result_mapper, parsed_response)
862
+ rescue Exception => e
863
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
864
+ end
865
+ end
866
+
867
+ result
868
+ end
869
+
870
+ promise.execute
871
+ end
872
+
873
+ #
874
+ # List all regional event subscriptions under an Azure subscription
875
+ #
876
+ # List all event subscriptions from the given location under a specific Azure
877
+ # subscription
878
+ #
879
+ # @param location [String] Name of the location
880
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
881
+ # will be added to the HTTP request.
882
+ #
883
+ # @return [EventSubscriptionsListResult] operation results.
884
+ #
885
+ def list_regional_by_subscription(location, custom_headers:nil)
886
+ response = list_regional_by_subscription_async(location, custom_headers:custom_headers).value!
887
+ response.body unless response.nil?
888
+ end
889
+
890
+ #
891
+ # List all regional event subscriptions under an Azure subscription
892
+ #
893
+ # List all event subscriptions from the given location under a specific Azure
894
+ # subscription
895
+ #
896
+ # @param location [String] Name of the location
897
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
898
+ # will be added to the HTTP request.
899
+ #
900
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
901
+ #
902
+ def list_regional_by_subscription_with_http_info(location, custom_headers:nil)
903
+ list_regional_by_subscription_async(location, custom_headers:custom_headers).value!
904
+ end
905
+
906
+ #
907
+ # List all regional event subscriptions under an Azure subscription
908
+ #
909
+ # List all event subscriptions from the given location under a specific Azure
910
+ # subscription
911
+ #
912
+ # @param location [String] Name of the location
913
+ # @param [Hash{String => String}] A hash of custom headers that will be added
914
+ # to the HTTP request.
915
+ #
916
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
917
+ #
918
+ def list_regional_by_subscription_async(location, custom_headers:nil)
919
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
920
+ fail ArgumentError, 'location is nil' if location.nil?
921
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
922
+
923
+
924
+ request_headers = {}
925
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
926
+
927
+ # Set Headers
928
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
929
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
930
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions'
931
+
932
+ request_url = @base_url || @client.base_url
933
+
934
+ options = {
935
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
936
+ path_params: {'subscriptionId' => @client.subscription_id,'location' => location},
937
+ query_params: {'api-version' => @client.api_version},
938
+ headers: request_headers.merge(custom_headers || {}),
939
+ base_url: request_url
940
+ }
941
+ promise = @client.make_request_async(:get, path_template, options)
942
+
943
+ promise = promise.then do |result|
944
+ http_response = result.response
945
+ status_code = http_response.status
946
+ response_content = http_response.body
947
+ unless status_code == 200
948
+ error_model = JSON.load(response_content)
949
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
950
+ end
951
+
952
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
953
+ # Deserialize Response
954
+ if status_code == 200
955
+ begin
956
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
957
+ result_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::Models::EventSubscriptionsListResult.mapper()
958
+ result.body = @client.deserialize(result_mapper, parsed_response)
959
+ rescue Exception => e
960
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
961
+ end
962
+ end
963
+
964
+ result
965
+ end
966
+
967
+ promise.execute
968
+ end
969
+
970
+ #
971
+ # List all regional event subscriptions under an Azure subscription and
972
+ # resource group
973
+ #
974
+ # List all event subscriptions from the given location under a specific Azure
975
+ # subscription and resource group
976
+ #
977
+ # @param resource_group_name [String] The name of the resource group within the
978
+ # user's subscription.
979
+ # @param location [String] Name of the location
980
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
981
+ # will be added to the HTTP request.
982
+ #
983
+ # @return [EventSubscriptionsListResult] operation results.
984
+ #
985
+ def list_regional_by_resource_group(resource_group_name, location, custom_headers:nil)
986
+ response = list_regional_by_resource_group_async(resource_group_name, location, custom_headers:custom_headers).value!
987
+ response.body unless response.nil?
988
+ end
989
+
990
+ #
991
+ # List all regional event subscriptions under an Azure subscription and
992
+ # resource group
993
+ #
994
+ # List all event subscriptions from the given location under a specific Azure
995
+ # subscription and resource group
996
+ #
997
+ # @param resource_group_name [String] The name of the resource group within the
998
+ # user's subscription.
999
+ # @param location [String] Name of the location
1000
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1001
+ # will be added to the HTTP request.
1002
+ #
1003
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1004
+ #
1005
+ def list_regional_by_resource_group_with_http_info(resource_group_name, location, custom_headers:nil)
1006
+ list_regional_by_resource_group_async(resource_group_name, location, custom_headers:custom_headers).value!
1007
+ end
1008
+
1009
+ #
1010
+ # List all regional event subscriptions under an Azure subscription and
1011
+ # resource group
1012
+ #
1013
+ # List all event subscriptions from the given location under a specific Azure
1014
+ # subscription and resource group
1015
+ #
1016
+ # @param resource_group_name [String] The name of the resource group within the
1017
+ # user's subscription.
1018
+ # @param location [String] Name of the location
1019
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1020
+ # to the HTTP request.
1021
+ #
1022
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1023
+ #
1024
+ def list_regional_by_resource_group_async(resource_group_name, location, custom_headers:nil)
1025
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1026
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1027
+ fail ArgumentError, 'location is nil' if location.nil?
1028
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1029
+
1030
+
1031
+ request_headers = {}
1032
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1033
+
1034
+ # Set Headers
1035
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1036
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1037
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions'
1038
+
1039
+ request_url = @base_url || @client.base_url
1040
+
1041
+ options = {
1042
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1043
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'location' => location},
1044
+ query_params: {'api-version' => @client.api_version},
1045
+ headers: request_headers.merge(custom_headers || {}),
1046
+ base_url: request_url
1047
+ }
1048
+ promise = @client.make_request_async(:get, path_template, options)
1049
+
1050
+ promise = promise.then do |result|
1051
+ http_response = result.response
1052
+ status_code = http_response.status
1053
+ response_content = http_response.body
1054
+ unless status_code == 200
1055
+ error_model = JSON.load(response_content)
1056
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1057
+ end
1058
+
1059
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1060
+ # Deserialize Response
1061
+ if status_code == 200
1062
+ begin
1063
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1064
+ result_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::Models::EventSubscriptionsListResult.mapper()
1065
+ result.body = @client.deserialize(result_mapper, parsed_response)
1066
+ rescue Exception => e
1067
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1068
+ end
1069
+ end
1070
+
1071
+ result
1072
+ end
1073
+
1074
+ promise.execute
1075
+ end
1076
+
1077
+ #
1078
+ # List all regional event subscriptions under an Azure subscription for a topic
1079
+ # type
1080
+ #
1081
+ # List all event subscriptions from the given location under a specific Azure
1082
+ # subscription and topic type.
1083
+ #
1084
+ # @param location [String] Name of the location
1085
+ # @param topic_type_name [String] Name of the topic type
1086
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1087
+ # will be added to the HTTP request.
1088
+ #
1089
+ # @return [EventSubscriptionsListResult] operation results.
1090
+ #
1091
+ def list_regional_by_subscription_for_topic_type(location, topic_type_name, custom_headers:nil)
1092
+ response = list_regional_by_subscription_for_topic_type_async(location, topic_type_name, custom_headers:custom_headers).value!
1093
+ response.body unless response.nil?
1094
+ end
1095
+
1096
+ #
1097
+ # List all regional event subscriptions under an Azure subscription for a topic
1098
+ # type
1099
+ #
1100
+ # List all event subscriptions from the given location under a specific Azure
1101
+ # subscription and topic type.
1102
+ #
1103
+ # @param location [String] Name of the location
1104
+ # @param topic_type_name [String] Name of the topic type
1105
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1106
+ # will be added to the HTTP request.
1107
+ #
1108
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1109
+ #
1110
+ def list_regional_by_subscription_for_topic_type_with_http_info(location, topic_type_name, custom_headers:nil)
1111
+ list_regional_by_subscription_for_topic_type_async(location, topic_type_name, custom_headers:custom_headers).value!
1112
+ end
1113
+
1114
+ #
1115
+ # List all regional event subscriptions under an Azure subscription for a topic
1116
+ # type
1117
+ #
1118
+ # List all event subscriptions from the given location under a specific Azure
1119
+ # subscription and topic type.
1120
+ #
1121
+ # @param location [String] Name of the location
1122
+ # @param topic_type_name [String] Name of the topic type
1123
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1124
+ # to the HTTP request.
1125
+ #
1126
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1127
+ #
1128
+ def list_regional_by_subscription_for_topic_type_async(location, topic_type_name, custom_headers:nil)
1129
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1130
+ fail ArgumentError, 'location is nil' if location.nil?
1131
+ fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil?
1132
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1133
+
1134
+
1135
+ request_headers = {}
1136
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1137
+
1138
+ # Set Headers
1139
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1140
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1141
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'
1142
+
1143
+ request_url = @base_url || @client.base_url
1144
+
1145
+ options = {
1146
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1147
+ path_params: {'subscriptionId' => @client.subscription_id,'location' => location,'topicTypeName' => topic_type_name},
1148
+ query_params: {'api-version' => @client.api_version},
1149
+ headers: request_headers.merge(custom_headers || {}),
1150
+ base_url: request_url
1151
+ }
1152
+ promise = @client.make_request_async(:get, path_template, options)
1153
+
1154
+ promise = promise.then do |result|
1155
+ http_response = result.response
1156
+ status_code = http_response.status
1157
+ response_content = http_response.body
1158
+ unless status_code == 200
1159
+ error_model = JSON.load(response_content)
1160
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1161
+ end
1162
+
1163
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1164
+ # Deserialize Response
1165
+ if status_code == 200
1166
+ begin
1167
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1168
+ result_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::Models::EventSubscriptionsListResult.mapper()
1169
+ result.body = @client.deserialize(result_mapper, parsed_response)
1170
+ rescue Exception => e
1171
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1172
+ end
1173
+ end
1174
+
1175
+ result
1176
+ end
1177
+
1178
+ promise.execute
1179
+ end
1180
+
1181
+ #
1182
+ # List all regional event subscriptions under an Azure subscription and
1183
+ # resource group for a topic type
1184
+ #
1185
+ # List all event subscriptions from the given location under a specific Azure
1186
+ # subscription and resource group and topic type
1187
+ #
1188
+ # @param resource_group_name [String] The name of the resource group within the
1189
+ # user's subscription.
1190
+ # @param location [String] Name of the location
1191
+ # @param topic_type_name [String] Name of the topic type
1192
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1193
+ # will be added to the HTTP request.
1194
+ #
1195
+ # @return [EventSubscriptionsListResult] operation results.
1196
+ #
1197
+ def list_regional_by_resource_group_for_topic_type(resource_group_name, location, topic_type_name, custom_headers:nil)
1198
+ response = list_regional_by_resource_group_for_topic_type_async(resource_group_name, location, topic_type_name, custom_headers:custom_headers).value!
1199
+ response.body unless response.nil?
1200
+ end
1201
+
1202
+ #
1203
+ # List all regional event subscriptions under an Azure subscription and
1204
+ # resource group for a topic type
1205
+ #
1206
+ # List all event subscriptions from the given location under a specific Azure
1207
+ # subscription and resource group and topic type
1208
+ #
1209
+ # @param resource_group_name [String] The name of the resource group within the
1210
+ # user's subscription.
1211
+ # @param location [String] Name of the location
1212
+ # @param topic_type_name [String] Name of the topic type
1213
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1214
+ # will be added to the HTTP request.
1215
+ #
1216
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1217
+ #
1218
+ def list_regional_by_resource_group_for_topic_type_with_http_info(resource_group_name, location, topic_type_name, custom_headers:nil)
1219
+ list_regional_by_resource_group_for_topic_type_async(resource_group_name, location, topic_type_name, custom_headers:custom_headers).value!
1220
+ end
1221
+
1222
+ #
1223
+ # List all regional event subscriptions under an Azure subscription and
1224
+ # resource group for a topic type
1225
+ #
1226
+ # List all event subscriptions from the given location under a specific Azure
1227
+ # subscription and resource group and topic type
1228
+ #
1229
+ # @param resource_group_name [String] The name of the resource group within the
1230
+ # user's subscription.
1231
+ # @param location [String] Name of the location
1232
+ # @param topic_type_name [String] Name of the topic type
1233
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1234
+ # to the HTTP request.
1235
+ #
1236
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1237
+ #
1238
+ def list_regional_by_resource_group_for_topic_type_async(resource_group_name, location, topic_type_name, custom_headers:nil)
1239
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1240
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1241
+ fail ArgumentError, 'location is nil' if location.nil?
1242
+ fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil?
1243
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1244
+
1245
+
1246
+ request_headers = {}
1247
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1248
+
1249
+ # Set Headers
1250
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1251
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1252
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'
1253
+
1254
+ request_url = @base_url || @client.base_url
1255
+
1256
+ options = {
1257
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1258
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'location' => location,'topicTypeName' => topic_type_name},
1259
+ query_params: {'api-version' => @client.api_version},
1260
+ headers: request_headers.merge(custom_headers || {}),
1261
+ base_url: request_url
1262
+ }
1263
+ promise = @client.make_request_async(:get, path_template, options)
1264
+
1265
+ promise = promise.then do |result|
1266
+ http_response = result.response
1267
+ status_code = http_response.status
1268
+ response_content = http_response.body
1269
+ unless status_code == 200
1270
+ error_model = JSON.load(response_content)
1271
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1272
+ end
1273
+
1274
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1275
+ # Deserialize Response
1276
+ if status_code == 200
1277
+ begin
1278
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1279
+ result_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::Models::EventSubscriptionsListResult.mapper()
1280
+ result.body = @client.deserialize(result_mapper, parsed_response)
1281
+ rescue Exception => e
1282
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1283
+ end
1284
+ end
1285
+
1286
+ result
1287
+ end
1288
+
1289
+ promise.execute
1290
+ end
1291
+
1292
+ #
1293
+ # List all event subscriptions for a specific topic
1294
+ #
1295
+ # List all event subscriptions that have been created for a specific topic
1296
+ #
1297
+ # @param resource_group_name [String] The name of the resource group within the
1298
+ # user's subscription.
1299
+ # @param provider_namespace [String] Namespace of the provider of the topic
1300
+ # @param resource_type_name [String] Name of the resource type
1301
+ # @param resource_name [String] Name of the resource
1302
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1303
+ # will be added to the HTTP request.
1304
+ #
1305
+ # @return [EventSubscriptionsListResult] operation results.
1306
+ #
1307
+ def list_by_resource(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:nil)
1308
+ response = list_by_resource_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:custom_headers).value!
1309
+ response.body unless response.nil?
1310
+ end
1311
+
1312
+ #
1313
+ # List all event subscriptions for a specific topic
1314
+ #
1315
+ # List all event subscriptions that have been created for a specific topic
1316
+ #
1317
+ # @param resource_group_name [String] The name of the resource group within the
1318
+ # user's subscription.
1319
+ # @param provider_namespace [String] Namespace of the provider of the topic
1320
+ # @param resource_type_name [String] Name of the resource type
1321
+ # @param resource_name [String] Name of the resource
1322
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1323
+ # will be added to the HTTP request.
1324
+ #
1325
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1326
+ #
1327
+ def list_by_resource_with_http_info(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:nil)
1328
+ list_by_resource_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:custom_headers).value!
1329
+ end
1330
+
1331
+ #
1332
+ # List all event subscriptions for a specific topic
1333
+ #
1334
+ # List all event subscriptions that have been created for a specific topic
1335
+ #
1336
+ # @param resource_group_name [String] The name of the resource group within the
1337
+ # user's subscription.
1338
+ # @param provider_namespace [String] Namespace of the provider of the topic
1339
+ # @param resource_type_name [String] Name of the resource type
1340
+ # @param resource_name [String] Name of the resource
1341
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1342
+ # to the HTTP request.
1343
+ #
1344
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1345
+ #
1346
+ def list_by_resource_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:nil)
1347
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1348
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1349
+ fail ArgumentError, 'provider_namespace is nil' if provider_namespace.nil?
1350
+ fail ArgumentError, 'resource_type_name is nil' if resource_type_name.nil?
1351
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1352
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1353
+
1354
+
1355
+ request_headers = {}
1356
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1357
+
1358
+ # Set Headers
1359
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1360
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1361
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions'
1362
+
1363
+ request_url = @base_url || @client.base_url
1364
+
1365
+ options = {
1366
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1367
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'providerNamespace' => provider_namespace,'resourceTypeName' => resource_type_name,'resourceName' => resource_name},
1368
+ query_params: {'api-version' => @client.api_version},
1369
+ headers: request_headers.merge(custom_headers || {}),
1370
+ base_url: request_url
1371
+ }
1372
+ promise = @client.make_request_async(:get, path_template, options)
1373
+
1374
+ promise = promise.then do |result|
1375
+ http_response = result.response
1376
+ status_code = http_response.status
1377
+ response_content = http_response.body
1378
+ unless status_code == 200
1379
+ error_model = JSON.load(response_content)
1380
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1381
+ end
1382
+
1383
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1384
+ # Deserialize Response
1385
+ if status_code == 200
1386
+ begin
1387
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1388
+ result_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::Models::EventSubscriptionsListResult.mapper()
1389
+ result.body = @client.deserialize(result_mapper, parsed_response)
1390
+ rescue Exception => e
1391
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1392
+ end
1393
+ end
1394
+
1395
+ result
1396
+ end
1397
+
1398
+ promise.execute
1399
+ end
1400
+
1401
+ #
1402
+ # List all event subscriptions for a specific domain topic
1403
+ #
1404
+ # List all event subscriptions that have been created for a specific domain
1405
+ # topic
1406
+ #
1407
+ # @param resource_group_name [String] The name of the resource group within the
1408
+ # user's subscription.
1409
+ # @param domain_name [String] Name of the top level domain
1410
+ # @param topic_name [String] Name of the domain topic
1411
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1412
+ # will be added to the HTTP request.
1413
+ #
1414
+ # @return [EventSubscriptionsListResult] operation results.
1415
+ #
1416
+ def list_by_domain_topic(resource_group_name, domain_name, topic_name, custom_headers:nil)
1417
+ response = list_by_domain_topic_async(resource_group_name, domain_name, topic_name, custom_headers:custom_headers).value!
1418
+ response.body unless response.nil?
1419
+ end
1420
+
1421
+ #
1422
+ # List all event subscriptions for a specific domain topic
1423
+ #
1424
+ # List all event subscriptions that have been created for a specific domain
1425
+ # topic
1426
+ #
1427
+ # @param resource_group_name [String] The name of the resource group within the
1428
+ # user's subscription.
1429
+ # @param domain_name [String] Name of the top level domain
1430
+ # @param topic_name [String] Name of the domain topic
1431
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1432
+ # will be added to the HTTP request.
1433
+ #
1434
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1435
+ #
1436
+ def list_by_domain_topic_with_http_info(resource_group_name, domain_name, topic_name, custom_headers:nil)
1437
+ list_by_domain_topic_async(resource_group_name, domain_name, topic_name, custom_headers:custom_headers).value!
1438
+ end
1439
+
1440
+ #
1441
+ # List all event subscriptions for a specific domain topic
1442
+ #
1443
+ # List all event subscriptions that have been created for a specific domain
1444
+ # topic
1445
+ #
1446
+ # @param resource_group_name [String] The name of the resource group within the
1447
+ # user's subscription.
1448
+ # @param domain_name [String] Name of the top level domain
1449
+ # @param topic_name [String] Name of the domain topic
1450
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1451
+ # to the HTTP request.
1452
+ #
1453
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1454
+ #
1455
+ def list_by_domain_topic_async(resource_group_name, domain_name, topic_name, custom_headers:nil)
1456
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1457
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1458
+ fail ArgumentError, 'domain_name is nil' if domain_name.nil?
1459
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
1460
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1461
+
1462
+
1463
+ request_headers = {}
1464
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1465
+
1466
+ # Set Headers
1467
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1468
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1469
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/providers/Microsoft.EventGrid/eventSubscriptions'
1470
+
1471
+ request_url = @base_url || @client.base_url
1472
+
1473
+ options = {
1474
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1475
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'domainName' => domain_name,'topicName' => topic_name},
1476
+ query_params: {'api-version' => @client.api_version},
1477
+ headers: request_headers.merge(custom_headers || {}),
1478
+ base_url: request_url
1479
+ }
1480
+ promise = @client.make_request_async(:get, path_template, options)
1481
+
1482
+ promise = promise.then do |result|
1483
+ http_response = result.response
1484
+ status_code = http_response.status
1485
+ response_content = http_response.body
1486
+ unless status_code == 200
1487
+ error_model = JSON.load(response_content)
1488
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1489
+ end
1490
+
1491
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1492
+ # Deserialize Response
1493
+ if status_code == 200
1494
+ begin
1495
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1496
+ result_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::Models::EventSubscriptionsListResult.mapper()
1497
+ result.body = @client.deserialize(result_mapper, parsed_response)
1498
+ rescue Exception => e
1499
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1500
+ end
1501
+ end
1502
+
1503
+ result
1504
+ end
1505
+
1506
+ promise.execute
1507
+ end
1508
+
1509
+ #
1510
+ # Create or update an event subscription
1511
+ #
1512
+ # Asynchronously creates a new event subscription or updates an existing event
1513
+ # subscription based on the specified scope.
1514
+ #
1515
+ # @param scope [String] The identifier of the resource to which the event
1516
+ # subscription needs to be created or updated. The scope can be a subscription,
1517
+ # or a resource group, or a top level resource belonging to a resource provider
1518
+ # namespace, or an EventGrid topic. For example, use
1519
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1520
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1521
+ # resource group, and
1522
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1523
+ # for a resource, and
1524
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1525
+ # for an EventGrid topic.
1526
+ # @param event_subscription_name [String] Name of the event subscription. Event
1527
+ # subscription names must be between 3 and 64 characters in length and should
1528
+ # use alphanumeric letters only.
1529
+ # @param event_subscription_info [EventSubscription] Event subscription
1530
+ # properties containing the destination and filter information
1531
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1532
+ # will be added to the HTTP request.
1533
+ #
1534
+ # @return [EventSubscription] operation results.
1535
+ #
1536
+ def begin_create_or_update(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
1537
+ response = begin_create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers:custom_headers).value!
1538
+ response.body unless response.nil?
1539
+ end
1540
+
1541
+ #
1542
+ # Create or update an event subscription
1543
+ #
1544
+ # Asynchronously creates a new event subscription or updates an existing event
1545
+ # subscription based on the specified scope.
1546
+ #
1547
+ # @param scope [String] The identifier of the resource to which the event
1548
+ # subscription needs to be created or updated. The scope can be a subscription,
1549
+ # or a resource group, or a top level resource belonging to a resource provider
1550
+ # namespace, or an EventGrid topic. For example, use
1551
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1552
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1553
+ # resource group, and
1554
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1555
+ # for a resource, and
1556
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1557
+ # for an EventGrid topic.
1558
+ # @param event_subscription_name [String] Name of the event subscription. Event
1559
+ # subscription names must be between 3 and 64 characters in length and should
1560
+ # use alphanumeric letters only.
1561
+ # @param event_subscription_info [EventSubscription] Event subscription
1562
+ # properties containing the destination and filter information
1563
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1564
+ # will be added to the HTTP request.
1565
+ #
1566
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1567
+ #
1568
+ def begin_create_or_update_with_http_info(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
1569
+ begin_create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers:custom_headers).value!
1570
+ end
1571
+
1572
+ #
1573
+ # Create or update an event subscription
1574
+ #
1575
+ # Asynchronously creates a new event subscription or updates an existing event
1576
+ # subscription based on the specified scope.
1577
+ #
1578
+ # @param scope [String] The identifier of the resource to which the event
1579
+ # subscription needs to be created or updated. The scope can be a subscription,
1580
+ # or a resource group, or a top level resource belonging to a resource provider
1581
+ # namespace, or an EventGrid topic. For example, use
1582
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1583
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1584
+ # resource group, and
1585
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1586
+ # for a resource, and
1587
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1588
+ # for an EventGrid topic.
1589
+ # @param event_subscription_name [String] Name of the event subscription. Event
1590
+ # subscription names must be between 3 and 64 characters in length and should
1591
+ # use alphanumeric letters only.
1592
+ # @param event_subscription_info [EventSubscription] Event subscription
1593
+ # properties containing the destination and filter information
1594
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1595
+ # to the HTTP request.
1596
+ #
1597
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1598
+ #
1599
+ def begin_create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
1600
+ fail ArgumentError, 'scope is nil' if scope.nil?
1601
+ fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil?
1602
+ fail ArgumentError, 'event_subscription_info is nil' if event_subscription_info.nil?
1603
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1604
+
1605
+
1606
+ request_headers = {}
1607
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1608
+
1609
+ # Set Headers
1610
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1611
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1612
+
1613
+ # Serialize Request
1614
+ request_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::Models::EventSubscription.mapper()
1615
+ request_content = @client.serialize(request_mapper, event_subscription_info)
1616
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1617
+
1618
+ path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'
1619
+
1620
+ request_url = @base_url || @client.base_url
1621
+
1622
+ options = {
1623
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1624
+ path_params: {'eventSubscriptionName' => event_subscription_name},
1625
+ skip_encoding_path_params: {'scope' => scope},
1626
+ query_params: {'api-version' => @client.api_version},
1627
+ body: request_content,
1628
+ headers: request_headers.merge(custom_headers || {}),
1629
+ base_url: request_url
1630
+ }
1631
+ promise = @client.make_request_async(:put, path_template, options)
1632
+
1633
+ promise = promise.then do |result|
1634
+ http_response = result.response
1635
+ status_code = http_response.status
1636
+ response_content = http_response.body
1637
+ unless status_code == 201
1638
+ error_model = JSON.load(response_content)
1639
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1640
+ end
1641
+
1642
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1643
+ # Deserialize Response
1644
+ if status_code == 201
1645
+ begin
1646
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1647
+ result_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::Models::EventSubscription.mapper()
1648
+ result.body = @client.deserialize(result_mapper, parsed_response)
1649
+ rescue Exception => e
1650
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1651
+ end
1652
+ end
1653
+
1654
+ result
1655
+ end
1656
+
1657
+ promise.execute
1658
+ end
1659
+
1660
+ #
1661
+ # Delete an event subscription
1662
+ #
1663
+ # Delete an existing event subscription
1664
+ #
1665
+ # @param scope [String] The scope of the event subscription. The scope can be a
1666
+ # subscription, or a resource group, or a top level resource belonging to a
1667
+ # resource provider namespace, or an EventGrid topic. For example, use
1668
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1669
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1670
+ # resource group, and
1671
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1672
+ # for a resource, and
1673
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1674
+ # for an EventGrid topic.
1675
+ # @param event_subscription_name [String] Name of the event subscription
1676
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1677
+ # will be added to the HTTP request.
1678
+ #
1679
+ #
1680
+ def begin_delete(scope, event_subscription_name, custom_headers:nil)
1681
+ response = begin_delete_async(scope, event_subscription_name, custom_headers:custom_headers).value!
1682
+ nil
1683
+ end
1684
+
1685
+ #
1686
+ # Delete an event subscription
1687
+ #
1688
+ # Delete an existing event subscription
1689
+ #
1690
+ # @param scope [String] The scope of the event subscription. The scope can be a
1691
+ # subscription, or a resource group, or a top level resource belonging to a
1692
+ # resource provider namespace, or an EventGrid topic. For example, use
1693
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1694
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1695
+ # resource group, and
1696
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1697
+ # for a resource, and
1698
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1699
+ # for an EventGrid topic.
1700
+ # @param event_subscription_name [String] Name of the event subscription
1701
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1702
+ # will be added to the HTTP request.
1703
+ #
1704
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1705
+ #
1706
+ def begin_delete_with_http_info(scope, event_subscription_name, custom_headers:nil)
1707
+ begin_delete_async(scope, event_subscription_name, custom_headers:custom_headers).value!
1708
+ end
1709
+
1710
+ #
1711
+ # Delete an event subscription
1712
+ #
1713
+ # Delete an existing event subscription
1714
+ #
1715
+ # @param scope [String] The scope of the event subscription. The scope can be a
1716
+ # subscription, or a resource group, or a top level resource belonging to a
1717
+ # resource provider namespace, or an EventGrid topic. For example, use
1718
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1719
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1720
+ # resource group, and
1721
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1722
+ # for a resource, and
1723
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1724
+ # for an EventGrid topic.
1725
+ # @param event_subscription_name [String] Name of the event subscription
1726
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1727
+ # to the HTTP request.
1728
+ #
1729
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1730
+ #
1731
+ def begin_delete_async(scope, event_subscription_name, custom_headers:nil)
1732
+ fail ArgumentError, 'scope is nil' if scope.nil?
1733
+ fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil?
1734
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1735
+
1736
+
1737
+ request_headers = {}
1738
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1739
+
1740
+ # Set Headers
1741
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1742
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1743
+ path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'
1744
+
1745
+ request_url = @base_url || @client.base_url
1746
+
1747
+ options = {
1748
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1749
+ path_params: {'eventSubscriptionName' => event_subscription_name},
1750
+ skip_encoding_path_params: {'scope' => scope},
1751
+ query_params: {'api-version' => @client.api_version},
1752
+ headers: request_headers.merge(custom_headers || {}),
1753
+ base_url: request_url
1754
+ }
1755
+ promise = @client.make_request_async(:delete, path_template, options)
1756
+
1757
+ promise = promise.then do |result|
1758
+ http_response = result.response
1759
+ status_code = http_response.status
1760
+ response_content = http_response.body
1761
+ unless status_code == 200 || status_code == 202 || status_code == 204
1762
+ error_model = JSON.load(response_content)
1763
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1764
+ end
1765
+
1766
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1767
+
1768
+ result
1769
+ end
1770
+
1771
+ promise.execute
1772
+ end
1773
+
1774
+ #
1775
+ # Update an event subscription
1776
+ #
1777
+ # Asynchronously updates an existing event subscription.
1778
+ #
1779
+ # @param scope [String] The scope of existing event subscription. The scope can
1780
+ # be a subscription, or a resource group, or a top level resource belonging to
1781
+ # a resource provider namespace, or an EventGrid topic. For example, use
1782
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1783
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1784
+ # resource group, and
1785
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1786
+ # for a resource, and
1787
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1788
+ # for an EventGrid topic.
1789
+ # @param event_subscription_name [String] Name of the event subscription to be
1790
+ # updated
1791
+ # @param event_subscription_update_parameters
1792
+ # [EventSubscriptionUpdateParameters] Updated event subscription information
1793
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1794
+ # will be added to the HTTP request.
1795
+ #
1796
+ # @return [EventSubscription] operation results.
1797
+ #
1798
+ def begin_update(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil)
1799
+ response = begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:custom_headers).value!
1800
+ response.body unless response.nil?
1801
+ end
1802
+
1803
+ #
1804
+ # Update an event subscription
1805
+ #
1806
+ # Asynchronously updates an existing event subscription.
1807
+ #
1808
+ # @param scope [String] The scope of existing event subscription. The scope can
1809
+ # be a subscription, or a resource group, or a top level resource belonging to
1810
+ # a resource provider namespace, or an EventGrid topic. For example, use
1811
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1812
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1813
+ # resource group, and
1814
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1815
+ # for a resource, and
1816
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1817
+ # for an EventGrid topic.
1818
+ # @param event_subscription_name [String] Name of the event subscription to be
1819
+ # updated
1820
+ # @param event_subscription_update_parameters
1821
+ # [EventSubscriptionUpdateParameters] Updated event subscription information
1822
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1823
+ # will be added to the HTTP request.
1824
+ #
1825
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1826
+ #
1827
+ def begin_update_with_http_info(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil)
1828
+ begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:custom_headers).value!
1829
+ end
1830
+
1831
+ #
1832
+ # Update an event subscription
1833
+ #
1834
+ # Asynchronously updates an existing event subscription.
1835
+ #
1836
+ # @param scope [String] The scope of existing event subscription. The scope can
1837
+ # be a subscription, or a resource group, or a top level resource belonging to
1838
+ # a resource provider namespace, or an EventGrid topic. For example, use
1839
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1840
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1841
+ # resource group, and
1842
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1843
+ # for a resource, and
1844
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1845
+ # for an EventGrid topic.
1846
+ # @param event_subscription_name [String] Name of the event subscription to be
1847
+ # updated
1848
+ # @param event_subscription_update_parameters
1849
+ # [EventSubscriptionUpdateParameters] Updated event subscription information
1850
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1851
+ # to the HTTP request.
1852
+ #
1853
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1854
+ #
1855
+ def begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil)
1856
+ fail ArgumentError, 'scope is nil' if scope.nil?
1857
+ fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil?
1858
+ fail ArgumentError, 'event_subscription_update_parameters is nil' if event_subscription_update_parameters.nil?
1859
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1860
+
1861
+
1862
+ request_headers = {}
1863
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1864
+
1865
+ # Set Headers
1866
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1867
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1868
+
1869
+ # Serialize Request
1870
+ request_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::Models::EventSubscriptionUpdateParameters.mapper()
1871
+ request_content = @client.serialize(request_mapper, event_subscription_update_parameters)
1872
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1873
+
1874
+ path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'
1875
+
1876
+ request_url = @base_url || @client.base_url
1877
+
1878
+ options = {
1879
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1880
+ path_params: {'eventSubscriptionName' => event_subscription_name},
1881
+ skip_encoding_path_params: {'scope' => scope},
1882
+ query_params: {'api-version' => @client.api_version},
1883
+ body: request_content,
1884
+ headers: request_headers.merge(custom_headers || {}),
1885
+ base_url: request_url
1886
+ }
1887
+ promise = @client.make_request_async(:patch, path_template, options)
1888
+
1889
+ promise = promise.then do |result|
1890
+ http_response = result.response
1891
+ status_code = http_response.status
1892
+ response_content = http_response.body
1893
+ unless status_code == 201
1894
+ error_model = JSON.load(response_content)
1895
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1896
+ end
1897
+
1898
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1899
+ # Deserialize Response
1900
+ if status_code == 201
1901
+ begin
1902
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1903
+ result_mapper = Azure::EventGrid::Mgmt::V2018_09_15_preview::Models::EventSubscription.mapper()
1904
+ result.body = @client.deserialize(result_mapper, parsed_response)
1905
+ rescue Exception => e
1906
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1907
+ end
1908
+ end
1909
+
1910
+ result
1911
+ end
1912
+
1913
+ promise.execute
1914
+ end
1915
+
1916
+ end
1917
+ end