azure_mgmt_key_vault 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-06-01/generated/azure_mgmt_key_vault/key_vault_management_client.rb +7 -6
  3. data/lib/2016-10-01/generated/azure_mgmt_key_vault/key_vault_management_client.rb +7 -6
  4. data/lib/2016-10-01/generated/azure_mgmt_key_vault/models/storage_permissions.rb +4 -0
  5. data/lib/2016-10-01/generated/azure_mgmt_key_vault/models/vault_patch_properties.rb +16 -3
  6. data/lib/2016-10-01/generated/azure_mgmt_key_vault/models/vault_properties.rb +22 -4
  7. data/lib/2016-10-01/generated/azure_mgmt_key_vault/vaults.rb +84 -132
  8. data/lib/2018-02-14/generated/azure_mgmt_key_vault.rb +65 -0
  9. data/lib/2018-02-14/generated/azure_mgmt_key_vault/key_vault_management_client.rb +137 -0
  10. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/access_policy_entry.rb +86 -0
  11. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/access_policy_update_kind.rb +17 -0
  12. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/certificate_permissions.rb +30 -0
  13. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/check_name_availability_result.rb +77 -0
  14. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/create_mode.rb +16 -0
  15. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/deleted_vault.rb +83 -0
  16. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/deleted_vault_list_result.rb +98 -0
  17. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/deleted_vault_properties.rb +103 -0
  18. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/iprule.rb +49 -0
  19. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/key_permissions.rb +30 -0
  20. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/log_specification.rb +68 -0
  21. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/network_rule_action.rb +16 -0
  22. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/network_rule_bypass_options.rb +16 -0
  23. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/network_rule_set.rb +103 -0
  24. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/operation.rb +83 -0
  25. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/operation_display.rb +79 -0
  26. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/operation_list_result.rb +100 -0
  27. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/permissions.rb +111 -0
  28. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/reason.rb +16 -0
  29. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/resource.rb +104 -0
  30. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/resource_list_result.rb +98 -0
  31. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/secret_permissions.rb +22 -0
  32. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/service_specification.rb +55 -0
  33. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/sku.rb +62 -0
  34. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/sku_name.rb +16 -0
  35. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/storage_permissions.rb +28 -0
  36. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/vault.rb +99 -0
  37. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/vault_access_policy_parameters.rb +95 -0
  38. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/vault_access_policy_properties.rb +57 -0
  39. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/vault_check_name_availability_parameters.rb +60 -0
  40. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/vault_create_or_update_parameters.rb +80 -0
  41. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/vault_list_result.rb +98 -0
  42. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/vault_patch_parameters.rb +67 -0
  43. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/vault_patch_properties.rb +175 -0
  44. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/vault_properties.rb +188 -0
  45. data/lib/2018-02-14/generated/azure_mgmt_key_vault/models/virtual_network_rule.rb +48 -0
  46. data/lib/2018-02-14/generated/azure_mgmt_key_vault/module_definition.rb +9 -0
  47. data/lib/2018-02-14/generated/azure_mgmt_key_vault/operations.rb +216 -0
  48. data/lib/2018-02-14/generated/azure_mgmt_key_vault/vaults.rb +1739 -0
  49. data/lib/azure_mgmt_key_vault.rb +2 -1
  50. data/lib/profiles/latest/modules/keyvault_profile_module.rb +95 -75
  51. data/lib/version.rb +1 -1
  52. metadata +46 -5
