azure_mgmt_azurestack 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2017-06-01/generated/azure_mgmt_azurestack.rb +58 -0
  4. data/lib/2017-06-01/generated/azure_mgmt_azurestack/azure_stack_management_client.rb +145 -0
  5. data/lib/2017-06-01/generated/azure_mgmt_azurestack/customer_subscriptions.rb +528 -0
  6. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/activation_key_result.rb +46 -0
  7. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/compute_role.rb +17 -0
  8. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/customer_subscription.rb +81 -0
  9. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/customer_subscription_list.rb +98 -0
  10. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/data_disk_image.rb +59 -0
  11. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/display.rb +86 -0
  12. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/error_details.rb +71 -0
  13. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/error_response.rb +48 -0
  14. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/extended_product.rb +184 -0
  15. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/icon_uris.rb +90 -0
  16. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/location.rb +15 -0
  17. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/operating_system.rb +17 -0
  18. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/operation.rb +71 -0
  19. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/operation_list.rb +98 -0
  20. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/os_disk_image.rb +60 -0
  21. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/product.rb +271 -0
  22. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/product_link.rb +57 -0
  23. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/product_list.rb +98 -0
  24. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/product_properties.rb +46 -0
  25. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/provisioning_state.rb +18 -0
  26. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/registration.rb +131 -0
  27. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/registration_list.rb +98 -0
  28. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/registration_parameter.rb +58 -0
  29. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/resource.rb +92 -0
  30. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/tracked_resource.rb +115 -0
  31. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/virtual_machine_extension_product_properties.rb +123 -0
  32. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/virtual_machine_product_properties.rb +81 -0
  33. data/lib/2017-06-01/generated/azure_mgmt_azurestack/module_definition.rb +9 -0
  34. data/lib/2017-06-01/generated/azure_mgmt_azurestack/operations.rb +218 -0
  35. data/lib/2017-06-01/generated/azure_mgmt_azurestack/products.rb +426 -0
  36. data/lib/2017-06-01/generated/azure_mgmt_azurestack/registrations.rb +717 -0
  37. data/lib/azure_mgmt_azurestack.rb +6 -0
  38. data/lib/module_definition.rb +7 -0
  39. data/lib/profiles/latest/azurestack_latest_profile_client.rb +40 -0
  40. data/lib/profiles/latest/azurestack_module_definition.rb +8 -0
  41. data/lib/profiles/latest/modules/azurestack_profile_module.rb +175 -0
  42. data/lib/version.rb +7 -0
  43. metadata +158 -0
