azure_mgmt_netapp 0.18.0 → 0.18.1

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