azure_mgmt_netapp 0.17.0

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