azure_mgmt_netapp 0.17.2 → 0.17.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +5 -5
  2. data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/azure_net_app_files_management_client.rb +1 -1
  3. data/lib/2019-05-01/generated/azure_mgmt_netapp/accounts.rb +641 -0
  4. data/lib/2019-05-01/generated/azure_mgmt_netapp/azure_net_app_files_management_client.rb +415 -0
  5. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/active_directory.rb +127 -0
  6. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/capacity_pool.rb +154 -0
  7. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/capacity_pool_list.rb +55 -0
  8. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/capacity_pool_patch.rb +125 -0
  9. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/check_name_resource_types.rb +18 -0
  10. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/dimension.rb +57 -0
  11. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/export_policy_rule.rb +113 -0
  12. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/in_availability_reason_type.rb +16 -0
  13. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/metric_specification.rb +145 -0
  14. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/mount_target.rb +210 -0
  15. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/mount_target_list.rb +55 -0
  16. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/net_app_account.rb +125 -0
  17. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/net_app_account_list.rb +55 -0
  18. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/net_app_account_patch.rb +125 -0
  19. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/operation.rb +83 -0
  20. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/operation_display.rb +79 -0
  21. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/operation_list_result.rb +57 -0
  22. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/resource_name_availability.rb +78 -0
  23. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/resource_name_availability_request.rb +72 -0
  24. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/service_level.rb +17 -0
  25. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/service_specification.rb +56 -0
  26. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/snapshot.rb +150 -0
  27. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/snapshot_patch.rb +46 -0
  28. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/snapshots_list.rb +55 -0
  29. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/volume.rb +226 -0
  30. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/volume_list.rb +55 -0
  31. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/volume_patch.rb +139 -0
  32. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/volume_patch_properties_export_policy.rb +58 -0
  33. data/lib/2019-05-01/generated/azure_mgmt_netapp/models/volume_properties_export_policy.rb +58 -0
  34. data/lib/2019-05-01/generated/azure_mgmt_netapp/module_definition.rb +9 -0
  35. data/lib/2019-05-01/generated/azure_mgmt_netapp/mount_targets.rb +134 -0
  36. data/lib/2019-05-01/generated/azure_mgmt_netapp/operations.rb +113 -0
  37. data/lib/2019-05-01/generated/azure_mgmt_netapp/pools.rb +665 -0
  38. data/lib/2019-05-01/generated/azure_mgmt_netapp/snapshots.rb +698 -0
  39. data/lib/2019-05-01/generated/azure_mgmt_netapp/volumes.rb +684 -0
  40. data/lib/2019-05-01/generated/azure_mgmt_netapp.rb +62 -0
  41. data/lib/azure_mgmt_netapp.rb +1 -0
  42. data/lib/profiles/latest/modules/netapp_profile_module.rb +84 -72
  43. data/lib/version.rb +1 -1
  44. metadata +41 -3
