azure_mgmt_key_vault 0.17.1 → 0.17.6

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