azure_mgmt_service_bus 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/azure_mgmt_service_bus.rb +5 -0
  4. data/lib/generated/azure_mgmt_service_bus.rb +57 -0
  5. data/lib/generated/azure_mgmt_service_bus/models/access_rights.rb +17 -0
  6. data/lib/generated/azure_mgmt_service_bus/models/entity_availability_status.rb +19 -0
  7. data/lib/generated/azure_mgmt_service_bus/models/entity_status.rb +23 -0
  8. data/lib/generated/azure_mgmt_service_bus/models/message_count_details.rb +86 -0
  9. data/lib/generated/azure_mgmt_service_bus/models/namespace_create_or_update_parameters.rb +147 -0
  10. data/lib/generated/azure_mgmt_service_bus/models/namespace_list_result.rb +95 -0
  11. data/lib/generated/azure_mgmt_service_bus/models/namespace_resource.rb +165 -0
  12. data/lib/generated/azure_mgmt_service_bus/models/namespace_state.rb +27 -0
  13. data/lib/generated/azure_mgmt_service_bus/models/policykey.rb +16 -0
  14. data/lib/generated/azure_mgmt_service_bus/models/queue_create_or_update_parameters.rb +301 -0
  15. data/lib/generated/azure_mgmt_service_bus/models/queue_list_result.rb +94 -0
  16. data/lib/generated/azure_mgmt_service_bus/models/queue_resource.rb +326 -0
  17. data/lib/generated/azure_mgmt_service_bus/models/regenerate_keys_parameters.rb +46 -0
  18. data/lib/generated/azure_mgmt_service_bus/models/resource_list_keys.rb +88 -0
  19. data/lib/generated/azure_mgmt_service_bus/models/shared_access_authorization_rule_create_or_update_parameters.rb +74 -0
  20. data/lib/generated/azure_mgmt_service_bus/models/shared_access_authorization_rule_list_result.rb +97 -0
  21. data/lib/generated/azure_mgmt_service_bus/models/shared_access_authorization_rule_resource.rb +97 -0
  22. data/lib/generated/azure_mgmt_service_bus/models/sku.rb +66 -0
  23. data/lib/generated/azure_mgmt_service_bus/models/sku_name.rb +17 -0
  24. data/lib/generated/azure_mgmt_service_bus/models/sku_tier.rb +17 -0
  25. data/lib/generated/azure_mgmt_service_bus/models/subscription_create_or_update_parameters.rb +232 -0
  26. data/lib/generated/azure_mgmt_service_bus/models/subscription_list_result.rb +95 -0
  27. data/lib/generated/azure_mgmt_service_bus/models/subscription_resource.rb +257 -0
  28. data/lib/generated/azure_mgmt_service_bus/models/topic_create_or_update_parameters.rb +288 -0
  29. data/lib/generated/azure_mgmt_service_bus/models/topic_list_result.rb +94 -0
  30. data/lib/generated/azure_mgmt_service_bus/models/topic_resource.rb +313 -0
  31. data/lib/generated/azure_mgmt_service_bus/module_definition.rb +8 -0
  32. data/lib/generated/azure_mgmt_service_bus/namespaces.rb +1494 -0
  33. data/lib/generated/azure_mgmt_service_bus/queues.rb +1236 -0
  34. data/lib/generated/azure_mgmt_service_bus/service_bus_management_client.rb +144 -0
  35. data/lib/generated/azure_mgmt_service_bus/subscriptions.rb +533 -0
  36. data/lib/generated/azure_mgmt_service_bus/topics.rb +1236 -0
  37. data/lib/generated/azure_mgmt_service_bus/version.rb +8 -0
  38. metadata +150 -0