@@ -0,0 +1,684 @@
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::NetApp::Mgmt::V2019_05_01
7
+ #
8
+ # Microsoft NetApp Azure Resource Provider specification
9
+ #
10
+ class Volumes
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Volumes class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [AzureNetAppFilesManagementClient] reference to the AzureNetAppFilesManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Describe all volumes
26
+ #
27
+ # List all volumes within the capacity pool
28
+ #
29
+ # @param resource_group_name [String] The name of the resource group.
30
+ # @param account_name [String] The name of the NetApp account
31
+ # @param pool_name [String] The name of the capacity pool
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [VolumeList] operation results.
36
+ #
37
+ def list(resource_group_name, account_name, pool_name, custom_headers:nil)
38
+ response = list_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # Describe all volumes
44
+ #
45
+ # List all volumes within the capacity pool
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group.
48
+ # @param account_name [String] The name of the NetApp account
49
+ # @param pool_name [String] The name of the capacity pool
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def list_with_http_info(resource_group_name, account_name, pool_name, custom_headers:nil)
56
+ list_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # Describe all volumes
61
+ #
62
+ # List all volumes within the capacity pool
63
+ #
64
+ # @param resource_group_name [String] The name of the resource group.
65
+ # @param account_name [String] The name of the NetApp account
66
+ # @param pool_name [String] The name of the capacity pool
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def list_async(resource_group_name, account_name, pool_name, custom_headers:nil)
73
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
74
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
75
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
76
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
77
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
78
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
79
+ fail ArgumentError, 'pool_name is nil' if pool_name.nil?
80
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
81
+
82
+
83
+ request_headers = {}
84
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
85
+
86
+ # Set Headers
87
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
88
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
89
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes'
90
+
91
+ request_url = @base_url || @client.base_url
92
+
93
+ options = {
94
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
95
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'poolName' => pool_name},
96
+ query_params: {'api-version' => @client.api_version},
97
+ headers: request_headers.merge(custom_headers || {}),
98
+ base_url: request_url
99
+ }
100
+ promise = @client.make_request_async(:get, path_template, options)
101
+
102
+ promise = promise.then do |result|
103
+ http_response = result.response
104
+ status_code = http_response.status
105
+ response_content = http_response.body
106
+ unless status_code == 200
107
+ error_model = JSON.load(response_content)
108
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
109
+ end
110
+
111
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
112
+ # Deserialize Response
113
+ if status_code == 200
114
+ begin
115
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
116
+ result_mapper = Azure::NetApp::Mgmt::V2019_05_01::Models::VolumeList.mapper()
117
+ result.body = @client.deserialize(result_mapper, parsed_response)
118
+ rescue Exception => e
119
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
120
+ end
121
+ end
122
+
123
+ result
124
+ end
125
+
126
+ promise.execute
127
+ end
128
+
129
+ #
130
+ # Describe a volume
131
+ #
132
+ # Get the details of the specified volume
133
+ #
134
+ # @param resource_group_name [String] The name of the resource group.
135
+ # @param account_name [String] The name of the NetApp account
136
+ # @param pool_name [String] The name of the capacity pool
137
+ # @param volume_name [String] The name of the volume
138
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
139
+ # will be added to the HTTP request.
140
+ #
141
+ # @return [Volume] operation results.
142
+ #
143
+ def get(resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
144
+ response = get_async(resource_group_name, account_name, pool_name, volume_name, custom_headers:custom_headers).value!
145
+ response.body unless response.nil?
146
+ end
147
+
148
+ #
149
+ # Describe a volume
150
+ #
151
+ # Get the details of the specified volume
152
+ #
153
+ # @param resource_group_name [String] The name of the resource group.
154
+ # @param account_name [String] The name of the NetApp account
155
+ # @param pool_name [String] The name of the capacity pool
156
+ # @param volume_name [String] The name of the volume
157
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
158
+ # will be added to the HTTP request.
159
+ #
160
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
161
+ #
162
+ def get_with_http_info(resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
163
+ get_async(resource_group_name, account_name, pool_name, volume_name, custom_headers:custom_headers).value!
164
+ end
165
+
166
+ #
167
+ # Describe a volume
168
+ #
169
+ # Get the details of the specified volume
170
+ #
171
+ # @param resource_group_name [String] The name of the resource group.
172
+ # @param account_name [String] The name of the NetApp account
173
+ # @param pool_name [String] The name of the capacity pool
174
+ # @param volume_name [String] The name of the volume
175
+ # @param [Hash{String => String}] A hash of custom headers that will be added
176
+ # to the HTTP request.
177
+ #
178
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
179
+ #
180
+ def get_async(resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
181
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
182
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
183
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
184
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
185
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
186
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
187
+ fail ArgumentError, 'pool_name is nil' if pool_name.nil?
188
+ fail ArgumentError, 'volume_name is nil' if volume_name.nil?
189
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
190
+
191
+
192
+ request_headers = {}
193
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
194
+
195
+ # Set Headers
196
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
197
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
198
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'
199
+
200
+ request_url = @base_url || @client.base_url
201
+
202
+ options = {
203
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
204
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'poolName' => pool_name,'volumeName' => volume_name},
205
+ query_params: {'api-version' => @client.api_version},
206
+ headers: request_headers.merge(custom_headers || {}),
207
+ base_url: request_url
208
+ }
209
+ promise = @client.make_request_async(:get, path_template, options)
210
+
211
+ promise = promise.then do |result|
212
+ http_response = result.response
213
+ status_code = http_response.status
214
+ response_content = http_response.body
215
+ unless status_code == 200
216
+ error_model = JSON.load(response_content)
217
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
218
+ end
219
+
220
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
221
+ # Deserialize Response
222
+ if status_code == 200
223
+ begin
224
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
225
+ result_mapper = Azure::NetApp::Mgmt::V2019_05_01::Models::Volume.mapper()
226
+ result.body = @client.deserialize(result_mapper, parsed_response)
227
+ rescue Exception => e
228
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
229
+ end
230
+ end
231
+
232
+ result
233
+ end
234
+
235
+ promise.execute
236
+ end
237
+
238
+ #
239
+ # Create or Update a volume
240
+ #
241
+ # Create or update the specified volume within the capacity pool
242
+ #
243
+ # @param body [Volume] Volume object supplied in the body of the operation.
244
+ # @param resource_group_name [String] The name of the resource group.
245
+ # @param account_name [String] The name of the NetApp account
246
+ # @param pool_name [String] The name of the capacity pool
247
+ # @param volume_name [String] The name of the volume
248
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
249
+ # will be added to the HTTP request.
250
+ #
251
+ # @return [Volume] operation results.
252
+ #
253
+ def create_or_update(body, resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
254
+ response = create_or_update_async(body, resource_group_name, account_name, pool_name, volume_name, custom_headers:custom_headers).value!
255
+ response.body unless response.nil?
256
+ end
257
+
258
+ #
259
+ # @param body [Volume] Volume object supplied in the body of the operation.
260
+ # @param resource_group_name [String] The name of the resource group.
261
+ # @param account_name [String] The name of the NetApp account
262
+ # @param pool_name [String] The name of the capacity pool
263
+ # @param volume_name [String] The name of the volume
264
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
265
+ # will be added to the HTTP request.
266
+ #
267
+ # @return [Concurrent::Promise] promise which provides async access to http
268
+ # response.
269
+ #
270
+ def create_or_update_async(body, resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
271
+ # Send request
272
+ promise = begin_create_or_update_async(body, resource_group_name, account_name, pool_name, volume_name, custom_headers:custom_headers)
273
+
274
+ promise = promise.then do |response|
275
+ # Defining deserialization method.
276
+ deserialize_method = lambda do |parsed_response|
277
+ result_mapper = Azure::NetApp::Mgmt::V2019_05_01::Models::Volume.mapper()
278
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
279
+ end
280
+
281
+ # Waiting for response.
282
+ @client.get_long_running_operation_result(response, deserialize_method)
283
+ end
284
+
285
+ promise
286
+ end
287
+
288
+ #
289
+ # Update a volume
290
+ #
291
+ # Patch the specified volume
292
+ #
293
+ # @param body [VolumePatch] Volume object supplied in the body of the
294
+ # operation.
295
+ # @param resource_group_name [String] The name of the resource group.
296
+ # @param account_name [String] The name of the NetApp account
297
+ # @param pool_name [String] The name of the capacity pool
298
+ # @param volume_name [String] The name of the volume
299
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
300
+ # will be added to the HTTP request.
301
+ #
302
+ # @return [Volume] operation results.
303
+ #
304
+ def update(body, resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
305
+ response = update_async(body, resource_group_name, account_name, pool_name, volume_name, custom_headers:custom_headers).value!
306
+ response.body unless response.nil?
307
+ end
308
+
309
+ #
310
+ # Update a volume
311
+ #
312
+ # Patch the specified volume
313
+ #
314
+ # @param body [VolumePatch] Volume object supplied in the body of the
315
+ # operation.
316
+ # @param resource_group_name [String] The name of the resource group.
317
+ # @param account_name [String] The name of the NetApp account
318
+ # @param pool_name [String] The name of the capacity pool
319
+ # @param volume_name [String] The name of the volume
320
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
321
+ # will be added to the HTTP request.
322
+ #
323
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
324
+ #
325
+ def update_with_http_info(body, resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
326
+ update_async(body, resource_group_name, account_name, pool_name, volume_name, custom_headers:custom_headers).value!
327
+ end
328
+
329
+ #
330
+ # Update a volume
331
+ #
332
+ # Patch the specified volume
333
+ #
334
+ # @param body [VolumePatch] Volume object supplied in the body of the
335
+ # operation.
336
+ # @param resource_group_name [String] The name of the resource group.
337
+ # @param account_name [String] The name of the NetApp account
338
+ # @param pool_name [String] The name of the capacity pool
339
+ # @param volume_name [String] The name of the volume
340
+ # @param [Hash{String => String}] A hash of custom headers that will be added
341
+ # to the HTTP request.
342
+ #
343
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
344
+ #
345
+ def update_async(body, resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
346
+ fail ArgumentError, 'body is nil' if body.nil?
347
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
348
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
349
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
350
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
351
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
352
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
353
+ fail ArgumentError, 'pool_name is nil' if pool_name.nil?
354
+ fail ArgumentError, 'volume_name is nil' if volume_name.nil?
355
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
356
+
357
+
358
+ request_headers = {}
359
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
360
+
361
+ # Set Headers
362
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
363
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
364
+
365
+ # Serialize Request
366
+ request_mapper = Azure::NetApp::Mgmt::V2019_05_01::Models::VolumePatch.mapper()
367
+ request_content = @client.serialize(request_mapper, body)
368
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
369
+
370
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'
371
+
372
+ request_url = @base_url || @client.base_url
373
+
374
+ options = {
375
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
376
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'poolName' => pool_name,'volumeName' => volume_name},
377
+ query_params: {'api-version' => @client.api_version},
378
+ body: request_content,
379
+ headers: request_headers.merge(custom_headers || {}),
380
+ base_url: request_url
381
+ }
382
+ promise = @client.make_request_async(:patch, path_template, options)
383
+
384
+ promise = promise.then do |result|
385
+ http_response = result.response
386
+ status_code = http_response.status
387
+ response_content = http_response.body
388
+ unless status_code == 200
389
+ error_model = JSON.load(response_content)
390
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
391
+ end
392
+
393
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
394
+ # Deserialize Response
395
+ if status_code == 200
396
+ begin
397
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
398
+ result_mapper = Azure::NetApp::Mgmt::V2019_05_01::Models::Volume.mapper()
399
+ result.body = @client.deserialize(result_mapper, parsed_response)
400
+ rescue Exception => e
401
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
402
+ end
403
+ end
404
+
405
+ result
406
+ end
407
+
408
+ promise.execute
409
+ end
410
+
411
+ #
412
+ # Delete a volume
413
+ #
414
+ # Delete the specified volume
415
+ #
416
+ # @param resource_group_name [String] The name of the resource group.
417
+ # @param account_name [String] The name of the NetApp account
418
+ # @param pool_name [String] The name of the capacity pool
419
+ # @param volume_name [String] The name of the volume
420
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
421
+ # will be added to the HTTP request.
422
+ #
423
+ def delete(resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
424
+ response = delete_async(resource_group_name, account_name, pool_name, volume_name, custom_headers:custom_headers).value!
425
+ nil
426
+ end
427
+
428
+ #
429
+ # @param resource_group_name [String] The name of the resource group.
430
+ # @param account_name [String] The name of the NetApp account
431
+ # @param pool_name [String] The name of the capacity pool
432
+ # @param volume_name [String] The name of the volume
433
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
434
+ # will be added to the HTTP request.
435
+ #
436
+ # @return [Concurrent::Promise] promise which provides async access to http
437
+ # response.
438
+ #
439
+ def delete_async(resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
440
+ # Send request
441
+ promise = begin_delete_async(resource_group_name, account_name, pool_name, volume_name, custom_headers:custom_headers)
442
+
443
+ promise = promise.then do |response|
444
+ # Defining deserialization method.
445
+ deserialize_method = lambda do |parsed_response|
446
+ end
447
+
448
+ # Waiting for response.
449
+ @client.get_long_running_operation_result(response, deserialize_method)
450
+ end
451
+
452
+ promise
453
+ end
454
+
455
+ #
456
+ # Create or Update a volume
457
+ #
458
+ # Create or update the specified volume within the capacity pool
459
+ #
460
+ # @param body [Volume] Volume object supplied in the body of the operation.
461
+ # @param resource_group_name [String] The name of the resource group.
462
+ # @param account_name [String] The name of the NetApp account
463
+ # @param pool_name [String] The name of the capacity pool
464
+ # @param volume_name [String] The name of the volume
465
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
466
+ # will be added to the HTTP request.
467
+ #
468
+ # @return [Volume] operation results.
469
+ #
470
+ def begin_create_or_update(body, resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
471
+ response = begin_create_or_update_async(body, resource_group_name, account_name, pool_name, volume_name, custom_headers:custom_headers).value!
472
+ response.body unless response.nil?
473
+ end
474
+
475
+ #
476
+ # Create or Update a volume
477
+ #
478
+ # Create or update the specified volume within the capacity pool
479
+ #
480
+ # @param body [Volume] Volume object supplied in the body of the operation.
481
+ # @param resource_group_name [String] The name of the resource group.
482
+ # @param account_name [String] The name of the NetApp account
483
+ # @param pool_name [String] The name of the capacity pool
484
+ # @param volume_name [String] The name of the volume
485
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
486
+ # will be added to the HTTP request.
487
+ #
488
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
489
+ #
490
+ def begin_create_or_update_with_http_info(body, resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
491
+ begin_create_or_update_async(body, resource_group_name, account_name, pool_name, volume_name, custom_headers:custom_headers).value!
492
+ end
493
+
494
+ #
495
+ # Create or Update a volume
496
+ #
497
+ # Create or update the specified volume within the capacity pool
498
+ #
499
+ # @param body [Volume] Volume object supplied in the body of the operation.
500
+ # @param resource_group_name [String] The name of the resource group.
501
+ # @param account_name [String] The name of the NetApp account
502
+ # @param pool_name [String] The name of the capacity pool
503
+ # @param volume_name [String] The name of the volume
504
+ # @param [Hash{String => String}] A hash of custom headers that will be added
505
+ # to the HTTP request.
506
+ #
507
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
508
+ #
509
+ def begin_create_or_update_async(body, resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
510
+ fail ArgumentError, 'body is nil' if body.nil?
511
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
512
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
513
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
514
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
515
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
516
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
517
+ fail ArgumentError, 'pool_name is nil' if pool_name.nil?
518
+ fail ArgumentError, 'volume_name is nil' if volume_name.nil?
519
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
520
+
521
+
522
+ request_headers = {}
523
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
524
+
525
+ # Set Headers
526
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
527
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
528
+
529
+ # Serialize Request
530
+ request_mapper = Azure::NetApp::Mgmt::V2019_05_01::Models::Volume.mapper()
531
+ request_content = @client.serialize(request_mapper, body)
532
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
533
+
534
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'
535
+
536
+ request_url = @base_url || @client.base_url
537
+
538
+ options = {
539
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
540
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'poolName' => pool_name,'volumeName' => volume_name},
541
+ query_params: {'api-version' => @client.api_version},
542
+ body: request_content,
543
+ headers: request_headers.merge(custom_headers || {}),
544
+ base_url: request_url
545
+ }
546
+ promise = @client.make_request_async(:put, path_template, options)
547
+
548
+ promise = promise.then do |result|
549
+ http_response = result.response
550
+ status_code = http_response.status
551
+ response_content = http_response.body
552
+ unless status_code == 200 || status_code == 201 || status_code == 202
553
+ error_model = JSON.load(response_content)
554
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
555
+ end
556
+
557
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
558
+ # Deserialize Response
559
+ if status_code == 200
560
+ begin
561
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
562
+ result_mapper = Azure::NetApp::Mgmt::V2019_05_01::Models::Volume.mapper()
563
+ result.body = @client.deserialize(result_mapper, parsed_response)
564
+ rescue Exception => e
565
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
566
+ end
567
+ end
568
+ # Deserialize Response
569
+ if status_code == 201
570
+ begin
571
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
572
+ result_mapper = Azure::NetApp::Mgmt::V2019_05_01::Models::Volume.mapper()
573
+ result.body = @client.deserialize(result_mapper, parsed_response)
574
+ rescue Exception => e
575
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
576
+ end
577
+ end
578
+
579
+ result
580
+ end
581
+
582
+ promise.execute
583
+ end
584
+
585
+ #
586
+ # Delete a volume
587
+ #
588
+ # Delete the specified volume
589
+ #
590
+ # @param resource_group_name [String] The name of the resource group.
591
+ # @param account_name [String] The name of the NetApp account
592
+ # @param pool_name [String] The name of the capacity pool
593
+ # @param volume_name [String] The name of the volume
594
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
595
+ # will be added to the HTTP request.
596
+ #
597
+ #
598
+ def begin_delete(resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
599
+ response = begin_delete_async(resource_group_name, account_name, pool_name, volume_name, custom_headers:custom_headers).value!
600
+ nil
601
+ end
602
+
603
+ #
604
+ # Delete a volume
605
+ #
606
+ # Delete the specified volume
607
+ #
608
+ # @param resource_group_name [String] The name of the resource group.
609
+ # @param account_name [String] The name of the NetApp account
610
+ # @param pool_name [String] The name of the capacity pool
611
+ # @param volume_name [String] The name of the volume
612
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
613
+ # will be added to the HTTP request.
614
+ #
615
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
616
+ #
617
+ def begin_delete_with_http_info(resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
618
+ begin_delete_async(resource_group_name, account_name, pool_name, volume_name, custom_headers:custom_headers).value!
619
+ end
620
+
621
+ #
622
+ # Delete a volume
623
+ #
624
+ # Delete the specified volume
625
+ #
626
+ # @param resource_group_name [String] The name of the resource group.
627
+ # @param account_name [String] The name of the NetApp account
628
+ # @param pool_name [String] The name of the capacity pool
629
+ # @param volume_name [String] The name of the volume
630
+ # @param [Hash{String => String}] A hash of custom headers that will be added
631
+ # to the HTTP request.
632
+ #
633
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
634
+ #
635
+ def begin_delete_async(resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
636
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
637
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
638
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
639
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
640
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
641
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
642
+ fail ArgumentError, 'pool_name is nil' if pool_name.nil?
643
+ fail ArgumentError, 'volume_name is nil' if volume_name.nil?
644
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.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}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'
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,'resourceGroupName' => resource_group_name,'accountName' => account_name,'poolName' => pool_name,'volumeName' => volume_name},
660
+ query_params: {'api-version' => @client.api_version},
661
+ headers: request_headers.merge(custom_headers || {}),
662
+ base_url: request_url
663
+ }
664
+ promise = @client.make_request_async(:delete, 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 == 202 || status_code == 204
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
+
677
+ result
678
+ end
679
+
680
+ promise.execute
681
+ end
682
+
683
+ end
684
+ end