azure_mgmt_netapp 0.20.2 → 0.21.0

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