azure_mgmt_storage 0.17.6 → 0.17.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) 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/storage_management_client.rb +1 -1
  6. data/lib/2017-06-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  7. data/lib/2017-10-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  8. data/lib/2018-02-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  9. data/lib/2018-03-01-preview/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  10. data/lib/2018-07-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  11. data/lib/2018-11-01/generated/azure_mgmt_storage/blob_containers.rb +1721 -0
  12. data/lib/2018-11-01/generated/azure_mgmt_storage/blob_services.rb +266 -0
  13. data/lib/2018-11-01/generated/azure_mgmt_storage/management_policies.rb +355 -0
  14. data/lib/2018-11-01/generated/azure_mgmt_storage/models/access_tier.rb +16 -0
  15. data/lib/2018-11-01/generated/azure_mgmt_storage/models/account_sas_parameters.rb +136 -0
  16. data/lib/2018-11-01/generated/azure_mgmt_storage/models/account_status.rb +16 -0
  17. data/lib/2018-11-01/generated/azure_mgmt_storage/models/action.rb +15 -0
  18. data/lib/2018-11-01/generated/azure_mgmt_storage/models/azure_entity_resource.rb +75 -0
  19. data/lib/2018-11-01/generated/azure_mgmt_storage/models/blob_container.rb +217 -0
  20. data/lib/2018-11-01/generated/azure_mgmt_storage/models/blob_service_properties.rb +104 -0
  21. data/lib/2018-11-01/generated/azure_mgmt_storage/models/bypass.rb +18 -0
  22. data/lib/2018-11-01/generated/azure_mgmt_storage/models/check_name_availability_result.rb +77 -0
  23. data/lib/2018-11-01/generated/azure_mgmt_storage/models/cors_rule.rb +128 -0
  24. data/lib/2018-11-01/generated/azure_mgmt_storage/models/cors_rules.rb +57 -0
  25. data/lib/2018-11-01/generated/azure_mgmt_storage/models/custom_domain.rb +60 -0
  26. data/lib/2018-11-01/generated/azure_mgmt_storage/models/date_after_creation.rb +50 -0
  27. data/lib/2018-11-01/generated/azure_mgmt_storage/models/date_after_modification.rb +50 -0
  28. data/lib/2018-11-01/generated/azure_mgmt_storage/models/default_action.rb +16 -0
  29. data/lib/2018-11-01/generated/azure_mgmt_storage/models/delete_retention_policy.rb +64 -0
  30. data/lib/2018-11-01/generated/azure_mgmt_storage/models/dimension.rb +57 -0
  31. data/lib/2018-11-01/generated/azure_mgmt_storage/models/encryption.rb +74 -0
  32. data/lib/2018-11-01/generated/azure_mgmt_storage/models/encryption_service.rb +62 -0
  33. data/lib/2018-11-01/generated/azure_mgmt_storage/models/encryption_services.rb +89 -0
  34. data/lib/2018-11-01/generated/azure_mgmt_storage/models/endpoints.rb +108 -0
  35. data/lib/2018-11-01/generated/azure_mgmt_storage/models/geo_replication_stats.rb +85 -0
  36. data/lib/2018-11-01/generated/azure_mgmt_storage/models/geo_replication_status.rb +17 -0
  37. data/lib/2018-11-01/generated/azure_mgmt_storage/models/http_protocol.rb +16 -0
  38. data/lib/2018-11-01/generated/azure_mgmt_storage/models/identity.rb +72 -0
  39. data/lib/2018-11-01/generated/azure_mgmt_storage/models/immutability_policy.rb +98 -0
  40. data/lib/2018-11-01/generated/azure_mgmt_storage/models/immutability_policy_properties.rb +95 -0
  41. data/lib/2018-11-01/generated/azure_mgmt_storage/models/immutability_policy_state.rb +16 -0
  42. data/lib/2018-11-01/generated/azure_mgmt_storage/models/immutability_policy_update_type.rb +17 -0
  43. data/lib/2018-11-01/generated/azure_mgmt_storage/models/iprule.rb +61 -0
  44. data/lib/2018-11-01/generated/azure_mgmt_storage/models/key_permission.rb +16 -0
  45. data/lib/2018-11-01/generated/azure_mgmt_storage/models/key_source.rb +16 -0
  46. data/lib/2018-11-01/generated/azure_mgmt_storage/models/key_vault_properties.rb +68 -0
  47. data/lib/2018-11-01/generated/azure_mgmt_storage/models/kind.rb +19 -0
  48. data/lib/2018-11-01/generated/azure_mgmt_storage/models/lease_duration.rb +16 -0
  49. data/lib/2018-11-01/generated/azure_mgmt_storage/models/lease_state.rb +19 -0
  50. data/lib/2018-11-01/generated/azure_mgmt_storage/models/lease_status.rb +16 -0
  51. data/lib/2018-11-01/generated/azure_mgmt_storage/models/legal_hold.rb +71 -0
  52. data/lib/2018-11-01/generated/azure_mgmt_storage/models/legal_hold_properties.rb +72 -0
  53. data/lib/2018-11-01/generated/azure_mgmt_storage/models/list_account_sas_response.rb +47 -0
  54. data/lib/2018-11-01/generated/azure_mgmt_storage/models/list_container_item.rb +216 -0
  55. data/lib/2018-11-01/generated/azure_mgmt_storage/models/list_container_items.rb +55 -0
  56. data/lib/2018-11-01/generated/azure_mgmt_storage/models/list_service_sas_response.rb +47 -0
  57. data/lib/2018-11-01/generated/azure_mgmt_storage/models/management_policy.rb +89 -0
  58. data/lib/2018-11-01/generated/azure_mgmt_storage/models/management_policy_action.rb +62 -0
  59. data/lib/2018-11-01/generated/azure_mgmt_storage/models/management_policy_base_blob.rb +73 -0
  60. data/lib/2018-11-01/generated/azure_mgmt_storage/models/management_policy_definition.rb +60 -0
  61. data/lib/2018-11-01/generated/azure_mgmt_storage/models/management_policy_filter.rb +76 -0
  62. data/lib/2018-11-01/generated/azure_mgmt_storage/models/management_policy_rule.rb +87 -0
  63. data/lib/2018-11-01/generated/azure_mgmt_storage/models/management_policy_schema.rb +58 -0
  64. data/lib/2018-11-01/generated/azure_mgmt_storage/models/management_policy_snap_shot.rb +47 -0
  65. data/lib/2018-11-01/generated/azure_mgmt_storage/models/metric_specification.rb +145 -0
  66. data/lib/2018-11-01/generated/azure_mgmt_storage/models/network_rule_set.rb +106 -0
  67. data/lib/2018-11-01/generated/azure_mgmt_storage/models/operation.rb +83 -0
  68. data/lib/2018-11-01/generated/azure_mgmt_storage/models/operation_display.rb +79 -0
  69. data/lib/2018-11-01/generated/azure_mgmt_storage/models/operation_list_result.rb +57 -0
  70. data/lib/2018-11-01/generated/azure_mgmt_storage/models/permissions.rb +22 -0
  71. data/lib/2018-11-01/generated/azure_mgmt_storage/models/provisioning_state.rb +17 -0
  72. data/lib/2018-11-01/generated/azure_mgmt_storage/models/proxy_resource.rb +63 -0
  73. data/lib/2018-11-01/generated/azure_mgmt_storage/models/public_access.rb +17 -0
  74. data/lib/2018-11-01/generated/azure_mgmt_storage/models/reason.rb +16 -0
  75. data/lib/2018-11-01/generated/azure_mgmt_storage/models/reason_code.rb +16 -0
  76. data/lib/2018-11-01/generated/azure_mgmt_storage/models/resource.rb +83 -0
  77. data/lib/2018-11-01/generated/azure_mgmt_storage/models/restriction.rb +85 -0
  78. data/lib/2018-11-01/generated/azure_mgmt_storage/models/service_sas_parameters.rb +247 -0
  79. data/lib/2018-11-01/generated/azure_mgmt_storage/models/service_specification.rb +56 -0
  80. data/lib/2018-11-01/generated/azure_mgmt_storage/models/services.rb +18 -0
  81. data/lib/2018-11-01/generated/azure_mgmt_storage/models/signed_resource.rb +18 -0
  82. data/lib/2018-11-01/generated/azure_mgmt_storage/models/signed_resource_types.rb +17 -0
  83. data/lib/2018-11-01/generated/azure_mgmt_storage/models/sku.rb +159 -0
  84. data/lib/2018-11-01/generated/azure_mgmt_storage/models/sku_name.rb +20 -0
  85. data/lib/2018-11-01/generated/azure_mgmt_storage/models/sku_tier.rb +16 -0
  86. data/lib/2018-11-01/generated/azure_mgmt_storage/models/skucapability.rb +63 -0
  87. data/lib/2018-11-01/generated/azure_mgmt_storage/models/state.rb +19 -0
  88. data/lib/2018-11-01/generated/azure_mgmt_storage/models/storage_account.rb +375 -0
  89. data/lib/2018-11-01/generated/azure_mgmt_storage/models/storage_account_check_name_availability_parameters.rb +63 -0
  90. data/lib/2018-11-01/generated/azure_mgmt_storage/models/storage_account_create_parameters.rb +203 -0
  91. data/lib/2018-11-01/generated/azure_mgmt_storage/models/storage_account_expand.rb +15 -0
  92. data/lib/2018-11-01/generated/azure_mgmt_storage/models/storage_account_key.rb +73 -0
  93. data/lib/2018-11-01/generated/azure_mgmt_storage/models/storage_account_list_keys_result.rb +57 -0
  94. data/lib/2018-11-01/generated/azure_mgmt_storage/models/storage_account_list_result.rb +57 -0
  95. data/lib/2018-11-01/generated/azure_mgmt_storage/models/storage_account_regenerate_key_parameters.rb +47 -0
  96. data/lib/2018-11-01/generated/azure_mgmt_storage/models/storage_account_update_parameters.rb +179 -0
  97. data/lib/2018-11-01/generated/azure_mgmt_storage/models/storage_sku_list_result.rb +57 -0
  98. data/lib/2018-11-01/generated/azure_mgmt_storage/models/tag_property.rb +97 -0
  99. data/lib/2018-11-01/generated/azure_mgmt_storage/models/tracked_resource.rb +92 -0
  100. data/lib/2018-11-01/generated/azure_mgmt_storage/models/update_history_property.rb +114 -0
  101. data/lib/2018-11-01/generated/azure_mgmt_storage/models/usage.rb +89 -0
  102. data/lib/2018-11-01/generated/azure_mgmt_storage/models/usage_list_result.rb +56 -0
  103. data/lib/2018-11-01/generated/azure_mgmt_storage/models/usage_name.rb +59 -0
  104. data/lib/2018-11-01/generated/azure_mgmt_storage/models/usage_unit.rb +20 -0
  105. data/lib/2018-11-01/generated/azure_mgmt_storage/models/virtual_network_rule.rb +75 -0
  106. data/lib/2018-11-01/generated/azure_mgmt_storage/module_definition.rb +9 -0
  107. data/lib/2018-11-01/generated/azure_mgmt_storage/operations.rb +108 -0
  108. data/lib/2018-11-01/generated/azure_mgmt_storage/skus.rb +114 -0
  109. data/lib/2018-11-01/generated/azure_mgmt_storage/storage_accounts.rb +1505 -0
  110. data/lib/2018-11-01/generated/azure_mgmt_storage/storage_management_client.rb +155 -0
  111. data/lib/2018-11-01/generated/azure_mgmt_storage/usages.rb +118 -0
  112. data/lib/2018-11-01/generated/azure_mgmt_storage.rb +126 -0
  113. data/lib/azure_mgmt_storage.rb +1 -0
  114. data/lib/profiles/latest/modules/storage_profile_module.rb +250 -224
  115. data/lib/version.rb +1 -1
  116. metadata +104 -2
