azure_mgmt_event_hub 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-08-01/generated/azure_mgmt_event_hub/event_hub_management_client.rb +7 -6
  3. data/lib/2015-08-01/generated/azure_mgmt_event_hub/event_hubs.rb +111 -0
  4. data/lib/2017-04-01/generated/azure_mgmt_event_hub.rb +11 -6
  5. data/lib/2017-04-01/generated/azure_mgmt_event_hub/consumer_groups.rb +36 -8
  6. data/lib/2017-04-01/generated/azure_mgmt_event_hub/event_hub_management_client.rb +11 -6
  7. data/lib/2017-04-01/generated/azure_mgmt_event_hub/event_hubs.rb +36 -8
  8. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/arm_disaster_recovery.rb +12 -0
  9. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/messaging_plan.rb +134 -0
  10. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/messaging_regions.rb +98 -0
  11. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/messaging_regions_list_result.rb +101 -0
  12. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/messaging_regions_properties.rb +60 -0
  13. data/lib/2017-04-01/generated/azure_mgmt_event_hub/namespaces.rb +99 -0
  14. data/lib/2017-04-01/generated/azure_mgmt_event_hub/regions.rb +224 -0
  15. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub.rb +51 -0
  16. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/clusters.rb +503 -0
  17. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/configuration.rb +257 -0
  18. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/event_hub2018preview_management_client.rb +145 -0
  19. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/cluster.rb +136 -0
  20. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/cluster_list_result.rb +100 -0
  21. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/cluster_quota_configuration_properties.rb +56 -0
  22. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/cluster_sku.rb +64 -0
  23. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/ehnamespace.rb +212 -0
  24. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/ehnamespace_list_result.rb +99 -0
  25. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/error_response.rb +58 -0
  26. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/ip_filter_rule.rb +96 -0
  27. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/ip_filter_rule_list_result.rb +100 -0
  28. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/ipaction.rb +16 -0
  29. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/operation.rb +59 -0
  30. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/operation_display.rb +72 -0
  31. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/operation_list_result.rb +103 -0
  32. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/resource.rb +71 -0
  33. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/sku.rb +75 -0
  34. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/sku_name.rb +16 -0
  35. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/sku_tier.rb +16 -0
  36. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/tracked_resource.rb +92 -0
  37. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/virtual_network_rule.rb +73 -0
  38. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/virtual_network_rule_list_result.rb +100 -0
  39. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/module_definition.rb +9 -0
  40. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/namespaces.rb +2006 -0
  41. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/operations.rb +216 -0
  42. data/lib/azure_mgmt_event_hub.rb +2 -1
  43. data/lib/profiles/latest/modules/eventhub_profile_module.rb +61 -111
  44. data/lib/version.rb +1 -1
  45. metadata +37 -5
