azure_mgmt_netapp 0.17.3 → 0.18.0

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