@@ -0,0 +1,426 @@
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::AzureStack::Mgmt::V2017_06_01
7
+ #
8
+ # Azure Stack
9
+ #
10
+ class Products
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Products class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [AzureStackManagementClient] reference to the AzureStackManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Returns a list of products.
26
+ #
27
+ # @param resource_group [String] Name of the resource group.
28
+ # @param registration_name [String] Name of the Azure Stack registration.
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [Array<Product>] operation results.
33
+ #
34
+ def list(resource_group, registration_name, custom_headers:nil)
35
+ first_page = list_as_lazy(resource_group, registration_name, custom_headers:custom_headers)
36
+ first_page.get_all_items
37
+ end
38
+
39
+ #
40
+ # Returns a list of products.
41
+ #
42
+ # @param resource_group [String] Name of the resource group.
43
+ # @param registration_name [String] Name of the Azure Stack registration.
44
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
45
+ # will be added to the HTTP request.
46
+ #
47
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
48
+ #
49
+ def list_with_http_info(resource_group, registration_name, custom_headers:nil)
50
+ list_async(resource_group, registration_name, custom_headers:custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Returns a list of products.
55
+ #
56
+ # @param resource_group [String] Name of the resource group.
57
+ # @param registration_name [String] Name of the Azure Stack registration.
58
+ # @param [Hash{String => String}] A hash of custom headers that will be added
59
+ # to the HTTP request.
60
+ #
61
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
62
+ #
63
+ def list_async(resource_group, registration_name, custom_headers:nil)
64
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
65
+ fail ArgumentError, 'resource_group is nil' if resource_group.nil?
66
+ fail ArgumentError, 'registration_name is nil' if registration_name.nil?
67
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
68
+
69
+
70
+ request_headers = {}
71
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
72
+
73
+ # Set Headers
74
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
75
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
76
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products'
77
+
78
+ request_url = @base_url || @client.base_url
79
+
80
+ options = {
81
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
82
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroup' => resource_group,'registrationName' => registration_name},
83
+ query_params: {'api-version' => @client.api_version},
84
+ headers: request_headers.merge(custom_headers || {}),
85
+ base_url: request_url
86
+ }
87
+ promise = @client.make_request_async(:get, path_template, options)
88
+
89
+ promise = promise.then do |result|
90
+ http_response = result.response
91
+ status_code = http_response.status
92
+ response_content = http_response.body
93
+ unless status_code == 200
94
+ error_model = JSON.load(response_content)
95
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
96
+ end
97
+
98
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
99
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
100
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::AzureStack::Mgmt::V2017_06_01::Models::ProductList.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
+ # Returns the specified product.
120
+ #
121
+ # @param resource_group [String] Name of the resource group.
122
+ # @param registration_name [String] Name of the Azure Stack registration.
123
+ # @param product_name [String] Name of the product.
124
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
125
+ # will be added to the HTTP request.
126
+ #
127
+ # @return [Product] operation results.
128
+ #
129
+ def get(resource_group, registration_name, product_name, custom_headers:nil)
130
+ response = get_async(resource_group, registration_name, product_name, custom_headers:custom_headers).value!
131
+ response.body unless response.nil?
132
+ end
133
+
134
+ #
135
+ # Returns the specified product.
136
+ #
137
+ # @param resource_group [String] Name of the resource group.
138
+ # @param registration_name [String] Name of the Azure Stack registration.
139
+ # @param product_name [String] Name of the product.
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, registration_name, product_name, custom_headers:nil)
146
+ get_async(resource_group, registration_name, product_name, custom_headers:custom_headers).value!
147
+ end
148
+
149
+ #
150
+ # Returns the specified product.
151
+ #
152
+ # @param resource_group [String] Name of the resource group.
153
+ # @param registration_name [String] Name of the Azure Stack registration.
154
+ # @param product_name [String] Name of the product.
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, registration_name, product_name, custom_headers:nil)
161
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
162
+ fail ArgumentError, 'resource_group is nil' if resource_group.nil?
163
+ fail ArgumentError, 'registration_name is nil' if registration_name.nil?
164
+ fail ArgumentError, 'product_name is nil' if product_name.nil?
165
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
166
+
167
+
168
+ request_headers = {}
169
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
170
+
171
+ # Set Headers
172
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
173
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
174
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}'
175
+
176
+ request_url = @base_url || @client.base_url
177
+
178
+ options = {
179
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
180
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroup' => resource_group,'registrationName' => registration_name,'productName' => product_name},
181
+ query_params: {'api-version' => @client.api_version},
182
+ headers: request_headers.merge(custom_headers || {}),
183
+ base_url: request_url
184
+ }
185
+ promise = @client.make_request_async(:get, path_template, options)
186
+
187
+ promise = promise.then do |result|
188
+ http_response = result.response
189
+ status_code = http_response.status
190
+ response_content = http_response.body
191
+ unless status_code == 200
192
+ error_model = JSON.load(response_content)
193
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
194
+ end
195
+
196
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
197
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
198
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
199
+ # Deserialize Response
200
+ if status_code == 200
201
+ begin
202
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
203
+ result_mapper = Azure::AzureStack::Mgmt::V2017_06_01::Models::Product.mapper()
204
+ result.body = @client.deserialize(result_mapper, parsed_response)
205
+ rescue Exception => e
206
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
207
+ end
208
+ end
209
+
210
+ result
211
+ end
212
+
213
+ promise.execute
214
+ end
215
+
216
+ #
217
+ # Returns the extended properties of a product.
218
+ #
219
+ # @param resource_group [String] Name of the resource group.
220
+ # @param registration_name [String] Name of the Azure Stack registration.
221
+ # @param product_name [String] Name of the product.
222
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
223
+ # will be added to the HTTP request.
224
+ #
225
+ # @return [ExtendedProduct] operation results.
226
+ #
227
+ def list_details(resource_group, registration_name, product_name, custom_headers:nil)
228
+ response = list_details_async(resource_group, registration_name, product_name, custom_headers:custom_headers).value!
229
+ response.body unless response.nil?
230
+ end
231
+
232
+ #
233
+ # Returns the extended properties of a product.
234
+ #
235
+ # @param resource_group [String] Name of the resource group.
236
+ # @param registration_name [String] Name of the Azure Stack registration.
237
+ # @param product_name [String] Name of the product.
238
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
239
+ # will be added to the HTTP request.
240
+ #
241
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
242
+ #
243
+ def list_details_with_http_info(resource_group, registration_name, product_name, custom_headers:nil)
244
+ list_details_async(resource_group, registration_name, product_name, custom_headers:custom_headers).value!
245
+ end
246
+
247
+ #
248
+ # Returns the extended properties of a product.
249
+ #
250
+ # @param resource_group [String] Name of the resource group.
251
+ # @param registration_name [String] Name of the Azure Stack registration.
252
+ # @param product_name [String] Name of the product.
253
+ # @param [Hash{String => String}] A hash of custom headers that will be added
254
+ # to the HTTP request.
255
+ #
256
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
257
+ #
258
+ def list_details_async(resource_group, registration_name, product_name, custom_headers:nil)
259
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
260
+ fail ArgumentError, 'resource_group is nil' if resource_group.nil?
261
+ fail ArgumentError, 'registration_name is nil' if registration_name.nil?
262
+ fail ArgumentError, 'product_name is nil' if product_name.nil?
263
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
264
+
265
+
266
+ request_headers = {}
267
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
268
+
269
+ # Set Headers
270
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
271
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
272
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/listDetails'
273
+
274
+ request_url = @base_url || @client.base_url
275
+
276
+ options = {
277
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
278
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroup' => resource_group,'registrationName' => registration_name,'productName' => product_name},
279
+ query_params: {'api-version' => @client.api_version},
280
+ headers: request_headers.merge(custom_headers || {}),
281
+ base_url: request_url
282
+ }
283
+ promise = @client.make_request_async(:post, path_template, options)
284
+
285
+ promise = promise.then do |result|
286
+ http_response = result.response
287
+ status_code = http_response.status
288
+ response_content = http_response.body
289
+ unless status_code == 200
290
+ error_model = JSON.load(response_content)
291
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
292
+ end
293
+
294
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
295
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
296
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
297
+ # Deserialize Response
298
+ if status_code == 200
299
+ begin
300
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
301
+ result_mapper = Azure::AzureStack::Mgmt::V2017_06_01::Models::ExtendedProduct.mapper()
302
+ result.body = @client.deserialize(result_mapper, parsed_response)
303
+ rescue Exception => e
304
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
305
+ end
306
+ end
307
+
308
+ result
309
+ end
310
+
311
+ promise.execute
312
+ end
313
+
314
+ #
315
+ # Returns a list of products.
316
+ #
317
+ # @param next_page_link [String] The NextLink from the previous successful call
318
+ # to List operation.
319
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
320
+ # will be added to the HTTP request.
321
+ #
322
+ # @return [ProductList] operation results.
323
+ #
324
+ def list_next(next_page_link, custom_headers:nil)
325
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
326
+ response.body unless response.nil?
327
+ end
328
+
329
+ #
330
+ # Returns a list of products.
331
+ #
332
+ # @param next_page_link [String] The NextLink from the previous successful call
333
+ # to List operation.
334
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
335
+ # will be added to the HTTP request.
336
+ #
337
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
338
+ #
339
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
340
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
341
+ end
342
+
343
+ #
344
+ # Returns a list of products.
345
+ #
346
+ # @param next_page_link [String] The NextLink from the previous successful call
347
+ # to List operation.
348
+ # @param [Hash{String => String}] A hash of custom headers that will be added
349
+ # to the HTTP request.
350
+ #
351
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
352
+ #
353
+ def list_next_async(next_page_link, custom_headers:nil)
354
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
355
+
356
+
357
+ request_headers = {}
358
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
359
+
360
+ # Set Headers
361
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
362
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
363
+ path_template = '{nextLink}'
364
+
365
+ request_url = @base_url || @client.base_url
366
+
367
+ options = {
368
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
369
+ skip_encoding_path_params: {'nextLink' => next_page_link},
370
+ headers: request_headers.merge(custom_headers || {}),
371
+ base_url: request_url
372
+ }
373
+ promise = @client.make_request_async(:get, path_template, options)
374
+
375
+ promise = promise.then do |result|
376
+ http_response = result.response
377
+ status_code = http_response.status
378
+ response_content = http_response.body
379
+ unless status_code == 200
380
+ error_model = JSON.load(response_content)
381
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
382
+ end
383
+
384
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
385
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
386
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
387
+ # Deserialize Response
388
+ if status_code == 200
389
+ begin
390
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
391
+ result_mapper = Azure::AzureStack::Mgmt::V2017_06_01::Models::ProductList.mapper()
392
+ result.body = @client.deserialize(result_mapper, parsed_response)
393
+ rescue Exception => e
394
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
395
+ end
396
+ end
397
+
398
+ result
399
+ end
400
+
401
+ promise.execute
402
+ end
403
+
404
+ #
405
+ # Returns a list of products.
406
+ #
407
+ # @param resource_group [String] Name of the resource group.
408
+ # @param registration_name [String] Name of the Azure Stack registration.
409
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
410
+ # will be added to the HTTP request.
411
+ #
412
+ # @return [ProductList] which provide lazy access to pages of the response.
413
+ #
414
+ def list_as_lazy(resource_group, registration_name, custom_headers:nil)
415
+ response = list_async(resource_group, registration_name, custom_headers:custom_headers).value!
416
+ unless response.nil?
417
+ page = response.body
418
+ page.next_method = Proc.new do |next_page_link|
419
+ list_next_async(next_page_link, custom_headers:custom_headers)
420
+ end
421
+ page
422
+ end
423
+ end
424
+
425
+ end
426
+ end
@@ -0,0 +1,717 @@
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::AzureStack::Mgmt::V2017_06_01
7
+ #
8
+ # Azure Stack
9
+ #
10
+ class Registrations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Registrations class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [AzureStackManagementClient] reference to the AzureStackManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Returns a list of all registrations.
26
+ #
27
+ # @param resource_group [String] Name of the resource group.
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<Registration>] operation results.
32
+ #
33
+ def list(resource_group, custom_headers:nil)
34
+ first_page = list_as_lazy(resource_group, custom_headers:custom_headers)
35
+ first_page.get_all_items
36
+ end
37
+
38
+ #
39
+ # Returns a list of all registrations.
40
+ #
41
+ # @param resource_group [String] Name of the resource group.
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_with_http_info(resource_group, custom_headers:nil)
48
+ list_async(resource_group, custom_headers:custom_headers).value!
49
+ end
50
+
51
+ #
52
+ # Returns a list of all registrations.
53
+ #
54
+ # @param resource_group [String] Name of the resource group.
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_async(resource_group, custom_headers:nil)
61
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
62
+ fail ArgumentError, 'resource_group is nil' if resource_group.nil?
63
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
64
+
65
+
66
+ request_headers = {}
67
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
68
+
69
+ # Set Headers
70
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
71
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
72
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations'
73
+
74
+ request_url = @base_url || @client.base_url
75
+
76
+ options = {
77
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
78
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroup' => resource_group},
79
+ query_params: {'api-version' => @client.api_version},
80
+ headers: request_headers.merge(custom_headers || {}),
81
+ base_url: request_url
82
+ }
83
+ promise = @client.make_request_async(:get, path_template, options)
84
+
85
+ promise = promise.then do |result|
86
+ http_response = result.response
87
+ status_code = http_response.status
88
+ response_content = http_response.body
89
+ unless status_code == 200
90
+ error_model = JSON.load(response_content)
91
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
92
+ end
93
+
94
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
95
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
96
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::AzureStack::Mgmt::V2017_06_01::Models::RegistrationList.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
+ # Returns the properties of an Azure Stack registration.
116
+ #
117
+ # @param resource_group [String] Name of the resource group.
118
+ # @param registration_name [String] Name of the Azure Stack registration.
119
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
120
+ # will be added to the HTTP request.
121
+ #
122
+ # @return [Registration] operation results.
123
+ #
124
+ def get(resource_group, registration_name, custom_headers:nil)
125
+ response = get_async(resource_group, registration_name, custom_headers:custom_headers).value!
126
+ response.body unless response.nil?
127
+ end
128
+
129
+ #
130
+ # Returns the properties of an Azure Stack registration.
131
+ #
132
+ # @param resource_group [String] Name of the resource group.
133
+ # @param registration_name [String] Name of the Azure Stack registration.
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 get_with_http_info(resource_group, registration_name, custom_headers:nil)
140
+ get_async(resource_group, registration_name, custom_headers:custom_headers).value!
141
+ end
142
+
143
+ #
144
+ # Returns the properties of an Azure Stack registration.
145
+ #
146
+ # @param resource_group [String] Name of the resource group.
147
+ # @param registration_name [String] Name of the Azure Stack registration.
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 get_async(resource_group, registration_name, custom_headers:nil)
154
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
155
+ fail ArgumentError, 'resource_group is nil' if resource_group.nil?
156
+ fail ArgumentError, 'registration_name is nil' if registration_name.nil?
157
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
158
+
159
+
160
+ request_headers = {}
161
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
162
+
163
+ # Set Headers
164
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
165
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
166
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}'
167
+
168
+ request_url = @base_url || @client.base_url
169
+
170
+ options = {
171
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
172
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroup' => resource_group,'registrationName' => registration_name},
173
+ query_params: {'api-version' => @client.api_version},
174
+ headers: request_headers.merge(custom_headers || {}),
175
+ base_url: request_url
176
+ }
177
+ promise = @client.make_request_async(:get, path_template, options)
178
+
179
+ promise = promise.then do |result|
180
+ http_response = result.response
181
+ status_code = http_response.status
182
+ response_content = http_response.body
183
+ unless status_code == 200
184
+ error_model = JSON.load(response_content)
185
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
186
+ end
187
+
188
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
189
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
190
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
191
+ # Deserialize Response
192
+ if status_code == 200
193
+ begin
194
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
195
+ result_mapper = Azure::AzureStack::Mgmt::V2017_06_01::Models::Registration.mapper()
196
+ result.body = @client.deserialize(result_mapper, parsed_response)
197
+ rescue Exception => e
198
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
199
+ end
200
+ end
201
+
202
+ result
203
+ end
204
+
205
+ promise.execute
206
+ end
207
+
208
+ #
209
+ # Delete the requested Azure Stack registration.
210
+ #
211
+ # @param resource_group [String] Name of the resource group.
212
+ # @param registration_name [String] Name of the Azure Stack registration.
213
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
214
+ # will be added to the HTTP request.
215
+ #
216
+ #
217
+ def delete(resource_group, registration_name, custom_headers:nil)
218
+ response = delete_async(resource_group, registration_name, custom_headers:custom_headers).value!
219
+ nil
220
+ end
221
+
222
+ #
223
+ # Delete the requested Azure Stack registration.
224
+ #
225
+ # @param resource_group [String] Name of the resource group.
226
+ # @param registration_name [String] Name of the Azure Stack registration.
227
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
228
+ # will be added to the HTTP request.
229
+ #
230
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
231
+ #
232
+ def delete_with_http_info(resource_group, registration_name, custom_headers:nil)
233
+ delete_async(resource_group, registration_name, custom_headers:custom_headers).value!
234
+ end
235
+
236
+ #
237
+ # Delete the requested Azure Stack registration.
238
+ #
239
+ # @param resource_group [String] Name of the resource group.
240
+ # @param registration_name [String] Name of the Azure Stack registration.
241
+ # @param [Hash{String => String}] A hash of custom headers that will be added
242
+ # to the HTTP request.
243
+ #
244
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
245
+ #
246
+ def delete_async(resource_group, registration_name, custom_headers:nil)
247
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
248
+ fail ArgumentError, 'resource_group is nil' if resource_group.nil?
249
+ fail ArgumentError, 'registration_name is nil' if registration_name.nil?
250
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
251
+
252
+
253
+ request_headers = {}
254
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
255
+
256
+ # Set Headers
257
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
258
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
259
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}'
260
+
261
+ request_url = @base_url || @client.base_url
262
+
263
+ options = {
264
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
265
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroup' => resource_group,'registrationName' => registration_name},
266
+ query_params: {'api-version' => @client.api_version},
267
+ headers: request_headers.merge(custom_headers || {}),
268
+ base_url: request_url
269
+ }
270
+ promise = @client.make_request_async(:delete, path_template, options)
271
+
272
+ promise = promise.then do |result|
273
+ http_response = result.response
274
+ status_code = http_response.status
275
+ response_content = http_response.body
276
+ unless status_code == 200 || status_code == 204
277
+ error_model = JSON.load(response_content)
278
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
279
+ end
280
+
281
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
282
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
283
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
284
+
285
+ result
286
+ end
287
+
288
+ promise.execute
289
+ end
290
+
291
+ #
292
+ # Create or update an Azure Stack registration.
293
+ #
294
+ # @param resource_group [String] Name of the resource group.
295
+ # @param registration_name [String] Name of the Azure Stack registration.
296
+ # @param token [RegistrationParameter] Registration token
297
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
298
+ # will be added to the HTTP request.
299
+ #
300
+ # @return [Registration] operation results.
301
+ #
302
+ def create_or_update(resource_group, registration_name, token, custom_headers:nil)
303
+ response = create_or_update_async(resource_group, registration_name, token, custom_headers:custom_headers).value!
304
+ response.body unless response.nil?
305
+ end
306
+
307
+ #
308
+ # Create or update an Azure Stack registration.
309
+ #
310
+ # @param resource_group [String] Name of the resource group.
311
+ # @param registration_name [String] Name of the Azure Stack registration.
312
+ # @param token [RegistrationParameter] Registration token
313
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
314
+ # will be added to the HTTP request.
315
+ #
316
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
317
+ #
318
+ def create_or_update_with_http_info(resource_group, registration_name, token, custom_headers:nil)
319
+ create_or_update_async(resource_group, registration_name, token, custom_headers:custom_headers).value!
320
+ end
321
+
322
+ #
323
+ # Create or update an Azure Stack registration.
324
+ #
325
+ # @param resource_group [String] Name of the resource group.
326
+ # @param registration_name [String] Name of the Azure Stack registration.
327
+ # @param token [RegistrationParameter] Registration token
328
+ # @param [Hash{String => String}] A hash of custom headers that will be added
329
+ # to the HTTP request.
330
+ #
331
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
332
+ #
333
+ def create_or_update_async(resource_group, registration_name, token, custom_headers:nil)
334
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
335
+ fail ArgumentError, 'resource_group is nil' if resource_group.nil?
336
+ fail ArgumentError, 'registration_name is nil' if registration_name.nil?
337
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
338
+ fail ArgumentError, 'token is nil' if token.nil?
339
+
340
+
341
+ request_headers = {}
342
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
343
+
344
+ # Set Headers
345
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
346
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
347
+
348
+ # Serialize Request
349
+ request_mapper = Azure::AzureStack::Mgmt::V2017_06_01::Models::RegistrationParameter.mapper()
350
+ request_content = @client.serialize(request_mapper, token)
351
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
352
+
353
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}'
354
+
355
+ request_url = @base_url || @client.base_url
356
+
357
+ options = {
358
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
359
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroup' => resource_group,'registrationName' => registration_name},
360
+ query_params: {'api-version' => @client.api_version},
361
+ body: request_content,
362
+ headers: request_headers.merge(custom_headers || {}),
363
+ base_url: request_url
364
+ }
365
+ promise = @client.make_request_async(:put, path_template, options)
366
+
367
+ promise = promise.then do |result|
368
+ http_response = result.response
369
+ status_code = http_response.status
370
+ response_content = http_response.body
371
+ unless status_code == 200 || status_code == 201
372
+ error_model = JSON.load(response_content)
373
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
374
+ end
375
+
376
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
377
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
378
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
379
+ # Deserialize Response
380
+ if status_code == 200
381
+ begin
382
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
383
+ result_mapper = Azure::AzureStack::Mgmt::V2017_06_01::Models::Registration.mapper()
384
+ result.body = @client.deserialize(result_mapper, parsed_response)
385
+ rescue Exception => e
386
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
387
+ end
388
+ end
389
+ # Deserialize Response
390
+ if status_code == 201
391
+ begin
392
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
393
+ result_mapper = Azure::AzureStack::Mgmt::V2017_06_01::Models::Registration.mapper()
394
+ result.body = @client.deserialize(result_mapper, parsed_response)
395
+ rescue Exception => e
396
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
397
+ end
398
+ end
399
+
400
+ result
401
+ end
402
+
403
+ promise.execute
404
+ end
405
+
406
+ #
407
+ # Patch an Azure Stack registration.
408
+ #
409
+ # @param resource_group [String] Name of the resource group.
410
+ # @param registration_name [String] Name of the Azure Stack registration.
411
+ # @param token [RegistrationParameter] Registration token
412
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
413
+ # will be added to the HTTP request.
414
+ #
415
+ # @return [Registration] operation results.
416
+ #
417
+ def update(resource_group, registration_name, token, custom_headers:nil)
418
+ response = update_async(resource_group, registration_name, token, custom_headers:custom_headers).value!
419
+ response.body unless response.nil?
420
+ end
421
+
422
+ #
423
+ # Patch an Azure Stack registration.
424
+ #
425
+ # @param resource_group [String] Name of the resource group.
426
+ # @param registration_name [String] Name of the Azure Stack registration.
427
+ # @param token [RegistrationParameter] Registration token
428
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
429
+ # will be added to the HTTP request.
430
+ #
431
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
432
+ #
433
+ def update_with_http_info(resource_group, registration_name, token, custom_headers:nil)
434
+ update_async(resource_group, registration_name, token, custom_headers:custom_headers).value!
435
+ end
436
+
437
+ #
438
+ # Patch an Azure Stack registration.
439
+ #
440
+ # @param resource_group [String] Name of the resource group.
441
+ # @param registration_name [String] Name of the Azure Stack registration.
442
+ # @param token [RegistrationParameter] Registration token
443
+ # @param [Hash{String => String}] A hash of custom headers that will be added
444
+ # to the HTTP request.
445
+ #
446
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
447
+ #
448
+ def update_async(resource_group, registration_name, token, custom_headers:nil)
449
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
450
+ fail ArgumentError, 'resource_group is nil' if resource_group.nil?
451
+ fail ArgumentError, 'registration_name is nil' if registration_name.nil?
452
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
453
+ fail ArgumentError, 'token is nil' if token.nil?
454
+
455
+
456
+ request_headers = {}
457
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
458
+
459
+ # Set Headers
460
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
461
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
462
+
463
+ # Serialize Request
464
+ request_mapper = Azure::AzureStack::Mgmt::V2017_06_01::Models::RegistrationParameter.mapper()
465
+ request_content = @client.serialize(request_mapper, token)
466
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
467
+
468
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}'
469
+
470
+ request_url = @base_url || @client.base_url
471
+
472
+ options = {
473
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
474
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroup' => resource_group,'registrationName' => registration_name},
475
+ query_params: {'api-version' => @client.api_version},
476
+ body: request_content,
477
+ headers: request_headers.merge(custom_headers || {}),
478
+ base_url: request_url
479
+ }
480
+ promise = @client.make_request_async(:patch, 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 MsRest::HttpOperationError.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
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
493
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
494
+ # Deserialize Response
495
+ if status_code == 200
496
+ begin
497
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
498
+ result_mapper = Azure::AzureStack::Mgmt::V2017_06_01::Models::Registration.mapper()
499
+ result.body = @client.deserialize(result_mapper, parsed_response)
500
+ rescue Exception => e
501
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
502
+ end
503
+ end
504
+
505
+ result
506
+ end
507
+
508
+ promise.execute
509
+ end
510
+
511
+ #
512
+ # Returns Azure Stack Activation Key.
513
+ #
514
+ # @param resource_group [String] Name of the resource group.
515
+ # @param registration_name [String] Name of the Azure Stack registration.
516
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
517
+ # will be added to the HTTP request.
518
+ #
519
+ # @return [ActivationKeyResult] operation results.
520
+ #
521
+ def get_activation_key(resource_group, registration_name, custom_headers:nil)
522
+ response = get_activation_key_async(resource_group, registration_name, custom_headers:custom_headers).value!
523
+ response.body unless response.nil?
524
+ end
525
+
526
+ #
527
+ # Returns Azure Stack Activation Key.
528
+ #
529
+ # @param resource_group [String] Name of the resource group.
530
+ # @param registration_name [String] Name of the Azure Stack registration.
531
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
532
+ # will be added to the HTTP request.
533
+ #
534
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
535
+ #
536
+ def get_activation_key_with_http_info(resource_group, registration_name, custom_headers:nil)
537
+ get_activation_key_async(resource_group, registration_name, custom_headers:custom_headers).value!
538
+ end
539
+
540
+ #
541
+ # Returns Azure Stack Activation Key.
542
+ #
543
+ # @param resource_group [String] Name of the resource group.
544
+ # @param registration_name [String] Name of the Azure Stack registration.
545
+ # @param [Hash{String => String}] A hash of custom headers that will be added
546
+ # to the HTTP request.
547
+ #
548
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
549
+ #
550
+ def get_activation_key_async(resource_group, registration_name, custom_headers:nil)
551
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
552
+ fail ArgumentError, 'resource_group is nil' if resource_group.nil?
553
+ fail ArgumentError, 'registration_name is nil' if registration_name.nil?
554
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
555
+
556
+
557
+ request_headers = {}
558
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
559
+
560
+ # Set Headers
561
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
562
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
563
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/getactivationkey'
564
+
565
+ request_url = @base_url || @client.base_url
566
+
567
+ options = {
568
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
569
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroup' => resource_group,'registrationName' => registration_name},
570
+ query_params: {'api-version' => @client.api_version},
571
+ headers: request_headers.merge(custom_headers || {}),
572
+ base_url: request_url
573
+ }
574
+ promise = @client.make_request_async(:post, path_template, options)
575
+
576
+ promise = promise.then do |result|
577
+ http_response = result.response
578
+ status_code = http_response.status
579
+ response_content = http_response.body
580
+ unless status_code == 200
581
+ error_model = JSON.load(response_content)
582
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
583
+ end
584
+
585
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
586
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
587
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
588
+ # Deserialize Response
589
+ if status_code == 200
590
+ begin
591
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
592
+ result_mapper = Azure::AzureStack::Mgmt::V2017_06_01::Models::ActivationKeyResult.mapper()
593
+ result.body = @client.deserialize(result_mapper, parsed_response)
594
+ rescue Exception => e
595
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
596
+ end
597
+ end
598
+
599
+ result
600
+ end
601
+
602
+ promise.execute
603
+ end
604
+
605
+ #
606
+ # Returns a list of all registrations.
607
+ #
608
+ # @param next_page_link [String] The NextLink from the previous successful call
609
+ # to List operation.
610
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
611
+ # will be added to the HTTP request.
612
+ #
613
+ # @return [RegistrationList] operation results.
614
+ #
615
+ def list_next(next_page_link, custom_headers:nil)
616
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
617
+ response.body unless response.nil?
618
+ end
619
+
620
+ #
621
+ # Returns a list of all registrations.
622
+ #
623
+ # @param next_page_link [String] The NextLink from the previous successful call
624
+ # to List operation.
625
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
626
+ # will be added to the HTTP request.
627
+ #
628
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
629
+ #
630
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
631
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
632
+ end
633
+
634
+ #
635
+ # Returns a list of all registrations.
636
+ #
637
+ # @param next_page_link [String] The NextLink from the previous successful call
638
+ # to List operation.
639
+ # @param [Hash{String => String}] A hash of custom headers that will be added
640
+ # to the HTTP request.
641
+ #
642
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
643
+ #
644
+ def list_next_async(next_page_link, custom_headers:nil)
645
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
646
+
647
+
648
+ request_headers = {}
649
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
650
+
651
+ # Set Headers
652
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
653
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
654
+ path_template = '{nextLink}'
655
+
656
+ request_url = @base_url || @client.base_url
657
+
658
+ options = {
659
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
660
+ skip_encoding_path_params: {'nextLink' => next_page_link},
661
+ headers: request_headers.merge(custom_headers || {}),
662
+ base_url: request_url
663
+ }
664
+ promise = @client.make_request_async(:get, path_template, options)
665
+
666
+ promise = promise.then do |result|
667
+ http_response = result.response
668
+ status_code = http_response.status
669
+ response_content = http_response.body
670
+ unless status_code == 200
671
+ error_model = JSON.load(response_content)
672
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
673
+ end
674
+
675
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
676
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
677
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
678
+ # Deserialize Response
679
+ if status_code == 200
680
+ begin
681
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
682
+ result_mapper = Azure::AzureStack::Mgmt::V2017_06_01::Models::RegistrationList.mapper()
683
+ result.body = @client.deserialize(result_mapper, parsed_response)
684
+ rescue Exception => e
685
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
686
+ end
687
+ end
688
+
689
+ result
690
+ end
691
+
692
+ promise.execute
693
+ end
694
+
695
+ #
696
+ # Returns a list of all registrations.
697
+ #
698
+ # @param resource_group [String] Name of the resource group.
699
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
700
+ # will be added to the HTTP request.
701
+ #
702
+ # @return [RegistrationList] which provide lazy access to pages of the
703
+ # response.
704
+ #
705
+ def list_as_lazy(resource_group, custom_headers:nil)
706
+ response = list_async(resource_group, custom_headers:custom_headers).value!
707
+ unless response.nil?
708
+ page = response.body
709
+ page.next_method = Proc.new do |next_page_link|
710
+ list_next_async(next_page_link, custom_headers:custom_headers)
711
+ end
712
+ page
713
+ end
714
+ end
715
+
716
+ end
717
+ end