@@ -0,0 +1,1721 @@
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::V2018_11_01
7
+ #
8
+ # The Azure Storage Management API.
9
+ #
10
+ class BlobContainers
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the BlobContainers 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
+ # Lists all containers and does not support a prefix like data plane. Also SRP
26
+ # today does not return continuation token.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group within the
29
+ # user's subscription. The name is case insensitive.
30
+ # @param account_name [String] The name of the storage account within the
31
+ # specified resource group. Storage account names must be between 3 and 24
32
+ # characters in length and use numbers and lower-case letters only.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [ListContainerItems] operation results.
37
+ #
38
+ def list(resource_group_name, account_name, custom_headers:nil)
39
+ response = list_async(resource_group_name, account_name, custom_headers:custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
43
+ #
44
+ # Lists all containers and does not support a prefix like data plane. Also SRP
45
+ # today does not return continuation token.
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group within the
48
+ # user's subscription. The name is case insensitive.
49
+ # @param account_name [String] The name of the storage account within the
50
+ # specified resource group. Storage account names must be between 3 and 24
51
+ # characters in length and use numbers and lower-case letters only.
52
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
53
+ # will be added to the HTTP request.
54
+ #
55
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
56
+ #
57
+ def list_with_http_info(resource_group_name, account_name, custom_headers:nil)
58
+ list_async(resource_group_name, account_name, custom_headers:custom_headers).value!
59
+ end
60
+
61
+ #
62
+ # Lists all containers and does not support a prefix like data plane. Also SRP
63
+ # today does not return continuation token.
64
+ #
65
+ # @param resource_group_name [String] The name of the resource group within the
66
+ # user's subscription. The name is case insensitive.
67
+ # @param account_name [String] The name of the storage account within the
68
+ # specified resource group. Storage account names must be between 3 and 24
69
+ # characters in length and use numbers and lower-case letters only.
70
+ # @param [Hash{String => String}] A hash of custom headers that will be added
71
+ # to the HTTP request.
72
+ #
73
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
74
+ #
75
+ def list_async(resource_group_name, account_name, custom_headers:nil)
76
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
77
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
78
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
79
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
80
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
81
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
82
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
83
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
84
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
85
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
86
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
87
+
88
+
89
+ request_headers = {}
90
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
91
+
92
+ # Set Headers
93
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
94
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
95
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers'
96
+
97
+ request_url = @base_url || @client.base_url
98
+
99
+ options = {
100
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
101
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
102
+ query_params: {'api-version' => @client.api_version},
103
+ headers: request_headers.merge(custom_headers || {}),
104
+ base_url: request_url
105
+ }
106
+ promise = @client.make_request_async(:get, path_template, options)
107
+
108
+ promise = promise.then do |result|
109
+ http_response = result.response
110
+ status_code = http_response.status
111
+ response_content = http_response.body
112
+ unless status_code == 200
113
+ error_model = JSON.load(response_content)
114
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
115
+ end
116
+
117
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
118
+ # Deserialize Response
119
+ if status_code == 200
120
+ begin
121
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
122
+ result_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::ListContainerItems.mapper()
123
+ result.body = @client.deserialize(result_mapper, parsed_response)
124
+ rescue Exception => e
125
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
126
+ end
127
+ end
128
+
129
+ result
130
+ end
131
+
132
+ promise.execute
133
+ end
134
+
135
+ #
136
+ # Creates a new container under the specified account as described by request
137
+ # body. The container resource includes metadata and properties for that
138
+ # container. It does not include a list of the blobs contained by the
139
+ # container.
140
+ #
141
+ # @param resource_group_name [String] The name of the resource group within the
142
+ # user's subscription. The name is case insensitive.
143
+ # @param account_name [String] The name of the storage account within the
144
+ # specified resource group. Storage account names must be between 3 and 24
145
+ # characters in length and use numbers and lower-case letters only.
146
+ # @param container_name [String] The name of the blob container within the
147
+ # specified storage account. Blob container names must be between 3 and 63
148
+ # characters in length and use numbers, lower-case letters and dash (-) only.
149
+ # Every dash (-) character must be immediately preceded and followed by a
150
+ # letter or number.
151
+ # @param blob_container [BlobContainer] Properties of the blob container to
152
+ # create.
153
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
154
+ # will be added to the HTTP request.
155
+ #
156
+ # @return [BlobContainer] operation results.
157
+ #
158
+ def create(resource_group_name, account_name, container_name, blob_container, custom_headers:nil)
159
+ response = create_async(resource_group_name, account_name, container_name, blob_container, custom_headers:custom_headers).value!
160
+ response.body unless response.nil?
161
+ end
162
+
163
+ #
164
+ # Creates a new container under the specified account as described by request
165
+ # body. The container resource includes metadata and properties for that
166
+ # container. It does not include a list of the blobs contained by the
167
+ # container.
168
+ #
169
+ # @param resource_group_name [String] The name of the resource group within the
170
+ # user's subscription. The name is case insensitive.
171
+ # @param account_name [String] The name of the storage account within the
172
+ # specified resource group. Storage account names must be between 3 and 24
173
+ # characters in length and use numbers and lower-case letters only.
174
+ # @param container_name [String] The name of the blob container within the
175
+ # specified storage account. Blob container names must be between 3 and 63
176
+ # characters in length and use numbers, lower-case letters and dash (-) only.
177
+ # Every dash (-) character must be immediately preceded and followed by a
178
+ # letter or number.
179
+ # @param blob_container [BlobContainer] Properties of the blob container to
180
+ # create.
181
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
182
+ # will be added to the HTTP request.
183
+ #
184
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
185
+ #
186
+ def create_with_http_info(resource_group_name, account_name, container_name, blob_container, custom_headers:nil)
187
+ create_async(resource_group_name, account_name, container_name, blob_container, custom_headers:custom_headers).value!
188
+ end
189
+
190
+ #
191
+ # Creates a new container under the specified account as described by request
192
+ # body. The container resource includes metadata and properties for that
193
+ # container. It does not include a list of the blobs contained by the
194
+ # container.
195
+ #
196
+ # @param resource_group_name [String] The name of the resource group within the
197
+ # user's subscription. The name is case insensitive.
198
+ # @param account_name [String] The name of the storage account within the
199
+ # specified resource group. Storage account names must be between 3 and 24
200
+ # characters in length and use numbers and lower-case letters only.
201
+ # @param container_name [String] The name of the blob container within the
202
+ # specified storage account. Blob container names must be between 3 and 63
203
+ # characters in length and use numbers, lower-case letters and dash (-) only.
204
+ # Every dash (-) character must be immediately preceded and followed by a
205
+ # letter or number.
206
+ # @param blob_container [BlobContainer] Properties of the blob container to
207
+ # create.
208
+ # @param [Hash{String => String}] A hash of custom headers that will be added
209
+ # to the HTTP request.
210
+ #
211
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
212
+ #
213
+ def create_async(resource_group_name, account_name, container_name, blob_container, custom_headers:nil)
214
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
215
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
216
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
217
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
218
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
219
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
220
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
221
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
222
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
223
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
224
+ fail ArgumentError, 'blob_container is nil' if blob_container.nil?
225
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
226
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
227
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
228
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
229
+
230
+
231
+ request_headers = {}
232
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
233
+
234
+ # Set Headers
235
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
236
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
237
+
238
+ # Serialize Request
239
+ request_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::BlobContainer.mapper()
240
+ request_content = @client.serialize(request_mapper, blob_container)
241
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
242
+
243
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'
244
+
245
+ request_url = @base_url || @client.base_url
246
+
247
+ options = {
248
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
249
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'subscriptionId' => @client.subscription_id},
250
+ query_params: {'api-version' => @client.api_version},
251
+ body: request_content,
252
+ headers: request_headers.merge(custom_headers || {}),
253
+ base_url: request_url
254
+ }
255
+ promise = @client.make_request_async(:put, path_template, options)
256
+
257
+ promise = promise.then do |result|
258
+ http_response = result.response
259
+ status_code = http_response.status
260
+ response_content = http_response.body
261
+ unless status_code == 201
262
+ error_model = JSON.load(response_content)
263
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
264
+ end
265
+
266
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
267
+ # Deserialize Response
268
+ if status_code == 201
269
+ begin
270
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
271
+ result_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::BlobContainer.mapper()
272
+ result.body = @client.deserialize(result_mapper, parsed_response)
273
+ rescue Exception => e
274
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
275
+ end
276
+ end
277
+
278
+ result
279
+ end
280
+
281
+ promise.execute
282
+ end
283
+
284
+ #
285
+ # Updates container properties as specified in request body. Properties not
286
+ # mentioned in the request will be unchanged. Update fails if the specified
287
+ # container doesn't already exist.
288
+ #
289
+ # @param resource_group_name [String] The name of the resource group within the
290
+ # user's subscription. The name is case insensitive.
291
+ # @param account_name [String] The name of the storage account within the
292
+ # specified resource group. Storage account names must be between 3 and 24
293
+ # characters in length and use numbers and lower-case letters only.
294
+ # @param container_name [String] The name of the blob container within the
295
+ # specified storage account. Blob container names must be between 3 and 63
296
+ # characters in length and use numbers, lower-case letters and dash (-) only.
297
+ # Every dash (-) character must be immediately preceded and followed by a
298
+ # letter or number.
299
+ # @param blob_container [BlobContainer] Properties to update for the blob
300
+ # container.
301
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
302
+ # will be added to the HTTP request.
303
+ #
304
+ # @return [BlobContainer] operation results.
305
+ #
306
+ def update(resource_group_name, account_name, container_name, blob_container, custom_headers:nil)
307
+ response = update_async(resource_group_name, account_name, container_name, blob_container, custom_headers:custom_headers).value!
308
+ response.body unless response.nil?
309
+ end
310
+
311
+ #
312
+ # Updates container properties as specified in request body. Properties not
313
+ # mentioned in the request will be unchanged. Update fails if the specified
314
+ # container doesn't already exist.
315
+ #
316
+ # @param resource_group_name [String] The name of the resource group within the
317
+ # user's subscription. The name is case insensitive.
318
+ # @param account_name [String] The name of the storage account within the
319
+ # specified resource group. Storage account names must be between 3 and 24
320
+ # characters in length and use numbers and lower-case letters only.
321
+ # @param container_name [String] The name of the blob container within the
322
+ # specified storage account. Blob container names must be between 3 and 63
323
+ # characters in length and use numbers, lower-case letters and dash (-) only.
324
+ # Every dash (-) character must be immediately preceded and followed by a
325
+ # letter or number.
326
+ # @param blob_container [BlobContainer] Properties to update for the blob
327
+ # container.
328
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
329
+ # will be added to the HTTP request.
330
+ #
331
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
332
+ #
333
+ def update_with_http_info(resource_group_name, account_name, container_name, blob_container, custom_headers:nil)
334
+ update_async(resource_group_name, account_name, container_name, blob_container, custom_headers:custom_headers).value!
335
+ end
336
+
337
+ #
338
+ # Updates container properties as specified in request body. Properties not
339
+ # mentioned in the request will be unchanged. Update fails if the specified
340
+ # container doesn't already exist.
341
+ #
342
+ # @param resource_group_name [String] The name of the resource group within the
343
+ # user's subscription. The name is case insensitive.
344
+ # @param account_name [String] The name of the storage account within the
345
+ # specified resource group. Storage account names must be between 3 and 24
346
+ # characters in length and use numbers and lower-case letters only.
347
+ # @param container_name [String] The name of the blob container within the
348
+ # specified storage account. Blob container names must be between 3 and 63
349
+ # characters in length and use numbers, lower-case letters and dash (-) only.
350
+ # Every dash (-) character must be immediately preceded and followed by a
351
+ # letter or number.
352
+ # @param blob_container [BlobContainer] Properties to update for the blob
353
+ # container.
354
+ # @param [Hash{String => String}] A hash of custom headers that will be added
355
+ # to the HTTP request.
356
+ #
357
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
358
+ #
359
+ def update_async(resource_group_name, account_name, container_name, blob_container, custom_headers:nil)
360
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
361
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
362
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
363
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
364
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
365
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
366
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
367
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
368
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
369
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
370
+ fail ArgumentError, 'blob_container is nil' if blob_container.nil?
371
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
372
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
373
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
374
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
375
+
376
+
377
+ request_headers = {}
378
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
379
+
380
+ # Set Headers
381
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
382
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
383
+
384
+ # Serialize Request
385
+ request_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::BlobContainer.mapper()
386
+ request_content = @client.serialize(request_mapper, blob_container)
387
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
388
+
389
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'
390
+
391
+ request_url = @base_url || @client.base_url
392
+
393
+ options = {
394
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
395
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'subscriptionId' => @client.subscription_id},
396
+ query_params: {'api-version' => @client.api_version},
397
+ body: request_content,
398
+ headers: request_headers.merge(custom_headers || {}),
399
+ base_url: request_url
400
+ }
401
+ promise = @client.make_request_async(:patch, path_template, options)
402
+
403
+ promise = promise.then do |result|
404
+ http_response = result.response
405
+ status_code = http_response.status
406
+ response_content = http_response.body
407
+ unless status_code == 200
408
+ error_model = JSON.load(response_content)
409
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
410
+ end
411
+
412
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
413
+ # Deserialize Response
414
+ if status_code == 200
415
+ begin
416
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
417
+ result_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::BlobContainer.mapper()
418
+ result.body = @client.deserialize(result_mapper, parsed_response)
419
+ rescue Exception => e
420
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
421
+ end
422
+ end
423
+
424
+ result
425
+ end
426
+
427
+ promise.execute
428
+ end
429
+
430
+ #
431
+ # Gets properties of a specified container.
432
+ #
433
+ # @param resource_group_name [String] The name of the resource group within the
434
+ # user's subscription. The name is case insensitive.
435
+ # @param account_name [String] The name of the storage account within the
436
+ # specified resource group. Storage account names must be between 3 and 24
437
+ # characters in length and use numbers and lower-case letters only.
438
+ # @param container_name [String] The name of the blob container within the
439
+ # specified storage account. Blob container names must be between 3 and 63
440
+ # characters in length and use numbers, lower-case letters and dash (-) only.
441
+ # Every dash (-) character must be immediately preceded and followed by a
442
+ # letter or number.
443
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
444
+ # will be added to the HTTP request.
445
+ #
446
+ # @return [BlobContainer] operation results.
447
+ #
448
+ def get(resource_group_name, account_name, container_name, custom_headers:nil)
449
+ response = get_async(resource_group_name, account_name, container_name, custom_headers:custom_headers).value!
450
+ response.body unless response.nil?
451
+ end
452
+
453
+ #
454
+ # Gets properties of a specified container.
455
+ #
456
+ # @param resource_group_name [String] The name of the resource group within the
457
+ # user's subscription. The name is case insensitive.
458
+ # @param account_name [String] The name of the storage account within the
459
+ # specified resource group. Storage account names must be between 3 and 24
460
+ # characters in length and use numbers and lower-case letters only.
461
+ # @param container_name [String] The name of the blob container within the
462
+ # specified storage account. Blob container names must be between 3 and 63
463
+ # characters in length and use numbers, lower-case letters and dash (-) only.
464
+ # Every dash (-) character must be immediately preceded and followed by a
465
+ # letter or number.
466
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
467
+ # will be added to the HTTP request.
468
+ #
469
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
470
+ #
471
+ def get_with_http_info(resource_group_name, account_name, container_name, custom_headers:nil)
472
+ get_async(resource_group_name, account_name, container_name, custom_headers:custom_headers).value!
473
+ end
474
+
475
+ #
476
+ # Gets properties of a specified container.
477
+ #
478
+ # @param resource_group_name [String] The name of the resource group within the
479
+ # user's subscription. The name is case insensitive.
480
+ # @param account_name [String] The name of the storage account within the
481
+ # specified resource group. Storage account names must be between 3 and 24
482
+ # characters in length and use numbers and lower-case letters only.
483
+ # @param container_name [String] The name of the blob container within the
484
+ # specified storage account. Blob container names must be between 3 and 63
485
+ # characters in length and use numbers, lower-case letters and dash (-) only.
486
+ # Every dash (-) character must be immediately preceded and followed by a
487
+ # letter or number.
488
+ # @param [Hash{String => String}] A hash of custom headers that will be added
489
+ # to the HTTP request.
490
+ #
491
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
492
+ #
493
+ def get_async(resource_group_name, account_name, container_name, custom_headers:nil)
494
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
495
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
496
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
497
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
498
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
499
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
500
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
501
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
502
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
503
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
504
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
505
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
506
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
507
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
508
+
509
+
510
+ request_headers = {}
511
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
512
+
513
+ # Set Headers
514
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
515
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
516
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'
517
+
518
+ request_url = @base_url || @client.base_url
519
+
520
+ options = {
521
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
522
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'subscriptionId' => @client.subscription_id},
523
+ query_params: {'api-version' => @client.api_version},
524
+ headers: request_headers.merge(custom_headers || {}),
525
+ base_url: request_url
526
+ }
527
+ promise = @client.make_request_async(:get, path_template, options)
528
+
529
+ promise = promise.then do |result|
530
+ http_response = result.response
531
+ status_code = http_response.status
532
+ response_content = http_response.body
533
+ unless status_code == 200
534
+ error_model = JSON.load(response_content)
535
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
536
+ end
537
+
538
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
539
+ # Deserialize Response
540
+ if status_code == 200
541
+ begin
542
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
543
+ result_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::BlobContainer.mapper()
544
+ result.body = @client.deserialize(result_mapper, parsed_response)
545
+ rescue Exception => e
546
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
547
+ end
548
+ end
549
+
550
+ result
551
+ end
552
+
553
+ promise.execute
554
+ end
555
+
556
+ #
557
+ # Deletes specified container under its account.
558
+ #
559
+ # @param resource_group_name [String] The name of the resource group within the
560
+ # user's subscription. The name is case insensitive.
561
+ # @param account_name [String] The name of the storage account within the
562
+ # specified resource group. Storage account names must be between 3 and 24
563
+ # characters in length and use numbers and lower-case letters only.
564
+ # @param container_name [String] The name of the blob container within the
565
+ # specified storage account. Blob container names must be between 3 and 63
566
+ # characters in length and use numbers, lower-case letters and dash (-) only.
567
+ # Every dash (-) character must be immediately preceded and followed by a
568
+ # letter or number.
569
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
570
+ # will be added to the HTTP request.
571
+ #
572
+ #
573
+ def delete(resource_group_name, account_name, container_name, custom_headers:nil)
574
+ response = delete_async(resource_group_name, account_name, container_name, custom_headers:custom_headers).value!
575
+ nil
576
+ end
577
+
578
+ #
579
+ # Deletes specified container under its account.
580
+ #
581
+ # @param resource_group_name [String] The name of the resource group within the
582
+ # user's subscription. The name is case insensitive.
583
+ # @param account_name [String] The name of the storage account within the
584
+ # specified resource group. Storage account names must be between 3 and 24
585
+ # characters in length and use numbers and lower-case letters only.
586
+ # @param container_name [String] The name of the blob container within the
587
+ # specified storage account. Blob container names must be between 3 and 63
588
+ # characters in length and use numbers, lower-case letters and dash (-) only.
589
+ # Every dash (-) character must be immediately preceded and followed by a
590
+ # letter or number.
591
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
592
+ # will be added to the HTTP request.
593
+ #
594
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
595
+ #
596
+ def delete_with_http_info(resource_group_name, account_name, container_name, custom_headers:nil)
597
+ delete_async(resource_group_name, account_name, container_name, custom_headers:custom_headers).value!
598
+ end
599
+
600
+ #
601
+ # Deletes specified container under its account.
602
+ #
603
+ # @param resource_group_name [String] The name of the resource group within the
604
+ # user's subscription. The name is case insensitive.
605
+ # @param account_name [String] The name of the storage account within the
606
+ # specified resource group. Storage account names must be between 3 and 24
607
+ # characters in length and use numbers and lower-case letters only.
608
+ # @param container_name [String] The name of the blob container within the
609
+ # specified storage account. Blob container names must be between 3 and 63
610
+ # characters in length and use numbers, lower-case letters and dash (-) only.
611
+ # Every dash (-) character must be immediately preceded and followed by a
612
+ # letter or number.
613
+ # @param [Hash{String => String}] A hash of custom headers that will be added
614
+ # to the HTTP request.
615
+ #
616
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
617
+ #
618
+ def delete_async(resource_group_name, account_name, container_name, custom_headers:nil)
619
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
620
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
621
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
622
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
623
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
624
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
625
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
626
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
627
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
628
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
629
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
630
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
631
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
632
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
633
+
634
+
635
+ request_headers = {}
636
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
637
+
638
+ # Set Headers
639
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
640
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
641
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'
642
+
643
+ request_url = @base_url || @client.base_url
644
+
645
+ options = {
646
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
647
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'subscriptionId' => @client.subscription_id},
648
+ query_params: {'api-version' => @client.api_version},
649
+ headers: request_headers.merge(custom_headers || {}),
650
+ base_url: request_url
651
+ }
652
+ promise = @client.make_request_async(:delete, path_template, options)
653
+
654
+ promise = promise.then do |result|
655
+ http_response = result.response
656
+ status_code = http_response.status
657
+ response_content = http_response.body
658
+ unless status_code == 200 || status_code == 204
659
+ error_model = JSON.load(response_content)
660
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
661
+ end
662
+
663
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
664
+
665
+ result
666
+ end
667
+
668
+ promise.execute
669
+ end
670
+
671
+ #
672
+ # Sets legal hold tags. Setting the same tag results in an idempotent
673
+ # operation. SetLegalHold follows an append pattern and does not clear out the
674
+ # existing tags that are not specified in the request.
675
+ #
676
+ # @param resource_group_name [String] The name of the resource group within the
677
+ # user's subscription. The name is case insensitive.
678
+ # @param account_name [String] The name of the storage account within the
679
+ # specified resource group. Storage account names must be between 3 and 24
680
+ # characters in length and use numbers and lower-case letters only.
681
+ # @param container_name [String] The name of the blob container within the
682
+ # specified storage account. Blob container names must be between 3 and 63
683
+ # characters in length and use numbers, lower-case letters and dash (-) only.
684
+ # Every dash (-) character must be immediately preceded and followed by a
685
+ # letter or number.
686
+ # @param legal_hold [LegalHold] The LegalHold property that will be set to a
687
+ # blob container.
688
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
689
+ # will be added to the HTTP request.
690
+ #
691
+ # @return [LegalHold] operation results.
692
+ #
693
+ def set_legal_hold(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
694
+ response = set_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:custom_headers).value!
695
+ response.body unless response.nil?
696
+ end
697
+
698
+ #
699
+ # Sets legal hold tags. Setting the same tag results in an idempotent
700
+ # operation. SetLegalHold follows an append pattern and does not clear out the
701
+ # existing tags that are not specified in the request.
702
+ #
703
+ # @param resource_group_name [String] The name of the resource group within the
704
+ # user's subscription. The name is case insensitive.
705
+ # @param account_name [String] The name of the storage account within the
706
+ # specified resource group. Storage account names must be between 3 and 24
707
+ # characters in length and use numbers and lower-case letters only.
708
+ # @param container_name [String] The name of the blob container within the
709
+ # specified storage account. Blob container names must be between 3 and 63
710
+ # characters in length and use numbers, lower-case letters and dash (-) only.
711
+ # Every dash (-) character must be immediately preceded and followed by a
712
+ # letter or number.
713
+ # @param legal_hold [LegalHold] The LegalHold property that will be set to a
714
+ # blob container.
715
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
716
+ # will be added to the HTTP request.
717
+ #
718
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
719
+ #
720
+ def set_legal_hold_with_http_info(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
721
+ set_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:custom_headers).value!
722
+ end
723
+
724
+ #
725
+ # Sets legal hold tags. Setting the same tag results in an idempotent
726
+ # operation. SetLegalHold follows an append pattern and does not clear out the
727
+ # existing tags that are not specified in the request.
728
+ #
729
+ # @param resource_group_name [String] The name of the resource group within the
730
+ # user's subscription. The name is case insensitive.
731
+ # @param account_name [String] The name of the storage account within the
732
+ # specified resource group. Storage account names must be between 3 and 24
733
+ # characters in length and use numbers and lower-case letters only.
734
+ # @param container_name [String] The name of the blob container within the
735
+ # specified storage account. Blob container names must be between 3 and 63
736
+ # characters in length and use numbers, lower-case letters and dash (-) only.
737
+ # Every dash (-) character must be immediately preceded and followed by a
738
+ # letter or number.
739
+ # @param legal_hold [LegalHold] The LegalHold property that will be set to a
740
+ # blob container.
741
+ # @param [Hash{String => String}] A hash of custom headers that will be added
742
+ # to the HTTP request.
743
+ #
744
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
745
+ #
746
+ def set_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
747
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
748
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
749
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
750
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
751
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
752
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
753
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
754
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
755
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
756
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
757
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
758
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
759
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
760
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
761
+ fail ArgumentError, 'legal_hold is nil' if legal_hold.nil?
762
+
763
+
764
+ request_headers = {}
765
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
766
+
767
+ # Set Headers
768
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
769
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
770
+
771
+ # Serialize Request
772
+ request_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::LegalHold.mapper()
773
+ request_content = @client.serialize(request_mapper, legal_hold)
774
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
775
+
776
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'
777
+
778
+ request_url = @base_url || @client.base_url
779
+
780
+ options = {
781
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
782
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'subscriptionId' => @client.subscription_id},
783
+ query_params: {'api-version' => @client.api_version},
784
+ body: request_content,
785
+ headers: request_headers.merge(custom_headers || {}),
786
+ base_url: request_url
787
+ }
788
+ promise = @client.make_request_async(:post, path_template, options)
789
+
790
+ promise = promise.then do |result|
791
+ http_response = result.response
792
+ status_code = http_response.status
793
+ response_content = http_response.body
794
+ unless status_code == 200
795
+ error_model = JSON.load(response_content)
796
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
797
+ end
798
+
799
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
800
+ # Deserialize Response
801
+ if status_code == 200
802
+ begin
803
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
804
+ result_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::LegalHold.mapper()
805
+ result.body = @client.deserialize(result_mapper, parsed_response)
806
+ rescue Exception => e
807
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
808
+ end
809
+ end
810
+
811
+ result
812
+ end
813
+
814
+ promise.execute
815
+ end
816
+
817
+ #
818
+ # Clears legal hold tags. Clearing the same or non-existent tag results in an
819
+ # idempotent operation. ClearLegalHold clears out only the specified tags in
820
+ # the request.
821
+ #
822
+ # @param resource_group_name [String] The name of the resource group within the
823
+ # user's subscription. The name is case insensitive.
824
+ # @param account_name [String] The name of the storage account within the
825
+ # specified resource group. Storage account names must be between 3 and 24
826
+ # characters in length and use numbers and lower-case letters only.
827
+ # @param container_name [String] The name of the blob container within the
828
+ # specified storage account. Blob container names must be between 3 and 63
829
+ # characters in length and use numbers, lower-case letters and dash (-) only.
830
+ # Every dash (-) character must be immediately preceded and followed by a
831
+ # letter or number.
832
+ # @param legal_hold [LegalHold] The LegalHold property that will be clear from
833
+ # a blob container.
834
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
835
+ # will be added to the HTTP request.
836
+ #
837
+ # @return [LegalHold] operation results.
838
+ #
839
+ def clear_legal_hold(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
840
+ response = clear_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:custom_headers).value!
841
+ response.body unless response.nil?
842
+ end
843
+
844
+ #
845
+ # Clears legal hold tags. Clearing the same or non-existent tag results in an
846
+ # idempotent operation. ClearLegalHold clears out only the specified tags in
847
+ # the request.
848
+ #
849
+ # @param resource_group_name [String] The name of the resource group within the
850
+ # user's subscription. The name is case insensitive.
851
+ # @param account_name [String] The name of the storage account within the
852
+ # specified resource group. Storage account names must be between 3 and 24
853
+ # characters in length and use numbers and lower-case letters only.
854
+ # @param container_name [String] The name of the blob container within the
855
+ # specified storage account. Blob container names must be between 3 and 63
856
+ # characters in length and use numbers, lower-case letters and dash (-) only.
857
+ # Every dash (-) character must be immediately preceded and followed by a
858
+ # letter or number.
859
+ # @param legal_hold [LegalHold] The LegalHold property that will be clear from
860
+ # a blob container.
861
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
862
+ # will be added to the HTTP request.
863
+ #
864
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
865
+ #
866
+ def clear_legal_hold_with_http_info(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
867
+ clear_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:custom_headers).value!
868
+ end
869
+
870
+ #
871
+ # Clears legal hold tags. Clearing the same or non-existent tag results in an
872
+ # idempotent operation. ClearLegalHold clears out only the specified tags in
873
+ # the request.
874
+ #
875
+ # @param resource_group_name [String] The name of the resource group within the
876
+ # user's subscription. The name is case insensitive.
877
+ # @param account_name [String] The name of the storage account within the
878
+ # specified resource group. Storage account names must be between 3 and 24
879
+ # characters in length and use numbers and lower-case letters only.
880
+ # @param container_name [String] The name of the blob container within the
881
+ # specified storage account. Blob container names must be between 3 and 63
882
+ # characters in length and use numbers, lower-case letters and dash (-) only.
883
+ # Every dash (-) character must be immediately preceded and followed by a
884
+ # letter or number.
885
+ # @param legal_hold [LegalHold] The LegalHold property that will be clear from
886
+ # a blob container.
887
+ # @param [Hash{String => String}] A hash of custom headers that will be added
888
+ # to the HTTP request.
889
+ #
890
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
891
+ #
892
+ def clear_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
893
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
894
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
895
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
896
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
897
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
898
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
899
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
900
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
901
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
902
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
903
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
904
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
905
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
906
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
907
+ fail ArgumentError, 'legal_hold is nil' if legal_hold.nil?
908
+
909
+
910
+ request_headers = {}
911
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
912
+
913
+ # Set Headers
914
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
915
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
916
+
917
+ # Serialize Request
918
+ request_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::LegalHold.mapper()
919
+ request_content = @client.serialize(request_mapper, legal_hold)
920
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
921
+
922
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'
923
+
924
+ request_url = @base_url || @client.base_url
925
+
926
+ options = {
927
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
928
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'subscriptionId' => @client.subscription_id},
929
+ query_params: {'api-version' => @client.api_version},
930
+ body: request_content,
931
+ headers: request_headers.merge(custom_headers || {}),
932
+ base_url: request_url
933
+ }
934
+ promise = @client.make_request_async(:post, path_template, options)
935
+
936
+ promise = promise.then do |result|
937
+ http_response = result.response
938
+ status_code = http_response.status
939
+ response_content = http_response.body
940
+ unless status_code == 200
941
+ error_model = JSON.load(response_content)
942
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
943
+ end
944
+
945
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
946
+ # Deserialize Response
947
+ if status_code == 200
948
+ begin
949
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
950
+ result_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::LegalHold.mapper()
951
+ result.body = @client.deserialize(result_mapper, parsed_response)
952
+ rescue Exception => e
953
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
954
+ end
955
+ end
956
+
957
+ result
958
+ end
959
+
960
+ promise.execute
961
+ end
962
+
963
+ #
964
+ # Creates or updates an unlocked immutability policy. ETag in If-Match is
965
+ # honored if given but not required for this operation.
966
+ #
967
+ # @param resource_group_name [String] The name of the resource group within the
968
+ # user's subscription. The name is case insensitive.
969
+ # @param account_name [String] The name of the storage account within the
970
+ # specified resource group. Storage account names must be between 3 and 24
971
+ # characters in length and use numbers and lower-case letters only.
972
+ # @param container_name [String] The name of the blob container within the
973
+ # specified storage account. Blob container names must be between 3 and 63
974
+ # characters in length and use numbers, lower-case letters and dash (-) only.
975
+ # Every dash (-) character must be immediately preceded and followed by a
976
+ # letter or number.
977
+ # @param parameters [ImmutabilityPolicy] The ImmutabilityPolicy Properties that
978
+ # will be created or updated to a blob container.
979
+ # @param if_match [String] The entity state (ETag) version of the immutability
980
+ # policy to update. A value of "*" can be used to apply the operation only if
981
+ # the immutability policy already exists. If omitted, this operation will
982
+ # always be applied.
983
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
984
+ # will be added to the HTTP request.
985
+ #
986
+ # @return [ImmutabilityPolicy] operation results.
987
+ #
988
+ def create_or_update_immutability_policy(resource_group_name, account_name, container_name, parameters:nil, if_match:nil, custom_headers:nil)
989
+ response = create_or_update_immutability_policy_async(resource_group_name, account_name, container_name, parameters:parameters, if_match:if_match, custom_headers:custom_headers).value!
990
+ response.body unless response.nil?
991
+ end
992
+
993
+ #
994
+ # Creates or updates an unlocked immutability policy. ETag in If-Match is
995
+ # honored if given but not required for this operation.
996
+ #
997
+ # @param resource_group_name [String] The name of the resource group within the
998
+ # user's subscription. The name is case insensitive.
999
+ # @param account_name [String] The name of the storage account within the
1000
+ # specified resource group. Storage account names must be between 3 and 24
1001
+ # characters in length and use numbers and lower-case letters only.
1002
+ # @param container_name [String] The name of the blob container within the
1003
+ # specified storage account. Blob container names must be between 3 and 63
1004
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1005
+ # Every dash (-) character must be immediately preceded and followed by a
1006
+ # letter or number.
1007
+ # @param parameters [ImmutabilityPolicy] The ImmutabilityPolicy Properties that
1008
+ # will be created or updated to a blob container.
1009
+ # @param if_match [String] The entity state (ETag) version of the immutability
1010
+ # policy to update. A value of "*" can be used to apply the operation only if
1011
+ # the immutability policy already exists. If omitted, this operation will
1012
+ # always be applied.
1013
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1014
+ # will be added to the HTTP request.
1015
+ #
1016
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1017
+ #
1018
+ def create_or_update_immutability_policy_with_http_info(resource_group_name, account_name, container_name, parameters:nil, if_match:nil, custom_headers:nil)
1019
+ create_or_update_immutability_policy_async(resource_group_name, account_name, container_name, parameters:parameters, if_match:if_match, custom_headers:custom_headers).value!
1020
+ end
1021
+
1022
+ #
1023
+ # Creates or updates an unlocked immutability policy. ETag in If-Match is
1024
+ # honored if given but not required for this operation.
1025
+ #
1026
+ # @param resource_group_name [String] The name of the resource group within the
1027
+ # user's subscription. The name is case insensitive.
1028
+ # @param account_name [String] The name of the storage account within the
1029
+ # specified resource group. Storage account names must be between 3 and 24
1030
+ # characters in length and use numbers and lower-case letters only.
1031
+ # @param container_name [String] The name of the blob container within the
1032
+ # specified storage account. Blob container names must be between 3 and 63
1033
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1034
+ # Every dash (-) character must be immediately preceded and followed by a
1035
+ # letter or number.
1036
+ # @param parameters [ImmutabilityPolicy] The ImmutabilityPolicy Properties that
1037
+ # will be created or updated to a blob container.
1038
+ # @param if_match [String] The entity state (ETag) version of the immutability
1039
+ # policy to update. A value of "*" can be used to apply the operation only if
1040
+ # the immutability policy already exists. If omitted, this operation will
1041
+ # always be applied.
1042
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1043
+ # to the HTTP request.
1044
+ #
1045
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1046
+ #
1047
+ def create_or_update_immutability_policy_async(resource_group_name, account_name, container_name, parameters:nil, if_match:nil, custom_headers:nil)
1048
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1049
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1050
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1051
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1052
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1053
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1054
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1055
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1056
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
1057
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
1058
+ immutability_policy_name = 'default'
1059
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1060
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1061
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1062
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1063
+
1064
+
1065
+ request_headers = {}
1066
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1067
+
1068
+ # Set Headers
1069
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1070
+ request_headers['If-Match'] = if_match unless if_match.nil?
1071
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1072
+
1073
+ # Serialize Request
1074
+ request_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::ImmutabilityPolicy.mapper()
1075
+ request_content = @client.serialize(request_mapper, parameters)
1076
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1077
+
1078
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'
1079
+
1080
+ request_url = @base_url || @client.base_url
1081
+
1082
+ options = {
1083
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1084
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'immutabilityPolicyName' => immutability_policy_name,'subscriptionId' => @client.subscription_id},
1085
+ query_params: {'api-version' => @client.api_version},
1086
+ body: request_content,
1087
+ headers: request_headers.merge(custom_headers || {}),
1088
+ base_url: request_url
1089
+ }
1090
+ promise = @client.make_request_async(:put, path_template, options)
1091
+
1092
+ promise = promise.then do |result|
1093
+ http_response = result.response
1094
+ status_code = http_response.status
1095
+ response_content = http_response.body
1096
+ unless status_code == 200
1097
+ error_model = JSON.load(response_content)
1098
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1099
+ end
1100
+
1101
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1102
+ # Deserialize Response
1103
+ if status_code == 200
1104
+ begin
1105
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1106
+ result_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::ImmutabilityPolicy.mapper()
1107
+ result.body = @client.deserialize(result_mapper, parsed_response)
1108
+ rescue Exception => e
1109
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1110
+ end
1111
+ end
1112
+
1113
+ result
1114
+ end
1115
+
1116
+ promise.execute
1117
+ end
1118
+
1119
+ #
1120
+ # Gets the existing immutability policy along with the corresponding ETag in
1121
+ # response headers and body.
1122
+ #
1123
+ # @param resource_group_name [String] The name of the resource group within the
1124
+ # user's subscription. The name is case insensitive.
1125
+ # @param account_name [String] The name of the storage account within the
1126
+ # specified resource group. Storage account names must be between 3 and 24
1127
+ # characters in length and use numbers and lower-case letters only.
1128
+ # @param container_name [String] The name of the blob container within the
1129
+ # specified storage account. Blob container names must be between 3 and 63
1130
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1131
+ # Every dash (-) character must be immediately preceded and followed by a
1132
+ # letter or number.
1133
+ # @param if_match [String] The entity state (ETag) version of the immutability
1134
+ # policy to update. A value of "*" can be used to apply the operation only if
1135
+ # the immutability policy already exists. If omitted, this operation will
1136
+ # always be applied.
1137
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1138
+ # will be added to the HTTP request.
1139
+ #
1140
+ # @return [ImmutabilityPolicy] operation results.
1141
+ #
1142
+ def get_immutability_policy(resource_group_name, account_name, container_name, if_match:nil, custom_headers:nil)
1143
+ response = get_immutability_policy_async(resource_group_name, account_name, container_name, if_match:if_match, custom_headers:custom_headers).value!
1144
+ response.body unless response.nil?
1145
+ end
1146
+
1147
+ #
1148
+ # Gets the existing immutability policy along with the corresponding ETag in
1149
+ # response headers and body.
1150
+ #
1151
+ # @param resource_group_name [String] The name of the resource group within the
1152
+ # user's subscription. The name is case insensitive.
1153
+ # @param account_name [String] The name of the storage account within the
1154
+ # specified resource group. Storage account names must be between 3 and 24
1155
+ # characters in length and use numbers and lower-case letters only.
1156
+ # @param container_name [String] The name of the blob container within the
1157
+ # specified storage account. Blob container names must be between 3 and 63
1158
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1159
+ # Every dash (-) character must be immediately preceded and followed by a
1160
+ # letter or number.
1161
+ # @param if_match [String] The entity state (ETag) version of the immutability
1162
+ # policy to update. A value of "*" can be used to apply the operation only if
1163
+ # the immutability policy already exists. If omitted, this operation will
1164
+ # always be applied.
1165
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1166
+ # will be added to the HTTP request.
1167
+ #
1168
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1169
+ #
1170
+ def get_immutability_policy_with_http_info(resource_group_name, account_name, container_name, if_match:nil, custom_headers:nil)
1171
+ get_immutability_policy_async(resource_group_name, account_name, container_name, if_match:if_match, custom_headers:custom_headers).value!
1172
+ end
1173
+
1174
+ #
1175
+ # Gets the existing immutability policy along with the corresponding ETag in
1176
+ # response headers and body.
1177
+ #
1178
+ # @param resource_group_name [String] The name of the resource group within the
1179
+ # user's subscription. The name is case insensitive.
1180
+ # @param account_name [String] The name of the storage account within the
1181
+ # specified resource group. Storage account names must be between 3 and 24
1182
+ # characters in length and use numbers and lower-case letters only.
1183
+ # @param container_name [String] The name of the blob container within the
1184
+ # specified storage account. Blob container names must be between 3 and 63
1185
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1186
+ # Every dash (-) character must be immediately preceded and followed by a
1187
+ # letter or number.
1188
+ # @param if_match [String] The entity state (ETag) version of the immutability
1189
+ # policy to update. A value of "*" can be used to apply the operation only if
1190
+ # the immutability policy already exists. If omitted, this operation will
1191
+ # always be applied.
1192
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1193
+ # to the HTTP request.
1194
+ #
1195
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1196
+ #
1197
+ def get_immutability_policy_async(resource_group_name, account_name, container_name, if_match:nil, custom_headers:nil)
1198
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1199
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1200
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1201
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1202
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1203
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1204
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1205
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1206
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
1207
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
1208
+ immutability_policy_name = 'default'
1209
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1210
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1211
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1212
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1213
+
1214
+
1215
+ request_headers = {}
1216
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1217
+
1218
+ # Set Headers
1219
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1220
+ request_headers['If-Match'] = if_match unless if_match.nil?
1221
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1222
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'
1223
+
1224
+ request_url = @base_url || @client.base_url
1225
+
1226
+ options = {
1227
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1228
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'immutabilityPolicyName' => immutability_policy_name,'subscriptionId' => @client.subscription_id},
1229
+ query_params: {'api-version' => @client.api_version},
1230
+ headers: request_headers.merge(custom_headers || {}),
1231
+ base_url: request_url
1232
+ }
1233
+ promise = @client.make_request_async(:get, path_template, options)
1234
+
1235
+ promise = promise.then do |result|
1236
+ http_response = result.response
1237
+ status_code = http_response.status
1238
+ response_content = http_response.body
1239
+ unless status_code == 200
1240
+ error_model = JSON.load(response_content)
1241
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1242
+ end
1243
+
1244
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1245
+ # Deserialize Response
1246
+ if status_code == 200
1247
+ begin
1248
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1249
+ result_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::ImmutabilityPolicy.mapper()
1250
+ result.body = @client.deserialize(result_mapper, parsed_response)
1251
+ rescue Exception => e
1252
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1253
+ end
1254
+ end
1255
+
1256
+ result
1257
+ end
1258
+
1259
+ promise.execute
1260
+ end
1261
+
1262
+ #
1263
+ # Aborts an unlocked immutability policy. The response of delete has
1264
+ # immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required
1265
+ # for this operation. Deleting a locked immutability policy is not allowed,
1266
+ # only way is to delete the container after deleting all blobs inside the
1267
+ # container.
1268
+ #
1269
+ # @param resource_group_name [String] The name of the resource group within the
1270
+ # user's subscription. The name is case insensitive.
1271
+ # @param account_name [String] The name of the storage account within the
1272
+ # specified resource group. Storage account names must be between 3 and 24
1273
+ # characters in length and use numbers and lower-case letters only.
1274
+ # @param container_name [String] The name of the blob container within the
1275
+ # specified storage account. Blob container names must be between 3 and 63
1276
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1277
+ # Every dash (-) character must be immediately preceded and followed by a
1278
+ # letter or number.
1279
+ # @param if_match [String] The entity state (ETag) version of the immutability
1280
+ # policy to update. A value of "*" can be used to apply the operation only if
1281
+ # the immutability policy already exists. If omitted, this operation will
1282
+ # always be applied.
1283
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1284
+ # will be added to the HTTP request.
1285
+ #
1286
+ # @return [ImmutabilityPolicy] operation results.
1287
+ #
1288
+ def delete_immutability_policy(resource_group_name, account_name, container_name, if_match, custom_headers:nil)
1289
+ response = delete_immutability_policy_async(resource_group_name, account_name, container_name, if_match, custom_headers:custom_headers).value!
1290
+ response.body unless response.nil?
1291
+ end
1292
+
1293
+ #
1294
+ # Aborts an unlocked immutability policy. The response of delete has
1295
+ # immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required
1296
+ # for this operation. Deleting a locked immutability policy is not allowed,
1297
+ # only way is to delete the container after deleting all blobs inside the
1298
+ # container.
1299
+ #
1300
+ # @param resource_group_name [String] The name of the resource group within the
1301
+ # user's subscription. The name is case insensitive.
1302
+ # @param account_name [String] The name of the storage account within the
1303
+ # specified resource group. Storage account names must be between 3 and 24
1304
+ # characters in length and use numbers and lower-case letters only.
1305
+ # @param container_name [String] The name of the blob container within the
1306
+ # specified storage account. Blob container names must be between 3 and 63
1307
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1308
+ # Every dash (-) character must be immediately preceded and followed by a
1309
+ # letter or number.
1310
+ # @param if_match [String] The entity state (ETag) version of the immutability
1311
+ # policy to update. A value of "*" can be used to apply the operation only if
1312
+ # the immutability policy already exists. If omitted, this operation will
1313
+ # always be applied.
1314
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1315
+ # will be added to the HTTP request.
1316
+ #
1317
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1318
+ #
1319
+ def delete_immutability_policy_with_http_info(resource_group_name, account_name, container_name, if_match, custom_headers:nil)
1320
+ delete_immutability_policy_async(resource_group_name, account_name, container_name, if_match, custom_headers:custom_headers).value!
1321
+ end
1322
+
1323
+ #
1324
+ # Aborts an unlocked immutability policy. The response of delete has
1325
+ # immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required
1326
+ # for this operation. Deleting a locked immutability policy is not allowed,
1327
+ # only way is to delete the container after deleting all blobs inside the
1328
+ # container.
1329
+ #
1330
+ # @param resource_group_name [String] The name of the resource group within the
1331
+ # user's subscription. The name is case insensitive.
1332
+ # @param account_name [String] The name of the storage account within the
1333
+ # specified resource group. Storage account names must be between 3 and 24
1334
+ # characters in length and use numbers and lower-case letters only.
1335
+ # @param container_name [String] The name of the blob container within the
1336
+ # specified storage account. Blob container names must be between 3 and 63
1337
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1338
+ # Every dash (-) character must be immediately preceded and followed by a
1339
+ # letter or number.
1340
+ # @param if_match [String] The entity state (ETag) version of the immutability
1341
+ # policy to update. A value of "*" can be used to apply the operation only if
1342
+ # the immutability policy already exists. If omitted, this operation will
1343
+ # always be applied.
1344
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1345
+ # to the HTTP request.
1346
+ #
1347
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1348
+ #
1349
+ def delete_immutability_policy_async(resource_group_name, account_name, container_name, if_match, custom_headers:nil)
1350
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1351
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1352
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1353
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1354
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1355
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1356
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1357
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1358
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
1359
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
1360
+ immutability_policy_name = 'default'
1361
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1362
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1363
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1364
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1365
+ fail ArgumentError, 'if_match is nil' if if_match.nil?
1366
+
1367
+
1368
+ request_headers = {}
1369
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1370
+
1371
+ # Set Headers
1372
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1373
+ request_headers['If-Match'] = if_match unless if_match.nil?
1374
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1375
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'
1376
+
1377
+ request_url = @base_url || @client.base_url
1378
+
1379
+ options = {
1380
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1381
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'immutabilityPolicyName' => immutability_policy_name,'subscriptionId' => @client.subscription_id},
1382
+ query_params: {'api-version' => @client.api_version},
1383
+ headers: request_headers.merge(custom_headers || {}),
1384
+ base_url: request_url
1385
+ }
1386
+ promise = @client.make_request_async(:delete, path_template, options)
1387
+
1388
+ promise = promise.then do |result|
1389
+ http_response = result.response
1390
+ status_code = http_response.status
1391
+ response_content = http_response.body
1392
+ unless status_code == 200
1393
+ error_model = JSON.load(response_content)
1394
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1395
+ end
1396
+
1397
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1398
+ # Deserialize Response
1399
+ if status_code == 200
1400
+ begin
1401
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1402
+ result_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::ImmutabilityPolicy.mapper()
1403
+ result.body = @client.deserialize(result_mapper, parsed_response)
1404
+ rescue Exception => e
1405
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1406
+ end
1407
+ end
1408
+
1409
+ result
1410
+ end
1411
+
1412
+ promise.execute
1413
+ end
1414
+
1415
+ #
1416
+ # Sets the ImmutabilityPolicy to Locked state. The only action allowed on a
1417
+ # Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is
1418
+ # required for this operation.
1419
+ #
1420
+ # @param resource_group_name [String] The name of the resource group within the
1421
+ # user's subscription. The name is case insensitive.
1422
+ # @param account_name [String] The name of the storage account within the
1423
+ # specified resource group. Storage account names must be between 3 and 24
1424
+ # characters in length and use numbers and lower-case letters only.
1425
+ # @param container_name [String] The name of the blob container within the
1426
+ # specified storage account. Blob container names must be between 3 and 63
1427
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1428
+ # Every dash (-) character must be immediately preceded and followed by a
1429
+ # letter or number.
1430
+ # @param if_match [String] The entity state (ETag) version of the immutability
1431
+ # policy to update. A value of "*" can be used to apply the operation only if
1432
+ # the immutability policy already exists. If omitted, this operation will
1433
+ # always be applied.
1434
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1435
+ # will be added to the HTTP request.
1436
+ #
1437
+ # @return [ImmutabilityPolicy] operation results.
1438
+ #
1439
+ def lock_immutability_policy(resource_group_name, account_name, container_name, if_match, custom_headers:nil)
1440
+ response = lock_immutability_policy_async(resource_group_name, account_name, container_name, if_match, custom_headers:custom_headers).value!
1441
+ response.body unless response.nil?
1442
+ end
1443
+
1444
+ #
1445
+ # Sets the ImmutabilityPolicy to Locked state. The only action allowed on a
1446
+ # Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is
1447
+ # required for this operation.
1448
+ #
1449
+ # @param resource_group_name [String] The name of the resource group within the
1450
+ # user's subscription. The name is case insensitive.
1451
+ # @param account_name [String] The name of the storage account within the
1452
+ # specified resource group. Storage account names must be between 3 and 24
1453
+ # characters in length and use numbers and lower-case letters only.
1454
+ # @param container_name [String] The name of the blob container within the
1455
+ # specified storage account. Blob container names must be between 3 and 63
1456
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1457
+ # Every dash (-) character must be immediately preceded and followed by a
1458
+ # letter or number.
1459
+ # @param if_match [String] The entity state (ETag) version of the immutability
1460
+ # policy to update. A value of "*" can be used to apply the operation only if
1461
+ # the immutability policy already exists. If omitted, this operation will
1462
+ # always be applied.
1463
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1464
+ # will be added to the HTTP request.
1465
+ #
1466
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1467
+ #
1468
+ def lock_immutability_policy_with_http_info(resource_group_name, account_name, container_name, if_match, custom_headers:nil)
1469
+ lock_immutability_policy_async(resource_group_name, account_name, container_name, if_match, custom_headers:custom_headers).value!
1470
+ end
1471
+
1472
+ #
1473
+ # Sets the ImmutabilityPolicy to Locked state. The only action allowed on a
1474
+ # Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is
1475
+ # required for this operation.
1476
+ #
1477
+ # @param resource_group_name [String] The name of the resource group within the
1478
+ # user's subscription. The name is case insensitive.
1479
+ # @param account_name [String] The name of the storage account within the
1480
+ # specified resource group. Storage account names must be between 3 and 24
1481
+ # characters in length and use numbers and lower-case letters only.
1482
+ # @param container_name [String] The name of the blob container within the
1483
+ # specified storage account. Blob container names must be between 3 and 63
1484
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1485
+ # Every dash (-) character must be immediately preceded and followed by a
1486
+ # letter or number.
1487
+ # @param if_match [String] The entity state (ETag) version of the immutability
1488
+ # policy to update. A value of "*" can be used to apply the operation only if
1489
+ # the immutability policy already exists. If omitted, this operation will
1490
+ # always be applied.
1491
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1492
+ # to the HTTP request.
1493
+ #
1494
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1495
+ #
1496
+ def lock_immutability_policy_async(resource_group_name, account_name, container_name, if_match, custom_headers:nil)
1497
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1498
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1499
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1500
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1501
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1502
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1503
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1504
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1505
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
1506
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
1507
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1508
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1509
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1510
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1511
+ fail ArgumentError, 'if_match is nil' if if_match.nil?
1512
+
1513
+
1514
+ request_headers = {}
1515
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1516
+
1517
+ # Set Headers
1518
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1519
+ request_headers['If-Match'] = if_match unless if_match.nil?
1520
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1521
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'
1522
+
1523
+ request_url = @base_url || @client.base_url
1524
+
1525
+ options = {
1526
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1527
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'subscriptionId' => @client.subscription_id},
1528
+ query_params: {'api-version' => @client.api_version},
1529
+ headers: request_headers.merge(custom_headers || {}),
1530
+ base_url: request_url
1531
+ }
1532
+ promise = @client.make_request_async(:post, path_template, options)
1533
+
1534
+ promise = promise.then do |result|
1535
+ http_response = result.response
1536
+ status_code = http_response.status
1537
+ response_content = http_response.body
1538
+ unless status_code == 200
1539
+ error_model = JSON.load(response_content)
1540
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1541
+ end
1542
+
1543
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1544
+ # Deserialize Response
1545
+ if status_code == 200
1546
+ begin
1547
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1548
+ result_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::ImmutabilityPolicy.mapper()
1549
+ result.body = @client.deserialize(result_mapper, parsed_response)
1550
+ rescue Exception => e
1551
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1552
+ end
1553
+ end
1554
+
1555
+ result
1556
+ end
1557
+
1558
+ promise.execute
1559
+ end
1560
+
1561
+ #
1562
+ # Extends the immutabilityPeriodSinceCreationInDays of a locked
1563
+ # immutabilityPolicy. The only action allowed on a Locked policy will be this
1564
+ # action. ETag in If-Match is required for this operation.
1565
+ #
1566
+ # @param resource_group_name [String] The name of the resource group within the
1567
+ # user's subscription. The name is case insensitive.
1568
+ # @param account_name [String] The name of the storage account within the
1569
+ # specified resource group. Storage account names must be between 3 and 24
1570
+ # characters in length and use numbers and lower-case letters only.
1571
+ # @param container_name [String] The name of the blob container within the
1572
+ # specified storage account. Blob container names must be between 3 and 63
1573
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1574
+ # Every dash (-) character must be immediately preceded and followed by a
1575
+ # letter or number.
1576
+ # @param if_match [String] The entity state (ETag) version of the immutability
1577
+ # policy to update. A value of "*" can be used to apply the operation only if
1578
+ # the immutability policy already exists. If omitted, this operation will
1579
+ # always be applied.
1580
+ # @param parameters [ImmutabilityPolicy] The ImmutabilityPolicy Properties that
1581
+ # will be extended for a blob container.
1582
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1583
+ # will be added to the HTTP request.
1584
+ #
1585
+ # @return [ImmutabilityPolicy] operation results.
1586
+ #
1587
+ def extend_immutability_policy(resource_group_name, account_name, container_name, if_match, parameters:nil, custom_headers:nil)
1588
+ response = extend_immutability_policy_async(resource_group_name, account_name, container_name, if_match, parameters:parameters, custom_headers:custom_headers).value!
1589
+ response.body unless response.nil?
1590
+ end
1591
+
1592
+ #
1593
+ # Extends the immutabilityPeriodSinceCreationInDays of a locked
1594
+ # immutabilityPolicy. The only action allowed on a Locked policy will be this
1595
+ # action. ETag in If-Match is required for this operation.
1596
+ #
1597
+ # @param resource_group_name [String] The name of the resource group within the
1598
+ # user's subscription. The name is case insensitive.
1599
+ # @param account_name [String] The name of the storage account within the
1600
+ # specified resource group. Storage account names must be between 3 and 24
1601
+ # characters in length and use numbers and lower-case letters only.
1602
+ # @param container_name [String] The name of the blob container within the
1603
+ # specified storage account. Blob container names must be between 3 and 63
1604
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1605
+ # Every dash (-) character must be immediately preceded and followed by a
1606
+ # letter or number.
1607
+ # @param if_match [String] The entity state (ETag) version of the immutability
1608
+ # policy to update. A value of "*" can be used to apply the operation only if
1609
+ # the immutability policy already exists. If omitted, this operation will
1610
+ # always be applied.
1611
+ # @param parameters [ImmutabilityPolicy] The ImmutabilityPolicy Properties that
1612
+ # will be extended for a blob container.
1613
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1614
+ # will be added to the HTTP request.
1615
+ #
1616
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1617
+ #
1618
+ def extend_immutability_policy_with_http_info(resource_group_name, account_name, container_name, if_match, parameters:nil, custom_headers:nil)
1619
+ extend_immutability_policy_async(resource_group_name, account_name, container_name, if_match, parameters:parameters, custom_headers:custom_headers).value!
1620
+ end
1621
+
1622
+ #
1623
+ # Extends the immutabilityPeriodSinceCreationInDays of a locked
1624
+ # immutabilityPolicy. The only action allowed on a Locked policy will be this
1625
+ # action. ETag in If-Match is required for this operation.
1626
+ #
1627
+ # @param resource_group_name [String] The name of the resource group within the
1628
+ # user's subscription. The name is case insensitive.
1629
+ # @param account_name [String] The name of the storage account within the
1630
+ # specified resource group. Storage account names must be between 3 and 24
1631
+ # characters in length and use numbers and lower-case letters only.
1632
+ # @param container_name [String] The name of the blob container within the
1633
+ # specified storage account. Blob container names must be between 3 and 63
1634
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1635
+ # Every dash (-) character must be immediately preceded and followed by a
1636
+ # letter or number.
1637
+ # @param if_match [String] The entity state (ETag) version of the immutability
1638
+ # policy to update. A value of "*" can be used to apply the operation only if
1639
+ # the immutability policy already exists. If omitted, this operation will
1640
+ # always be applied.
1641
+ # @param parameters [ImmutabilityPolicy] The ImmutabilityPolicy Properties that
1642
+ # will be extended for a blob container.
1643
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1644
+ # to the HTTP request.
1645
+ #
1646
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1647
+ #
1648
+ def extend_immutability_policy_async(resource_group_name, account_name, container_name, if_match, parameters:nil, custom_headers:nil)
1649
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1650
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1651
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1652
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1653
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1654
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1655
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1656
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1657
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
1658
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
1659
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1660
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1661
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1662
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1663
+ fail ArgumentError, 'if_match is nil' if if_match.nil?
1664
+
1665
+
1666
+ request_headers = {}
1667
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1668
+
1669
+ # Set Headers
1670
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1671
+ request_headers['If-Match'] = if_match unless if_match.nil?
1672
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1673
+
1674
+ # Serialize Request
1675
+ request_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::ImmutabilityPolicy.mapper()
1676
+ request_content = @client.serialize(request_mapper, parameters)
1677
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1678
+
1679
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'
1680
+
1681
+ request_url = @base_url || @client.base_url
1682
+
1683
+ options = {
1684
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1685
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'subscriptionId' => @client.subscription_id},
1686
+ query_params: {'api-version' => @client.api_version},
1687
+ body: request_content,
1688
+ headers: request_headers.merge(custom_headers || {}),
1689
+ base_url: request_url
1690
+ }
1691
+ promise = @client.make_request_async(:post, path_template, options)
1692
+
1693
+ promise = promise.then do |result|
1694
+ http_response = result.response
1695
+ status_code = http_response.status
1696
+ response_content = http_response.body
1697
+ unless status_code == 200
1698
+ error_model = JSON.load(response_content)
1699
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1700
+ end
1701
+
1702
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1703
+ # Deserialize Response
1704
+ if status_code == 200
1705
+ begin
1706
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1707
+ result_mapper = Azure::Storage::Mgmt::V2018_11_01::Models::ImmutabilityPolicy.mapper()
1708
+ result.body = @client.deserialize(result_mapper, parsed_response)
1709
+ rescue Exception => e
1710
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1711
+ end
1712
+ end
1713
+
1714
+ result
1715
+ end
1716
+
1717
+ promise.execute
1718
+ end
1719
+
1720
+ end
1721
+ end