azure_mgmt_netapp 0.18.1 → 0.18.2

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