azure_mgmt_key_vault 0.14.0 → 0.15.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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-06-01/generated/azure_mgmt_key_vault.rb +41 -0
  3. data/lib/2015-06-01/generated/azure_mgmt_key_vault/key_vault_management_client.rb +131 -0
  4. data/lib/{generated → 2015-06-01/generated}/azure_mgmt_key_vault/models/access_policy_entry.rb +1 -1
  5. data/lib/2015-06-01/generated/azure_mgmt_key_vault/models/certificate_permissions.rb +29 -0
  6. data/lib/2015-06-01/generated/azure_mgmt_key_vault/models/key_permissions.rb +31 -0
  7. data/lib/2015-06-01/generated/azure_mgmt_key_vault/models/permissions.rb +85 -0
  8. data/lib/{generated → 2015-06-01/generated}/azure_mgmt_key_vault/models/resource.rb +1 -1
  9. data/lib/{generated → 2015-06-01/generated}/azure_mgmt_key_vault/models/resource_list_result.rb +1 -1
  10. data/lib/2015-06-01/generated/azure_mgmt_key_vault/models/secret_permissions.rb +23 -0
  11. data/lib/{generated → 2015-06-01/generated}/azure_mgmt_key_vault/models/sku.rb +1 -1
  12. data/lib/{generated → 2015-06-01/generated}/azure_mgmt_key_vault/models/sku_name.rb +1 -1
  13. data/lib/{generated → 2015-06-01/generated}/azure_mgmt_key_vault/models/vault.rb +1 -1
  14. data/lib/{generated → 2015-06-01/generated}/azure_mgmt_key_vault/models/vault_create_or_update_parameters.rb +1 -1
  15. data/lib/{generated → 2015-06-01/generated}/azure_mgmt_key_vault/models/vault_list_result.rb +1 -1
  16. data/lib/2015-06-01/generated/azure_mgmt_key_vault/models/vault_properties.rb +136 -0
  17. data/lib/2015-06-01/generated/azure_mgmt_key_vault/module_definition.rb +9 -0
  18. data/lib/2015-06-01/generated/azure_mgmt_key_vault/vaults.rb +734 -0
  19. data/lib/{generated → 2015-06-01/generated}/azure_mgmt_key_vault/version.rb +2 -2
  20. data/lib/{generated → 2016-10-01/generated}/azure_mgmt_key_vault.rb +22 -22
  21. data/lib/{generated → 2016-10-01/generated}/azure_mgmt_key_vault/key_vault_management_client.rb +3 -3
  22. data/lib/2016-10-01/generated/azure_mgmt_key_vault/models/access_policy_entry.rb +81 -0
  23. data/lib/{generated → 2016-10-01/generated}/azure_mgmt_key_vault/models/certificate_permissions.rb +1 -1
  24. data/lib/{generated → 2016-10-01/generated}/azure_mgmt_key_vault/models/create_mode.rb +1 -1
  25. data/lib/{generated → 2016-10-01/generated}/azure_mgmt_key_vault/models/deleted_vault.rb +1 -1
  26. data/lib/{generated → 2016-10-01/generated}/azure_mgmt_key_vault/models/deleted_vault_list_result.rb +1 -1
  27. data/lib/{generated → 2016-10-01/generated}/azure_mgmt_key_vault/models/deleted_vault_properties.rb +1 -1
  28. data/lib/{generated → 2016-10-01/generated}/azure_mgmt_key_vault/models/key_permissions.rb +1 -1
  29. data/lib/{generated → 2016-10-01/generated}/azure_mgmt_key_vault/models/permissions.rb +1 -1
  30. data/lib/2016-10-01/generated/azure_mgmt_key_vault/models/resource.rb +96 -0
  31. data/lib/2016-10-01/generated/azure_mgmt_key_vault/models/resource_list_result.rb +94 -0
  32. data/lib/{generated → 2016-10-01/generated}/azure_mgmt_key_vault/models/secret_permissions.rb +1 -1
  33. data/lib/2016-10-01/generated/azure_mgmt_key_vault/models/sku.rb +59 -0
  34. data/lib/2016-10-01/generated/azure_mgmt_key_vault/models/sku_name.rb +16 -0
  35. data/lib/{generated → 2016-10-01/generated}/azure_mgmt_key_vault/models/storage_permissions.rb +1 -1
  36. data/lib/2016-10-01/generated/azure_mgmt_key_vault/models/vault.rb +90 -0
  37. data/lib/2016-10-01/generated/azure_mgmt_key_vault/models/vault_create_or_update_parameters.rb +75 -0
  38. data/lib/2016-10-01/generated/azure_mgmt_key_vault/models/vault_list_result.rb +94 -0
  39. data/lib/{generated → 2016-10-01/generated}/azure_mgmt_key_vault/models/vault_properties.rb +1 -1
  40. data/lib/2016-10-01/generated/azure_mgmt_key_vault/module_definition.rb +9 -0
  41. data/lib/{generated → 2016-10-01/generated}/azure_mgmt_key_vault/vaults.rb +12 -12
  42. data/lib/{generated/azure_mgmt_key_vault/module_definition.rb → 2016-10-01/generated/azure_mgmt_key_vault/version.rb} +3 -3
  43. data/lib/azure_mgmt_key_vault.rb +3 -1
  44. data/lib/module_definition.rb +9 -0
  45. data/lib/profiles/common/configurable.rb +73 -0
  46. data/lib/profiles/common/default.rb +68 -0
  47. data/lib/profiles/latest/keyvault_latest_profile_client.rb +33 -0
  48. data/lib/profiles/latest/keyvault_module_definition.rb +9 -0
  49. data/lib/profiles/latest/modules/keyvault_profile_module.rb +114 -0
  50. data/lib/version.rb +7 -0
  51. metadata +50 -25