@@ -0,0 +1,144 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::ServiceBus
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class ServiceBusManagementClient < 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] Client API version.
26
+ attr_reader :api_version
27
+
28
+ # @return [String] Gets or sets the preferred language for the response.
29
+ attr_accessor :accept_language
30
+
31
+ # @return [Integer] Gets or sets the retry timeout in seconds for Long
32
+ # Running Operations. Default value is 30.
33
+ attr_accessor :long_running_operation_retry_timeout
34
+
35
+ # @return [Boolean] When set to true a unique x-ms-client-request-id value
36
+ # is generated and included in each request. Default is true.
37
+ attr_accessor :generate_client_request_id
38
+
39
+ # @return [Namespaces] namespaces
40
+ attr_reader :namespaces
41
+
42
+ # @return [Queues] queues
43
+ attr_reader :queues
44
+
45
+ # @return [Topics] topics
46
+ attr_reader :topics
47
+
48
+ # @return [Subscriptions] subscriptions
49
+ attr_reader :subscriptions
50
+
51
+ #
52
+ # Creates initializes a new instance of the ServiceBusManagementClient class.
53
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
54
+ # @param base_url [String] the base URI of the service.
55
+ # @param options [Array] filters to be applied to the HTTP requests.
56
+ #
57
+ def initialize(credentials, base_url = nil, options = nil)
58
+ super(credentials, options)
59
+ @base_url = base_url || 'https://management.azure.com'
60
+
61
+ fail ArgumentError, 'credentials is nil' if credentials.nil?
62
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials)
63
+ @credentials = credentials
64
+
65
+ @namespaces = Namespaces.new(self)
66
+ @queues = Queues.new(self)
67
+ @topics = Topics.new(self)
68
+ @subscriptions = Subscriptions.new(self)
69
+ @api_version = '2015-08-01'
70
+ @accept_language = 'en-US'
71
+ @long_running_operation_retry_timeout = 30
72
+ @generate_client_request_id = true
73
+ add_telemetry
74
+ end
75
+
76
+ #
77
+ # Makes a request and returns the body of the response.
78
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
79
+ # @param path [String] the path, relative to {base_url}.
80
+ # @param options [Hash{String=>String}] specifying any request options like :body.
81
+ # @return [Hash{String=>String}] containing the body of the response.
82
+ # Example:
83
+ #
84
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
85
+ # path = "/path"
86
+ # options = {
87
+ # body: request_content,
88
+ # query_params: {'api-version' => '2016-02-01'}
89
+ # }
90
+ # result = @client.make_request(:put, path, options)
91
+ #
92
+ def make_request(method, path, options = {})
93
+ result = make_request_with_http_info(method, path, options)
94
+ result.body unless result.nil?
95
+ end
96
+
97
+ #
98
+ # Makes a request and returns the operation response.
99
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
100
+ # @param path [String] the path, relative to {base_url}.
101
+ # @param options [Hash{String=>String}] specifying any request options like :body.
102
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
103
+ #
104
+ def make_request_with_http_info(method, path, options = {})
105
+ result = make_request_async(method, path, options).value!
106
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
107
+ result
108
+ end
109
+
110
+ #
111
+ # Makes a request asynchronously.
112
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
113
+ # @param path [String] the path, relative to {base_url}.
114
+ # @param options [Hash{String=>String}] specifying any request options like :body.
115
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
116
+ #
117
+ def make_request_async(method, path, options = {})
118
+ fail ArgumentError, 'method is nil' if method.nil?
119
+ fail ArgumentError, 'path is nil' if path.nil?
120
+
121
+ request_url = options[:base_url] || @base_url
122
+
123
+ request_headers = @request_headers
124
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
125
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
126
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
127
+
128
+ super(request_url, method, path, options)
129
+ end
130
+
131
+
132
+ private
133
+ #
134
+ # Adds telemetry information.
135
+ #
136
+ def add_telemetry
137
+ sdk_information = 'azure_mgmt_service_bus'
138
+ if defined? Azure::ARM::ServiceBus::VERSION
139
+ sdk_information = "#{sdk_information}/#{Azure::ARM::ServiceBus::VERSION}"
140
+ end
141
+ add_user_agent_information(sdk_information)
142
+ end
143
+ end
144
+ end
@@ -0,0 +1,533 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::ServiceBus
7
+ #
8
+ # Azure Service Bus client
9
+ #
10
+ class Subscriptions
11
+ include Azure::ARM::ServiceBus::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Subscriptions class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [ServiceBusManagementClient] reference to the ServiceBusManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Lsit all the subscriptions under a specified topic.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group.
29
+ # @param namespace_name [String] The namespace name.
30
+ # @param topic_name [String] The topic name.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [Array<SubscriptionResource>] operation results.
35
+ #
36
+ def list_all(resource_group_name, namespace_name, topic_name, custom_headers = nil)
37
+ first_page = list_all_as_lazy(resource_group_name, namespace_name, topic_name, custom_headers)
38
+ first_page.get_all_items
39
+ end
40
+
41
+ #
42
+ # Lsit all the subscriptions under a specified topic.
43
+ #
44
+ # @param resource_group_name [String] The name of the resource group.
45
+ # @param namespace_name [String] The namespace name.
46
+ # @param topic_name [String] The topic name.
47
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
48
+ # will be added to the HTTP request.
49
+ #
50
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
51
+ #
52
+ def list_all_with_http_info(resource_group_name, namespace_name, topic_name, custom_headers = nil)
53
+ list_all_async(resource_group_name, namespace_name, topic_name, custom_headers).value!
54
+ end
55
+
56
+ #
57
+ # Lsit all the subscriptions under a specified topic.
58
+ #
59
+ # @param resource_group_name [String] The name of the resource group.
60
+ # @param namespace_name [String] The namespace name.
61
+ # @param topic_name [String] The topic name.
62
+ # @param [Hash{String => String}] A hash of custom headers that will be added
63
+ # to the HTTP request.
64
+ #
65
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
66
+ #
67
+ def list_all_async(resource_group_name, namespace_name, topic_name, custom_headers = nil)
68
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
69
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
70
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
71
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
72
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
73
+
74
+
75
+ request_headers = {}
76
+
77
+ # Set Headers
78
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
79
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
80
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions'
81
+
82
+ request_url = @base_url || @client.base_url
83
+
84
+ options = {
85
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
86
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'topicName' => topic_name,'subscriptionId' => @client.subscription_id},
87
+ query_params: {'api-version' => @client.api_version},
88
+ headers: request_headers.merge(custom_headers || {}),
89
+ base_url: request_url
90
+ }
91
+ promise = @client.make_request_async(:get, path_template, options)
92
+
93
+ promise = promise.then do |result|
94
+ http_response = result.response
95
+ status_code = http_response.status
96
+ response_content = http_response.body
97
+ unless status_code == 200
98
+ error_model = JSON.load(response_content)
99
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
100
+ end
101
+
102
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
103
+ # Deserialize Response
104
+ if status_code == 200
105
+ begin
106
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
107
+ result_mapper = SubscriptionListResult.mapper()
108
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
109
+ rescue Exception => e
110
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
111
+ end
112
+ end
113
+
114
+ result
115
+ end
116
+
117
+ promise.execute
118
+ end
119
+
120
+ #
121
+ # Creates a topic subscription.
122
+ #
123
+ # @param resource_group_name [String] The name of the resource group.
124
+ # @param namespace_name [String] The namespace name.
125
+ # @param topic_name [String] The topic name.
126
+ # @param subscription_name [String] The subscription name.
127
+ # @param parameters [SubscriptionCreateOrUpdateParameters] Parameters supplied
128
+ # to create a subscription resource.
129
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
130
+ # will be added to the HTTP request.
131
+ #
132
+ # @return [SubscriptionResource] operation results.
133
+ #
134
+ def create_or_update(resource_group_name, namespace_name, topic_name, subscription_name, parameters, custom_headers = nil)
135
+ response = create_or_update_async(resource_group_name, namespace_name, topic_name, subscription_name, parameters, custom_headers).value!
136
+ response.body unless response.nil?
137
+ end
138
+
139
+ #
140
+ # Creates a topic subscription.
141
+ #
142
+ # @param resource_group_name [String] The name of the resource group.
143
+ # @param namespace_name [String] The namespace name.
144
+ # @param topic_name [String] The topic name.
145
+ # @param subscription_name [String] The subscription name.
146
+ # @param parameters [SubscriptionCreateOrUpdateParameters] Parameters supplied
147
+ # to create a subscription resource.
148
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
149
+ # will be added to the HTTP request.
150
+ #
151
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
152
+ #
153
+ def create_or_update_with_http_info(resource_group_name, namespace_name, topic_name, subscription_name, parameters, custom_headers = nil)
154
+ create_or_update_async(resource_group_name, namespace_name, topic_name, subscription_name, parameters, custom_headers).value!
155
+ end
156
+
157
+ #
158
+ # Creates a topic subscription.
159
+ #
160
+ # @param resource_group_name [String] The name of the resource group.
161
+ # @param namespace_name [String] The namespace name.
162
+ # @param topic_name [String] The topic name.
163
+ # @param subscription_name [String] The subscription name.
164
+ # @param parameters [SubscriptionCreateOrUpdateParameters] Parameters supplied
165
+ # to create a subscription resource.
166
+ # @param [Hash{String => String}] A hash of custom headers that will be added
167
+ # to the HTTP request.
168
+ #
169
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
170
+ #
171
+ def create_or_update_async(resource_group_name, namespace_name, topic_name, subscription_name, parameters, custom_headers = nil)
172
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
173
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
174
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
175
+ fail ArgumentError, 'subscription_name is nil' if subscription_name.nil?
176
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
177
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
178
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
179
+
180
+
181
+ request_headers = {}
182
+
183
+ # Set Headers
184
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
185
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
186
+
187
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
188
+
189
+ # Serialize Request
190
+ request_mapper = SubscriptionCreateOrUpdateParameters.mapper()
191
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
192
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
193
+
194
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'
195
+
196
+ request_url = @base_url || @client.base_url
197
+
198
+ options = {
199
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
200
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'topicName' => topic_name,'subscriptionName' => subscription_name,'subscriptionId' => @client.subscription_id},
201
+ query_params: {'api-version' => @client.api_version},
202
+ body: request_content,
203
+ headers: request_headers.merge(custom_headers || {}),
204
+ base_url: request_url
205
+ }
206
+ promise = @client.make_request_async(:put, path_template, options)
207
+
208
+ promise = promise.then do |result|
209
+ http_response = result.response
210
+ status_code = http_response.status
211
+ response_content = http_response.body
212
+ unless status_code == 200
213
+ error_model = JSON.load(response_content)
214
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
215
+ end
216
+
217
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
218
+ # Deserialize Response
219
+ if status_code == 200
220
+ begin
221
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
222
+ result_mapper = SubscriptionResource.mapper()
223
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
224
+ rescue Exception => e
225
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
226
+ end
227
+ end
228
+
229
+ result
230
+ end
231
+
232
+ promise.execute
233
+ end
234
+
235
+ #
236
+ # Deletes a subscription from the specified topic.
237
+ #
238
+ # @param resource_group_name [String] The name of the resource group.
239
+ # @param namespace_name [String] The namespace name.
240
+ # @param topic_name [String] The topic name.
241
+ # @param subscription_name [String] The subscription name.
242
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
243
+ # will be added to the HTTP request.
244
+ #
245
+ #
246
+ def delete(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers = nil)
247
+ response = delete_async(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers).value!
248
+ nil
249
+ end
250
+
251
+ #
252
+ # Deletes a subscription from the specified topic.
253
+ #
254
+ # @param resource_group_name [String] The name of the resource group.
255
+ # @param namespace_name [String] The namespace name.
256
+ # @param topic_name [String] The topic name.
257
+ # @param subscription_name [String] The subscription name.
258
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
259
+ # will be added to the HTTP request.
260
+ #
261
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
262
+ #
263
+ def delete_with_http_info(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers = nil)
264
+ delete_async(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers).value!
265
+ end
266
+
267
+ #
268
+ # Deletes a subscription from the specified topic.
269
+ #
270
+ # @param resource_group_name [String] The name of the resource group.
271
+ # @param namespace_name [String] The namespace name.
272
+ # @param topic_name [String] The topic name.
273
+ # @param subscription_name [String] The subscription name.
274
+ # @param [Hash{String => String}] A hash of custom headers that will be added
275
+ # to the HTTP request.
276
+ #
277
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
278
+ #
279
+ def delete_async(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers = nil)
280
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
281
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
282
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
283
+ fail ArgumentError, 'subscription_name is nil' if subscription_name.nil?
284
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
285
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
286
+
287
+
288
+ request_headers = {}
289
+
290
+ # Set Headers
291
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
292
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
293
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'
294
+
295
+ request_url = @base_url || @client.base_url
296
+
297
+ options = {
298
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
299
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'topicName' => topic_name,'subscriptionName' => subscription_name,'subscriptionId' => @client.subscription_id},
300
+ query_params: {'api-version' => @client.api_version},
301
+ headers: request_headers.merge(custom_headers || {}),
302
+ base_url: request_url
303
+ }
304
+ promise = @client.make_request_async(:delete, path_template, options)
305
+
306
+ promise = promise.then do |result|
307
+ http_response = result.response
308
+ status_code = http_response.status
309
+ response_content = http_response.body
310
+ unless status_code == 204 || status_code == 200
311
+ error_model = JSON.load(response_content)
312
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
313
+ end
314
+
315
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
316
+
317
+ result
318
+ end
319
+
320
+ promise.execute
321
+ end
322
+
323
+ #
324
+ # Returns a subscription description for the specified topic.
325
+ #
326
+ # @param resource_group_name [String] The name of the resource group.
327
+ # @param namespace_name [String] The namespace name.
328
+ # @param topic_name [String] The topic name.
329
+ # @param subscription_name [String] The subscription name.
330
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
331
+ # will be added to the HTTP request.
332
+ #
333
+ # @return [SubscriptionResource] operation results.
334
+ #
335
+ def get(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers = nil)
336
+ response = get_async(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers).value!
337
+ response.body unless response.nil?
338
+ end
339
+
340
+ #
341
+ # Returns a subscription description for the specified topic.
342
+ #
343
+ # @param resource_group_name [String] The name of the resource group.
344
+ # @param namespace_name [String] The namespace name.
345
+ # @param topic_name [String] The topic name.
346
+ # @param subscription_name [String] The subscription name.
347
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
348
+ # will be added to the HTTP request.
349
+ #
350
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
351
+ #
352
+ def get_with_http_info(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers = nil)
353
+ get_async(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers).value!
354
+ end
355
+
356
+ #
357
+ # Returns a subscription description for the specified topic.
358
+ #
359
+ # @param resource_group_name [String] The name of the resource group.
360
+ # @param namespace_name [String] The namespace name.
361
+ # @param topic_name [String] The topic name.
362
+ # @param subscription_name [String] The subscription name.
363
+ # @param [Hash{String => String}] A hash of custom headers that will be added
364
+ # to the HTTP request.
365
+ #
366
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
367
+ #
368
+ def get_async(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers = nil)
369
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
370
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
371
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
372
+ fail ArgumentError, 'subscription_name is nil' if subscription_name.nil?
373
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
374
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
375
+
376
+
377
+ request_headers = {}
378
+
379
+ # Set Headers
380
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
381
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
382
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'
383
+
384
+ request_url = @base_url || @client.base_url
385
+
386
+ options = {
387
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
388
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'topicName' => topic_name,'subscriptionName' => subscription_name,'subscriptionId' => @client.subscription_id},
389
+ query_params: {'api-version' => @client.api_version},
390
+ headers: request_headers.merge(custom_headers || {}),
391
+ base_url: request_url
392
+ }
393
+ promise = @client.make_request_async(:get, path_template, options)
394
+
395
+ promise = promise.then do |result|
396
+ http_response = result.response
397
+ status_code = http_response.status
398
+ response_content = http_response.body
399
+ unless status_code == 200
400
+ error_model = JSON.load(response_content)
401
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
402
+ end
403
+
404
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
405
+ # Deserialize Response
406
+ if status_code == 200
407
+ begin
408
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
409
+ result_mapper = SubscriptionResource.mapper()
410
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
411
+ rescue Exception => e
412
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
413
+ end
414
+ end
415
+
416
+ result
417
+ end
418
+
419
+ promise.execute
420
+ end
421
+
422
+ #
423
+ # Lsit all the subscriptions under a specified topic.
424
+ #
425
+ # @param next_page_link [String] The NextLink from the previous successful call
426
+ # to List operation.
427
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
428
+ # will be added to the HTTP request.
429
+ #
430
+ # @return [SubscriptionListResult] operation results.
431
+ #
432
+ def list_all_next(next_page_link, custom_headers = nil)
433
+ response = list_all_next_async(next_page_link, custom_headers).value!
434
+ response.body unless response.nil?
435
+ end
436
+
437
+ #
438
+ # Lsit all the subscriptions under a specified topic.
439
+ #
440
+ # @param next_page_link [String] The NextLink from the previous successful call
441
+ # to List operation.
442
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
443
+ # will be added to the HTTP request.
444
+ #
445
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
446
+ #
447
+ def list_all_next_with_http_info(next_page_link, custom_headers = nil)
448
+ list_all_next_async(next_page_link, custom_headers).value!
449
+ end
450
+
451
+ #
452
+ # Lsit all the subscriptions under a specified topic.
453
+ #
454
+ # @param next_page_link [String] The NextLink from the previous successful call
455
+ # to List operation.
456
+ # @param [Hash{String => String}] A hash of custom headers that will be added
457
+ # to the HTTP request.
458
+ #
459
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
460
+ #
461
+ def list_all_next_async(next_page_link, custom_headers = nil)
462
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
463
+
464
+
465
+ request_headers = {}
466
+
467
+ # Set Headers
468
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
469
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
470
+ path_template = '{nextLink}'
471
+
472
+ request_url = @base_url || @client.base_url
473
+
474
+ options = {
475
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
476
+ skip_encoding_path_params: {'nextLink' => next_page_link},
477
+ headers: request_headers.merge(custom_headers || {}),
478
+ base_url: request_url
479
+ }
480
+ promise = @client.make_request_async(:get, path_template, options)
481
+
482
+ promise = promise.then do |result|
483
+ http_response = result.response
484
+ status_code = http_response.status
485
+ response_content = http_response.body
486
+ unless status_code == 200
487
+ error_model = JSON.load(response_content)
488
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
489
+ end
490
+
491
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
492
+ # Deserialize Response
493
+ if status_code == 200
494
+ begin
495
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
496
+ result_mapper = SubscriptionListResult.mapper()
497
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
498
+ rescue Exception => e
499
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
500
+ end
501
+ end
502
+
503
+ result
504
+ end
505
+
506
+ promise.execute
507
+ end
508
+
509
+ #
510
+ # Lsit all the subscriptions under a specified topic.
511
+ #
512
+ # @param resource_group_name [String] The name of the resource group.
513
+ # @param namespace_name [String] The namespace name.
514
+ # @param topic_name [String] The topic name.
515
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
516
+ # will be added to the HTTP request.
517
+ #
518
+ # @return [SubscriptionListResult] which provide lazy access to pages of the
519
+ # response.
520
+ #
521
+ def list_all_as_lazy(resource_group_name, namespace_name, topic_name, custom_headers = nil)
522
+ response = list_all_async(resource_group_name, namespace_name, topic_name, custom_headers).value!
523
+ unless response.nil?
524
+ page = response.body
525
+ page.next_method = Proc.new do |next_page_link|
526
+ list_all_next_async(next_page_link, custom_headers)
527
+ end
528
+ page
529
+ end
530
+ end
531
+
532
+ end
533
+ end