@@ -0,0 +1,1739 @@
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::V2018_02_14
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:custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
43
+ #
44
+ # @param resource_group_name [String] The name of the Resource Group to which
45
+ # the server belongs.
46
+ # @param vault_name [String] Name of the vault
47
+ # @param parameters [VaultCreateOrUpdateParameters] Parameters to create or
48
+ # update the vault
49
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
50
+ # will be added to the HTTP request.
51
+ #
52
+ # @return [Concurrent::Promise] promise which provides async access to http
53
+ # response.
54
+ #
55
+ def create_or_update_async(resource_group_name, vault_name, parameters, custom_headers:nil)
56
+ # Send request
57
+ promise = begin_create_or_update_async(resource_group_name, vault_name, parameters, custom_headers:custom_headers)
58
+
59
+ promise = promise.then do |response|
60
+ # Defining deserialization method.
61
+ deserialize_method = lambda do |parsed_response|
62
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::Vault.mapper()
63
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
64
+ end
65
+
66
+ # Waiting for response.
67
+ @client.get_long_running_operation_result(response, deserialize_method)
68
+ end
69
+
70
+ promise
71
+ end
72
+
73
+ #
74
+ # Update a key vault in the specified subscription.
75
+ #
76
+ # @param resource_group_name [String] The name of the Resource Group to which
77
+ # the server belongs.
78
+ # @param vault_name [String] Name of the vault
79
+ # @param parameters [VaultPatchParameters] Parameters to patch the vault
80
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
81
+ # will be added to the HTTP request.
82
+ #
83
+ # @return [Vault] operation results.
84
+ #
85
+ def update(resource_group_name, vault_name, parameters, custom_headers:nil)
86
+ response = update_async(resource_group_name, vault_name, parameters, custom_headers:custom_headers).value!
87
+ response.body unless response.nil?
88
+ end
89
+
90
+ #
91
+ # Update a key vault in the specified subscription.
92
+ #
93
+ # @param resource_group_name [String] The name of the Resource Group to which
94
+ # the server belongs.
95
+ # @param vault_name [String] Name of the vault
96
+ # @param parameters [VaultPatchParameters] Parameters to patch the vault
97
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
98
+ # will be added to the HTTP request.
99
+ #
100
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
101
+ #
102
+ def update_with_http_info(resource_group_name, vault_name, parameters, custom_headers:nil)
103
+ update_async(resource_group_name, vault_name, parameters, custom_headers:custom_headers).value!
104
+ end
105
+
106
+ #
107
+ # Update a key vault in the specified subscription.
108
+ #
109
+ # @param resource_group_name [String] The name of the Resource Group to which
110
+ # the server belongs.
111
+ # @param vault_name [String] Name of the vault
112
+ # @param parameters [VaultPatchParameters] Parameters to patch the vault
113
+ # @param [Hash{String => String}] A hash of custom headers that will be added
114
+ # to the HTTP request.
115
+ #
116
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
117
+ #
118
+ def update_async(resource_group_name, vault_name, parameters, custom_headers:nil)
119
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
120
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
121
+ fail ArgumentError, "'vault_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9-]{3,24}$'" if !vault_name.nil? && vault_name.match(Regexp.new('^^[a-zA-Z0-9-]{3,24}$$')).nil?
122
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
123
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
124
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
125
+
126
+
127
+ request_headers = {}
128
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
129
+
130
+ # Set Headers
131
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
132
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
133
+
134
+ # Serialize Request
135
+ request_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::VaultPatchParameters.mapper()
136
+ request_content = @client.serialize(request_mapper, parameters)
137
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
138
+
139
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'
140
+
141
+ request_url = @base_url || @client.base_url
142
+
143
+ options = {
144
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
145
+ path_params: {'resourceGroupName' => resource_group_name,'vaultName' => vault_name,'subscriptionId' => @client.subscription_id},
146
+ query_params: {'api-version' => @client.api_version},
147
+ body: request_content,
148
+ headers: request_headers.merge(custom_headers || {}),
149
+ base_url: request_url
150
+ }
151
+ promise = @client.make_request_async(:patch, path_template, options)
152
+
153
+ promise = promise.then do |result|
154
+ http_response = result.response
155
+ status_code = http_response.status
156
+ response_content = http_response.body
157
+ unless status_code == 201 || status_code == 200
158
+ error_model = JSON.load(response_content)
159
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
160
+ end
161
+
162
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
163
+ # Deserialize Response
164
+ if status_code == 201
165
+ begin
166
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
167
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::Vault.mapper()
168
+ result.body = @client.deserialize(result_mapper, parsed_response)
169
+ rescue Exception => e
170
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
171
+ end
172
+ end
173
+ # Deserialize Response
174
+ if status_code == 200
175
+ begin
176
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
177
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::Vault.mapper()
178
+ result.body = @client.deserialize(result_mapper, parsed_response)
179
+ rescue Exception => e
180
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
181
+ end
182
+ end
183
+
184
+ result
185
+ end
186
+
187
+ promise.execute
188
+ end
189
+
190
+ #
191
+ # Deletes the specified Azure key vault.
192
+ #
193
+ # @param resource_group_name [String] The name of the Resource Group to which
194
+ # the vault belongs.
195
+ # @param vault_name [String] The name of the vault to delete
196
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
197
+ # will be added to the HTTP request.
198
+ #
199
+ #
200
+ def delete(resource_group_name, vault_name, custom_headers:nil)
201
+ response = delete_async(resource_group_name, vault_name, custom_headers:custom_headers).value!
202
+ nil
203
+ end
204
+
205
+ #
206
+ # Deletes the specified Azure key vault.
207
+ #
208
+ # @param resource_group_name [String] The name of the Resource Group to which
209
+ # the vault belongs.
210
+ # @param vault_name [String] The name of the vault to delete
211
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
212
+ # will be added to the HTTP request.
213
+ #
214
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
215
+ #
216
+ def delete_with_http_info(resource_group_name, vault_name, custom_headers:nil)
217
+ delete_async(resource_group_name, vault_name, custom_headers:custom_headers).value!
218
+ end
219
+
220
+ #
221
+ # Deletes the specified Azure key vault.
222
+ #
223
+ # @param resource_group_name [String] The name of the Resource Group to which
224
+ # the vault belongs.
225
+ # @param vault_name [String] The name of the vault to delete
226
+ # @param [Hash{String => String}] A hash of custom headers that will be added
227
+ # to the HTTP request.
228
+ #
229
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
230
+ #
231
+ def delete_async(resource_group_name, vault_name, custom_headers:nil)
232
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
233
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
234
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
235
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
236
+
237
+
238
+ request_headers = {}
239
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
240
+
241
+ # Set Headers
242
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
243
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
244
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'
245
+
246
+ request_url = @base_url || @client.base_url
247
+
248
+ options = {
249
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
250
+ path_params: {'resourceGroupName' => resource_group_name,'vaultName' => vault_name,'subscriptionId' => @client.subscription_id},
251
+ query_params: {'api-version' => @client.api_version},
252
+ headers: request_headers.merge(custom_headers || {}),
253
+ base_url: request_url
254
+ }
255
+ promise = @client.make_request_async(:delete, path_template, options)
256
+
257
+ promise = promise.then do |result|
258
+ http_response = result.response
259
+ status_code = http_response.status
260
+ response_content = http_response.body
261
+ unless status_code == 200
262
+ error_model = JSON.load(response_content)
263
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
264
+ end
265
+
266
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
267
+
268
+ result
269
+ end
270
+
271
+ promise.execute
272
+ end
273
+
274
+ #
275
+ # Gets the specified Azure key vault.
276
+ #
277
+ # @param resource_group_name [String] The name of the Resource Group to which
278
+ # the vault belongs.
279
+ # @param vault_name [String] The name of the vault.
280
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
281
+ # will be added to the HTTP request.
282
+ #
283
+ # @return [Vault] operation results.
284
+ #
285
+ def get(resource_group_name, vault_name, custom_headers:nil)
286
+ response = get_async(resource_group_name, vault_name, custom_headers:custom_headers).value!
287
+ response.body unless response.nil?
288
+ end
289
+
290
+ #
291
+ # Gets the specified Azure key vault.
292
+ #
293
+ # @param resource_group_name [String] The name of the Resource Group to which
294
+ # the vault belongs.
295
+ # @param vault_name [String] The name of the vault.
296
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
297
+ # will be added to the HTTP request.
298
+ #
299
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
300
+ #
301
+ def get_with_http_info(resource_group_name, vault_name, custom_headers:nil)
302
+ get_async(resource_group_name, vault_name, custom_headers:custom_headers).value!
303
+ end
304
+
305
+ #
306
+ # Gets the specified Azure key vault.
307
+ #
308
+ # @param resource_group_name [String] The name of the Resource Group to which
309
+ # the vault belongs.
310
+ # @param vault_name [String] The name of the vault.
311
+ # @param [Hash{String => String}] A hash of custom headers that will be added
312
+ # to the HTTP request.
313
+ #
314
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
315
+ #
316
+ def get_async(resource_group_name, vault_name, custom_headers:nil)
317
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
318
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
319
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
320
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
321
+
322
+
323
+ request_headers = {}
324
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
325
+
326
+ # Set Headers
327
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
328
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
329
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'
330
+
331
+ request_url = @base_url || @client.base_url
332
+
333
+ options = {
334
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
335
+ path_params: {'resourceGroupName' => resource_group_name,'vaultName' => vault_name,'subscriptionId' => @client.subscription_id},
336
+ query_params: {'api-version' => @client.api_version},
337
+ headers: request_headers.merge(custom_headers || {}),
338
+ base_url: request_url
339
+ }
340
+ promise = @client.make_request_async(:get, path_template, options)
341
+
342
+ promise = promise.then do |result|
343
+ http_response = result.response
344
+ status_code = http_response.status
345
+ response_content = http_response.body
346
+ unless status_code == 200
347
+ error_model = JSON.load(response_content)
348
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
349
+ end
350
+
351
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
352
+ # Deserialize Response
353
+ if status_code == 200
354
+ begin
355
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
356
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::Vault.mapper()
357
+ result.body = @client.deserialize(result_mapper, parsed_response)
358
+ rescue Exception => e
359
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
360
+ end
361
+ end
362
+
363
+ result
364
+ end
365
+
366
+ promise.execute
367
+ end
368
+
369
+ #
370
+ # Update access policies in a key vault in the specified subscription.
371
+ #
372
+ # @param resource_group_name [String] The name of the Resource Group to which
373
+ # the vault belongs.
374
+ # @param vault_name [String] Name of the vault
375
+ # @param operation_kind [AccessPolicyUpdateKind] Name of the operation.
376
+ # Possible values include: 'add', 'replace', 'remove'
377
+ # @param parameters [VaultAccessPolicyParameters] Access policy to merge into
378
+ # the vault
379
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
380
+ # will be added to the HTTP request.
381
+ #
382
+ # @return [VaultAccessPolicyParameters] operation results.
383
+ #
384
+ def update_access_policy(resource_group_name, vault_name, operation_kind, parameters, custom_headers:nil)
385
+ response = update_access_policy_async(resource_group_name, vault_name, operation_kind, parameters, custom_headers:custom_headers).value!
386
+ response.body unless response.nil?
387
+ end
388
+
389
+ #
390
+ # Update access policies in a key vault in the specified subscription.
391
+ #
392
+ # @param resource_group_name [String] The name of the Resource Group to which
393
+ # the vault belongs.
394
+ # @param vault_name [String] Name of the vault
395
+ # @param operation_kind [AccessPolicyUpdateKind] Name of the operation.
396
+ # Possible values include: 'add', 'replace', 'remove'
397
+ # @param parameters [VaultAccessPolicyParameters] Access policy to merge into
398
+ # the vault
399
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
400
+ # will be added to the HTTP request.
401
+ #
402
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
403
+ #
404
+ def update_access_policy_with_http_info(resource_group_name, vault_name, operation_kind, parameters, custom_headers:nil)
405
+ update_access_policy_async(resource_group_name, vault_name, operation_kind, parameters, custom_headers:custom_headers).value!
406
+ end
407
+
408
+ #
409
+ # Update access policies in a key vault in the specified subscription.
410
+ #
411
+ # @param resource_group_name [String] The name of the Resource Group to which
412
+ # the vault belongs.
413
+ # @param vault_name [String] Name of the vault
414
+ # @param operation_kind [AccessPolicyUpdateKind] Name of the operation.
415
+ # Possible values include: 'add', 'replace', 'remove'
416
+ # @param parameters [VaultAccessPolicyParameters] Access policy to merge into
417
+ # the vault
418
+ # @param [Hash{String => String}] A hash of custom headers that will be added
419
+ # to the HTTP request.
420
+ #
421
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
422
+ #
423
+ def update_access_policy_async(resource_group_name, vault_name, operation_kind, parameters, custom_headers:nil)
424
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
425
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
426
+ fail ArgumentError, "'vault_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9-]{3,24}$'" if !vault_name.nil? && vault_name.match(Regexp.new('^^[a-zA-Z0-9-]{3,24}$$')).nil?
427
+ fail ArgumentError, 'operation_kind is nil' if operation_kind.nil?
428
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
429
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
430
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
431
+
432
+
433
+ request_headers = {}
434
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
435
+
436
+ # Set Headers
437
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
438
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
439
+
440
+ # Serialize Request
441
+ request_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::VaultAccessPolicyParameters.mapper()
442
+ request_content = @client.serialize(request_mapper, parameters)
443
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
444
+
445
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'
446
+
447
+ request_url = @base_url || @client.base_url
448
+
449
+ options = {
450
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
451
+ path_params: {'resourceGroupName' => resource_group_name,'vaultName' => vault_name,'operationKind' => operation_kind,'subscriptionId' => @client.subscription_id},
452
+ query_params: {'api-version' => @client.api_version},
453
+ body: request_content,
454
+ headers: request_headers.merge(custom_headers || {}),
455
+ base_url: request_url
456
+ }
457
+ promise = @client.make_request_async(:put, path_template, options)
458
+
459
+ promise = promise.then do |result|
460
+ http_response = result.response
461
+ status_code = http_response.status
462
+ response_content = http_response.body
463
+ unless status_code == 201 || status_code == 200
464
+ error_model = JSON.load(response_content)
465
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
466
+ end
467
+
468
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
469
+ # Deserialize Response
470
+ if status_code == 201
471
+ begin
472
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
473
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::VaultAccessPolicyParameters.mapper()
474
+ result.body = @client.deserialize(result_mapper, parsed_response)
475
+ rescue Exception => e
476
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
477
+ end
478
+ end
479
+ # Deserialize Response
480
+ if status_code == 200
481
+ begin
482
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
483
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::VaultAccessPolicyParameters.mapper()
484
+ result.body = @client.deserialize(result_mapper, parsed_response)
485
+ rescue Exception => e
486
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
487
+ end
488
+ end
489
+
490
+ result
491
+ end
492
+
493
+ promise.execute
494
+ end
495
+
496
+ #
497
+ # The List operation gets information about the vaults associated with the
498
+ # subscription and within the specified resource group.
499
+ #
500
+ # @param resource_group_name [String] The name of the Resource Group to which
501
+ # the vault belongs.
502
+ # @param top [Integer] Maximum number of results to return.
503
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
504
+ # will be added to the HTTP request.
505
+ #
506
+ # @return [Array<Vault>] operation results.
507
+ #
508
+ def list_by_resource_group(resource_group_name, top:nil, custom_headers:nil)
509
+ first_page = list_by_resource_group_as_lazy(resource_group_name, top:top, custom_headers:custom_headers)
510
+ first_page.get_all_items
511
+ end
512
+
513
+ #
514
+ # The List operation gets information about the vaults associated with the
515
+ # subscription and within the specified resource group.
516
+ #
517
+ # @param resource_group_name [String] The name of the Resource Group to which
518
+ # the vault belongs.
519
+ # @param top [Integer] Maximum number of results to return.
520
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
521
+ # will be added to the HTTP request.
522
+ #
523
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
524
+ #
525
+ def list_by_resource_group_with_http_info(resource_group_name, top:nil, custom_headers:nil)
526
+ list_by_resource_group_async(resource_group_name, top:top, custom_headers:custom_headers).value!
527
+ end
528
+
529
+ #
530
+ # The List operation gets information about the vaults associated with the
531
+ # subscription and within the specified resource group.
532
+ #
533
+ # @param resource_group_name [String] The name of the Resource Group to which
534
+ # the vault belongs.
535
+ # @param top [Integer] Maximum number of results to return.
536
+ # @param [Hash{String => String}] A hash of custom headers that will be added
537
+ # to the HTTP request.
538
+ #
539
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
540
+ #
541
+ def list_by_resource_group_async(resource_group_name, top:nil, custom_headers:nil)
542
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
543
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
544
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
545
+
546
+
547
+ request_headers = {}
548
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
549
+
550
+ # Set Headers
551
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
552
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
553
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'
554
+
555
+ request_url = @base_url || @client.base_url
556
+
557
+ options = {
558
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
559
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
560
+ query_params: {'$top' => top,'api-version' => @client.api_version},
561
+ headers: request_headers.merge(custom_headers || {}),
562
+ base_url: request_url
563
+ }
564
+ promise = @client.make_request_async(:get, path_template, options)
565
+
566
+ promise = promise.then do |result|
567
+ http_response = result.response
568
+ status_code = http_response.status
569
+ response_content = http_response.body
570
+ unless status_code == 200
571
+ error_model = JSON.load(response_content)
572
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
573
+ end
574
+
575
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
576
+ # Deserialize Response
577
+ if status_code == 200
578
+ begin
579
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
580
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::VaultListResult.mapper()
581
+ result.body = @client.deserialize(result_mapper, parsed_response)
582
+ rescue Exception => e
583
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
584
+ end
585
+ end
586
+
587
+ result
588
+ end
589
+
590
+ promise.execute
591
+ end
592
+
593
+ #
594
+ # The List operation gets information about the vaults associated with the
595
+ # subscription.
596
+ #
597
+ # @param top [Integer] Maximum number of results to return.
598
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
599
+ # will be added to the HTTP request.
600
+ #
601
+ # @return [Array<Vault>] operation results.
602
+ #
603
+ def list_by_subscription(top:nil, custom_headers:nil)
604
+ first_page = list_by_subscription_as_lazy(top:top, custom_headers:custom_headers)
605
+ first_page.get_all_items
606
+ end
607
+
608
+ #
609
+ # The List operation gets information about the vaults associated with the
610
+ # subscription.
611
+ #
612
+ # @param top [Integer] Maximum number of results to return.
613
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
614
+ # will be added to the HTTP request.
615
+ #
616
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
617
+ #
618
+ def list_by_subscription_with_http_info(top:nil, custom_headers:nil)
619
+ list_by_subscription_async(top:top, custom_headers:custom_headers).value!
620
+ end
621
+
622
+ #
623
+ # The List operation gets information about the vaults associated with the
624
+ # subscription.
625
+ #
626
+ # @param top [Integer] Maximum number of results to return.
627
+ # @param [Hash{String => String}] A hash of custom headers that will be added
628
+ # to the HTTP request.
629
+ #
630
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
631
+ #
632
+ def list_by_subscription_async(top:nil, custom_headers:nil)
633
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
634
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
635
+
636
+
637
+ request_headers = {}
638
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
639
+
640
+ # Set Headers
641
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
642
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
643
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'
644
+
645
+ request_url = @base_url || @client.base_url
646
+
647
+ options = {
648
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
649
+ path_params: {'subscriptionId' => @client.subscription_id},
650
+ query_params: {'$top' => top,'api-version' => @client.api_version},
651
+ headers: request_headers.merge(custom_headers || {}),
652
+ base_url: request_url
653
+ }
654
+ promise = @client.make_request_async(:get, path_template, options)
655
+
656
+ promise = promise.then do |result|
657
+ http_response = result.response
658
+ status_code = http_response.status
659
+ response_content = http_response.body
660
+ unless status_code == 200
661
+ error_model = JSON.load(response_content)
662
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
663
+ end
664
+
665
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
666
+ # Deserialize Response
667
+ if status_code == 200
668
+ begin
669
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
670
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::VaultListResult.mapper()
671
+ result.body = @client.deserialize(result_mapper, parsed_response)
672
+ rescue Exception => e
673
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
674
+ end
675
+ end
676
+
677
+ result
678
+ end
679
+
680
+ promise.execute
681
+ end
682
+
683
+ #
684
+ # Gets information about the deleted vaults in a subscription.
685
+ #
686
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
687
+ # will be added to the HTTP request.
688
+ #
689
+ # @return [Array<DeletedVault>] operation results.
690
+ #
691
+ def list_deleted(custom_headers:nil)
692
+ first_page = list_deleted_as_lazy(custom_headers:custom_headers)
693
+ first_page.get_all_items
694
+ end
695
+
696
+ #
697
+ # Gets information about the deleted vaults in a subscription.
698
+ #
699
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
700
+ # will be added to the HTTP request.
701
+ #
702
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
703
+ #
704
+ def list_deleted_with_http_info(custom_headers:nil)
705
+ list_deleted_async(custom_headers:custom_headers).value!
706
+ end
707
+
708
+ #
709
+ # Gets information about the deleted vaults in a subscription.
710
+ #
711
+ # @param [Hash{String => String}] A hash of custom headers that will be added
712
+ # to the HTTP request.
713
+ #
714
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
715
+ #
716
+ def list_deleted_async(custom_headers:nil)
717
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
718
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
719
+
720
+
721
+ request_headers = {}
722
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
723
+
724
+ # Set Headers
725
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
726
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
727
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'
728
+
729
+ request_url = @base_url || @client.base_url
730
+
731
+ options = {
732
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
733
+ path_params: {'subscriptionId' => @client.subscription_id},
734
+ query_params: {'api-version' => @client.api_version},
735
+ headers: request_headers.merge(custom_headers || {}),
736
+ base_url: request_url
737
+ }
738
+ promise = @client.make_request_async(:get, path_template, options)
739
+
740
+ promise = promise.then do |result|
741
+ http_response = result.response
742
+ status_code = http_response.status
743
+ response_content = http_response.body
744
+ unless status_code == 200
745
+ error_model = JSON.load(response_content)
746
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
747
+ end
748
+
749
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
750
+ # Deserialize Response
751
+ if status_code == 200
752
+ begin
753
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
754
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::DeletedVaultListResult.mapper()
755
+ result.body = @client.deserialize(result_mapper, parsed_response)
756
+ rescue Exception => e
757
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
758
+ end
759
+ end
760
+
761
+ result
762
+ end
763
+
764
+ promise.execute
765
+ end
766
+
767
+ #
768
+ # Gets the deleted Azure key vault.
769
+ #
770
+ # @param vault_name [String] The name of the vault.
771
+ # @param location [String] The location of the deleted vault.
772
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
773
+ # will be added to the HTTP request.
774
+ #
775
+ # @return [DeletedVault] operation results.
776
+ #
777
+ def get_deleted(vault_name, location, custom_headers:nil)
778
+ response = get_deleted_async(vault_name, location, custom_headers:custom_headers).value!
779
+ response.body unless response.nil?
780
+ end
781
+
782
+ #
783
+ # Gets the deleted Azure key vault.
784
+ #
785
+ # @param vault_name [String] The name of the vault.
786
+ # @param location [String] The location of the deleted vault.
787
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
788
+ # will be added to the HTTP request.
789
+ #
790
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
791
+ #
792
+ def get_deleted_with_http_info(vault_name, location, custom_headers:nil)
793
+ get_deleted_async(vault_name, location, custom_headers:custom_headers).value!
794
+ end
795
+
796
+ #
797
+ # Gets the deleted Azure key vault.
798
+ #
799
+ # @param vault_name [String] The name of the vault.
800
+ # @param location [String] The location of the deleted vault.
801
+ # @param [Hash{String => String}] A hash of custom headers that will be added
802
+ # to the HTTP request.
803
+ #
804
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
805
+ #
806
+ def get_deleted_async(vault_name, location, custom_headers:nil)
807
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
808
+ fail ArgumentError, 'location is nil' if location.nil?
809
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
810
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
811
+
812
+
813
+ request_headers = {}
814
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
815
+
816
+ # Set Headers
817
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
818
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
819
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'
820
+
821
+ request_url = @base_url || @client.base_url
822
+
823
+ options = {
824
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
825
+ path_params: {'vaultName' => vault_name,'location' => location,'subscriptionId' => @client.subscription_id},
826
+ query_params: {'api-version' => @client.api_version},
827
+ headers: request_headers.merge(custom_headers || {}),
828
+ base_url: request_url
829
+ }
830
+ promise = @client.make_request_async(:get, path_template, options)
831
+
832
+ promise = promise.then do |result|
833
+ http_response = result.response
834
+ status_code = http_response.status
835
+ response_content = http_response.body
836
+ unless status_code == 200
837
+ error_model = JSON.load(response_content)
838
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
839
+ end
840
+
841
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
842
+ # Deserialize Response
843
+ if status_code == 200
844
+ begin
845
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
846
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::DeletedVault.mapper()
847
+ result.body = @client.deserialize(result_mapper, parsed_response)
848
+ rescue Exception => e
849
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
850
+ end
851
+ end
852
+
853
+ result
854
+ end
855
+
856
+ promise.execute
857
+ end
858
+
859
+ #
860
+ # Permanently deletes the specified vault. aka Purges the deleted Azure key
861
+ # vault.
862
+ #
863
+ # @param vault_name [String] The name of the soft-deleted vault.
864
+ # @param location [String] The location of the soft-deleted vault.
865
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
866
+ # will be added to the HTTP request.
867
+ #
868
+ def purge_deleted(vault_name, location, custom_headers:nil)
869
+ response = purge_deleted_async(vault_name, location, custom_headers:custom_headers).value!
870
+ nil
871
+ end
872
+
873
+ #
874
+ # @param vault_name [String] The name of the soft-deleted vault.
875
+ # @param location [String] The location of the soft-deleted vault.
876
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
877
+ # will be added to the HTTP request.
878
+ #
879
+ # @return [Concurrent::Promise] promise which provides async access to http
880
+ # response.
881
+ #
882
+ def purge_deleted_async(vault_name, location, custom_headers:nil)
883
+ # Send request
884
+ promise = begin_purge_deleted_async(vault_name, location, custom_headers:custom_headers)
885
+
886
+ promise = promise.then do |response|
887
+ # Defining deserialization method.
888
+ deserialize_method = lambda do |parsed_response|
889
+ end
890
+
891
+ # Waiting for response.
892
+ @client.get_long_running_operation_result(response, deserialize_method)
893
+ end
894
+
895
+ promise
896
+ end
897
+
898
+ #
899
+ # The List operation gets information about the vaults associated with the
900
+ # subscription.
901
+ #
902
+ # @param top [Integer] Maximum number of results to return.
903
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
904
+ # will be added to the HTTP request.
905
+ #
906
+ # @return [Array<Resource>] operation results.
907
+ #
908
+ def list(top:nil, custom_headers:nil)
909
+ first_page = list_as_lazy(top:top, custom_headers:custom_headers)
910
+ first_page.get_all_items
911
+ end
912
+
913
+ #
914
+ # The List operation gets information about the vaults associated with the
915
+ # subscription.
916
+ #
917
+ # @param top [Integer] Maximum number of results to return.
918
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
919
+ # will be added to the HTTP request.
920
+ #
921
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
922
+ #
923
+ def list_with_http_info(top:nil, custom_headers:nil)
924
+ list_async(top:top, custom_headers:custom_headers).value!
925
+ end
926
+
927
+ #
928
+ # The List operation gets information about the vaults associated with the
929
+ # subscription.
930
+ #
931
+ # @param top [Integer] Maximum number of results to return.
932
+ # @param [Hash{String => String}] A hash of custom headers that will be added
933
+ # to the HTTP request.
934
+ #
935
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
936
+ #
937
+ def list_async(top:nil, custom_headers:nil)
938
+ filter = 'resourceType eq \'Microsoft.KeyVault/vaults\''
939
+ api_version = '2015-11-01'
940
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
941
+
942
+
943
+ request_headers = {}
944
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
945
+
946
+ # Set Headers
947
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
948
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
949
+ path_template = 'subscriptions/{subscriptionId}/resources'
950
+
951
+ request_url = @base_url || @client.base_url
952
+
953
+ options = {
954
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
955
+ path_params: {'subscriptionId' => @client.subscription_id},
956
+ query_params: {'$filter' => filter,'$top' => top,'api-version' => api_version},
957
+ headers: request_headers.merge(custom_headers || {}),
958
+ base_url: request_url
959
+ }
960
+ promise = @client.make_request_async(:get, path_template, options)
961
+
962
+ promise = promise.then do |result|
963
+ http_response = result.response
964
+ status_code = http_response.status
965
+ response_content = http_response.body
966
+ unless status_code == 200
967
+ error_model = JSON.load(response_content)
968
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
969
+ end
970
+
971
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
972
+ # Deserialize Response
973
+ if status_code == 200
974
+ begin
975
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
976
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::ResourceListResult.mapper()
977
+ result.body = @client.deserialize(result_mapper, parsed_response)
978
+ rescue Exception => e
979
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
980
+ end
981
+ end
982
+
983
+ result
984
+ end
985
+
986
+ promise.execute
987
+ end
988
+
989
+ #
990
+ # Checks that the vault name is valid and is not already in use.
991
+ #
992
+ # @param vault_name [VaultCheckNameAvailabilityParameters] The name of the
993
+ # vault.
994
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
995
+ # will be added to the HTTP request.
996
+ #
997
+ # @return [CheckNameAvailabilityResult] operation results.
998
+ #
999
+ def check_name_availability(vault_name, custom_headers:nil)
1000
+ response = check_name_availability_async(vault_name, custom_headers:custom_headers).value!
1001
+ response.body unless response.nil?
1002
+ end
1003
+
1004
+ #
1005
+ # Checks that the vault name is valid and is not already in use.
1006
+ #
1007
+ # @param vault_name [VaultCheckNameAvailabilityParameters] The name of the
1008
+ # vault.
1009
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1010
+ # will be added to the HTTP request.
1011
+ #
1012
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1013
+ #
1014
+ def check_name_availability_with_http_info(vault_name, custom_headers:nil)
1015
+ check_name_availability_async(vault_name, custom_headers:custom_headers).value!
1016
+ end
1017
+
1018
+ #
1019
+ # Checks that the vault name is valid and is not already in use.
1020
+ #
1021
+ # @param vault_name [VaultCheckNameAvailabilityParameters] The name of the
1022
+ # vault.
1023
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1024
+ # to the HTTP request.
1025
+ #
1026
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1027
+ #
1028
+ def check_name_availability_async(vault_name, custom_headers:nil)
1029
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
1030
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1031
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1032
+
1033
+
1034
+ request_headers = {}
1035
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1036
+
1037
+ # Set Headers
1038
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1039
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1040
+
1041
+ # Serialize Request
1042
+ request_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::VaultCheckNameAvailabilityParameters.mapper()
1043
+ request_content = @client.serialize(request_mapper, vault_name)
1044
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1045
+
1046
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'
1047
+
1048
+ request_url = @base_url || @client.base_url
1049
+
1050
+ options = {
1051
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1052
+ path_params: {'subscriptionId' => @client.subscription_id},
1053
+ query_params: {'api-version' => @client.api_version},
1054
+ body: request_content,
1055
+ headers: request_headers.merge(custom_headers || {}),
1056
+ base_url: request_url
1057
+ }
1058
+ promise = @client.make_request_async(:post, path_template, options)
1059
+
1060
+ promise = promise.then do |result|
1061
+ http_response = result.response
1062
+ status_code = http_response.status
1063
+ response_content = http_response.body
1064
+ unless status_code == 200
1065
+ error_model = JSON.load(response_content)
1066
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1067
+ end
1068
+
1069
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1070
+ # Deserialize Response
1071
+ if status_code == 200
1072
+ begin
1073
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1074
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::CheckNameAvailabilityResult.mapper()
1075
+ result.body = @client.deserialize(result_mapper, parsed_response)
1076
+ rescue Exception => e
1077
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1078
+ end
1079
+ end
1080
+
1081
+ result
1082
+ end
1083
+
1084
+ promise.execute
1085
+ end
1086
+
1087
+ #
1088
+ # Create or update a key vault in the specified subscription.
1089
+ #
1090
+ # @param resource_group_name [String] The name of the Resource Group to which
1091
+ # the server belongs.
1092
+ # @param vault_name [String] Name of the vault
1093
+ # @param parameters [VaultCreateOrUpdateParameters] Parameters to create or
1094
+ # update the vault
1095
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1096
+ # will be added to the HTTP request.
1097
+ #
1098
+ # @return [Vault] operation results.
1099
+ #
1100
+ def begin_create_or_update(resource_group_name, vault_name, parameters, custom_headers:nil)
1101
+ response = begin_create_or_update_async(resource_group_name, vault_name, parameters, custom_headers:custom_headers).value!
1102
+ response.body unless response.nil?
1103
+ end
1104
+
1105
+ #
1106
+ # Create or update a key vault in the specified subscription.
1107
+ #
1108
+ # @param resource_group_name [String] The name of the Resource Group to which
1109
+ # the server belongs.
1110
+ # @param vault_name [String] Name of the vault
1111
+ # @param parameters [VaultCreateOrUpdateParameters] Parameters to create or
1112
+ # update the vault
1113
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1114
+ # will be added to the HTTP request.
1115
+ #
1116
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1117
+ #
1118
+ def begin_create_or_update_with_http_info(resource_group_name, vault_name, parameters, custom_headers:nil)
1119
+ begin_create_or_update_async(resource_group_name, vault_name, parameters, custom_headers:custom_headers).value!
1120
+ end
1121
+
1122
+ #
1123
+ # Create or update a key vault in the specified subscription.
1124
+ #
1125
+ # @param resource_group_name [String] The name of the Resource Group to which
1126
+ # the server belongs.
1127
+ # @param vault_name [String] Name of the vault
1128
+ # @param parameters [VaultCreateOrUpdateParameters] Parameters to create or
1129
+ # update the vault
1130
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1131
+ # to the HTTP request.
1132
+ #
1133
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1134
+ #
1135
+ def begin_create_or_update_async(resource_group_name, vault_name, parameters, custom_headers:nil)
1136
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1137
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
1138
+ fail ArgumentError, "'vault_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9-]{3,24}$'" if !vault_name.nil? && vault_name.match(Regexp.new('^^[a-zA-Z0-9-]{3,24}$$')).nil?
1139
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1140
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1141
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1142
+
1143
+
1144
+ request_headers = {}
1145
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1146
+
1147
+ # Set Headers
1148
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1149
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1150
+
1151
+ # Serialize Request
1152
+ request_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::VaultCreateOrUpdateParameters.mapper()
1153
+ request_content = @client.serialize(request_mapper, parameters)
1154
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1155
+
1156
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'
1157
+
1158
+ request_url = @base_url || @client.base_url
1159
+
1160
+ options = {
1161
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1162
+ path_params: {'resourceGroupName' => resource_group_name,'vaultName' => vault_name,'subscriptionId' => @client.subscription_id},
1163
+ query_params: {'api-version' => @client.api_version},
1164
+ body: request_content,
1165
+ headers: request_headers.merge(custom_headers || {}),
1166
+ base_url: request_url
1167
+ }
1168
+ promise = @client.make_request_async(:put, path_template, options)
1169
+
1170
+ promise = promise.then do |result|
1171
+ http_response = result.response
1172
+ status_code = http_response.status
1173
+ response_content = http_response.body
1174
+ unless status_code == 201 || status_code == 200
1175
+ error_model = JSON.load(response_content)
1176
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1177
+ end
1178
+
1179
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1180
+ # Deserialize Response
1181
+ if status_code == 201
1182
+ begin
1183
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1184
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::Vault.mapper()
1185
+ result.body = @client.deserialize(result_mapper, parsed_response)
1186
+ rescue Exception => e
1187
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1188
+ end
1189
+ end
1190
+ # Deserialize Response
1191
+ if status_code == 200
1192
+ begin
1193
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1194
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::Vault.mapper()
1195
+ result.body = @client.deserialize(result_mapper, parsed_response)
1196
+ rescue Exception => e
1197
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1198
+ end
1199
+ end
1200
+
1201
+ result
1202
+ end
1203
+
1204
+ promise.execute
1205
+ end
1206
+
1207
+ #
1208
+ # Permanently deletes the specified vault. aka Purges the deleted Azure key
1209
+ # vault.
1210
+ #
1211
+ # @param vault_name [String] The name of the soft-deleted vault.
1212
+ # @param location [String] The location of the soft-deleted vault.
1213
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1214
+ # will be added to the HTTP request.
1215
+ #
1216
+ #
1217
+ def begin_purge_deleted(vault_name, location, custom_headers:nil)
1218
+ response = begin_purge_deleted_async(vault_name, location, custom_headers:custom_headers).value!
1219
+ nil
1220
+ end
1221
+
1222
+ #
1223
+ # Permanently deletes the specified vault. aka Purges the deleted Azure key
1224
+ # vault.
1225
+ #
1226
+ # @param vault_name [String] The name of the soft-deleted vault.
1227
+ # @param location [String] The location of the soft-deleted vault.
1228
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1229
+ # will be added to the HTTP request.
1230
+ #
1231
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1232
+ #
1233
+ def begin_purge_deleted_with_http_info(vault_name, location, custom_headers:nil)
1234
+ begin_purge_deleted_async(vault_name, location, custom_headers:custom_headers).value!
1235
+ end
1236
+
1237
+ #
1238
+ # Permanently deletes the specified vault. aka Purges the deleted Azure key
1239
+ # vault.
1240
+ #
1241
+ # @param vault_name [String] The name of the soft-deleted vault.
1242
+ # @param location [String] The location of the soft-deleted vault.
1243
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1244
+ # to the HTTP request.
1245
+ #
1246
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1247
+ #
1248
+ def begin_purge_deleted_async(vault_name, location, custom_headers:nil)
1249
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
1250
+ fail ArgumentError, 'location is nil' if location.nil?
1251
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1252
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1253
+
1254
+
1255
+ request_headers = {}
1256
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1257
+
1258
+ # Set Headers
1259
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1260
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1261
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'
1262
+
1263
+ request_url = @base_url || @client.base_url
1264
+
1265
+ options = {
1266
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1267
+ path_params: {'vaultName' => vault_name,'location' => location,'subscriptionId' => @client.subscription_id},
1268
+ query_params: {'api-version' => @client.api_version},
1269
+ headers: request_headers.merge(custom_headers || {}),
1270
+ base_url: request_url
1271
+ }
1272
+ promise = @client.make_request_async(:post, path_template, options)
1273
+
1274
+ promise = promise.then do |result|
1275
+ http_response = result.response
1276
+ status_code = http_response.status
1277
+ response_content = http_response.body
1278
+ unless status_code == 200 || status_code == 202
1279
+ error_model = JSON.load(response_content)
1280
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1281
+ end
1282
+
1283
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1284
+
1285
+ result
1286
+ end
1287
+
1288
+ promise.execute
1289
+ end
1290
+
1291
+ #
1292
+ # The List operation gets information about the vaults associated with the
1293
+ # subscription and within the specified resource group.
1294
+ #
1295
+ # @param next_page_link [String] The NextLink from the previous successful call
1296
+ # to List operation.
1297
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1298
+ # will be added to the HTTP request.
1299
+ #
1300
+ # @return [VaultListResult] operation results.
1301
+ #
1302
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
1303
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
1304
+ response.body unless response.nil?
1305
+ end
1306
+
1307
+ #
1308
+ # The List operation gets information about the vaults associated with the
1309
+ # subscription and within the specified resource group.
1310
+ #
1311
+ # @param next_page_link [String] The NextLink from the previous successful call
1312
+ # to List operation.
1313
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1314
+ # will be added to the HTTP request.
1315
+ #
1316
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1317
+ #
1318
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
1319
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
1320
+ end
1321
+
1322
+ #
1323
+ # The List operation gets information about the vaults associated with the
1324
+ # subscription and within the specified resource group.
1325
+ #
1326
+ # @param next_page_link [String] The NextLink from the previous successful call
1327
+ # to List operation.
1328
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1329
+ # to the HTTP request.
1330
+ #
1331
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1332
+ #
1333
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
1334
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1335
+
1336
+
1337
+ request_headers = {}
1338
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1339
+
1340
+ # Set Headers
1341
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1342
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1343
+ path_template = '{nextLink}'
1344
+
1345
+ request_url = @base_url || @client.base_url
1346
+
1347
+ options = {
1348
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1349
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1350
+ headers: request_headers.merge(custom_headers || {}),
1351
+ base_url: request_url
1352
+ }
1353
+ promise = @client.make_request_async(:get, path_template, options)
1354
+
1355
+ promise = promise.then do |result|
1356
+ http_response = result.response
1357
+ status_code = http_response.status
1358
+ response_content = http_response.body
1359
+ unless status_code == 200
1360
+ error_model = JSON.load(response_content)
1361
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1362
+ end
1363
+
1364
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1365
+ # Deserialize Response
1366
+ if status_code == 200
1367
+ begin
1368
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1369
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::VaultListResult.mapper()
1370
+ result.body = @client.deserialize(result_mapper, parsed_response)
1371
+ rescue Exception => e
1372
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1373
+ end
1374
+ end
1375
+
1376
+ result
1377
+ end
1378
+
1379
+ promise.execute
1380
+ end
1381
+
1382
+ #
1383
+ # The List operation gets information about the vaults associated with the
1384
+ # subscription.
1385
+ #
1386
+ # @param next_page_link [String] The NextLink from the previous successful call
1387
+ # to List operation.
1388
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1389
+ # will be added to the HTTP request.
1390
+ #
1391
+ # @return [VaultListResult] operation results.
1392
+ #
1393
+ def list_by_subscription_next(next_page_link, custom_headers:nil)
1394
+ response = list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
1395
+ response.body unless response.nil?
1396
+ end
1397
+
1398
+ #
1399
+ # The List operation gets information about the vaults associated with the
1400
+ # subscription.
1401
+ #
1402
+ # @param next_page_link [String] The NextLink from the previous successful call
1403
+ # to List operation.
1404
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1405
+ # will be added to the HTTP request.
1406
+ #
1407
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1408
+ #
1409
+ def list_by_subscription_next_with_http_info(next_page_link, custom_headers:nil)
1410
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
1411
+ end
1412
+
1413
+ #
1414
+ # The List operation gets information about the vaults associated with the
1415
+ # subscription.
1416
+ #
1417
+ # @param next_page_link [String] The NextLink from the previous successful call
1418
+ # to List operation.
1419
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1420
+ # to the HTTP request.
1421
+ #
1422
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1423
+ #
1424
+ def list_by_subscription_next_async(next_page_link, custom_headers:nil)
1425
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1426
+
1427
+
1428
+ request_headers = {}
1429
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1430
+
1431
+ # Set Headers
1432
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1433
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1434
+ path_template = '{nextLink}'
1435
+
1436
+ request_url = @base_url || @client.base_url
1437
+
1438
+ options = {
1439
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1440
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1441
+ headers: request_headers.merge(custom_headers || {}),
1442
+ base_url: request_url
1443
+ }
1444
+ promise = @client.make_request_async(:get, path_template, options)
1445
+
1446
+ promise = promise.then do |result|
1447
+ http_response = result.response
1448
+ status_code = http_response.status
1449
+ response_content = http_response.body
1450
+ unless status_code == 200
1451
+ error_model = JSON.load(response_content)
1452
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1453
+ end
1454
+
1455
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1456
+ # Deserialize Response
1457
+ if status_code == 200
1458
+ begin
1459
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1460
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::VaultListResult.mapper()
1461
+ result.body = @client.deserialize(result_mapper, parsed_response)
1462
+ rescue Exception => e
1463
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1464
+ end
1465
+ end
1466
+
1467
+ result
1468
+ end
1469
+
1470
+ promise.execute
1471
+ end
1472
+
1473
+ #
1474
+ # Gets information about the deleted vaults in a subscription.
1475
+ #
1476
+ # @param next_page_link [String] The NextLink from the previous successful call
1477
+ # to List operation.
1478
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1479
+ # will be added to the HTTP request.
1480
+ #
1481
+ # @return [DeletedVaultListResult] operation results.
1482
+ #
1483
+ def list_deleted_next(next_page_link, custom_headers:nil)
1484
+ response = list_deleted_next_async(next_page_link, custom_headers:custom_headers).value!
1485
+ response.body unless response.nil?
1486
+ end
1487
+
1488
+ #
1489
+ # Gets information about the deleted vaults in a subscription.
1490
+ #
1491
+ # @param next_page_link [String] The NextLink from the previous successful call
1492
+ # to List operation.
1493
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1494
+ # will be added to the HTTP request.
1495
+ #
1496
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1497
+ #
1498
+ def list_deleted_next_with_http_info(next_page_link, custom_headers:nil)
1499
+ list_deleted_next_async(next_page_link, custom_headers:custom_headers).value!
1500
+ end
1501
+
1502
+ #
1503
+ # Gets information about the deleted vaults in a subscription.
1504
+ #
1505
+ # @param next_page_link [String] The NextLink from the previous successful call
1506
+ # to List operation.
1507
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1508
+ # to the HTTP request.
1509
+ #
1510
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1511
+ #
1512
+ def list_deleted_next_async(next_page_link, custom_headers:nil)
1513
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1514
+
1515
+
1516
+ request_headers = {}
1517
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1518
+
1519
+ # Set Headers
1520
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1521
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1522
+ path_template = '{nextLink}'
1523
+
1524
+ request_url = @base_url || @client.base_url
1525
+
1526
+ options = {
1527
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1528
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1529
+ headers: request_headers.merge(custom_headers || {}),
1530
+ base_url: request_url
1531
+ }
1532
+ promise = @client.make_request_async(:get, path_template, options)
1533
+
1534
+ promise = promise.then do |result|
1535
+ http_response = result.response
1536
+ status_code = http_response.status
1537
+ response_content = http_response.body
1538
+ unless status_code == 200
1539
+ error_model = JSON.load(response_content)
1540
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1541
+ end
1542
+
1543
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1544
+ # Deserialize Response
1545
+ if status_code == 200
1546
+ begin
1547
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1548
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::DeletedVaultListResult.mapper()
1549
+ result.body = @client.deserialize(result_mapper, parsed_response)
1550
+ rescue Exception => e
1551
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1552
+ end
1553
+ end
1554
+
1555
+ result
1556
+ end
1557
+
1558
+ promise.execute
1559
+ end
1560
+
1561
+ #
1562
+ # The List operation gets information about the vaults associated with the
1563
+ # subscription.
1564
+ #
1565
+ # @param next_page_link [String] The NextLink from the previous successful call
1566
+ # to List operation.
1567
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1568
+ # will be added to the HTTP request.
1569
+ #
1570
+ # @return [ResourceListResult] operation results.
1571
+ #
1572
+ def list_next(next_page_link, custom_headers:nil)
1573
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
1574
+ response.body unless response.nil?
1575
+ end
1576
+
1577
+ #
1578
+ # The List operation gets information about the vaults associated with the
1579
+ # subscription.
1580
+ #
1581
+ # @param next_page_link [String] The NextLink from the previous successful call
1582
+ # to List operation.
1583
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1584
+ # will be added to the HTTP request.
1585
+ #
1586
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1587
+ #
1588
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
1589
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
1590
+ end
1591
+
1592
+ #
1593
+ # The List operation gets information about the vaults associated with the
1594
+ # subscription.
1595
+ #
1596
+ # @param next_page_link [String] The NextLink from the previous successful call
1597
+ # to List operation.
1598
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1599
+ # to the HTTP request.
1600
+ #
1601
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1602
+ #
1603
+ def list_next_async(next_page_link, custom_headers:nil)
1604
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1605
+
1606
+
1607
+ request_headers = {}
1608
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1609
+
1610
+ # Set Headers
1611
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1612
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1613
+ path_template = '{nextLink}'
1614
+
1615
+ request_url = @base_url || @client.base_url
1616
+
1617
+ options = {
1618
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1619
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1620
+ headers: request_headers.merge(custom_headers || {}),
1621
+ base_url: request_url
1622
+ }
1623
+ promise = @client.make_request_async(:get, path_template, options)
1624
+
1625
+ promise = promise.then do |result|
1626
+ http_response = result.response
1627
+ status_code = http_response.status
1628
+ response_content = http_response.body
1629
+ unless status_code == 200
1630
+ error_model = JSON.load(response_content)
1631
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1632
+ end
1633
+
1634
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1635
+ # Deserialize Response
1636
+ if status_code == 200
1637
+ begin
1638
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1639
+ result_mapper = Azure::KeyVault::Mgmt::V2018_02_14::Models::ResourceListResult.mapper()
1640
+ result.body = @client.deserialize(result_mapper, parsed_response)
1641
+ rescue Exception => e
1642
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1643
+ end
1644
+ end
1645
+
1646
+ result
1647
+ end
1648
+
1649
+ promise.execute
1650
+ end
1651
+
1652
+ #
1653
+ # The List operation gets information about the vaults associated with the
1654
+ # subscription and within the specified resource group.
1655
+ #
1656
+ # @param resource_group_name [String] The name of the Resource Group to which
1657
+ # the vault belongs.
1658
+ # @param top [Integer] Maximum number of results to return.
1659
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1660
+ # will be added to the HTTP request.
1661
+ #
1662
+ # @return [VaultListResult] which provide lazy access to pages of the response.
1663
+ #
1664
+ def list_by_resource_group_as_lazy(resource_group_name, top:nil, custom_headers:nil)
1665
+ response = list_by_resource_group_async(resource_group_name, top:top, custom_headers:custom_headers).value!
1666
+ unless response.nil?
1667
+ page = response.body
1668
+ page.next_method = Proc.new do |next_page_link|
1669
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
1670
+ end
1671
+ page
1672
+ end
1673
+ end
1674
+
1675
+ #
1676
+ # The List operation gets information about the vaults associated with the
1677
+ # subscription.
1678
+ #
1679
+ # @param top [Integer] Maximum number of results to return.
1680
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1681
+ # will be added to the HTTP request.
1682
+ #
1683
+ # @return [VaultListResult] which provide lazy access to pages of the response.
1684
+ #
1685
+ def list_by_subscription_as_lazy(top:nil, custom_headers:nil)
1686
+ response = list_by_subscription_async(top:top, custom_headers:custom_headers).value!
1687
+ unless response.nil?
1688
+ page = response.body
1689
+ page.next_method = Proc.new do |next_page_link|
1690
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers)
1691
+ end
1692
+ page
1693
+ end
1694
+ end
1695
+
1696
+ #
1697
+ # Gets information about the deleted vaults in a subscription.
1698
+ #
1699
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1700
+ # will be added to the HTTP request.
1701
+ #
1702
+ # @return [DeletedVaultListResult] which provide lazy access to pages of the
1703
+ # response.
1704
+ #
1705
+ def list_deleted_as_lazy(custom_headers:nil)
1706
+ response = list_deleted_async(custom_headers:custom_headers).value!
1707
+ unless response.nil?
1708
+ page = response.body
1709
+ page.next_method = Proc.new do |next_page_link|
1710
+ list_deleted_next_async(next_page_link, custom_headers:custom_headers)
1711
+ end
1712
+ page
1713
+ end
1714
+ end
1715
+
1716
+ #
1717
+ # The List operation gets information about the vaults associated with the
1718
+ # subscription.
1719
+ #
1720
+ # @param top [Integer] Maximum number of results to return.
1721
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1722
+ # will be added to the HTTP request.
1723
+ #
1724
+ # @return [ResourceListResult] which provide lazy access to pages of the
1725
+ # response.
1726
+ #
1727
+ def list_as_lazy(top:nil, custom_headers:nil)
1728
+ response = list_async(top:top, custom_headers:custom_headers).value!
1729
+ unless response.nil?
1730
+ page = response.body
1731
+ page.next_method = Proc.new do |next_page_link|
1732
+ list_next_async(next_page_link, custom_headers:custom_headers)
1733
+ end
1734
+ page
1735
+ end
1736
+ end
1737
+
1738
+ end
1739
+ end