@@ -0,0 +1,9 @@
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 end
7
+ module Azure::KeyVault end
8
+ module Azure::KeyVault::Mgmt end
9
+ module Azure::KeyVault::Mgmt::V2015_06_01 end
@@ -0,0 +1,734 @@
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::KeyVault::Mgmt::V2015_06_01
7
+ #
8
+ # The Azure management API provides a RESTful set of web services that
9
+ # interact with Azure Key Vault.
10
+ #
11
+ class Vaults
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Vaults class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [KeyVaultManagementClient] reference to the KeyVaultManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Create or update a key vault in the specified subscription.
27
+ #
28
+ # @param resource_group_name [String] The name of the Resource Group to which
29
+ # the server belongs.
30
+ # @param vault_name [String] Name of the vault
31
+ # @param parameters [VaultCreateOrUpdateParameters] Parameters to create or
32
+ # update the vault
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [Vault] operation results.
37
+ #
38
+ def create_or_update(resource_group_name, vault_name, parameters, custom_headers = nil)
39
+ response = create_or_update_async(resource_group_name, vault_name, parameters, custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
43
+ #
44
+ # Create or update a key vault in the specified subscription.
45
+ #
46
+ # @param resource_group_name [String] The name of the Resource Group to which
47
+ # the server belongs.
48
+ # @param vault_name [String] Name of the vault
49
+ # @param parameters [VaultCreateOrUpdateParameters] Parameters to create or
50
+ # update the vault
51
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
52
+ # will be added to the HTTP request.
53
+ #
54
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
55
+ #
56
+ def create_or_update_with_http_info(resource_group_name, vault_name, parameters, custom_headers = nil)
57
+ create_or_update_async(resource_group_name, vault_name, parameters, custom_headers).value!
58
+ end
59
+
60
+ #
61
+ # Create or update a key vault in the specified subscription.
62
+ #
63
+ # @param resource_group_name [String] The name of the Resource Group to which
64
+ # the server belongs.
65
+ # @param vault_name [String] Name of the vault
66
+ # @param parameters [VaultCreateOrUpdateParameters] Parameters to create or
67
+ # update the vault
68
+ # @param [Hash{String => String}] A hash of custom headers that will be added
69
+ # to the HTTP request.
70
+ #
71
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
72
+ #
73
+ def create_or_update_async(resource_group_name, vault_name, parameters, custom_headers = nil)
74
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
75
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
76
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
77
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
78
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
79
+
80
+
81
+ request_headers = {}
82
+
83
+ # Set Headers
84
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
85
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
86
+
87
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
88
+
89
+ # Serialize Request
90
+ request_mapper = Azure::KeyVault::Mgmt::V2015_06_01::Models::VaultCreateOrUpdateParameters.mapper()
91
+ request_content = @client.serialize(request_mapper, parameters)
92
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
93
+
94
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'
95
+
96
+ request_url = @base_url || @client.base_url
97
+
98
+ options = {
99
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
100
+ path_params: {'resourceGroupName' => resource_group_name,'vaultName' => vault_name,'subscriptionId' => @client.subscription_id},
101
+ query_params: {'api-version' => @client.api_version},
102
+ body: request_content,
103
+ headers: request_headers.merge(custom_headers || {}),
104
+ base_url: request_url
105
+ }
106
+ promise = @client.make_request_async(:put, path_template, options)
107
+
108
+ promise = promise.then do |result|
109
+ http_response = result.response
110
+ status_code = http_response.status
111
+ response_content = http_response.body
112
+ unless status_code == 201 || status_code == 200
113
+ error_model = JSON.load(response_content)
114
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
115
+ end
116
+
117
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
118
+ # Deserialize Response
119
+ if status_code == 201
120
+ begin
121
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
122
+ result_mapper = Azure::KeyVault::Mgmt::V2015_06_01::Models::Vault.mapper()
123
+ result.body = @client.deserialize(result_mapper, parsed_response)
124
+ rescue Exception => e
125
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
126
+ end
127
+ end
128
+ # Deserialize Response
129
+ if status_code == 200
130
+ begin
131
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
132
+ result_mapper = Azure::KeyVault::Mgmt::V2015_06_01::Models::Vault.mapper()
133
+ result.body = @client.deserialize(result_mapper, parsed_response)
134
+ rescue Exception => e
135
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
136
+ end
137
+ end
138
+
139
+ result
140
+ end
141
+
142
+ promise.execute
143
+ end
144
+
145
+ #
146
+ # Deletes the specified Azure key vault.
147
+ #
148
+ # @param resource_group_name [String] The name of the Resource Group to which
149
+ # the vault belongs.
150
+ # @param vault_name [String] The name of the vault to delete
151
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
152
+ # will be added to the HTTP request.
153
+ #
154
+ #
155
+ def delete(resource_group_name, vault_name, custom_headers = nil)
156
+ response = delete_async(resource_group_name, vault_name, custom_headers).value!
157
+ nil
158
+ end
159
+
160
+ #
161
+ # Deletes the specified Azure key vault.
162
+ #
163
+ # @param resource_group_name [String] The name of the Resource Group to which
164
+ # the vault belongs.
165
+ # @param vault_name [String] The name of the vault to delete
166
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
167
+ # will be added to the HTTP request.
168
+ #
169
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
170
+ #
171
+ def delete_with_http_info(resource_group_name, vault_name, custom_headers = nil)
172
+ delete_async(resource_group_name, vault_name, custom_headers).value!
173
+ end
174
+
175
+ #
176
+ # Deletes the specified Azure key vault.
177
+ #
178
+ # @param resource_group_name [String] The name of the Resource Group to which
179
+ # the vault belongs.
180
+ # @param vault_name [String] The name of the vault to delete
181
+ # @param [Hash{String => String}] A hash of custom headers that will be added
182
+ # to the HTTP request.
183
+ #
184
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
185
+ #
186
+ def delete_async(resource_group_name, vault_name, custom_headers = nil)
187
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
188
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
189
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
190
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
191
+
192
+
193
+ request_headers = {}
194
+
195
+ # Set Headers
196
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
197
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
198
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'
199
+
200
+ request_url = @base_url || @client.base_url
201
+
202
+ options = {
203
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
204
+ path_params: {'resourceGroupName' => resource_group_name,'vaultName' => vault_name,'subscriptionId' => @client.subscription_id},
205
+ query_params: {'api-version' => @client.api_version},
206
+ headers: request_headers.merge(custom_headers || {}),
207
+ base_url: request_url
208
+ }
209
+ promise = @client.make_request_async(:delete, path_template, options)
210
+
211
+ promise = promise.then do |result|
212
+ http_response = result.response
213
+ status_code = http_response.status
214
+ response_content = http_response.body
215
+ unless status_code == 200
216
+ error_model = JSON.load(response_content)
217
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
218
+ end
219
+
220
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
221
+
222
+ result
223
+ end
224
+
225
+ promise.execute
226
+ end
227
+
228
+ #
229
+ # Gets the specified Azure key vault.
230
+ #
231
+ # @param resource_group_name [String] The name of the Resource Group to which
232
+ # the vault belongs.
233
+ # @param vault_name [String] The name of the vault.
234
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
235
+ # will be added to the HTTP request.
236
+ #
237
+ # @return [Vault] operation results.
238
+ #
239
+ def get(resource_group_name, vault_name, custom_headers = nil)
240
+ response = get_async(resource_group_name, vault_name, custom_headers).value!
241
+ response.body unless response.nil?
242
+ end
243
+
244
+ #
245
+ # Gets the specified Azure key vault.
246
+ #
247
+ # @param resource_group_name [String] The name of the Resource Group to which
248
+ # the vault belongs.
249
+ # @param vault_name [String] The name of the vault.
250
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
251
+ # will be added to the HTTP request.
252
+ #
253
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
254
+ #
255
+ def get_with_http_info(resource_group_name, vault_name, custom_headers = nil)
256
+ get_async(resource_group_name, vault_name, custom_headers).value!
257
+ end
258
+
259
+ #
260
+ # Gets the specified Azure key vault.
261
+ #
262
+ # @param resource_group_name [String] The name of the Resource Group to which
263
+ # the vault belongs.
264
+ # @param vault_name [String] The name of the vault.
265
+ # @param [Hash{String => String}] A hash of custom headers that will be added
266
+ # to the HTTP request.
267
+ #
268
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
269
+ #
270
+ def get_async(resource_group_name, vault_name, custom_headers = nil)
271
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
272
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
273
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
274
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
275
+
276
+
277
+ request_headers = {}
278
+
279
+ # Set Headers
280
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
281
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
282
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'
283
+
284
+ request_url = @base_url || @client.base_url
285
+
286
+ options = {
287
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
288
+ path_params: {'resourceGroupName' => resource_group_name,'vaultName' => vault_name,'subscriptionId' => @client.subscription_id},
289
+ query_params: {'api-version' => @client.api_version},
290
+ headers: request_headers.merge(custom_headers || {}),
291
+ base_url: request_url
292
+ }
293
+ promise = @client.make_request_async(:get, path_template, options)
294
+
295
+ promise = promise.then do |result|
296
+ http_response = result.response
297
+ status_code = http_response.status
298
+ response_content = http_response.body
299
+ unless status_code == 200
300
+ error_model = JSON.load(response_content)
301
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
302
+ end
303
+
304
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
305
+ # Deserialize Response
306
+ if status_code == 200
307
+ begin
308
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
309
+ result_mapper = Azure::KeyVault::Mgmt::V2015_06_01::Models::Vault.mapper()
310
+ result.body = @client.deserialize(result_mapper, parsed_response)
311
+ rescue Exception => e
312
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
313
+ end
314
+ end
315
+
316
+ result
317
+ end
318
+
319
+ promise.execute
320
+ end
321
+
322
+ #
323
+ # The List operation gets information about the vaults associated with the
324
+ # subscription and within the specified resource group.
325
+ #
326
+ # @param resource_group_name [String] The name of the Resource Group to which
327
+ # the vault belongs.
328
+ # @param top [Integer] Maximum number of results to return.
329
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
330
+ # will be added to the HTTP request.
331
+ #
332
+ # @return [Array<Vault>] operation results.
333
+ #
334
+ def list_by_resource_group(resource_group_name, top = nil, custom_headers = nil)
335
+ first_page = list_by_resource_group_as_lazy(resource_group_name, top, custom_headers)
336
+ first_page.get_all_items
337
+ end
338
+
339
+ #
340
+ # The List operation gets information about the vaults associated with the
341
+ # subscription and within the specified resource group.
342
+ #
343
+ # @param resource_group_name [String] The name of the Resource Group to which
344
+ # the vault belongs.
345
+ # @param top [Integer] Maximum number of results to return.
346
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
347
+ # will be added to the HTTP request.
348
+ #
349
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
350
+ #
351
+ def list_by_resource_group_with_http_info(resource_group_name, top = nil, custom_headers = nil)
352
+ list_by_resource_group_async(resource_group_name, top, custom_headers).value!
353
+ end
354
+
355
+ #
356
+ # The List operation gets information about the vaults associated with the
357
+ # subscription and within the specified resource group.
358
+ #
359
+ # @param resource_group_name [String] The name of the Resource Group to which
360
+ # the vault belongs.
361
+ # @param top [Integer] Maximum number of results to return.
362
+ # @param [Hash{String => String}] A hash of custom headers that will be added
363
+ # to the HTTP request.
364
+ #
365
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
366
+ #
367
+ def list_by_resource_group_async(resource_group_name, top = nil, custom_headers = nil)
368
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
369
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
370
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
371
+
372
+
373
+ request_headers = {}
374
+
375
+ # Set Headers
376
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
377
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
378
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'
379
+
380
+ request_url = @base_url || @client.base_url
381
+
382
+ options = {
383
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
384
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
385
+ query_params: {'$top' => top,'api-version' => @client.api_version},
386
+ headers: request_headers.merge(custom_headers || {}),
387
+ base_url: request_url
388
+ }
389
+ promise = @client.make_request_async(:get, path_template, options)
390
+
391
+ promise = promise.then do |result|
392
+ http_response = result.response
393
+ status_code = http_response.status
394
+ response_content = http_response.body
395
+ unless status_code == 200
396
+ error_model = JSON.load(response_content)
397
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
398
+ end
399
+
400
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
401
+ # Deserialize Response
402
+ if status_code == 200
403
+ begin
404
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
405
+ result_mapper = Azure::KeyVault::Mgmt::V2015_06_01::Models::VaultListResult.mapper()
406
+ result.body = @client.deserialize(result_mapper, parsed_response)
407
+ rescue Exception => e
408
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
409
+ end
410
+ end
411
+
412
+ result
413
+ end
414
+
415
+ promise.execute
416
+ end
417
+
418
+ #
419
+ # The List operation gets information about the vaults associated with the
420
+ # subscription.
421
+ #
422
+ # @param top [Integer] Maximum number of results to return.
423
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
424
+ # will be added to the HTTP request.
425
+ #
426
+ # @return [Array<Resource>] operation results.
427
+ #
428
+ def list(top = nil, custom_headers = nil)
429
+ first_page = list_as_lazy(top, custom_headers)
430
+ first_page.get_all_items
431
+ end
432
+
433
+ #
434
+ # The List operation gets information about the vaults associated with the
435
+ # subscription.
436
+ #
437
+ # @param top [Integer] Maximum number of results to return.
438
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
439
+ # will be added to the HTTP request.
440
+ #
441
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
442
+ #
443
+ def list_with_http_info(top = nil, custom_headers = nil)
444
+ list_async(top, custom_headers).value!
445
+ end
446
+
447
+ #
448
+ # The List operation gets information about the vaults associated with the
449
+ # subscription.
450
+ #
451
+ # @param top [Integer] Maximum number of results to return.
452
+ # @param [Hash{String => String}] A hash of custom headers that will be added
453
+ # to the HTTP request.
454
+ #
455
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
456
+ #
457
+ def list_async(top = nil, custom_headers = nil)
458
+ filter = 'resourceType eq \'Microsoft.KeyVault/vaults\''
459
+ api_version = '2015-11-01'
460
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
461
+
462
+
463
+ request_headers = {}
464
+
465
+ # Set Headers
466
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
467
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
468
+ path_template = 'subscriptions/{subscriptionId}/resources'
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},
475
+ query_params: {'$filter' => filter,'$top' => top,'api-version' => api_version},
476
+ headers: request_headers.merge(custom_headers || {}),
477
+ base_url: request_url
478
+ }
479
+ promise = @client.make_request_async(:get, path_template, options)
480
+
481
+ promise = promise.then do |result|
482
+ http_response = result.response
483
+ status_code = http_response.status
484
+ response_content = http_response.body
485
+ unless status_code == 200
486
+ error_model = JSON.load(response_content)
487
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
488
+ end
489
+
490
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
491
+ # Deserialize Response
492
+ if status_code == 200
493
+ begin
494
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
495
+ result_mapper = Azure::KeyVault::Mgmt::V2015_06_01::Models::ResourceListResult.mapper()
496
+ result.body = @client.deserialize(result_mapper, parsed_response)
497
+ rescue Exception => e
498
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
499
+ end
500
+ end
501
+
502
+ result
503
+ end
504
+
505
+ promise.execute
506
+ end
507
+
508
+ #
509
+ # The List operation gets information about the vaults associated with the
510
+ # subscription and within the specified resource group.
511
+ #
512
+ # @param next_page_link [String] The NextLink from the previous successful call
513
+ # to List operation.
514
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
515
+ # will be added to the HTTP request.
516
+ #
517
+ # @return [VaultListResult] operation results.
518
+ #
519
+ def list_by_resource_group_next(next_page_link, custom_headers = nil)
520
+ response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
521
+ response.body unless response.nil?
522
+ end
523
+
524
+ #
525
+ # The List operation gets information about the vaults associated with the
526
+ # subscription and within the specified resource group.
527
+ #
528
+ # @param next_page_link [String] The NextLink from the previous successful call
529
+ # to List operation.
530
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
531
+ # will be added to the HTTP request.
532
+ #
533
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
534
+ #
535
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
536
+ list_by_resource_group_next_async(next_page_link, custom_headers).value!
537
+ end
538
+
539
+ #
540
+ # The List operation gets information about the vaults associated with the
541
+ # subscription and within the specified resource group.
542
+ #
543
+ # @param next_page_link [String] The NextLink from the previous successful call
544
+ # to List operation.
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 list_by_resource_group_next_async(next_page_link, custom_headers = nil)
551
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
552
+
553
+
554
+ request_headers = {}
555
+
556
+ # Set Headers
557
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
558
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
559
+ path_template = '{nextLink}'
560
+
561
+ request_url = @base_url || @client.base_url
562
+
563
+ options = {
564
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
565
+ skip_encoding_path_params: {'nextLink' => next_page_link},
566
+ headers: request_headers.merge(custom_headers || {}),
567
+ base_url: request_url
568
+ }
569
+ promise = @client.make_request_async(:get, path_template, options)
570
+
571
+ promise = promise.then do |result|
572
+ http_response = result.response
573
+ status_code = http_response.status
574
+ response_content = http_response.body
575
+ unless status_code == 200
576
+ error_model = JSON.load(response_content)
577
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
578
+ end
579
+
580
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
581
+ # Deserialize Response
582
+ if status_code == 200
583
+ begin
584
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
585
+ result_mapper = Azure::KeyVault::Mgmt::V2015_06_01::Models::VaultListResult.mapper()
586
+ result.body = @client.deserialize(result_mapper, parsed_response)
587
+ rescue Exception => e
588
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
589
+ end
590
+ end
591
+
592
+ result
593
+ end
594
+
595
+ promise.execute
596
+ end
597
+
598
+ #
599
+ # The List operation gets information about the vaults associated with the
600
+ # subscription.
601
+ #
602
+ # @param next_page_link [String] The NextLink from the previous successful call
603
+ # to List operation.
604
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
605
+ # will be added to the HTTP request.
606
+ #
607
+ # @return [ResourceListResult] operation results.
608
+ #
609
+ def list_next(next_page_link, custom_headers = nil)
610
+ response = list_next_async(next_page_link, custom_headers).value!
611
+ response.body unless response.nil?
612
+ end
613
+
614
+ #
615
+ # The List operation gets information about the vaults associated with the
616
+ # subscription.
617
+ #
618
+ # @param next_page_link [String] The NextLink from the previous successful call
619
+ # to List operation.
620
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
621
+ # will be added to the HTTP request.
622
+ #
623
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
624
+ #
625
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
626
+ list_next_async(next_page_link, custom_headers).value!
627
+ end
628
+
629
+ #
630
+ # The List operation gets information about the vaults associated with the
631
+ # subscription.
632
+ #
633
+ # @param next_page_link [String] The NextLink from the previous successful call
634
+ # to List operation.
635
+ # @param [Hash{String => String}] A hash of custom headers that will be added
636
+ # to the HTTP request.
637
+ #
638
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
639
+ #
640
+ def list_next_async(next_page_link, custom_headers = nil)
641
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
642
+
643
+
644
+ request_headers = {}
645
+
646
+ # Set Headers
647
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
648
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
649
+ path_template = '{nextLink}'
650
+
651
+ request_url = @base_url || @client.base_url
652
+
653
+ options = {
654
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
655
+ skip_encoding_path_params: {'nextLink' => next_page_link},
656
+ headers: request_headers.merge(custom_headers || {}),
657
+ base_url: request_url
658
+ }
659
+ promise = @client.make_request_async(:get, path_template, options)
660
+
661
+ promise = promise.then do |result|
662
+ http_response = result.response
663
+ status_code = http_response.status
664
+ response_content = http_response.body
665
+ unless status_code == 200
666
+ error_model = JSON.load(response_content)
667
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
668
+ end
669
+
670
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
671
+ # Deserialize Response
672
+ if status_code == 200
673
+ begin
674
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
675
+ result_mapper = Azure::KeyVault::Mgmt::V2015_06_01::Models::ResourceListResult.mapper()
676
+ result.body = @client.deserialize(result_mapper, parsed_response)
677
+ rescue Exception => e
678
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
679
+ end
680
+ end
681
+
682
+ result
683
+ end
684
+
685
+ promise.execute
686
+ end
687
+
688
+ #
689
+ # The List operation gets information about the vaults associated with the
690
+ # subscription and within the specified resource group.
691
+ #
692
+ # @param resource_group_name [String] The name of the Resource Group to which
693
+ # the vault belongs.
694
+ # @param top [Integer] Maximum number of results to return.
695
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
696
+ # will be added to the HTTP request.
697
+ #
698
+ # @return [VaultListResult] which provide lazy access to pages of the response.
699
+ #
700
+ def list_by_resource_group_as_lazy(resource_group_name, top = nil, custom_headers = nil)
701
+ response = list_by_resource_group_async(resource_group_name, top, custom_headers).value!
702
+ unless response.nil?
703
+ page = response.body
704
+ page.next_method = Proc.new do |next_page_link|
705
+ list_by_resource_group_next_async(next_page_link, custom_headers)
706
+ end
707
+ page
708
+ end
709
+ end
710
+
711
+ #
712
+ # The List operation gets information about the vaults associated with the
713
+ # subscription.
714
+ #
715
+ # @param top [Integer] Maximum number of results to return.
716
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
717
+ # will be added to the HTTP request.
718
+ #
719
+ # @return [ResourceListResult] which provide lazy access to pages of the
720
+ # response.
721
+ #
722
+ def list_as_lazy(top = nil, custom_headers = nil)
723
+ response = list_async(top, custom_headers).value!
724
+ unless response.nil?
725
+ page = response.body
726
+ page.next_method = Proc.new do |next_page_link|
727
+ list_next_async(next_page_link, custom_headers)
728
+ end
729
+ page
730
+ end
731
+ end
732
+
733
+ end
734
+ end