@@ -0,0 +1,224 @@
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::EventHub::Mgmt::V2017_04_01
7
+ #
8
+ # Azure Event Hubs client
9
+ #
10
+ class Regions
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Regions class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [EventHubManagementClient] reference to the EventHubManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets the available Regions for a given sku
26
+ #
27
+ # @param sku [String] The sku type.
28
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
29
+ # will be added to the HTTP request.
30
+ #
31
+ # @return [Array<MessagingRegions>] operation results.
32
+ #
33
+ def list_by_sku(sku, custom_headers:nil)
34
+ first_page = list_by_sku_as_lazy(sku, custom_headers:custom_headers)
35
+ first_page.get_all_items
36
+ end
37
+
38
+ #
39
+ # Gets the available Regions for a given sku
40
+ #
41
+ # @param sku [String] The sku type.
42
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
43
+ # will be added to the HTTP request.
44
+ #
45
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
46
+ #
47
+ def list_by_sku_with_http_info(sku, custom_headers:nil)
48
+ list_by_sku_async(sku, custom_headers:custom_headers).value!
49
+ end
50
+
51
+ #
52
+ # Gets the available Regions for a given sku
53
+ #
54
+ # @param sku [String] The sku type.
55
+ # @param [Hash{String => String}] A hash of custom headers that will be added
56
+ # to the HTTP request.
57
+ #
58
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
59
+ #
60
+ def list_by_sku_async(sku, custom_headers:nil)
61
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
62
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
63
+ fail ArgumentError, 'sku is nil' if sku.nil?
64
+ fail ArgumentError, "'sku' should satisfy the constraint - 'MaxLength': '50'" if !sku.nil? && sku.length > 50
65
+ fail ArgumentError, "'sku' should satisfy the constraint - 'MinLength': '1'" if !sku.nil? && sku.length < 1
66
+
67
+
68
+ request_headers = {}
69
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
70
+
71
+ # Set Headers
72
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
73
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
74
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventHub/sku/{sku}/regions'
75
+
76
+ request_url = @base_url || @client.base_url
77
+
78
+ options = {
79
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
80
+ path_params: {'subscriptionId' => @client.subscription_id,'sku' => sku},
81
+ query_params: {'api-version' => @client.api_version},
82
+ headers: request_headers.merge(custom_headers || {}),
83
+ base_url: request_url
84
+ }
85
+ promise = @client.make_request_async(:get, path_template, options)
86
+
87
+ promise = promise.then do |result|
88
+ http_response = result.response
89
+ status_code = http_response.status
90
+ response_content = http_response.body
91
+ unless status_code == 200
92
+ error_model = JSON.load(response_content)
93
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
94
+ end
95
+
96
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
97
+ # Deserialize Response
98
+ if status_code == 200
99
+ begin
100
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
101
+ result_mapper = Azure::EventHub::Mgmt::V2017_04_01::Models::MessagingRegionsListResult.mapper()
102
+ result.body = @client.deserialize(result_mapper, parsed_response)
103
+ rescue Exception => e
104
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
105
+ end
106
+ end
107
+
108
+ result
109
+ end
110
+
111
+ promise.execute
112
+ end
113
+
114
+ #
115
+ # Gets the available Regions for a given sku
116
+ #
117
+ # @param next_page_link [String] The NextLink from the previous successful call
118
+ # to List operation.
119
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
120
+ # will be added to the HTTP request.
121
+ #
122
+ # @return [MessagingRegionsListResult] operation results.
123
+ #
124
+ def list_by_sku_next(next_page_link, custom_headers:nil)
125
+ response = list_by_sku_next_async(next_page_link, custom_headers:custom_headers).value!
126
+ response.body unless response.nil?
127
+ end
128
+
129
+ #
130
+ # Gets the available Regions for a given sku
131
+ #
132
+ # @param next_page_link [String] The NextLink from the previous successful call
133
+ # to List operation.
134
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
135
+ # will be added to the HTTP request.
136
+ #
137
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
138
+ #
139
+ def list_by_sku_next_with_http_info(next_page_link, custom_headers:nil)
140
+ list_by_sku_next_async(next_page_link, custom_headers:custom_headers).value!
141
+ end
142
+
143
+ #
144
+ # Gets the available Regions for a given sku
145
+ #
146
+ # @param next_page_link [String] The NextLink from the previous successful call
147
+ # to List operation.
148
+ # @param [Hash{String => String}] A hash of custom headers that will be added
149
+ # to the HTTP request.
150
+ #
151
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
152
+ #
153
+ def list_by_sku_next_async(next_page_link, custom_headers:nil)
154
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
155
+
156
+
157
+ request_headers = {}
158
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
159
+
160
+ # Set Headers
161
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
162
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
163
+ path_template = '{nextLink}'
164
+
165
+ request_url = @base_url || @client.base_url
166
+
167
+ options = {
168
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
169
+ skip_encoding_path_params: {'nextLink' => next_page_link},
170
+ headers: request_headers.merge(custom_headers || {}),
171
+ base_url: request_url
172
+ }
173
+ promise = @client.make_request_async(:get, path_template, options)
174
+
175
+ promise = promise.then do |result|
176
+ http_response = result.response
177
+ status_code = http_response.status
178
+ response_content = http_response.body
179
+ unless status_code == 200
180
+ error_model = JSON.load(response_content)
181
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
182
+ end
183
+
184
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
185
+ # Deserialize Response
186
+ if status_code == 200
187
+ begin
188
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
189
+ result_mapper = Azure::EventHub::Mgmt::V2017_04_01::Models::MessagingRegionsListResult.mapper()
190
+ result.body = @client.deserialize(result_mapper, parsed_response)
191
+ rescue Exception => e
192
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
193
+ end
194
+ end
195
+
196
+ result
197
+ end
198
+
199
+ promise.execute
200
+ end
201
+
202
+ #
203
+ # Gets the available Regions for a given sku
204
+ #
205
+ # @param sku [String] The sku type.
206
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
207
+ # will be added to the HTTP request.
208
+ #
209
+ # @return [MessagingRegionsListResult] which provide lazy access to pages of
210
+ # the response.
211
+ #
212
+ def list_by_sku_as_lazy(sku, custom_headers:nil)
213
+ response = list_by_sku_async(sku, custom_headers:custom_headers).value!
214
+ unless response.nil?
215
+ page = response.body
216
+ page.next_method = Proc.new do |next_page_link|
217
+ list_by_sku_next_async(next_page_link, custom_headers:custom_headers)
218
+ end
219
+ page
220
+ end
221
+ end
222
+
223
+ end
224
+ end
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2018-01-01-preview/generated/azure_mgmt_event_hub/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::EventHub::Mgmt::V2018_01_01_preview
23
+ autoload :Operations, '2018-01-01-preview/generated/azure_mgmt_event_hub/operations.rb'
24
+ autoload :Clusters, '2018-01-01-preview/generated/azure_mgmt_event_hub/clusters.rb'
25
+ autoload :Configuration, '2018-01-01-preview/generated/azure_mgmt_event_hub/configuration.rb'
26
+ autoload :Namespaces, '2018-01-01-preview/generated/azure_mgmt_event_hub/namespaces.rb'
27
+ autoload :EventHub2018PreviewManagementClient, '2018-01-01-preview/generated/azure_mgmt_event_hub/event_hub2018preview_management_client.rb'
28
+
29
+ module Models
30
+ autoload :ClusterQuotaConfigurationProperties, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/cluster_quota_configuration_properties.rb'
31
+ autoload :OperationDisplay, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/operation_display.rb'
32
+ autoload :ErrorResponse, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/error_response.rb'
33
+ autoload :OperationListResult, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/operation_list_result.rb'
34
+ autoload :VirtualNetworkRuleListResult, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/virtual_network_rule_list_result.rb'
35
+ autoload :Resource, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/resource.rb'
36
+ autoload :Operation, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/operation.rb'
37
+ autoload :Sku, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/sku.rb'
38
+ autoload :ClusterListResult, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/cluster_list_result.rb'
39
+ autoload :IpFilterRuleListResult, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/ip_filter_rule_list_result.rb'
40
+ autoload :ClusterSku, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/cluster_sku.rb'
41
+ autoload :EHNamespaceListResult, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/ehnamespace_list_result.rb'
42
+ autoload :TrackedResource, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/tracked_resource.rb'
43
+ autoload :Cluster, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/cluster.rb'
44
+ autoload :EHNamespace, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/ehnamespace.rb'
45
+ autoload :IpFilterRule, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/ip_filter_rule.rb'
46
+ autoload :VirtualNetworkRule, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/virtual_network_rule.rb'
47
+ autoload :SkuName, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/sku_name.rb'
48
+ autoload :SkuTier, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/sku_tier.rb'
49
+ autoload :IPAction, '2018-01-01-preview/generated/azure_mgmt_event_hub/models/ipaction.rb'
50
+ end
51
+ end
@@ -0,0 +1,503 @@
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::EventHub::Mgmt::V2018_01_01_preview
7
+ #
8
+ # Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and
9
+ # VirtualNetworkRules resources.
10
+ #
11
+ class Clusters
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Clusters class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [EventHub2018PreviewManagementClient] reference to the EventHub2018PreviewManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Lists the available Event Hubs Clusters within an ARM resource group.
27
+ #
28
+ # @param resource_group_name [String] Name of the resource group within the
29
+ # Azure subscription.
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [Array<Cluster>] operation results.
34
+ #
35
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
36
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
37
+ first_page.get_all_items
38
+ end
39
+
40
+ #
41
+ # Lists the available Event Hubs Clusters within an ARM resource group.
42
+ #
43
+ # @param resource_group_name [String] Name of the resource group within the
44
+ # Azure subscription.
45
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
46
+ # will be added to the HTTP request.
47
+ #
48
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
49
+ #
50
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
51
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
52
+ end
53
+
54
+ #
55
+ # Lists the available Event Hubs Clusters within an ARM resource group.
56
+ #
57
+ # @param resource_group_name [String] Name of the resource group within the
58
+ # Azure subscription.
59
+ # @param [Hash{String => String}] A hash of custom headers that will be added
60
+ # to the HTTP request.
61
+ #
62
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
63
+ #
64
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
65
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
66
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
67
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
68
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
69
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
70
+
71
+
72
+ request_headers = {}
73
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
74
+
75
+ # Set Headers
76
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
77
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
78
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters'
79
+
80
+ request_url = @base_url || @client.base_url
81
+
82
+ options = {
83
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
84
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
85
+ query_params: {'api-version' => @client.api_version},
86
+ headers: request_headers.merge(custom_headers || {}),
87
+ base_url: request_url
88
+ }
89
+ promise = @client.make_request_async(:get, path_template, options)
90
+
91
+ promise = promise.then do |result|
92
+ http_response = result.response
93
+ status_code = http_response.status
94
+ response_content = http_response.body
95
+ unless status_code == 200
96
+ error_model = JSON.load(response_content)
97
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
98
+ end
99
+
100
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
101
+ # Deserialize Response
102
+ if status_code == 200
103
+ begin
104
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
105
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::ClusterListResult.mapper()
106
+ result.body = @client.deserialize(result_mapper, parsed_response)
107
+ rescue Exception => e
108
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
109
+ end
110
+ end
111
+
112
+ result
113
+ end
114
+
115
+ promise.execute
116
+ end
117
+
118
+ #
119
+ # Gets the resource description of the specified Event Hubs Cluster.
120
+ #
121
+ # @param resource_group_name [String] Name of the resource group within the
122
+ # Azure subscription.
123
+ # @param cluster_name [String] The name of the Event Hubs Cluster.
124
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
125
+ # will be added to the HTTP request.
126
+ #
127
+ # @return [Cluster] operation results.
128
+ #
129
+ def get(resource_group_name, cluster_name, custom_headers:nil)
130
+ response = get_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
131
+ response.body unless response.nil?
132
+ end
133
+
134
+ #
135
+ # Gets the resource description of the specified Event Hubs Cluster.
136
+ #
137
+ # @param resource_group_name [String] Name of the resource group within the
138
+ # Azure subscription.
139
+ # @param cluster_name [String] The name of the Event Hubs Cluster.
140
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
141
+ # will be added to the HTTP request.
142
+ #
143
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
144
+ #
145
+ def get_with_http_info(resource_group_name, cluster_name, custom_headers:nil)
146
+ get_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
147
+ end
148
+
149
+ #
150
+ # Gets the resource description of the specified Event Hubs Cluster.
151
+ #
152
+ # @param resource_group_name [String] Name of the resource group within the
153
+ # Azure subscription.
154
+ # @param cluster_name [String] The name of the Event Hubs Cluster.
155
+ # @param [Hash{String => String}] A hash of custom headers that will be added
156
+ # to the HTTP request.
157
+ #
158
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
159
+ #
160
+ def get_async(resource_group_name, cluster_name, custom_headers:nil)
161
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
162
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
163
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
164
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
165
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
166
+ fail ArgumentError, "'cluster_name' should satisfy the constraint - 'MaxLength': '50'" if !cluster_name.nil? && cluster_name.length > 50
167
+ fail ArgumentError, "'cluster_name' should satisfy the constraint - 'MinLength': '6'" if !cluster_name.nil? && cluster_name.length < 6
168
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
169
+
170
+
171
+ request_headers = {}
172
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
173
+
174
+ # Set Headers
175
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
176
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
177
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}'
178
+
179
+ request_url = @base_url || @client.base_url
180
+
181
+ options = {
182
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
183
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'clusterName' => cluster_name},
184
+ query_params: {'api-version' => @client.api_version},
185
+ headers: request_headers.merge(custom_headers || {}),
186
+ base_url: request_url
187
+ }
188
+ promise = @client.make_request_async(:get, path_template, options)
189
+
190
+ promise = promise.then do |result|
191
+ http_response = result.response
192
+ status_code = http_response.status
193
+ response_content = http_response.body
194
+ unless status_code == 200
195
+ error_model = JSON.load(response_content)
196
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
197
+ end
198
+
199
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
200
+ # Deserialize Response
201
+ if status_code == 200
202
+ begin
203
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
204
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::Cluster.mapper()
205
+ result.body = @client.deserialize(result_mapper, parsed_response)
206
+ rescue Exception => e
207
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
208
+ end
209
+ end
210
+
211
+ result
212
+ end
213
+
214
+ promise.execute
215
+ end
216
+
217
+ #
218
+ # Modifies mutable properties on the Event Hubs Cluster. This operation is
219
+ # idempotent.
220
+ #
221
+ # @param resource_group_name [String] Name of the resource group within the
222
+ # Azure subscription.
223
+ # @param cluster_name [String] The name of the Event Hubs Cluster.
224
+ # @param parameters [Cluster] The properties of the Event Hubs Cluster which
225
+ # should be updated.
226
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
227
+ # will be added to the HTTP request.
228
+ #
229
+ # @return [Cluster] operation results.
230
+ #
231
+ def patch(resource_group_name, cluster_name, parameters, custom_headers:nil)
232
+ response = patch_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value!
233
+ response.body unless response.nil?
234
+ end
235
+
236
+ #
237
+ # @param resource_group_name [String] Name of the resource group within the
238
+ # Azure subscription.
239
+ # @param cluster_name [String] The name of the Event Hubs Cluster.
240
+ # @param parameters [Cluster] The properties of the Event Hubs Cluster which
241
+ # should be updated.
242
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
243
+ # will be added to the HTTP request.
244
+ #
245
+ # @return [Concurrent::Promise] promise which provides async access to http
246
+ # response.
247
+ #
248
+ def patch_async(resource_group_name, cluster_name, parameters, custom_headers:nil)
249
+ # Send request
250
+ promise = begin_patch_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers)
251
+
252
+ promise = promise.then do |response|
253
+ # Defining deserialization method.
254
+ deserialize_method = lambda do |parsed_response|
255
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::Cluster.mapper()
256
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
257
+ end
258
+
259
+ # Waiting for response.
260
+ @client.get_long_running_operation_result(response, deserialize_method)
261
+ end
262
+
263
+ promise
264
+ end
265
+
266
+ #
267
+ # Modifies mutable properties on the Event Hubs Cluster. This operation is
268
+ # idempotent.
269
+ #
270
+ # @param resource_group_name [String] Name of the resource group within the
271
+ # Azure subscription.
272
+ # @param cluster_name [String] The name of the Event Hubs Cluster.
273
+ # @param parameters [Cluster] The properties of the Event Hubs Cluster which
274
+ # should be updated.
275
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
276
+ # will be added to the HTTP request.
277
+ #
278
+ # @return [Cluster] operation results.
279
+ #
280
+ def begin_patch(resource_group_name, cluster_name, parameters, custom_headers:nil)
281
+ response = begin_patch_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value!
282
+ response.body unless response.nil?
283
+ end
284
+
285
+ #
286
+ # Modifies mutable properties on the Event Hubs Cluster. This operation is
287
+ # idempotent.
288
+ #
289
+ # @param resource_group_name [String] Name of the resource group within the
290
+ # Azure subscription.
291
+ # @param cluster_name [String] The name of the Event Hubs Cluster.
292
+ # @param parameters [Cluster] The properties of the Event Hubs Cluster which
293
+ # should be updated.
294
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
295
+ # will be added to the HTTP request.
296
+ #
297
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
298
+ #
299
+ def begin_patch_with_http_info(resource_group_name, cluster_name, parameters, custom_headers:nil)
300
+ begin_patch_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value!
301
+ end
302
+
303
+ #
304
+ # Modifies mutable properties on the Event Hubs Cluster. This operation is
305
+ # idempotent.
306
+ #
307
+ # @param resource_group_name [String] Name of the resource group within the
308
+ # Azure subscription.
309
+ # @param cluster_name [String] The name of the Event Hubs Cluster.
310
+ # @param parameters [Cluster] The properties of the Event Hubs Cluster which
311
+ # should be updated.
312
+ # @param [Hash{String => String}] A hash of custom headers that will be added
313
+ # to the HTTP request.
314
+ #
315
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
316
+ #
317
+ def begin_patch_async(resource_group_name, cluster_name, parameters, custom_headers:nil)
318
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
319
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
320
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
321
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
322
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
323
+ fail ArgumentError, "'cluster_name' should satisfy the constraint - 'MaxLength': '50'" if !cluster_name.nil? && cluster_name.length > 50
324
+ fail ArgumentError, "'cluster_name' should satisfy the constraint - 'MinLength': '6'" if !cluster_name.nil? && cluster_name.length < 6
325
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
326
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
327
+
328
+
329
+ request_headers = {}
330
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
331
+
332
+ # Set Headers
333
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
334
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
335
+
336
+ # Serialize Request
337
+ request_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::Cluster.mapper()
338
+ request_content = @client.serialize(request_mapper, parameters)
339
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
340
+
341
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}'
342
+
343
+ request_url = @base_url || @client.base_url
344
+
345
+ options = {
346
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
347
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'clusterName' => cluster_name},
348
+ query_params: {'api-version' => @client.api_version},
349
+ body: request_content,
350
+ headers: request_headers.merge(custom_headers || {}),
351
+ base_url: request_url
352
+ }
353
+ promise = @client.make_request_async(:patch, path_template, options)
354
+
355
+ promise = promise.then do |result|
356
+ http_response = result.response
357
+ status_code = http_response.status
358
+ response_content = http_response.body
359
+ unless status_code == 200 || status_code == 201 || status_code == 202
360
+ error_model = JSON.load(response_content)
361
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
362
+ end
363
+
364
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
365
+ # Deserialize Response
366
+ if status_code == 200
367
+ begin
368
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
369
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::Cluster.mapper()
370
+ result.body = @client.deserialize(result_mapper, parsed_response)
371
+ rescue Exception => e
372
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
373
+ end
374
+ end
375
+ # Deserialize Response
376
+ if status_code == 201
377
+ begin
378
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
379
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::Cluster.mapper()
380
+ result.body = @client.deserialize(result_mapper, parsed_response)
381
+ rescue Exception => e
382
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
383
+ end
384
+ end
385
+
386
+ result
387
+ end
388
+
389
+ promise.execute
390
+ end
391
+
392
+ #
393
+ # Lists the available Event Hubs Clusters within an ARM resource group.
394
+ #
395
+ # @param next_page_link [String] The NextLink from the previous successful call
396
+ # to List operation.
397
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
398
+ # will be added to the HTTP request.
399
+ #
400
+ # @return [ClusterListResult] operation results.
401
+ #
402
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
403
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
404
+ response.body unless response.nil?
405
+ end
406
+
407
+ #
408
+ # Lists the available Event Hubs Clusters within an ARM resource group.
409
+ #
410
+ # @param next_page_link [String] The NextLink from the previous successful call
411
+ # to List operation.
412
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
413
+ # will be added to the HTTP request.
414
+ #
415
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
416
+ #
417
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
418
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
419
+ end
420
+
421
+ #
422
+ # Lists the available Event Hubs Clusters within an ARM resource group.
423
+ #
424
+ # @param next_page_link [String] The NextLink from the previous successful call
425
+ # to List operation.
426
+ # @param [Hash{String => String}] A hash of custom headers that will be added
427
+ # to the HTTP request.
428
+ #
429
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
430
+ #
431
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
432
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
433
+
434
+
435
+ request_headers = {}
436
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
437
+
438
+ # Set Headers
439
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
440
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
441
+ path_template = '{nextLink}'
442
+
443
+ request_url = @base_url || @client.base_url
444
+
445
+ options = {
446
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
447
+ skip_encoding_path_params: {'nextLink' => next_page_link},
448
+ headers: request_headers.merge(custom_headers || {}),
449
+ base_url: request_url
450
+ }
451
+ promise = @client.make_request_async(:get, path_template, options)
452
+
453
+ promise = promise.then do |result|
454
+ http_response = result.response
455
+ status_code = http_response.status
456
+ response_content = http_response.body
457
+ unless status_code == 200
458
+ error_model = JSON.load(response_content)
459
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
460
+ end
461
+
462
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
463
+ # Deserialize Response
464
+ if status_code == 200
465
+ begin
466
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
467
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::ClusterListResult.mapper()
468
+ result.body = @client.deserialize(result_mapper, parsed_response)
469
+ rescue Exception => e
470
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
471
+ end
472
+ end
473
+
474
+ result
475
+ end
476
+
477
+ promise.execute
478
+ end
479
+
480
+ #
481
+ # Lists the available Event Hubs Clusters within an ARM resource group.
482
+ #
483
+ # @param resource_group_name [String] Name of the resource group within the
484
+ # Azure subscription.
485
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
486
+ # will be added to the HTTP request.
487
+ #
488
+ # @return [ClusterListResult] which provide lazy access to pages of the
489
+ # response.
490
+ #
491
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
492
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
493
+ unless response.nil?
494
+ page = response.body
495
+ page.next_method = Proc.new do |next_page_link|
496
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
497
+ end
498
+ page
499
+ end
500
+ end
501
+
502
+ end
503
+ end