azure_mgmt_storage 0.19.3 → 0.21.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-05-01-preview/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  3. data/lib/2015-06-15/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  4. data/lib/2016-01-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  5. data/lib/2016-12-01/generated/azure_mgmt_storage.rb +2 -0
  6. data/lib/2016-12-01/generated/azure_mgmt_storage/models/permissions.rb +22 -0
  7. data/lib/2016-12-01/generated/azure_mgmt_storage/models/service_sas_parameters.rb +7 -7
  8. data/lib/2016-12-01/generated/azure_mgmt_storage/models/signed_resource.rb +18 -0
  9. data/lib/2016-12-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  10. data/lib/2017-06-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  11. data/lib/2017-10-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  12. data/lib/2018-02-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  13. data/lib/2018-03-01-preview/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  14. data/lib/2018-07-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  15. data/lib/2018-11-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  16. data/lib/2019-04-01/generated/azure_mgmt_storage.rb +1 -0
  17. data/lib/2019-04-01/generated/azure_mgmt_storage/models/minimum_tls_version.rb +17 -0
  18. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account.rb +26 -0
  19. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_create_parameters.rb +26 -0
  20. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_update_parameters.rb +26 -0
  21. data/lib/2019-04-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  22. data/lib/2019-06-01/generated/azure_mgmt_storage.rb +80 -52
  23. data/lib/2019-06-01/generated/azure_mgmt_storage/blob_containers.rb +20 -8
  24. data/lib/2019-06-01/generated/azure_mgmt_storage/file_shares.rb +156 -14
  25. data/lib/2019-06-01/generated/azure_mgmt_storage/models/blob_container.rb +73 -0
  26. data/lib/2019-06-01/generated/azure_mgmt_storage/models/blob_restore_range.rb +4 -2
  27. data/lib/2019-06-01/generated/azure_mgmt_storage/models/deleted_share.rb +59 -0
  28. data/lib/2019-06-01/generated/azure_mgmt_storage/models/enabled_protocols.rb +16 -0
  29. data/lib/2019-06-01/generated/azure_mgmt_storage/models/encryption.rb +13 -0
  30. data/lib/2019-06-01/generated/azure_mgmt_storage/models/file_share.rb +129 -0
  31. data/lib/2019-06-01/generated/azure_mgmt_storage/models/file_share_item.rb +129 -0
  32. data/lib/2019-06-01/generated/azure_mgmt_storage/models/get_share_expand.rb +15 -0
  33. data/lib/2019-06-01/generated/azure_mgmt_storage/models/key_vault_properties.rb +25 -0
  34. data/lib/2019-06-01/generated/azure_mgmt_storage/models/list_container_item.rb +73 -0
  35. data/lib/2019-06-01/generated/azure_mgmt_storage/models/list_containers_include.rb +15 -0
  36. data/lib/2019-06-01/generated/azure_mgmt_storage/models/list_queue.rb +83 -0
  37. data/lib/2019-06-01/generated/azure_mgmt_storage/models/list_queue_resource.rb +101 -0
  38. data/lib/2019-06-01/generated/azure_mgmt_storage/models/list_queue_services.rb +58 -0
  39. data/lib/2019-06-01/generated/azure_mgmt_storage/models/list_shares_expand.rb +15 -0
  40. data/lib/2019-06-01/generated/azure_mgmt_storage/models/list_table_resource.rb +101 -0
  41. data/lib/2019-06-01/generated/azure_mgmt_storage/models/list_table_services.rb +58 -0
  42. data/lib/2019-06-01/generated/azure_mgmt_storage/models/management_policy_filter.rb +21 -0
  43. data/lib/2019-06-01/generated/azure_mgmt_storage/models/minimum_tls_version.rb +17 -0
  44. data/lib/2019-06-01/generated/azure_mgmt_storage/models/object_replication_policies.rb +56 -0
  45. data/lib/2019-06-01/generated/azure_mgmt_storage/models/object_replication_policy.rb +131 -0
  46. data/lib/2019-06-01/generated/azure_mgmt_storage/models/object_replication_policy_filter.rb +70 -0
  47. data/lib/2019-06-01/generated/azure_mgmt_storage/models/object_replication_policy_rule.rb +82 -0
  48. data/lib/2019-06-01/generated/azure_mgmt_storage/models/private_endpoint_connection_list_result.rb +57 -0
  49. data/lib/2019-06-01/generated/azure_mgmt_storage/models/queue_service_properties.rb +77 -0
  50. data/lib/2019-06-01/generated/azure_mgmt_storage/models/restore_policy_properties.rb +13 -0
  51. data/lib/2019-06-01/generated/azure_mgmt_storage/models/root_squash_type.rb +17 -0
  52. data/lib/2019-06-01/generated/azure_mgmt_storage/models/share_access_tier.rb +18 -0
  53. data/lib/2019-06-01/generated/azure_mgmt_storage/models/storage_account.rb +26 -0
  54. data/lib/2019-06-01/generated/azure_mgmt_storage/models/storage_account_create_parameters.rb +26 -0
  55. data/lib/2019-06-01/generated/azure_mgmt_storage/models/storage_account_update_parameters.rb +26 -0
  56. data/lib/2019-06-01/generated/azure_mgmt_storage/models/storage_queue.rb +97 -0
  57. data/lib/2019-06-01/generated/azure_mgmt_storage/models/table.rb +74 -0
  58. data/lib/2019-06-01/generated/azure_mgmt_storage/models/table_service_properties.rb +77 -0
  59. data/lib/2019-06-01/generated/azure_mgmt_storage/models/tag_filter.rb +80 -0
  60. data/lib/2019-06-01/generated/azure_mgmt_storage/object_replication_policies_operations.rb +495 -0
  61. data/lib/2019-06-01/generated/azure_mgmt_storage/private_endpoint_connections.rb +122 -9
  62. data/lib/2019-06-01/generated/azure_mgmt_storage/queue.rb +805 -0
  63. data/lib/2019-06-01/generated/azure_mgmt_storage/queue_services.rb +386 -0
  64. data/lib/2019-06-01/generated/azure_mgmt_storage/storage_management_client.rb +22 -1
  65. data/lib/2019-06-01/generated/azure_mgmt_storage/table_operations.rb +743 -0
  66. data/lib/2019-06-01/generated/azure_mgmt_storage/table_services.rb +386 -0
  67. data/lib/profiles/latest/modules/storage_profile_module.rb +266 -164
  68. data/lib/version.rb +1 -1
  69. metadata +35 -4
