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