@@ -0,0 +1,495 @@
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::Storage::Mgmt::V2019_06_01
7
+ #
8
+ # The Azure Storage Management API.
9
+ #
10
+ class ObjectReplicationPoliciesOperations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ObjectReplicationPoliciesOperations class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [StorageManagementClient] reference to the StorageManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # List the object replication policies associated with the storage account.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group within the
28
+ # user's subscription. The name is case insensitive.
29
+ # @param account_name [String] The name of the storage account within the
30
+ # specified resource group. Storage account names must be between 3 and 24
31
+ # characters in length and use numbers and lower-case letters only.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [ObjectReplicationPolicies] operation results.
36
+ #
37
+ def list(resource_group_name, account_name, custom_headers:nil)
38
+ response = list_async(resource_group_name, account_name, custom_headers:custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # List the object replication policies associated with the storage account.
44
+ #
45
+ # @param resource_group_name [String] The name of the resource group within the
46
+ # user's subscription. The name is case insensitive.
47
+ # @param account_name [String] The name of the storage account within the
48
+ # specified resource group. Storage account names must be between 3 and 24
49
+ # characters in length and use numbers and lower-case letters only.
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def list_with_http_info(resource_group_name, account_name, custom_headers:nil)
56
+ list_async(resource_group_name, account_name, custom_headers:custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # List the object replication policies associated with the storage account.
61
+ #
62
+ # @param resource_group_name [String] The name of the resource group within the
63
+ # user's subscription. The name is case insensitive.
64
+ # @param account_name [String] The name of the storage account within the
65
+ # specified resource group. Storage account names must be between 3 and 24
66
+ # characters in length and use numbers and lower-case letters only.
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def list_async(resource_group_name, account_name, custom_headers:nil)
73
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
74
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
75
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
76
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
77
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
78
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
79
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
80
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
81
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
82
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
83
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
84
+
85
+
86
+ request_headers = {}
87
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
88
+
89
+ # Set Headers
90
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
91
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
92
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'
93
+
94
+ request_url = @base_url || @client.base_url
95
+
96
+ options = {
97
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
98
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
99
+ query_params: {'api-version' => @client.api_version},
100
+ headers: request_headers.merge(custom_headers || {}),
101
+ base_url: request_url
102
+ }
103
+ promise = @client.make_request_async(:get, path_template, options)
104
+
105
+ promise = promise.then do |result|
106
+ http_response = result.response
107
+ status_code = http_response.status
108
+ response_content = http_response.body
109
+ unless status_code == 200
110
+ error_model = JSON.load(response_content)
111
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
112
+ end
113
+
114
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
115
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
116
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
117
+ # Deserialize Response
118
+ if status_code == 200
119
+ begin
120
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
121
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::ObjectReplicationPolicies.mapper()
122
+ result.body = @client.deserialize(result_mapper, parsed_response)
123
+ rescue Exception => e
124
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
125
+ end
126
+ end
127
+
128
+ result
129
+ end
130
+
131
+ promise.execute
132
+ end
133
+
134
+ #
135
+ # Get the object replication policy of the storage account by policy ID.
136
+ #
137
+ # @param resource_group_name [String] The name of the resource group within the
138
+ # user's subscription. The name is case insensitive.
139
+ # @param account_name [String] The name of the storage account within the
140
+ # specified resource group. Storage account names must be between 3 and 24
141
+ # characters in length and use numbers and lower-case letters only.
142
+ # @param object_replication_policy_id [String] The ID of object replication
143
+ # policy or 'default' if the policy ID is unknown.
144
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
145
+ # will be added to the HTTP request.
146
+ #
147
+ # @return [ObjectReplicationPolicy] operation results.
148
+ #
149
+ def get(resource_group_name, account_name, object_replication_policy_id, custom_headers:nil)
150
+ response = get_async(resource_group_name, account_name, object_replication_policy_id, custom_headers:custom_headers).value!
151
+ response.body unless response.nil?
152
+ end
153
+
154
+ #
155
+ # Get the object replication policy of the storage account by policy ID.
156
+ #
157
+ # @param resource_group_name [String] The name of the resource group within the
158
+ # user's subscription. The name is case insensitive.
159
+ # @param account_name [String] The name of the storage account within the
160
+ # specified resource group. Storage account names must be between 3 and 24
161
+ # characters in length and use numbers and lower-case letters only.
162
+ # @param object_replication_policy_id [String] The ID of object replication
163
+ # policy or 'default' if the policy ID is unknown.
164
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
165
+ # will be added to the HTTP request.
166
+ #
167
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
168
+ #
169
+ def get_with_http_info(resource_group_name, account_name, object_replication_policy_id, custom_headers:nil)
170
+ get_async(resource_group_name, account_name, object_replication_policy_id, custom_headers:custom_headers).value!
171
+ end
172
+
173
+ #
174
+ # Get the object replication policy of the storage account by policy ID.
175
+ #
176
+ # @param resource_group_name [String] The name of the resource group within the
177
+ # user's subscription. The name is case insensitive.
178
+ # @param account_name [String] The name of the storage account within the
179
+ # specified resource group. Storage account names must be between 3 and 24
180
+ # characters in length and use numbers and lower-case letters only.
181
+ # @param object_replication_policy_id [String] The ID of object replication
182
+ # policy or 'default' if the policy ID is unknown.
183
+ # @param [Hash{String => String}] A hash of custom headers that will be added
184
+ # to the HTTP request.
185
+ #
186
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
187
+ #
188
+ def get_async(resource_group_name, account_name, object_replication_policy_id, custom_headers:nil)
189
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
190
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
191
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
192
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
193
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
194
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
195
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
196
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
197
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
198
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
199
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
200
+ fail ArgumentError, 'object_replication_policy_id is nil' if object_replication_policy_id.nil?
201
+ fail ArgumentError, "'object_replication_policy_id' should satisfy the constraint - 'MinLength': '1'" if !object_replication_policy_id.nil? && object_replication_policy_id.length < 1
202
+
203
+
204
+ request_headers = {}
205
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
206
+
207
+ # Set Headers
208
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
209
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
210
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'
211
+
212
+ request_url = @base_url || @client.base_url
213
+
214
+ options = {
215
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
216
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'objectReplicationPolicyId' => object_replication_policy_id},
217
+ query_params: {'api-version' => @client.api_version},
218
+ headers: request_headers.merge(custom_headers || {}),
219
+ base_url: request_url
220
+ }
221
+ promise = @client.make_request_async(:get, path_template, options)
222
+
223
+ promise = promise.then do |result|
224
+ http_response = result.response
225
+ status_code = http_response.status
226
+ response_content = http_response.body
227
+ unless status_code == 200
228
+ error_model = JSON.load(response_content)
229
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
230
+ end
231
+
232
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
233
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
234
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
235
+ # Deserialize Response
236
+ if status_code == 200
237
+ begin
238
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
239
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::ObjectReplicationPolicy.mapper()
240
+ result.body = @client.deserialize(result_mapper, parsed_response)
241
+ rescue Exception => e
242
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
243
+ end
244
+ end
245
+
246
+ result
247
+ end
248
+
249
+ promise.execute
250
+ end
251
+
252
+ #
253
+ # Create or update the object replication policy of the storage account.
254
+ #
255
+ # @param resource_group_name [String] The name of the resource group within the
256
+ # user's subscription. The name is case insensitive.
257
+ # @param account_name [String] The name of the storage account within the
258
+ # specified resource group. Storage account names must be between 3 and 24
259
+ # characters in length and use numbers and lower-case letters only.
260
+ # @param object_replication_policy_id [String] The ID of object replication
261
+ # policy or 'default' if the policy ID is unknown.
262
+ # @param properties [ObjectReplicationPolicy] The object replication policy set
263
+ # to a storage account. A unique policy ID will be created if absent.
264
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
265
+ # will be added to the HTTP request.
266
+ #
267
+ # @return [ObjectReplicationPolicy] operation results.
268
+ #
269
+ def create_or_update(resource_group_name, account_name, object_replication_policy_id, properties, custom_headers:nil)
270
+ response = create_or_update_async(resource_group_name, account_name, object_replication_policy_id, properties, custom_headers:custom_headers).value!
271
+ response.body unless response.nil?
272
+ end
273
+
274
+ #
275
+ # Create or update the object replication policy of the storage account.
276
+ #
277
+ # @param resource_group_name [String] The name of the resource group within the
278
+ # user's subscription. The name is case insensitive.
279
+ # @param account_name [String] The name of the storage account within the
280
+ # specified resource group. Storage account names must be between 3 and 24
281
+ # characters in length and use numbers and lower-case letters only.
282
+ # @param object_replication_policy_id [String] The ID of object replication
283
+ # policy or 'default' if the policy ID is unknown.
284
+ # @param properties [ObjectReplicationPolicy] The object replication policy set
285
+ # to a storage account. A unique policy ID will be created if absent.
286
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
287
+ # will be added to the HTTP request.
288
+ #
289
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
290
+ #
291
+ def create_or_update_with_http_info(resource_group_name, account_name, object_replication_policy_id, properties, custom_headers:nil)
292
+ create_or_update_async(resource_group_name, account_name, object_replication_policy_id, properties, custom_headers:custom_headers).value!
293
+ end
294
+
295
+ #
296
+ # Create or update the object replication policy of the storage account.
297
+ #
298
+ # @param resource_group_name [String] The name of the resource group within the
299
+ # user's subscription. The name is case insensitive.
300
+ # @param account_name [String] The name of the storage account within the
301
+ # specified resource group. Storage account names must be between 3 and 24
302
+ # characters in length and use numbers and lower-case letters only.
303
+ # @param object_replication_policy_id [String] The ID of object replication
304
+ # policy or 'default' if the policy ID is unknown.
305
+ # @param properties [ObjectReplicationPolicy] The object replication policy set
306
+ # to a storage account. A unique policy ID will be created if absent.
307
+ # @param [Hash{String => String}] A hash of custom headers that will be added
308
+ # to the HTTP request.
309
+ #
310
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
311
+ #
312
+ def create_or_update_async(resource_group_name, account_name, object_replication_policy_id, properties, custom_headers:nil)
313
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
314
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
315
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
316
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
317
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
318
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
319
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
320
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
321
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
322
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
323
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
324
+ fail ArgumentError, 'object_replication_policy_id is nil' if object_replication_policy_id.nil?
325
+ fail ArgumentError, "'object_replication_policy_id' should satisfy the constraint - 'MinLength': '1'" if !object_replication_policy_id.nil? && object_replication_policy_id.length < 1
326
+ fail ArgumentError, 'properties is nil' if properties.nil?
327
+
328
+
329
+ request_headers = {}
330
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
331
+
332
+ # Set Headers
333
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
334
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
335
+
336
+ # Serialize Request
337
+ request_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::ObjectReplicationPolicy.mapper()
338
+ request_content = @client.serialize(request_mapper, properties)
339
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
340
+
341
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'
342
+
343
+ request_url = @base_url || @client.base_url
344
+
345
+ options = {
346
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
347
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'objectReplicationPolicyId' => object_replication_policy_id},
348
+ query_params: {'api-version' => @client.api_version},
349
+ body: request_content,
350
+ headers: request_headers.merge(custom_headers || {}),
351
+ base_url: request_url
352
+ }
353
+ promise = @client.make_request_async(:put, path_template, options)
354
+
355
+ promise = promise.then do |result|
356
+ http_response = result.response
357
+ status_code = http_response.status
358
+ response_content = http_response.body
359
+ unless status_code == 200
360
+ error_model = JSON.load(response_content)
361
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
362
+ end
363
+
364
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
365
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
366
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
367
+ # Deserialize Response
368
+ if status_code == 200
369
+ begin
370
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
371
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::ObjectReplicationPolicy.mapper()
372
+ result.body = @client.deserialize(result_mapper, parsed_response)
373
+ rescue Exception => e
374
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
375
+ end
376
+ end
377
+
378
+ result
379
+ end
380
+
381
+ promise.execute
382
+ end
383
+
384
+ #
385
+ # Deletes the object replication policy associated with the specified storage
386
+ # account.
387
+ #
388
+ # @param resource_group_name [String] The name of the resource group within the
389
+ # user's subscription. The name is case insensitive.
390
+ # @param account_name [String] The name of the storage account within the
391
+ # specified resource group. Storage account names must be between 3 and 24
392
+ # characters in length and use numbers and lower-case letters only.
393
+ # @param object_replication_policy_id [String] The ID of object replication
394
+ # policy or 'default' if the policy ID is unknown.
395
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
396
+ # will be added to the HTTP request.
397
+ #
398
+ #
399
+ def delete(resource_group_name, account_name, object_replication_policy_id, custom_headers:nil)
400
+ response = delete_async(resource_group_name, account_name, object_replication_policy_id, custom_headers:custom_headers).value!
401
+ nil
402
+ end
403
+
404
+ #
405
+ # Deletes the object replication policy associated with the specified storage
406
+ # account.
407
+ #
408
+ # @param resource_group_name [String] The name of the resource group within the
409
+ # user's subscription. The name is case insensitive.
410
+ # @param account_name [String] The name of the storage account within the
411
+ # specified resource group. Storage account names must be between 3 and 24
412
+ # characters in length and use numbers and lower-case letters only.
413
+ # @param object_replication_policy_id [String] The ID of object replication
414
+ # policy or 'default' if the policy ID is unknown.
415
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
416
+ # will be added to the HTTP request.
417
+ #
418
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
419
+ #
420
+ def delete_with_http_info(resource_group_name, account_name, object_replication_policy_id, custom_headers:nil)
421
+ delete_async(resource_group_name, account_name, object_replication_policy_id, custom_headers:custom_headers).value!
422
+ end
423
+
424
+ #
425
+ # Deletes the object replication policy associated with the specified storage
426
+ # account.
427
+ #
428
+ # @param resource_group_name [String] The name of the resource group within the
429
+ # user's subscription. The name is case insensitive.
430
+ # @param account_name [String] The name of the storage account within the
431
+ # specified resource group. Storage account names must be between 3 and 24
432
+ # characters in length and use numbers and lower-case letters only.
433
+ # @param object_replication_policy_id [String] The ID of object replication
434
+ # policy or 'default' if the policy ID is unknown.
435
+ # @param [Hash{String => String}] A hash of custom headers that will be added
436
+ # to the HTTP request.
437
+ #
438
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
439
+ #
440
+ def delete_async(resource_group_name, account_name, object_replication_policy_id, custom_headers:nil)
441
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
442
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
443
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
444
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
445
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
446
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
447
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
448
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
449
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
450
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
451
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
452
+ fail ArgumentError, 'object_replication_policy_id is nil' if object_replication_policy_id.nil?
453
+ fail ArgumentError, "'object_replication_policy_id' should satisfy the constraint - 'MinLength': '1'" if !object_replication_policy_id.nil? && object_replication_policy_id.length < 1
454
+
455
+
456
+ request_headers = {}
457
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
458
+
459
+ # Set Headers
460
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
461
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
462
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'
463
+
464
+ request_url = @base_url || @client.base_url
465
+
466
+ options = {
467
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
468
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'objectReplicationPolicyId' => object_replication_policy_id},
469
+ query_params: {'api-version' => @client.api_version},
470
+ headers: request_headers.merge(custom_headers || {}),
471
+ base_url: request_url
472
+ }
473
+ promise = @client.make_request_async(:delete, path_template, options)
474
+
475
+ promise = promise.then do |result|
476
+ http_response = result.response
477
+ status_code = http_response.status
478
+ response_content = http_response.body
479
+ unless status_code == 200 || status_code == 204
480
+ error_model = JSON.load(response_content)
481
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
482
+ end
483
+
484
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
485
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
486
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
487
+
488
+ result
489
+ end
490
+
491
+ promise.execute
492
+ end
493
+
494
+ end
495
+ end