azure_mgmt_storage 0.17.8 → 0.17.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. checksums.yaml +5 -5
  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.rb +25 -23
  9. data/lib/2018-02-01/generated/azure_mgmt_storage/blob_containers.rb +142 -0
  10. data/lib/2018-02-01/generated/azure_mgmt_storage/models/lease_container_request.rb +97 -0
  11. data/lib/2018-02-01/generated/azure_mgmt_storage/models/lease_container_response.rb +60 -0
  12. data/lib/2018-02-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  13. data/lib/2018-03-01-preview/generated/azure_mgmt_storage.rb +24 -22
  14. data/lib/2018-03-01-preview/generated/azure_mgmt_storage/blob_containers.rb +142 -0
  15. data/lib/2018-03-01-preview/generated/azure_mgmt_storage/models/lease_container_request.rb +97 -0
  16. data/lib/2018-03-01-preview/generated/azure_mgmt_storage/models/lease_container_response.rb +60 -0
  17. data/lib/2018-03-01-preview/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  18. data/lib/2018-07-01/generated/azure_mgmt_storage.rb +27 -25
  19. data/lib/2018-07-01/generated/azure_mgmt_storage/blob_containers.rb +142 -0
  20. data/lib/2018-07-01/generated/azure_mgmt_storage/models/lease_container_request.rb +97 -0
  21. data/lib/2018-07-01/generated/azure_mgmt_storage/models/lease_container_response.rb +60 -0
  22. data/lib/2018-07-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  23. data/lib/2018-11-01/generated/azure_mgmt_storage.rb +31 -29
  24. data/lib/2018-11-01/generated/azure_mgmt_storage/blob_containers.rb +153 -1
  25. data/lib/2018-11-01/generated/azure_mgmt_storage/models/lease_container_request.rb +97 -0
  26. data/lib/2018-11-01/generated/azure_mgmt_storage/models/lease_container_response.rb +60 -0
  27. data/lib/2018-11-01/generated/azure_mgmt_storage/storage_accounts.rb +97 -0
  28. data/lib/2018-11-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  29. data/lib/2019-04-01/generated/azure_mgmt_storage.rb +128 -0
  30. data/lib/2019-04-01/generated/azure_mgmt_storage/blob_containers.rb +1873 -0
  31. data/lib/2019-04-01/generated/azure_mgmt_storage/blob_services.rb +266 -0
  32. data/lib/2019-04-01/generated/azure_mgmt_storage/management_policies.rb +355 -0
  33. data/lib/2019-04-01/generated/azure_mgmt_storage/models/access_tier.rb +16 -0
  34. data/lib/2019-04-01/generated/azure_mgmt_storage/models/account_sas_parameters.rb +136 -0
  35. data/lib/2019-04-01/generated/azure_mgmt_storage/models/account_status.rb +16 -0
  36. data/lib/2019-04-01/generated/azure_mgmt_storage/models/action.rb +15 -0
  37. data/lib/2019-04-01/generated/azure_mgmt_storage/models/azure_entity_resource.rb +75 -0
  38. data/lib/2019-04-01/generated/azure_mgmt_storage/models/blob_container.rb +217 -0
  39. data/lib/2019-04-01/generated/azure_mgmt_storage/models/blob_service_properties.rb +115 -0
  40. data/lib/2019-04-01/generated/azure_mgmt_storage/models/bypass.rb +18 -0
  41. data/lib/2019-04-01/generated/azure_mgmt_storage/models/check_name_availability_result.rb +77 -0
  42. data/lib/2019-04-01/generated/azure_mgmt_storage/models/cors_rule.rb +128 -0
  43. data/lib/2019-04-01/generated/azure_mgmt_storage/models/cors_rules.rb +57 -0
  44. data/lib/2019-04-01/generated/azure_mgmt_storage/models/custom_domain.rb +60 -0
  45. data/lib/2019-04-01/generated/azure_mgmt_storage/models/date_after_creation.rb +50 -0
  46. data/lib/2019-04-01/generated/azure_mgmt_storage/models/date_after_modification.rb +50 -0
  47. data/lib/2019-04-01/generated/azure_mgmt_storage/models/default_action.rb +16 -0
  48. data/lib/2019-04-01/generated/azure_mgmt_storage/models/delete_retention_policy.rb +64 -0
  49. data/lib/2019-04-01/generated/azure_mgmt_storage/models/dimension.rb +57 -0
  50. data/lib/2019-04-01/generated/azure_mgmt_storage/models/encryption.rb +74 -0
  51. data/lib/2019-04-01/generated/azure_mgmt_storage/models/encryption_service.rb +62 -0
  52. data/lib/2019-04-01/generated/azure_mgmt_storage/models/encryption_services.rb +89 -0
  53. data/lib/2019-04-01/generated/azure_mgmt_storage/models/endpoints.rb +108 -0
  54. data/lib/2019-04-01/generated/azure_mgmt_storage/models/geo_replication_stats.rb +85 -0
  55. data/lib/2019-04-01/generated/azure_mgmt_storage/models/geo_replication_status.rb +17 -0
  56. data/lib/2019-04-01/generated/azure_mgmt_storage/models/http_protocol.rb +16 -0
  57. data/lib/2019-04-01/generated/azure_mgmt_storage/models/identity.rb +72 -0
  58. data/lib/2019-04-01/generated/azure_mgmt_storage/models/immutability_policy.rb +98 -0
  59. data/lib/2019-04-01/generated/azure_mgmt_storage/models/immutability_policy_properties.rb +95 -0
  60. data/lib/2019-04-01/generated/azure_mgmt_storage/models/immutability_policy_state.rb +16 -0
  61. data/lib/2019-04-01/generated/azure_mgmt_storage/models/immutability_policy_update_type.rb +17 -0
  62. data/lib/2019-04-01/generated/azure_mgmt_storage/models/iprule.rb +61 -0
  63. data/lib/2019-04-01/generated/azure_mgmt_storage/models/key_permission.rb +16 -0
  64. data/lib/2019-04-01/generated/azure_mgmt_storage/models/key_source.rb +16 -0
  65. data/lib/2019-04-01/generated/azure_mgmt_storage/models/key_vault_properties.rb +68 -0
  66. data/lib/2019-04-01/generated/azure_mgmt_storage/models/kind.rb +19 -0
  67. data/lib/2019-04-01/generated/azure_mgmt_storage/models/lease_container_request.rb +97 -0
  68. data/lib/2019-04-01/generated/azure_mgmt_storage/models/lease_container_response.rb +60 -0
  69. data/lib/2019-04-01/generated/azure_mgmt_storage/models/lease_duration.rb +16 -0
  70. data/lib/2019-04-01/generated/azure_mgmt_storage/models/lease_state.rb +19 -0
  71. data/lib/2019-04-01/generated/azure_mgmt_storage/models/lease_status.rb +16 -0
  72. data/lib/2019-04-01/generated/azure_mgmt_storage/models/legal_hold.rb +71 -0
  73. data/lib/2019-04-01/generated/azure_mgmt_storage/models/legal_hold_properties.rb +72 -0
  74. data/lib/2019-04-01/generated/azure_mgmt_storage/models/list_account_sas_response.rb +47 -0
  75. data/lib/2019-04-01/generated/azure_mgmt_storage/models/list_container_item.rb +216 -0
  76. data/lib/2019-04-01/generated/azure_mgmt_storage/models/list_container_items.rb +55 -0
  77. data/lib/2019-04-01/generated/azure_mgmt_storage/models/list_service_sas_response.rb +47 -0
  78. data/lib/2019-04-01/generated/azure_mgmt_storage/models/management_policy.rb +89 -0
  79. data/lib/2019-04-01/generated/azure_mgmt_storage/models/management_policy_action.rb +62 -0
  80. data/lib/2019-04-01/generated/azure_mgmt_storage/models/management_policy_base_blob.rb +73 -0
  81. data/lib/2019-04-01/generated/azure_mgmt_storage/models/management_policy_definition.rb +60 -0
  82. data/lib/2019-04-01/generated/azure_mgmt_storage/models/management_policy_filter.rb +76 -0
  83. data/lib/2019-04-01/generated/azure_mgmt_storage/models/management_policy_rule.rb +87 -0
  84. data/lib/2019-04-01/generated/azure_mgmt_storage/models/management_policy_schema.rb +58 -0
  85. data/lib/2019-04-01/generated/azure_mgmt_storage/models/management_policy_snap_shot.rb +47 -0
  86. data/lib/2019-04-01/generated/azure_mgmt_storage/models/metric_specification.rb +145 -0
  87. data/lib/2019-04-01/generated/azure_mgmt_storage/models/network_rule_set.rb +106 -0
  88. data/lib/2019-04-01/generated/azure_mgmt_storage/models/operation.rb +83 -0
  89. data/lib/2019-04-01/generated/azure_mgmt_storage/models/operation_display.rb +79 -0
  90. data/lib/2019-04-01/generated/azure_mgmt_storage/models/operation_list_result.rb +57 -0
  91. data/lib/2019-04-01/generated/azure_mgmt_storage/models/permissions.rb +22 -0
  92. data/lib/2019-04-01/generated/azure_mgmt_storage/models/provisioning_state.rb +17 -0
  93. data/lib/2019-04-01/generated/azure_mgmt_storage/models/proxy_resource.rb +63 -0
  94. data/lib/2019-04-01/generated/azure_mgmt_storage/models/public_access.rb +17 -0
  95. data/lib/2019-04-01/generated/azure_mgmt_storage/models/reason.rb +16 -0
  96. data/lib/2019-04-01/generated/azure_mgmt_storage/models/reason_code.rb +16 -0
  97. data/lib/2019-04-01/generated/azure_mgmt_storage/models/resource.rb +83 -0
  98. data/lib/2019-04-01/generated/azure_mgmt_storage/models/restriction.rb +85 -0
  99. data/lib/2019-04-01/generated/azure_mgmt_storage/models/service_sas_parameters.rb +247 -0
  100. data/lib/2019-04-01/generated/azure_mgmt_storage/models/service_specification.rb +56 -0
  101. data/lib/2019-04-01/generated/azure_mgmt_storage/models/services.rb +18 -0
  102. data/lib/2019-04-01/generated/azure_mgmt_storage/models/signed_resource.rb +18 -0
  103. data/lib/2019-04-01/generated/azure_mgmt_storage/models/signed_resource_types.rb +17 -0
  104. data/lib/2019-04-01/generated/azure_mgmt_storage/models/sku.rb +157 -0
  105. data/lib/2019-04-01/generated/azure_mgmt_storage/models/sku_name.rb +22 -0
  106. data/lib/2019-04-01/generated/azure_mgmt_storage/models/sku_tier.rb +16 -0
  107. data/lib/2019-04-01/generated/azure_mgmt_storage/models/skucapability.rb +63 -0
  108. data/lib/2019-04-01/generated/azure_mgmt_storage/models/state.rb +19 -0
  109. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account.rb +374 -0
  110. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_check_name_availability_parameters.rb +63 -0
  111. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_create_parameters.rb +202 -0
  112. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_expand.rb +15 -0
  113. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_key.rb +73 -0
  114. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_list_keys_result.rb +57 -0
  115. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_list_result.rb +57 -0
  116. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_regenerate_key_parameters.rb +47 -0
  117. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_update_parameters.rb +178 -0
  118. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_sku_list_result.rb +57 -0
  119. data/lib/2019-04-01/generated/azure_mgmt_storage/models/tag_property.rb +97 -0
  120. data/lib/2019-04-01/generated/azure_mgmt_storage/models/tracked_resource.rb +92 -0
  121. data/lib/2019-04-01/generated/azure_mgmt_storage/models/update_history_property.rb +114 -0
  122. data/lib/2019-04-01/generated/azure_mgmt_storage/models/usage.rb +89 -0
  123. data/lib/2019-04-01/generated/azure_mgmt_storage/models/usage_list_result.rb +56 -0
  124. data/lib/2019-04-01/generated/azure_mgmt_storage/models/usage_name.rb +59 -0
  125. data/lib/2019-04-01/generated/azure_mgmt_storage/models/usage_unit.rb +20 -0
  126. data/lib/2019-04-01/generated/azure_mgmt_storage/models/virtual_network_rule.rb +75 -0
  127. data/lib/2019-04-01/generated/azure_mgmt_storage/module_definition.rb +9 -0
  128. data/lib/2019-04-01/generated/azure_mgmt_storage/operations.rb +108 -0
  129. data/lib/2019-04-01/generated/azure_mgmt_storage/skus.rb +114 -0
  130. data/lib/2019-04-01/generated/azure_mgmt_storage/storage_accounts.rb +1602 -0
  131. data/lib/2019-04-01/generated/azure_mgmt_storage/storage_management_client.rb +155 -0
  132. data/lib/2019-04-01/generated/azure_mgmt_storage/usages.rb +118 -0
  133. data/lib/azure_mgmt_storage.rb +1 -0
  134. data/lib/profiles/latest/modules/storage_profile_module.rb +232 -224
  135. data/lib/version.rb +1 -1
  136. metadata +115 -3
@@ -0,0 +1,97 @@
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
+ module Models
8
+ #
9
+ # Lease Container request schema.
10
+ #
11
+ class LeaseContainerRequest
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Enum] Specifies the lease action. Can be one of the available
16
+ # actions. Possible values include: 'Acquire', 'Renew', 'Change',
17
+ # 'Release', 'Break'
18
+ attr_accessor :action
19
+
20
+ # @return [String] Identifies the lease. Can be specified in any valid
21
+ # GUID string format.
22
+ attr_accessor :lease_id
23
+
24
+ # @return [Integer] Optional. For a break action, proposed duration the
25
+ # lease should continue before it is broken, in seconds, between 0 and
26
+ # 60.
27
+ attr_accessor :break_period
28
+
29
+ # @return [Integer] Required for acquire. Specifies the duration of the
30
+ # lease, in seconds, or negative one (-1) for a lease that never expires.
31
+ attr_accessor :lease_duration
32
+
33
+ # @return [String] Optional for acquire, required for change. Proposed
34
+ # lease ID, in a GUID string format.
35
+ attr_accessor :proposed_lease_id
36
+
37
+
38
+ #
39
+ # Mapper for LeaseContainerRequest class as Ruby Hash.
40
+ # This will be used for serialization/deserialization.
41
+ #
42
+ def self.mapper()
43
+ {
44
+ client_side_validation: true,
45
+ required: false,
46
+ serialized_name: 'LeaseContainerRequest',
47
+ type: {
48
+ name: 'Composite',
49
+ class_name: 'LeaseContainerRequest',
50
+ model_properties: {
51
+ action: {
52
+ client_side_validation: true,
53
+ required: true,
54
+ serialized_name: 'action',
55
+ type: {
56
+ name: 'String'
57
+ }
58
+ },
59
+ lease_id: {
60
+ client_side_validation: true,
61
+ required: false,
62
+ serialized_name: 'leaseId',
63
+ type: {
64
+ name: 'String'
65
+ }
66
+ },
67
+ break_period: {
68
+ client_side_validation: true,
69
+ required: false,
70
+ serialized_name: 'breakPeriod',
71
+ type: {
72
+ name: 'Number'
73
+ }
74
+ },
75
+ lease_duration: {
76
+ client_side_validation: true,
77
+ required: false,
78
+ serialized_name: 'leaseDuration',
79
+ type: {
80
+ name: 'Number'
81
+ }
82
+ },
83
+ proposed_lease_id: {
84
+ client_side_validation: true,
85
+ required: false,
86
+ serialized_name: 'proposedLeaseId',
87
+ type: {
88
+ name: 'String'
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,60 @@
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
+ module Models
8
+ #
9
+ # Lease Container response schema.
10
+ #
11
+ class LeaseContainerResponse
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Returned unique lease ID that must be included with
16
+ # any request to delete the container, or to renew, change, or release
17
+ # the lease.
18
+ attr_accessor :lease_id
19
+
20
+ # @return [String] Approximate time remaining in the lease period, in
21
+ # seconds.
22
+ attr_accessor :lease_time_seconds
23
+
24
+
25
+ #
26
+ # Mapper for LeaseContainerResponse class as Ruby Hash.
27
+ # This will be used for serialization/deserialization.
28
+ #
29
+ def self.mapper()
30
+ {
31
+ client_side_validation: true,
32
+ required: false,
33
+ serialized_name: 'LeaseContainerResponse',
34
+ type: {
35
+ name: 'Composite',
36
+ class_name: 'LeaseContainerResponse',
37
+ model_properties: {
38
+ lease_id: {
39
+ client_side_validation: true,
40
+ required: false,
41
+ serialized_name: 'leaseId',
42
+ type: {
43
+ name: 'String'
44
+ }
45
+ },
46
+ lease_time_seconds: {
47
+ client_side_validation: true,
48
+ required: false,
49
+ serialized_name: 'leaseTimeSeconds',
50
+ type: {
51
+ name: 'String'
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ end
58
+ end
59
+ end
60
+ end
@@ -1261,6 +1261,103 @@ module Azure::Storage::Mgmt::V2018_11_01
1261
1261
  promise
1262
1262
  end
1263
1263
 
1264
+ #
1265
+ # Revoke user delegation keys.
1266
+ #
1267
+ # @param resource_group_name [String] The name of the resource group within the
1268
+ # user's subscription. The name is case insensitive.
1269
+ # @param account_name [String] The name of the storage account within the
1270
+ # specified resource group. Storage account names must be between 3 and 24
1271
+ # characters in length and use numbers and lower-case letters only.
1272
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1273
+ # will be added to the HTTP request.
1274
+ #
1275
+ #
1276
+ def revoke_user_delegation_keys(resource_group_name, account_name, custom_headers:nil)
1277
+ response = revoke_user_delegation_keys_async(resource_group_name, account_name, custom_headers:custom_headers).value!
1278
+ nil
1279
+ end
1280
+
1281
+ #
1282
+ # Revoke user delegation keys.
1283
+ #
1284
+ # @param resource_group_name [String] The name of the resource group within the
1285
+ # user's subscription. The name is case insensitive.
1286
+ # @param account_name [String] The name of the storage account within the
1287
+ # specified resource group. Storage account names must be between 3 and 24
1288
+ # characters in length and use numbers and lower-case letters only.
1289
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1290
+ # will be added to the HTTP request.
1291
+ #
1292
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1293
+ #
1294
+ def revoke_user_delegation_keys_with_http_info(resource_group_name, account_name, custom_headers:nil)
1295
+ revoke_user_delegation_keys_async(resource_group_name, account_name, custom_headers:custom_headers).value!
1296
+ end
1297
+
1298
+ #
1299
+ # Revoke user delegation keys.
1300
+ #
1301
+ # @param resource_group_name [String] The name of the resource group within the
1302
+ # user's subscription. The name is case insensitive.
1303
+ # @param account_name [String] The name of the storage account within the
1304
+ # specified resource group. Storage account names must be between 3 and 24
1305
+ # characters in length and use numbers and lower-case letters only.
1306
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1307
+ # to the HTTP request.
1308
+ #
1309
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1310
+ #
1311
+ def revoke_user_delegation_keys_async(resource_group_name, account_name, custom_headers:nil)
1312
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1313
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1314
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1315
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1316
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1317
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1318
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1319
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1320
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1321
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1322
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1323
+
1324
+
1325
+ request_headers = {}
1326
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1327
+
1328
+ # Set Headers
1329
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1330
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1331
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'
1332
+
1333
+ request_url = @base_url || @client.base_url
1334
+
1335
+ options = {
1336
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1337
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
1338
+ query_params: {'api-version' => @client.api_version},
1339
+ headers: request_headers.merge(custom_headers || {}),
1340
+ base_url: request_url
1341
+ }
1342
+ promise = @client.make_request_async(:post, path_template, options)
1343
+
1344
+ promise = promise.then do |result|
1345
+ http_response = result.response
1346
+ status_code = http_response.status
1347
+ response_content = http_response.body
1348
+ unless status_code == 200
1349
+ error_model = JSON.load(response_content)
1350
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1351
+ end
1352
+
1353
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1354
+
1355
+ result
1356
+ end
1357
+
1358
+ promise.execute
1359
+ end
1360
+
1264
1361
  #
1265
1362
  # Asynchronously creates a new storage account with the specified parameters.
1266
1363
  # If an account is already created and a subsequent create request is issued
@@ -148,7 +148,7 @@ module Azure::Storage::Mgmt::V2018_11_01
148
148
  #
149
149
  def add_telemetry
150
150
  sdk_information = 'azure_mgmt_storage'
151
- sdk_information = "#{sdk_information}/0.17.8"
151
+ sdk_information = "#{sdk_information}/0.17.9"
152
152
  add_user_agent_information(sdk_information)
153
153
  end
154
154
  end
@@ -0,0 +1,128 @@
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
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2019-04-01/generated/azure_mgmt_storage/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::Storage::Mgmt::V2019_04_01
23
+ autoload :Operations, '2019-04-01/generated/azure_mgmt_storage/operations.rb'
24
+ autoload :Skus, '2019-04-01/generated/azure_mgmt_storage/skus.rb'
25
+ autoload :StorageAccounts, '2019-04-01/generated/azure_mgmt_storage/storage_accounts.rb'
26
+ autoload :Usages, '2019-04-01/generated/azure_mgmt_storage/usages.rb'
27
+ autoload :ManagementPolicies, '2019-04-01/generated/azure_mgmt_storage/management_policies.rb'
28
+ autoload :BlobServices, '2019-04-01/generated/azure_mgmt_storage/blob_services.rb'
29
+ autoload :BlobContainers, '2019-04-01/generated/azure_mgmt_storage/blob_containers.rb'
30
+ autoload :StorageManagementClient, '2019-04-01/generated/azure_mgmt_storage/storage_management_client.rb'
31
+
32
+ module Models
33
+ autoload :AccountSasParameters, '2019-04-01/generated/azure_mgmt_storage/models/account_sas_parameters.rb'
34
+ autoload :OperationDisplay, '2019-04-01/generated/azure_mgmt_storage/models/operation_display.rb'
35
+ autoload :ListAccountSasResponse, '2019-04-01/generated/azure_mgmt_storage/models/list_account_sas_response.rb'
36
+ autoload :MetricSpecification, '2019-04-01/generated/azure_mgmt_storage/models/metric_specification.rb'
37
+ autoload :ServiceSasParameters, '2019-04-01/generated/azure_mgmt_storage/models/service_sas_parameters.rb'
38
+ autoload :Operation, '2019-04-01/generated/azure_mgmt_storage/models/operation.rb'
39
+ autoload :ListServiceSasResponse, '2019-04-01/generated/azure_mgmt_storage/models/list_service_sas_response.rb'
40
+ autoload :StorageAccountCheckNameAvailabilityParameters, '2019-04-01/generated/azure_mgmt_storage/models/storage_account_check_name_availability_parameters.rb'
41
+ autoload :DateAfterModification, '2019-04-01/generated/azure_mgmt_storage/models/date_after_modification.rb'
42
+ autoload :Restriction, '2019-04-01/generated/azure_mgmt_storage/models/restriction.rb'
43
+ autoload :ManagementPolicyBaseBlob, '2019-04-01/generated/azure_mgmt_storage/models/management_policy_base_blob.rb'
44
+ autoload :StorageSkuListResult, '2019-04-01/generated/azure_mgmt_storage/models/storage_sku_list_result.rb'
45
+ autoload :DateAfterCreation, '2019-04-01/generated/azure_mgmt_storage/models/date_after_creation.rb'
46
+ autoload :CustomDomain, '2019-04-01/generated/azure_mgmt_storage/models/custom_domain.rb'
47
+ autoload :ManagementPolicySnapShot, '2019-04-01/generated/azure_mgmt_storage/models/management_policy_snap_shot.rb'
48
+ autoload :EncryptionServices, '2019-04-01/generated/azure_mgmt_storage/models/encryption_services.rb'
49
+ autoload :ManagementPolicyAction, '2019-04-01/generated/azure_mgmt_storage/models/management_policy_action.rb'
50
+ autoload :Encryption, '2019-04-01/generated/azure_mgmt_storage/models/encryption.rb'
51
+ autoload :ManagementPolicyFilter, '2019-04-01/generated/azure_mgmt_storage/models/management_policy_filter.rb'
52
+ autoload :IPRule, '2019-04-01/generated/azure_mgmt_storage/models/iprule.rb'
53
+ autoload :ManagementPolicyDefinition, '2019-04-01/generated/azure_mgmt_storage/models/management_policy_definition.rb'
54
+ autoload :Identity, '2019-04-01/generated/azure_mgmt_storage/models/identity.rb'
55
+ autoload :ManagementPolicyRule, '2019-04-01/generated/azure_mgmt_storage/models/management_policy_rule.rb'
56
+ autoload :Endpoints, '2019-04-01/generated/azure_mgmt_storage/models/endpoints.rb'
57
+ autoload :ManagementPolicySchema, '2019-04-01/generated/azure_mgmt_storage/models/management_policy_schema.rb'
58
+ autoload :VirtualNetworkRule, '2019-04-01/generated/azure_mgmt_storage/models/virtual_network_rule.rb'
59
+ autoload :NetworkRuleSet, '2019-04-01/generated/azure_mgmt_storage/models/network_rule_set.rb'
60
+ autoload :StorageAccountListResult, '2019-04-01/generated/azure_mgmt_storage/models/storage_account_list_result.rb'
61
+ autoload :StorageAccountCreateParameters, '2019-04-01/generated/azure_mgmt_storage/models/storage_account_create_parameters.rb'
62
+ autoload :StorageAccountRegenerateKeyParameters, '2019-04-01/generated/azure_mgmt_storage/models/storage_account_regenerate_key_parameters.rb'
63
+ autoload :GeoReplicationStats, '2019-04-01/generated/azure_mgmt_storage/models/geo_replication_stats.rb'
64
+ autoload :UsageName, '2019-04-01/generated/azure_mgmt_storage/models/usage_name.rb'
65
+ autoload :UsageListResult, '2019-04-01/generated/azure_mgmt_storage/models/usage_list_result.rb'
66
+ autoload :LeaseContainerResponse, '2019-04-01/generated/azure_mgmt_storage/models/lease_container_response.rb'
67
+ autoload :ServiceSpecification, '2019-04-01/generated/azure_mgmt_storage/models/service_specification.rb'
68
+ autoload :LeaseContainerRequest, '2019-04-01/generated/azure_mgmt_storage/models/lease_container_request.rb'
69
+ autoload :SKUCapability, '2019-04-01/generated/azure_mgmt_storage/models/skucapability.rb'
70
+ autoload :Sku, '2019-04-01/generated/azure_mgmt_storage/models/sku.rb'
71
+ autoload :ListContainerItems, '2019-04-01/generated/azure_mgmt_storage/models/list_container_items.rb'
72
+ autoload :EncryptionService, '2019-04-01/generated/azure_mgmt_storage/models/encryption_service.rb'
73
+ autoload :DeleteRetentionPolicy, '2019-04-01/generated/azure_mgmt_storage/models/delete_retention_policy.rb'
74
+ autoload :StorageAccountKey, '2019-04-01/generated/azure_mgmt_storage/models/storage_account_key.rb'
75
+ autoload :Resource, '2019-04-01/generated/azure_mgmt_storage/models/resource.rb'
76
+ autoload :StorageAccountUpdateParameters, '2019-04-01/generated/azure_mgmt_storage/models/storage_account_update_parameters.rb'
77
+ autoload :UpdateHistoryProperty, '2019-04-01/generated/azure_mgmt_storage/models/update_history_property.rb'
78
+ autoload :Dimension, '2019-04-01/generated/azure_mgmt_storage/models/dimension.rb'
79
+ autoload :ImmutabilityPolicyProperties, '2019-04-01/generated/azure_mgmt_storage/models/immutability_policy_properties.rb'
80
+ autoload :CheckNameAvailabilityResult, '2019-04-01/generated/azure_mgmt_storage/models/check_name_availability_result.rb'
81
+ autoload :TagProperty, '2019-04-01/generated/azure_mgmt_storage/models/tag_property.rb'
82
+ autoload :StorageAccountListKeysResult, '2019-04-01/generated/azure_mgmt_storage/models/storage_account_list_keys_result.rb'
83
+ autoload :LegalHoldProperties, '2019-04-01/generated/azure_mgmt_storage/models/legal_hold_properties.rb'
84
+ autoload :OperationListResult, '2019-04-01/generated/azure_mgmt_storage/models/operation_list_result.rb'
85
+ autoload :CorsRules, '2019-04-01/generated/azure_mgmt_storage/models/cors_rules.rb'
86
+ autoload :Usage, '2019-04-01/generated/azure_mgmt_storage/models/usage.rb'
87
+ autoload :CorsRule, '2019-04-01/generated/azure_mgmt_storage/models/cors_rule.rb'
88
+ autoload :KeyVaultProperties, '2019-04-01/generated/azure_mgmt_storage/models/key_vault_properties.rb'
89
+ autoload :LegalHold, '2019-04-01/generated/azure_mgmt_storage/models/legal_hold.rb'
90
+ autoload :TrackedResource, '2019-04-01/generated/azure_mgmt_storage/models/tracked_resource.rb'
91
+ autoload :StorageAccount, '2019-04-01/generated/azure_mgmt_storage/models/storage_account.rb'
92
+ autoload :ManagementPolicy, '2019-04-01/generated/azure_mgmt_storage/models/management_policy.rb'
93
+ autoload :ProxyResource, '2019-04-01/generated/azure_mgmt_storage/models/proxy_resource.rb'
94
+ autoload :AzureEntityResource, '2019-04-01/generated/azure_mgmt_storage/models/azure_entity_resource.rb'
95
+ autoload :BlobContainer, '2019-04-01/generated/azure_mgmt_storage/models/blob_container.rb'
96
+ autoload :ImmutabilityPolicy, '2019-04-01/generated/azure_mgmt_storage/models/immutability_policy.rb'
97
+ autoload :ListContainerItem, '2019-04-01/generated/azure_mgmt_storage/models/list_container_item.rb'
98
+ autoload :BlobServiceProperties, '2019-04-01/generated/azure_mgmt_storage/models/blob_service_properties.rb'
99
+ autoload :ReasonCode, '2019-04-01/generated/azure_mgmt_storage/models/reason_code.rb'
100
+ autoload :SkuName, '2019-04-01/generated/azure_mgmt_storage/models/sku_name.rb'
101
+ autoload :SkuTier, '2019-04-01/generated/azure_mgmt_storage/models/sku_tier.rb'
102
+ autoload :Kind, '2019-04-01/generated/azure_mgmt_storage/models/kind.rb'
103
+ autoload :Reason, '2019-04-01/generated/azure_mgmt_storage/models/reason.rb'
104
+ autoload :KeySource, '2019-04-01/generated/azure_mgmt_storage/models/key_source.rb'
105
+ autoload :Action, '2019-04-01/generated/azure_mgmt_storage/models/action.rb'
106
+ autoload :State, '2019-04-01/generated/azure_mgmt_storage/models/state.rb'
107
+ autoload :Bypass, '2019-04-01/generated/azure_mgmt_storage/models/bypass.rb'
108
+ autoload :DefaultAction, '2019-04-01/generated/azure_mgmt_storage/models/default_action.rb'
109
+ autoload :AccessTier, '2019-04-01/generated/azure_mgmt_storage/models/access_tier.rb'
110
+ autoload :GeoReplicationStatus, '2019-04-01/generated/azure_mgmt_storage/models/geo_replication_status.rb'
111
+ autoload :ProvisioningState, '2019-04-01/generated/azure_mgmt_storage/models/provisioning_state.rb'
112
+ autoload :AccountStatus, '2019-04-01/generated/azure_mgmt_storage/models/account_status.rb'
113
+ autoload :KeyPermission, '2019-04-01/generated/azure_mgmt_storage/models/key_permission.rb'
114
+ autoload :UsageUnit, '2019-04-01/generated/azure_mgmt_storage/models/usage_unit.rb'
115
+ autoload :Services, '2019-04-01/generated/azure_mgmt_storage/models/services.rb'
116
+ autoload :SignedResourceTypes, '2019-04-01/generated/azure_mgmt_storage/models/signed_resource_types.rb'
117
+ autoload :Permissions, '2019-04-01/generated/azure_mgmt_storage/models/permissions.rb'
118
+ autoload :HttpProtocol, '2019-04-01/generated/azure_mgmt_storage/models/http_protocol.rb'
119
+ autoload :SignedResource, '2019-04-01/generated/azure_mgmt_storage/models/signed_resource.rb'
120
+ autoload :PublicAccess, '2019-04-01/generated/azure_mgmt_storage/models/public_access.rb'
121
+ autoload :LeaseStatus, '2019-04-01/generated/azure_mgmt_storage/models/lease_status.rb'
122
+ autoload :LeaseState, '2019-04-01/generated/azure_mgmt_storage/models/lease_state.rb'
123
+ autoload :LeaseDuration, '2019-04-01/generated/azure_mgmt_storage/models/lease_duration.rb'
124
+ autoload :ImmutabilityPolicyState, '2019-04-01/generated/azure_mgmt_storage/models/immutability_policy_state.rb'
125
+ autoload :ImmutabilityPolicyUpdateType, '2019-04-01/generated/azure_mgmt_storage/models/immutability_policy_update_type.rb'
126
+ autoload :StorageAccountExpand, '2019-04-01/generated/azure_mgmt_storage/models/storage_account_expand.rb'
127
+ end
128
+ end
@@ -0,0 +1,1873 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Storage::Mgmt::V2019_04_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::V2019_04_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::V2019_04_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 || status_code == 200
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::V2019_04_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
+ # Deserialize Response
278
+ if status_code == 200
279
+ begin
280
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
281
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::BlobContainer.mapper()
282
+ result.body = @client.deserialize(result_mapper, parsed_response)
283
+ rescue Exception => e
284
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
285
+ end
286
+ end
287
+
288
+ result
289
+ end
290
+
291
+ promise.execute
292
+ end
293
+
294
+ #
295
+ # Updates container properties as specified in request body. Properties not
296
+ # mentioned in the request will be unchanged. Update fails if the specified
297
+ # container doesn't already exist.
298
+ #
299
+ # @param resource_group_name [String] The name of the resource group within the
300
+ # user's subscription. The name is case insensitive.
301
+ # @param account_name [String] The name of the storage account within the
302
+ # specified resource group. Storage account names must be between 3 and 24
303
+ # characters in length and use numbers and lower-case letters only.
304
+ # @param container_name [String] The name of the blob container within the
305
+ # specified storage account. Blob container names must be between 3 and 63
306
+ # characters in length and use numbers, lower-case letters and dash (-) only.
307
+ # Every dash (-) character must be immediately preceded and followed by a
308
+ # letter or number.
309
+ # @param blob_container [BlobContainer] Properties to update for the blob
310
+ # container.
311
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
312
+ # will be added to the HTTP request.
313
+ #
314
+ # @return [BlobContainer] operation results.
315
+ #
316
+ def update(resource_group_name, account_name, container_name, blob_container, custom_headers:nil)
317
+ response = update_async(resource_group_name, account_name, container_name, blob_container, custom_headers:custom_headers).value!
318
+ response.body unless response.nil?
319
+ end
320
+
321
+ #
322
+ # Updates container properties as specified in request body. Properties not
323
+ # mentioned in the request will be unchanged. Update fails if the specified
324
+ # container doesn't already exist.
325
+ #
326
+ # @param resource_group_name [String] The name of the resource group within the
327
+ # user's subscription. The name is case insensitive.
328
+ # @param account_name [String] The name of the storage account within the
329
+ # specified resource group. Storage account names must be between 3 and 24
330
+ # characters in length and use numbers and lower-case letters only.
331
+ # @param container_name [String] The name of the blob container within the
332
+ # specified storage account. Blob container names must be between 3 and 63
333
+ # characters in length and use numbers, lower-case letters and dash (-) only.
334
+ # Every dash (-) character must be immediately preceded and followed by a
335
+ # letter or number.
336
+ # @param blob_container [BlobContainer] Properties to update for the blob
337
+ # container.
338
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
339
+ # will be added to the HTTP request.
340
+ #
341
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
342
+ #
343
+ def update_with_http_info(resource_group_name, account_name, container_name, blob_container, custom_headers:nil)
344
+ update_async(resource_group_name, account_name, container_name, blob_container, custom_headers:custom_headers).value!
345
+ end
346
+
347
+ #
348
+ # Updates container properties as specified in request body. Properties not
349
+ # mentioned in the request will be unchanged. Update fails if the specified
350
+ # container doesn't already exist.
351
+ #
352
+ # @param resource_group_name [String] The name of the resource group within the
353
+ # user's subscription. The name is case insensitive.
354
+ # @param account_name [String] The name of the storage account within the
355
+ # specified resource group. Storage account names must be between 3 and 24
356
+ # characters in length and use numbers and lower-case letters only.
357
+ # @param container_name [String] The name of the blob container within the
358
+ # specified storage account. Blob container names must be between 3 and 63
359
+ # characters in length and use numbers, lower-case letters and dash (-) only.
360
+ # Every dash (-) character must be immediately preceded and followed by a
361
+ # letter or number.
362
+ # @param blob_container [BlobContainer] Properties to update for the blob
363
+ # container.
364
+ # @param [Hash{String => String}] A hash of custom headers that will be added
365
+ # to the HTTP request.
366
+ #
367
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
368
+ #
369
+ def update_async(resource_group_name, account_name, container_name, blob_container, custom_headers:nil)
370
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
371
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
372
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
373
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
374
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
375
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
376
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
377
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
378
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
379
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
380
+ fail ArgumentError, 'blob_container is nil' if blob_container.nil?
381
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
382
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
383
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
384
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
385
+
386
+
387
+ request_headers = {}
388
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
389
+
390
+ # Set Headers
391
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
392
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
393
+
394
+ # Serialize Request
395
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::BlobContainer.mapper()
396
+ request_content = @client.serialize(request_mapper, blob_container)
397
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
398
+
399
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'
400
+
401
+ request_url = @base_url || @client.base_url
402
+
403
+ options = {
404
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
405
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'subscriptionId' => @client.subscription_id},
406
+ query_params: {'api-version' => @client.api_version},
407
+ body: request_content,
408
+ headers: request_headers.merge(custom_headers || {}),
409
+ base_url: request_url
410
+ }
411
+ promise = @client.make_request_async(:patch, path_template, options)
412
+
413
+ promise = promise.then do |result|
414
+ http_response = result.response
415
+ status_code = http_response.status
416
+ response_content = http_response.body
417
+ unless status_code == 200
418
+ error_model = JSON.load(response_content)
419
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
420
+ end
421
+
422
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
423
+ # Deserialize Response
424
+ if status_code == 200
425
+ begin
426
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
427
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::BlobContainer.mapper()
428
+ result.body = @client.deserialize(result_mapper, parsed_response)
429
+ rescue Exception => e
430
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
431
+ end
432
+ end
433
+
434
+ result
435
+ end
436
+
437
+ promise.execute
438
+ end
439
+
440
+ #
441
+ # Gets properties of a specified container.
442
+ #
443
+ # @param resource_group_name [String] The name of the resource group within the
444
+ # user's subscription. The name is case insensitive.
445
+ # @param account_name [String] The name of the storage account within the
446
+ # specified resource group. Storage account names must be between 3 and 24
447
+ # characters in length and use numbers and lower-case letters only.
448
+ # @param container_name [String] The name of the blob container within the
449
+ # specified storage account. Blob container names must be between 3 and 63
450
+ # characters in length and use numbers, lower-case letters and dash (-) only.
451
+ # Every dash (-) character must be immediately preceded and followed by a
452
+ # letter or number.
453
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
454
+ # will be added to the HTTP request.
455
+ #
456
+ # @return [BlobContainer] operation results.
457
+ #
458
+ def get(resource_group_name, account_name, container_name, custom_headers:nil)
459
+ response = get_async(resource_group_name, account_name, container_name, custom_headers:custom_headers).value!
460
+ response.body unless response.nil?
461
+ end
462
+
463
+ #
464
+ # Gets properties of a specified container.
465
+ #
466
+ # @param resource_group_name [String] The name of the resource group within the
467
+ # user's subscription. The name is case insensitive.
468
+ # @param account_name [String] The name of the storage account within the
469
+ # specified resource group. Storage account names must be between 3 and 24
470
+ # characters in length and use numbers and lower-case letters only.
471
+ # @param container_name [String] The name of the blob container within the
472
+ # specified storage account. Blob container names must be between 3 and 63
473
+ # characters in length and use numbers, lower-case letters and dash (-) only.
474
+ # Every dash (-) character must be immediately preceded and followed by a
475
+ # letter or number.
476
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
477
+ # will be added to the HTTP request.
478
+ #
479
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
480
+ #
481
+ def get_with_http_info(resource_group_name, account_name, container_name, custom_headers:nil)
482
+ get_async(resource_group_name, account_name, container_name, custom_headers:custom_headers).value!
483
+ end
484
+
485
+ #
486
+ # Gets properties of a specified container.
487
+ #
488
+ # @param resource_group_name [String] The name of the resource group within the
489
+ # user's subscription. The name is case insensitive.
490
+ # @param account_name [String] The name of the storage account within the
491
+ # specified resource group. Storage account names must be between 3 and 24
492
+ # characters in length and use numbers and lower-case letters only.
493
+ # @param container_name [String] The name of the blob container within the
494
+ # specified storage account. Blob container names must be between 3 and 63
495
+ # characters in length and use numbers, lower-case letters and dash (-) only.
496
+ # Every dash (-) character must be immediately preceded and followed by a
497
+ # letter or number.
498
+ # @param [Hash{String => String}] A hash of custom headers that will be added
499
+ # to the HTTP request.
500
+ #
501
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
502
+ #
503
+ def get_async(resource_group_name, account_name, container_name, custom_headers:nil)
504
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
505
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
506
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
507
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
508
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
509
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
510
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
511
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
512
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
513
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
514
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
515
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
516
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
517
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
518
+
519
+
520
+ request_headers = {}
521
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
522
+
523
+ # Set Headers
524
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
525
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
526
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'
527
+
528
+ request_url = @base_url || @client.base_url
529
+
530
+ options = {
531
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
532
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'subscriptionId' => @client.subscription_id},
533
+ query_params: {'api-version' => @client.api_version},
534
+ headers: request_headers.merge(custom_headers || {}),
535
+ base_url: request_url
536
+ }
537
+ promise = @client.make_request_async(:get, path_template, options)
538
+
539
+ promise = promise.then do |result|
540
+ http_response = result.response
541
+ status_code = http_response.status
542
+ response_content = http_response.body
543
+ unless status_code == 200
544
+ error_model = JSON.load(response_content)
545
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
546
+ end
547
+
548
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
549
+ # Deserialize Response
550
+ if status_code == 200
551
+ begin
552
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
553
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::BlobContainer.mapper()
554
+ result.body = @client.deserialize(result_mapper, parsed_response)
555
+ rescue Exception => e
556
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
557
+ end
558
+ end
559
+
560
+ result
561
+ end
562
+
563
+ promise.execute
564
+ end
565
+
566
+ #
567
+ # Deletes specified container under its account.
568
+ #
569
+ # @param resource_group_name [String] The name of the resource group within the
570
+ # user's subscription. The name is case insensitive.
571
+ # @param account_name [String] The name of the storage account within the
572
+ # specified resource group. Storage account names must be between 3 and 24
573
+ # characters in length and use numbers and lower-case letters only.
574
+ # @param container_name [String] The name of the blob container within the
575
+ # specified storage account. Blob container names must be between 3 and 63
576
+ # characters in length and use numbers, lower-case letters and dash (-) only.
577
+ # Every dash (-) character must be immediately preceded and followed by a
578
+ # letter or number.
579
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
580
+ # will be added to the HTTP request.
581
+ #
582
+ #
583
+ def delete(resource_group_name, account_name, container_name, custom_headers:nil)
584
+ response = delete_async(resource_group_name, account_name, container_name, custom_headers:custom_headers).value!
585
+ nil
586
+ end
587
+
588
+ #
589
+ # Deletes specified container under its account.
590
+ #
591
+ # @param resource_group_name [String] The name of the resource group within the
592
+ # user's subscription. The name is case insensitive.
593
+ # @param account_name [String] The name of the storage account within the
594
+ # specified resource group. Storage account names must be between 3 and 24
595
+ # characters in length and use numbers and lower-case letters only.
596
+ # @param container_name [String] The name of the blob container within the
597
+ # specified storage account. Blob container names must be between 3 and 63
598
+ # characters in length and use numbers, lower-case letters and dash (-) only.
599
+ # Every dash (-) character must be immediately preceded and followed by a
600
+ # letter or number.
601
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
602
+ # will be added to the HTTP request.
603
+ #
604
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
605
+ #
606
+ def delete_with_http_info(resource_group_name, account_name, container_name, custom_headers:nil)
607
+ delete_async(resource_group_name, account_name, container_name, custom_headers:custom_headers).value!
608
+ end
609
+
610
+ #
611
+ # Deletes specified container under its account.
612
+ #
613
+ # @param resource_group_name [String] The name of the resource group within the
614
+ # user's subscription. The name is case insensitive.
615
+ # @param account_name [String] The name of the storage account within the
616
+ # specified resource group. Storage account names must be between 3 and 24
617
+ # characters in length and use numbers and lower-case letters only.
618
+ # @param container_name [String] The name of the blob container within the
619
+ # specified storage account. Blob container names must be between 3 and 63
620
+ # characters in length and use numbers, lower-case letters and dash (-) only.
621
+ # Every dash (-) character must be immediately preceded and followed by a
622
+ # letter or number.
623
+ # @param [Hash{String => String}] A hash of custom headers that will be added
624
+ # to the HTTP request.
625
+ #
626
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
627
+ #
628
+ def delete_async(resource_group_name, account_name, container_name, custom_headers:nil)
629
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
630
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
631
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
632
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
633
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
634
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
635
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
636
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
637
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
638
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
639
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
640
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
641
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
642
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
643
+
644
+
645
+ request_headers = {}
646
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
647
+
648
+ # Set Headers
649
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
650
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
651
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}'
652
+
653
+ request_url = @base_url || @client.base_url
654
+
655
+ options = {
656
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
657
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'subscriptionId' => @client.subscription_id},
658
+ query_params: {'api-version' => @client.api_version},
659
+ headers: request_headers.merge(custom_headers || {}),
660
+ base_url: request_url
661
+ }
662
+ promise = @client.make_request_async(:delete, path_template, options)
663
+
664
+ promise = promise.then do |result|
665
+ http_response = result.response
666
+ status_code = http_response.status
667
+ response_content = http_response.body
668
+ unless status_code == 200 || status_code == 204
669
+ error_model = JSON.load(response_content)
670
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
671
+ end
672
+
673
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
674
+
675
+ result
676
+ end
677
+
678
+ promise.execute
679
+ end
680
+
681
+ #
682
+ # Sets legal hold tags. Setting the same tag results in an idempotent
683
+ # operation. SetLegalHold follows an append pattern and does not clear out the
684
+ # existing tags that are not specified in the request.
685
+ #
686
+ # @param resource_group_name [String] The name of the resource group within the
687
+ # user's subscription. The name is case insensitive.
688
+ # @param account_name [String] The name of the storage account within the
689
+ # specified resource group. Storage account names must be between 3 and 24
690
+ # characters in length and use numbers and lower-case letters only.
691
+ # @param container_name [String] The name of the blob container within the
692
+ # specified storage account. Blob container names must be between 3 and 63
693
+ # characters in length and use numbers, lower-case letters and dash (-) only.
694
+ # Every dash (-) character must be immediately preceded and followed by a
695
+ # letter or number.
696
+ # @param legal_hold [LegalHold] The LegalHold property that will be set to a
697
+ # blob container.
698
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
699
+ # will be added to the HTTP request.
700
+ #
701
+ # @return [LegalHold] operation results.
702
+ #
703
+ def set_legal_hold(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
704
+ response = set_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:custom_headers).value!
705
+ response.body unless response.nil?
706
+ end
707
+
708
+ #
709
+ # Sets legal hold tags. Setting the same tag results in an idempotent
710
+ # operation. SetLegalHold follows an append pattern and does not clear out the
711
+ # existing tags that are not specified in the request.
712
+ #
713
+ # @param resource_group_name [String] The name of the resource group within the
714
+ # user's subscription. The name is case insensitive.
715
+ # @param account_name [String] The name of the storage account within the
716
+ # specified resource group. Storage account names must be between 3 and 24
717
+ # characters in length and use numbers and lower-case letters only.
718
+ # @param container_name [String] The name of the blob container within the
719
+ # specified storage account. Blob container names must be between 3 and 63
720
+ # characters in length and use numbers, lower-case letters and dash (-) only.
721
+ # Every dash (-) character must be immediately preceded and followed by a
722
+ # letter or number.
723
+ # @param legal_hold [LegalHold] The LegalHold property that will be set to a
724
+ # blob container.
725
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
726
+ # will be added to the HTTP request.
727
+ #
728
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
729
+ #
730
+ def set_legal_hold_with_http_info(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
731
+ set_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:custom_headers).value!
732
+ end
733
+
734
+ #
735
+ # Sets legal hold tags. Setting the same tag results in an idempotent
736
+ # operation. SetLegalHold follows an append pattern and does not clear out the
737
+ # existing tags that are not specified in the request.
738
+ #
739
+ # @param resource_group_name [String] The name of the resource group within the
740
+ # user's subscription. The name is case insensitive.
741
+ # @param account_name [String] The name of the storage account within the
742
+ # specified resource group. Storage account names must be between 3 and 24
743
+ # characters in length and use numbers and lower-case letters only.
744
+ # @param container_name [String] The name of the blob container within the
745
+ # specified storage account. Blob container names must be between 3 and 63
746
+ # characters in length and use numbers, lower-case letters and dash (-) only.
747
+ # Every dash (-) character must be immediately preceded and followed by a
748
+ # letter or number.
749
+ # @param legal_hold [LegalHold] The LegalHold property that will be set to a
750
+ # blob container.
751
+ # @param [Hash{String => String}] A hash of custom headers that will be added
752
+ # to the HTTP request.
753
+ #
754
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
755
+ #
756
+ def set_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
757
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
758
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
759
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
760
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
761
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
762
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
763
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
764
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
765
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
766
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
767
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
768
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
769
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
770
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
771
+ fail ArgumentError, 'legal_hold is nil' if legal_hold.nil?
772
+
773
+
774
+ request_headers = {}
775
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
776
+
777
+ # Set Headers
778
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
779
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
780
+
781
+ # Serialize Request
782
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::LegalHold.mapper()
783
+ request_content = @client.serialize(request_mapper, legal_hold)
784
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
785
+
786
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold'
787
+
788
+ request_url = @base_url || @client.base_url
789
+
790
+ options = {
791
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
792
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'subscriptionId' => @client.subscription_id},
793
+ query_params: {'api-version' => @client.api_version},
794
+ body: request_content,
795
+ headers: request_headers.merge(custom_headers || {}),
796
+ base_url: request_url
797
+ }
798
+ promise = @client.make_request_async(:post, path_template, options)
799
+
800
+ promise = promise.then do |result|
801
+ http_response = result.response
802
+ status_code = http_response.status
803
+ response_content = http_response.body
804
+ unless status_code == 200
805
+ error_model = JSON.load(response_content)
806
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
807
+ end
808
+
809
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
810
+ # Deserialize Response
811
+ if status_code == 200
812
+ begin
813
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
814
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::LegalHold.mapper()
815
+ result.body = @client.deserialize(result_mapper, parsed_response)
816
+ rescue Exception => e
817
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
818
+ end
819
+ end
820
+
821
+ result
822
+ end
823
+
824
+ promise.execute
825
+ end
826
+
827
+ #
828
+ # Clears legal hold tags. Clearing the same or non-existent tag results in an
829
+ # idempotent operation. ClearLegalHold clears out only the specified tags in
830
+ # the request.
831
+ #
832
+ # @param resource_group_name [String] The name of the resource group within the
833
+ # user's subscription. The name is case insensitive.
834
+ # @param account_name [String] The name of the storage account within the
835
+ # specified resource group. Storage account names must be between 3 and 24
836
+ # characters in length and use numbers and lower-case letters only.
837
+ # @param container_name [String] The name of the blob container within the
838
+ # specified storage account. Blob container names must be between 3 and 63
839
+ # characters in length and use numbers, lower-case letters and dash (-) only.
840
+ # Every dash (-) character must be immediately preceded and followed by a
841
+ # letter or number.
842
+ # @param legal_hold [LegalHold] The LegalHold property that will be clear from
843
+ # a blob container.
844
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
845
+ # will be added to the HTTP request.
846
+ #
847
+ # @return [LegalHold] operation results.
848
+ #
849
+ def clear_legal_hold(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
850
+ response = clear_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:custom_headers).value!
851
+ response.body unless response.nil?
852
+ end
853
+
854
+ #
855
+ # Clears legal hold tags. Clearing the same or non-existent tag results in an
856
+ # idempotent operation. ClearLegalHold clears out only the specified tags in
857
+ # the request.
858
+ #
859
+ # @param resource_group_name [String] The name of the resource group within the
860
+ # user's subscription. The name is case insensitive.
861
+ # @param account_name [String] The name of the storage account within the
862
+ # specified resource group. Storage account names must be between 3 and 24
863
+ # characters in length and use numbers and lower-case letters only.
864
+ # @param container_name [String] The name of the blob container within the
865
+ # specified storage account. Blob container names must be between 3 and 63
866
+ # characters in length and use numbers, lower-case letters and dash (-) only.
867
+ # Every dash (-) character must be immediately preceded and followed by a
868
+ # letter or number.
869
+ # @param legal_hold [LegalHold] The LegalHold property that will be clear from
870
+ # a blob container.
871
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
872
+ # will be added to the HTTP request.
873
+ #
874
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
875
+ #
876
+ def clear_legal_hold_with_http_info(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
877
+ clear_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:custom_headers).value!
878
+ end
879
+
880
+ #
881
+ # Clears legal hold tags. Clearing the same or non-existent tag results in an
882
+ # idempotent operation. ClearLegalHold clears out only the specified tags in
883
+ # the request.
884
+ #
885
+ # @param resource_group_name [String] The name of the resource group within the
886
+ # user's subscription. The name is case insensitive.
887
+ # @param account_name [String] The name of the storage account within the
888
+ # specified resource group. Storage account names must be between 3 and 24
889
+ # characters in length and use numbers and lower-case letters only.
890
+ # @param container_name [String] The name of the blob container within the
891
+ # specified storage account. Blob container names must be between 3 and 63
892
+ # characters in length and use numbers, lower-case letters and dash (-) only.
893
+ # Every dash (-) character must be immediately preceded and followed by a
894
+ # letter or number.
895
+ # @param legal_hold [LegalHold] The LegalHold property that will be clear from
896
+ # a blob container.
897
+ # @param [Hash{String => String}] A hash of custom headers that will be added
898
+ # to the HTTP request.
899
+ #
900
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
901
+ #
902
+ def clear_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
903
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
904
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
905
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
906
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
907
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
908
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
909
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
910
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
911
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
912
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
913
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
914
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
915
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
916
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
917
+ fail ArgumentError, 'legal_hold is nil' if legal_hold.nil?
918
+
919
+
920
+ request_headers = {}
921
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
922
+
923
+ # Set Headers
924
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
925
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
926
+
927
+ # Serialize Request
928
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::LegalHold.mapper()
929
+ request_content = @client.serialize(request_mapper, legal_hold)
930
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
931
+
932
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold'
933
+
934
+ request_url = @base_url || @client.base_url
935
+
936
+ options = {
937
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
938
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'subscriptionId' => @client.subscription_id},
939
+ query_params: {'api-version' => @client.api_version},
940
+ body: request_content,
941
+ headers: request_headers.merge(custom_headers || {}),
942
+ base_url: request_url
943
+ }
944
+ promise = @client.make_request_async(:post, path_template, options)
945
+
946
+ promise = promise.then do |result|
947
+ http_response = result.response
948
+ status_code = http_response.status
949
+ response_content = http_response.body
950
+ unless status_code == 200
951
+ error_model = JSON.load(response_content)
952
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
953
+ end
954
+
955
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
956
+ # Deserialize Response
957
+ if status_code == 200
958
+ begin
959
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
960
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::LegalHold.mapper()
961
+ result.body = @client.deserialize(result_mapper, parsed_response)
962
+ rescue Exception => e
963
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
964
+ end
965
+ end
966
+
967
+ result
968
+ end
969
+
970
+ promise.execute
971
+ end
972
+
973
+ #
974
+ # Creates or updates an unlocked immutability policy. ETag in If-Match is
975
+ # honored if given but not required for this operation.
976
+ #
977
+ # @param resource_group_name [String] The name of the resource group within the
978
+ # user's subscription. The name is case insensitive.
979
+ # @param account_name [String] The name of the storage account within the
980
+ # specified resource group. Storage account names must be between 3 and 24
981
+ # characters in length and use numbers and lower-case letters only.
982
+ # @param container_name [String] The name of the blob container within the
983
+ # specified storage account. Blob container names must be between 3 and 63
984
+ # characters in length and use numbers, lower-case letters and dash (-) only.
985
+ # Every dash (-) character must be immediately preceded and followed by a
986
+ # letter or number.
987
+ # @param parameters [ImmutabilityPolicy] The ImmutabilityPolicy Properties that
988
+ # will be created or updated to a blob container.
989
+ # @param if_match [String] The entity state (ETag) version of the immutability
990
+ # policy to update. A value of "*" can be used to apply the operation only if
991
+ # the immutability policy already exists. If omitted, this operation will
992
+ # always be applied.
993
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
994
+ # will be added to the HTTP request.
995
+ #
996
+ # @return [ImmutabilityPolicy] operation results.
997
+ #
998
+ def create_or_update_immutability_policy(resource_group_name, account_name, container_name, parameters:nil, if_match:nil, custom_headers:nil)
999
+ 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!
1000
+ response.body unless response.nil?
1001
+ end
1002
+
1003
+ #
1004
+ # Creates or updates an unlocked immutability policy. ETag in If-Match is
1005
+ # honored if given but not required for this operation.
1006
+ #
1007
+ # @param resource_group_name [String] The name of the resource group within the
1008
+ # user's subscription. The name is case insensitive.
1009
+ # @param account_name [String] The name of the storage account within the
1010
+ # specified resource group. Storage account names must be between 3 and 24
1011
+ # characters in length and use numbers and lower-case letters only.
1012
+ # @param container_name [String] The name of the blob container within the
1013
+ # specified storage account. Blob container names must be between 3 and 63
1014
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1015
+ # Every dash (-) character must be immediately preceded and followed by a
1016
+ # letter or number.
1017
+ # @param parameters [ImmutabilityPolicy] The ImmutabilityPolicy Properties that
1018
+ # will be created or updated to a blob container.
1019
+ # @param if_match [String] The entity state (ETag) version of the immutability
1020
+ # policy to update. A value of "*" can be used to apply the operation only if
1021
+ # the immutability policy already exists. If omitted, this operation will
1022
+ # always be applied.
1023
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1024
+ # will be added to the HTTP request.
1025
+ #
1026
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1027
+ #
1028
+ def create_or_update_immutability_policy_with_http_info(resource_group_name, account_name, container_name, parameters:nil, if_match:nil, custom_headers:nil)
1029
+ create_or_update_immutability_policy_async(resource_group_name, account_name, container_name, parameters:parameters, if_match:if_match, custom_headers:custom_headers).value!
1030
+ end
1031
+
1032
+ #
1033
+ # Creates or updates an unlocked immutability policy. ETag in If-Match is
1034
+ # honored if given but not required for this operation.
1035
+ #
1036
+ # @param resource_group_name [String] The name of the resource group within the
1037
+ # user's subscription. The name is case insensitive.
1038
+ # @param account_name [String] The name of the storage account within the
1039
+ # specified resource group. Storage account names must be between 3 and 24
1040
+ # characters in length and use numbers and lower-case letters only.
1041
+ # @param container_name [String] The name of the blob container within the
1042
+ # specified storage account. Blob container names must be between 3 and 63
1043
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1044
+ # Every dash (-) character must be immediately preceded and followed by a
1045
+ # letter or number.
1046
+ # @param parameters [ImmutabilityPolicy] The ImmutabilityPolicy Properties that
1047
+ # will be created or updated to a blob container.
1048
+ # @param if_match [String] The entity state (ETag) version of the immutability
1049
+ # policy to update. A value of "*" can be used to apply the operation only if
1050
+ # the immutability policy already exists. If omitted, this operation will
1051
+ # always be applied.
1052
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1053
+ # to the HTTP request.
1054
+ #
1055
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1056
+ #
1057
+ def create_or_update_immutability_policy_async(resource_group_name, account_name, container_name, parameters:nil, if_match:nil, custom_headers:nil)
1058
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1059
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1060
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1061
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1062
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1063
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1064
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1065
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1066
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
1067
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
1068
+ immutability_policy_name = 'default'
1069
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1070
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1071
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1072
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1073
+
1074
+
1075
+ request_headers = {}
1076
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1077
+
1078
+ # Set Headers
1079
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1080
+ request_headers['If-Match'] = if_match unless if_match.nil?
1081
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1082
+
1083
+ # Serialize Request
1084
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::ImmutabilityPolicy.mapper()
1085
+ request_content = @client.serialize(request_mapper, parameters)
1086
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1087
+
1088
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'
1089
+
1090
+ request_url = @base_url || @client.base_url
1091
+
1092
+ options = {
1093
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1094
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'immutabilityPolicyName' => immutability_policy_name,'subscriptionId' => @client.subscription_id},
1095
+ query_params: {'api-version' => @client.api_version},
1096
+ body: request_content,
1097
+ headers: request_headers.merge(custom_headers || {}),
1098
+ base_url: request_url
1099
+ }
1100
+ promise = @client.make_request_async(:put, path_template, options)
1101
+
1102
+ promise = promise.then do |result|
1103
+ http_response = result.response
1104
+ status_code = http_response.status
1105
+ response_content = http_response.body
1106
+ unless status_code == 200
1107
+ error_model = JSON.load(response_content)
1108
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1109
+ end
1110
+
1111
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1112
+ # Deserialize Response
1113
+ if status_code == 200
1114
+ begin
1115
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1116
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::ImmutabilityPolicy.mapper()
1117
+ result.body = @client.deserialize(result_mapper, parsed_response)
1118
+ rescue Exception => e
1119
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1120
+ end
1121
+ end
1122
+
1123
+ result
1124
+ end
1125
+
1126
+ promise.execute
1127
+ end
1128
+
1129
+ #
1130
+ # Gets the existing immutability policy along with the corresponding ETag in
1131
+ # response headers and body.
1132
+ #
1133
+ # @param resource_group_name [String] The name of the resource group within the
1134
+ # user's subscription. The name is case insensitive.
1135
+ # @param account_name [String] The name of the storage account within the
1136
+ # specified resource group. Storage account names must be between 3 and 24
1137
+ # characters in length and use numbers and lower-case letters only.
1138
+ # @param container_name [String] The name of the blob container within the
1139
+ # specified storage account. Blob container names must be between 3 and 63
1140
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1141
+ # Every dash (-) character must be immediately preceded and followed by a
1142
+ # letter or number.
1143
+ # @param if_match [String] The entity state (ETag) version of the immutability
1144
+ # policy to update. A value of "*" can be used to apply the operation only if
1145
+ # the immutability policy already exists. If omitted, this operation will
1146
+ # always be applied.
1147
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1148
+ # will be added to the HTTP request.
1149
+ #
1150
+ # @return [ImmutabilityPolicy] operation results.
1151
+ #
1152
+ def get_immutability_policy(resource_group_name, account_name, container_name, if_match:nil, custom_headers:nil)
1153
+ response = get_immutability_policy_async(resource_group_name, account_name, container_name, if_match:if_match, custom_headers:custom_headers).value!
1154
+ response.body unless response.nil?
1155
+ end
1156
+
1157
+ #
1158
+ # Gets the existing immutability policy along with the corresponding ETag in
1159
+ # response headers and body.
1160
+ #
1161
+ # @param resource_group_name [String] The name of the resource group within the
1162
+ # user's subscription. The name is case insensitive.
1163
+ # @param account_name [String] The name of the storage account within the
1164
+ # specified resource group. Storage account names must be between 3 and 24
1165
+ # characters in length and use numbers and lower-case letters only.
1166
+ # @param container_name [String] The name of the blob container within the
1167
+ # specified storage account. Blob container names must be between 3 and 63
1168
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1169
+ # Every dash (-) character must be immediately preceded and followed by a
1170
+ # letter or number.
1171
+ # @param if_match [String] The entity state (ETag) version of the immutability
1172
+ # policy to update. A value of "*" can be used to apply the operation only if
1173
+ # the immutability policy already exists. If omitted, this operation will
1174
+ # always be applied.
1175
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1176
+ # will be added to the HTTP request.
1177
+ #
1178
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1179
+ #
1180
+ def get_immutability_policy_with_http_info(resource_group_name, account_name, container_name, if_match:nil, custom_headers:nil)
1181
+ get_immutability_policy_async(resource_group_name, account_name, container_name, if_match:if_match, custom_headers:custom_headers).value!
1182
+ end
1183
+
1184
+ #
1185
+ # Gets the existing immutability policy along with the corresponding ETag in
1186
+ # response headers and body.
1187
+ #
1188
+ # @param resource_group_name [String] The name of the resource group within the
1189
+ # user's subscription. The name is case insensitive.
1190
+ # @param account_name [String] The name of the storage account within the
1191
+ # specified resource group. Storage account names must be between 3 and 24
1192
+ # characters in length and use numbers and lower-case letters only.
1193
+ # @param container_name [String] The name of the blob container within the
1194
+ # specified storage account. Blob container names must be between 3 and 63
1195
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1196
+ # Every dash (-) character must be immediately preceded and followed by a
1197
+ # letter or number.
1198
+ # @param if_match [String] The entity state (ETag) version of the immutability
1199
+ # policy to update. A value of "*" can be used to apply the operation only if
1200
+ # the immutability policy already exists. If omitted, this operation will
1201
+ # always be applied.
1202
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1203
+ # to the HTTP request.
1204
+ #
1205
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1206
+ #
1207
+ def get_immutability_policy_async(resource_group_name, account_name, container_name, if_match:nil, custom_headers:nil)
1208
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1209
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1210
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1211
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1212
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1213
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1214
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1215
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1216
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
1217
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
1218
+ immutability_policy_name = 'default'
1219
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1220
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1221
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1222
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1223
+
1224
+
1225
+ request_headers = {}
1226
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1227
+
1228
+ # Set Headers
1229
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1230
+ request_headers['If-Match'] = if_match unless if_match.nil?
1231
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1232
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'
1233
+
1234
+ request_url = @base_url || @client.base_url
1235
+
1236
+ options = {
1237
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1238
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'immutabilityPolicyName' => immutability_policy_name,'subscriptionId' => @client.subscription_id},
1239
+ query_params: {'api-version' => @client.api_version},
1240
+ headers: request_headers.merge(custom_headers || {}),
1241
+ base_url: request_url
1242
+ }
1243
+ promise = @client.make_request_async(:get, path_template, options)
1244
+
1245
+ promise = promise.then do |result|
1246
+ http_response = result.response
1247
+ status_code = http_response.status
1248
+ response_content = http_response.body
1249
+ unless status_code == 200
1250
+ error_model = JSON.load(response_content)
1251
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1252
+ end
1253
+
1254
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1255
+ # Deserialize Response
1256
+ if status_code == 200
1257
+ begin
1258
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1259
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::ImmutabilityPolicy.mapper()
1260
+ result.body = @client.deserialize(result_mapper, parsed_response)
1261
+ rescue Exception => e
1262
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1263
+ end
1264
+ end
1265
+
1266
+ result
1267
+ end
1268
+
1269
+ promise.execute
1270
+ end
1271
+
1272
+ #
1273
+ # Aborts an unlocked immutability policy. The response of delete has
1274
+ # immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required
1275
+ # for this operation. Deleting a locked immutability policy is not allowed,
1276
+ # only way is to delete the container after deleting all blobs inside the
1277
+ # container.
1278
+ #
1279
+ # @param resource_group_name [String] The name of the resource group within the
1280
+ # user's subscription. The name is case insensitive.
1281
+ # @param account_name [String] The name of the storage account within the
1282
+ # specified resource group. Storage account names must be between 3 and 24
1283
+ # characters in length and use numbers and lower-case letters only.
1284
+ # @param container_name [String] The name of the blob container within the
1285
+ # specified storage account. Blob container names must be between 3 and 63
1286
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1287
+ # Every dash (-) character must be immediately preceded and followed by a
1288
+ # letter or number.
1289
+ # @param if_match [String] The entity state (ETag) version of the immutability
1290
+ # policy to update. A value of "*" can be used to apply the operation only if
1291
+ # the immutability policy already exists. If omitted, this operation will
1292
+ # always be applied.
1293
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1294
+ # will be added to the HTTP request.
1295
+ #
1296
+ # @return [ImmutabilityPolicy] operation results.
1297
+ #
1298
+ def delete_immutability_policy(resource_group_name, account_name, container_name, if_match, custom_headers:nil)
1299
+ response = delete_immutability_policy_async(resource_group_name, account_name, container_name, if_match, custom_headers:custom_headers).value!
1300
+ response.body unless response.nil?
1301
+ end
1302
+
1303
+ #
1304
+ # Aborts an unlocked immutability policy. The response of delete has
1305
+ # immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required
1306
+ # for this operation. Deleting a locked immutability policy is not allowed,
1307
+ # only way is to delete the container after deleting all blobs inside the
1308
+ # container.
1309
+ #
1310
+ # @param resource_group_name [String] The name of the resource group within the
1311
+ # user's subscription. The name is case insensitive.
1312
+ # @param account_name [String] The name of the storage account within the
1313
+ # specified resource group. Storage account names must be between 3 and 24
1314
+ # characters in length and use numbers and lower-case letters only.
1315
+ # @param container_name [String] The name of the blob container within the
1316
+ # specified storage account. Blob container names must be between 3 and 63
1317
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1318
+ # Every dash (-) character must be immediately preceded and followed by a
1319
+ # letter or number.
1320
+ # @param if_match [String] The entity state (ETag) version of the immutability
1321
+ # policy to update. A value of "*" can be used to apply the operation only if
1322
+ # the immutability policy already exists. If omitted, this operation will
1323
+ # always be applied.
1324
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1325
+ # will be added to the HTTP request.
1326
+ #
1327
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1328
+ #
1329
+ def delete_immutability_policy_with_http_info(resource_group_name, account_name, container_name, if_match, custom_headers:nil)
1330
+ delete_immutability_policy_async(resource_group_name, account_name, container_name, if_match, custom_headers:custom_headers).value!
1331
+ end
1332
+
1333
+ #
1334
+ # Aborts an unlocked immutability policy. The response of delete has
1335
+ # immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required
1336
+ # for this operation. Deleting a locked immutability policy is not allowed,
1337
+ # only way is to delete the container after deleting all blobs inside the
1338
+ # container.
1339
+ #
1340
+ # @param resource_group_name [String] The name of the resource group within the
1341
+ # user's subscription. The name is case insensitive.
1342
+ # @param account_name [String] The name of the storage account within the
1343
+ # specified resource group. Storage account names must be between 3 and 24
1344
+ # characters in length and use numbers and lower-case letters only.
1345
+ # @param container_name [String] The name of the blob container within the
1346
+ # specified storage account. Blob container names must be between 3 and 63
1347
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1348
+ # Every dash (-) character must be immediately preceded and followed by a
1349
+ # letter or number.
1350
+ # @param if_match [String] The entity state (ETag) version of the immutability
1351
+ # policy to update. A value of "*" can be used to apply the operation only if
1352
+ # the immutability policy already exists. If omitted, this operation will
1353
+ # always be applied.
1354
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1355
+ # to the HTTP request.
1356
+ #
1357
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1358
+ #
1359
+ def delete_immutability_policy_async(resource_group_name, account_name, container_name, if_match, custom_headers:nil)
1360
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1361
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1362
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1363
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1364
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1365
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1366
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1367
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1368
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
1369
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
1370
+ immutability_policy_name = 'default'
1371
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1372
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1373
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1374
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1375
+ fail ArgumentError, 'if_match is nil' if if_match.nil?
1376
+
1377
+
1378
+ request_headers = {}
1379
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1380
+
1381
+ # Set Headers
1382
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1383
+ request_headers['If-Match'] = if_match unless if_match.nil?
1384
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1385
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}'
1386
+
1387
+ request_url = @base_url || @client.base_url
1388
+
1389
+ options = {
1390
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1391
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'immutabilityPolicyName' => immutability_policy_name,'subscriptionId' => @client.subscription_id},
1392
+ query_params: {'api-version' => @client.api_version},
1393
+ headers: request_headers.merge(custom_headers || {}),
1394
+ base_url: request_url
1395
+ }
1396
+ promise = @client.make_request_async(:delete, path_template, options)
1397
+
1398
+ promise = promise.then do |result|
1399
+ http_response = result.response
1400
+ status_code = http_response.status
1401
+ response_content = http_response.body
1402
+ unless status_code == 200
1403
+ error_model = JSON.load(response_content)
1404
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1405
+ end
1406
+
1407
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1408
+ # Deserialize Response
1409
+ if status_code == 200
1410
+ begin
1411
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1412
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::ImmutabilityPolicy.mapper()
1413
+ result.body = @client.deserialize(result_mapper, parsed_response)
1414
+ rescue Exception => e
1415
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1416
+ end
1417
+ end
1418
+
1419
+ result
1420
+ end
1421
+
1422
+ promise.execute
1423
+ end
1424
+
1425
+ #
1426
+ # Sets the ImmutabilityPolicy to Locked state. The only action allowed on a
1427
+ # Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is
1428
+ # required for this operation.
1429
+ #
1430
+ # @param resource_group_name [String] The name of the resource group within the
1431
+ # user's subscription. The name is case insensitive.
1432
+ # @param account_name [String] The name of the storage account within the
1433
+ # specified resource group. Storage account names must be between 3 and 24
1434
+ # characters in length and use numbers and lower-case letters only.
1435
+ # @param container_name [String] The name of the blob container within the
1436
+ # specified storage account. Blob container names must be between 3 and 63
1437
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1438
+ # Every dash (-) character must be immediately preceded and followed by a
1439
+ # letter or number.
1440
+ # @param if_match [String] The entity state (ETag) version of the immutability
1441
+ # policy to update. A value of "*" can be used to apply the operation only if
1442
+ # the immutability policy already exists. If omitted, this operation will
1443
+ # always be applied.
1444
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1445
+ # will be added to the HTTP request.
1446
+ #
1447
+ # @return [ImmutabilityPolicy] operation results.
1448
+ #
1449
+ def lock_immutability_policy(resource_group_name, account_name, container_name, if_match, custom_headers:nil)
1450
+ response = lock_immutability_policy_async(resource_group_name, account_name, container_name, if_match, custom_headers:custom_headers).value!
1451
+ response.body unless response.nil?
1452
+ end
1453
+
1454
+ #
1455
+ # Sets the ImmutabilityPolicy to Locked state. The only action allowed on a
1456
+ # Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is
1457
+ # required for this operation.
1458
+ #
1459
+ # @param resource_group_name [String] The name of the resource group within the
1460
+ # user's subscription. The name is case insensitive.
1461
+ # @param account_name [String] The name of the storage account within the
1462
+ # specified resource group. Storage account names must be between 3 and 24
1463
+ # characters in length and use numbers and lower-case letters only.
1464
+ # @param container_name [String] The name of the blob container within the
1465
+ # specified storage account. Blob container names must be between 3 and 63
1466
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1467
+ # Every dash (-) character must be immediately preceded and followed by a
1468
+ # letter or number.
1469
+ # @param if_match [String] The entity state (ETag) version of the immutability
1470
+ # policy to update. A value of "*" can be used to apply the operation only if
1471
+ # the immutability policy already exists. If omitted, this operation will
1472
+ # always be applied.
1473
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1474
+ # will be added to the HTTP request.
1475
+ #
1476
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1477
+ #
1478
+ def lock_immutability_policy_with_http_info(resource_group_name, account_name, container_name, if_match, custom_headers:nil)
1479
+ lock_immutability_policy_async(resource_group_name, account_name, container_name, if_match, custom_headers:custom_headers).value!
1480
+ end
1481
+
1482
+ #
1483
+ # Sets the ImmutabilityPolicy to Locked state. The only action allowed on a
1484
+ # Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is
1485
+ # required for this operation.
1486
+ #
1487
+ # @param resource_group_name [String] The name of the resource group within the
1488
+ # user's subscription. The name is case insensitive.
1489
+ # @param account_name [String] The name of the storage account within the
1490
+ # specified resource group. Storage account names must be between 3 and 24
1491
+ # characters in length and use numbers and lower-case letters only.
1492
+ # @param container_name [String] The name of the blob container within the
1493
+ # specified storage account. Blob container names must be between 3 and 63
1494
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1495
+ # Every dash (-) character must be immediately preceded and followed by a
1496
+ # letter or number.
1497
+ # @param if_match [String] The entity state (ETag) version of the immutability
1498
+ # policy to update. A value of "*" can be used to apply the operation only if
1499
+ # the immutability policy already exists. If omitted, this operation will
1500
+ # always be applied.
1501
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1502
+ # to the HTTP request.
1503
+ #
1504
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1505
+ #
1506
+ def lock_immutability_policy_async(resource_group_name, account_name, container_name, if_match, custom_headers:nil)
1507
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1508
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1509
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1510
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1511
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1512
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1513
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1514
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1515
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
1516
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
1517
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1518
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1519
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1520
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1521
+ fail ArgumentError, 'if_match is nil' if if_match.nil?
1522
+
1523
+
1524
+ request_headers = {}
1525
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1526
+
1527
+ # Set Headers
1528
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1529
+ request_headers['If-Match'] = if_match unless if_match.nil?
1530
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1531
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock'
1532
+
1533
+ request_url = @base_url || @client.base_url
1534
+
1535
+ options = {
1536
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1537
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'subscriptionId' => @client.subscription_id},
1538
+ query_params: {'api-version' => @client.api_version},
1539
+ headers: request_headers.merge(custom_headers || {}),
1540
+ base_url: request_url
1541
+ }
1542
+ promise = @client.make_request_async(:post, path_template, options)
1543
+
1544
+ promise = promise.then do |result|
1545
+ http_response = result.response
1546
+ status_code = http_response.status
1547
+ response_content = http_response.body
1548
+ unless status_code == 200
1549
+ error_model = JSON.load(response_content)
1550
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1551
+ end
1552
+
1553
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1554
+ # Deserialize Response
1555
+ if status_code == 200
1556
+ begin
1557
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1558
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::ImmutabilityPolicy.mapper()
1559
+ result.body = @client.deserialize(result_mapper, parsed_response)
1560
+ rescue Exception => e
1561
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1562
+ end
1563
+ end
1564
+
1565
+ result
1566
+ end
1567
+
1568
+ promise.execute
1569
+ end
1570
+
1571
+ #
1572
+ # Extends the immutabilityPeriodSinceCreationInDays of a locked
1573
+ # immutabilityPolicy. The only action allowed on a Locked policy will be this
1574
+ # action. ETag in If-Match is required for this operation.
1575
+ #
1576
+ # @param resource_group_name [String] The name of the resource group within the
1577
+ # user's subscription. The name is case insensitive.
1578
+ # @param account_name [String] The name of the storage account within the
1579
+ # specified resource group. Storage account names must be between 3 and 24
1580
+ # characters in length and use numbers and lower-case letters only.
1581
+ # @param container_name [String] The name of the blob container within the
1582
+ # specified storage account. Blob container names must be between 3 and 63
1583
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1584
+ # Every dash (-) character must be immediately preceded and followed by a
1585
+ # letter or number.
1586
+ # @param if_match [String] The entity state (ETag) version of the immutability
1587
+ # policy to update. A value of "*" can be used to apply the operation only if
1588
+ # the immutability policy already exists. If omitted, this operation will
1589
+ # always be applied.
1590
+ # @param parameters [ImmutabilityPolicy] The ImmutabilityPolicy Properties that
1591
+ # will be extended for a blob container.
1592
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1593
+ # will be added to the HTTP request.
1594
+ #
1595
+ # @return [ImmutabilityPolicy] operation results.
1596
+ #
1597
+ def extend_immutability_policy(resource_group_name, account_name, container_name, if_match, parameters:nil, custom_headers:nil)
1598
+ response = extend_immutability_policy_async(resource_group_name, account_name, container_name, if_match, parameters:parameters, custom_headers:custom_headers).value!
1599
+ response.body unless response.nil?
1600
+ end
1601
+
1602
+ #
1603
+ # Extends the immutabilityPeriodSinceCreationInDays of a locked
1604
+ # immutabilityPolicy. The only action allowed on a Locked policy will be this
1605
+ # action. ETag in If-Match is required for this operation.
1606
+ #
1607
+ # @param resource_group_name [String] The name of the resource group within the
1608
+ # user's subscription. The name is case insensitive.
1609
+ # @param account_name [String] The name of the storage account within the
1610
+ # specified resource group. Storage account names must be between 3 and 24
1611
+ # characters in length and use numbers and lower-case letters only.
1612
+ # @param container_name [String] The name of the blob container within the
1613
+ # specified storage account. Blob container names must be between 3 and 63
1614
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1615
+ # Every dash (-) character must be immediately preceded and followed by a
1616
+ # letter or number.
1617
+ # @param if_match [String] The entity state (ETag) version of the immutability
1618
+ # policy to update. A value of "*" can be used to apply the operation only if
1619
+ # the immutability policy already exists. If omitted, this operation will
1620
+ # always be applied.
1621
+ # @param parameters [ImmutabilityPolicy] The ImmutabilityPolicy Properties that
1622
+ # will be extended for a blob container.
1623
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1624
+ # will be added to the HTTP request.
1625
+ #
1626
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1627
+ #
1628
+ def extend_immutability_policy_with_http_info(resource_group_name, account_name, container_name, if_match, parameters:nil, custom_headers:nil)
1629
+ extend_immutability_policy_async(resource_group_name, account_name, container_name, if_match, parameters:parameters, custom_headers:custom_headers).value!
1630
+ end
1631
+
1632
+ #
1633
+ # Extends the immutabilityPeriodSinceCreationInDays of a locked
1634
+ # immutabilityPolicy. The only action allowed on a Locked policy will be this
1635
+ # action. ETag in If-Match is required for this operation.
1636
+ #
1637
+ # @param resource_group_name [String] The name of the resource group within the
1638
+ # user's subscription. The name is case insensitive.
1639
+ # @param account_name [String] The name of the storage account within the
1640
+ # specified resource group. Storage account names must be between 3 and 24
1641
+ # characters in length and use numbers and lower-case letters only.
1642
+ # @param container_name [String] The name of the blob container within the
1643
+ # specified storage account. Blob container names must be between 3 and 63
1644
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1645
+ # Every dash (-) character must be immediately preceded and followed by a
1646
+ # letter or number.
1647
+ # @param if_match [String] The entity state (ETag) version of the immutability
1648
+ # policy to update. A value of "*" can be used to apply the operation only if
1649
+ # the immutability policy already exists. If omitted, this operation will
1650
+ # always be applied.
1651
+ # @param parameters [ImmutabilityPolicy] The ImmutabilityPolicy Properties that
1652
+ # will be extended for a blob container.
1653
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1654
+ # to the HTTP request.
1655
+ #
1656
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1657
+ #
1658
+ def extend_immutability_policy_async(resource_group_name, account_name, container_name, if_match, parameters:nil, custom_headers:nil)
1659
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1660
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1661
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1662
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1663
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1664
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1665
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1666
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1667
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
1668
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
1669
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1670
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1671
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1672
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1673
+ fail ArgumentError, 'if_match is nil' if if_match.nil?
1674
+
1675
+
1676
+ request_headers = {}
1677
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1678
+
1679
+ # Set Headers
1680
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1681
+ request_headers['If-Match'] = if_match unless if_match.nil?
1682
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1683
+
1684
+ # Serialize Request
1685
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::ImmutabilityPolicy.mapper()
1686
+ request_content = @client.serialize(request_mapper, parameters)
1687
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1688
+
1689
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend'
1690
+
1691
+ request_url = @base_url || @client.base_url
1692
+
1693
+ options = {
1694
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1695
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'subscriptionId' => @client.subscription_id},
1696
+ query_params: {'api-version' => @client.api_version},
1697
+ body: request_content,
1698
+ headers: request_headers.merge(custom_headers || {}),
1699
+ base_url: request_url
1700
+ }
1701
+ promise = @client.make_request_async(:post, path_template, options)
1702
+
1703
+ promise = promise.then do |result|
1704
+ http_response = result.response
1705
+ status_code = http_response.status
1706
+ response_content = http_response.body
1707
+ unless status_code == 200
1708
+ error_model = JSON.load(response_content)
1709
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1710
+ end
1711
+
1712
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1713
+ # Deserialize Response
1714
+ if status_code == 200
1715
+ begin
1716
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1717
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::ImmutabilityPolicy.mapper()
1718
+ result.body = @client.deserialize(result_mapper, parsed_response)
1719
+ rescue Exception => e
1720
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1721
+ end
1722
+ end
1723
+
1724
+ result
1725
+ end
1726
+
1727
+ promise.execute
1728
+ end
1729
+
1730
+ #
1731
+ # The Lease Container operation establishes and manages a lock on a container
1732
+ # for delete operations. The lock duration can be 15 to 60 seconds, or can be
1733
+ # infinite.
1734
+ #
1735
+ # @param resource_group_name [String] The name of the resource group within the
1736
+ # user's subscription. The name is case insensitive.
1737
+ # @param account_name [String] The name of the storage account within the
1738
+ # specified resource group. Storage account names must be between 3 and 24
1739
+ # characters in length and use numbers and lower-case letters only.
1740
+ # @param container_name [String] The name of the blob container within the
1741
+ # specified storage account. Blob container names must be between 3 and 63
1742
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1743
+ # Every dash (-) character must be immediately preceded and followed by a
1744
+ # letter or number.
1745
+ # @param parameters [LeaseContainerRequest] Lease Container request body.
1746
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1747
+ # will be added to the HTTP request.
1748
+ #
1749
+ # @return [LeaseContainerResponse] operation results.
1750
+ #
1751
+ def lease(resource_group_name, account_name, container_name, parameters:nil, custom_headers:nil)
1752
+ response = lease_async(resource_group_name, account_name, container_name, parameters:parameters, custom_headers:custom_headers).value!
1753
+ response.body unless response.nil?
1754
+ end
1755
+
1756
+ #
1757
+ # The Lease Container operation establishes and manages a lock on a container
1758
+ # for delete operations. The lock duration can be 15 to 60 seconds, or can be
1759
+ # infinite.
1760
+ #
1761
+ # @param resource_group_name [String] The name of the resource group within the
1762
+ # user's subscription. The name is case insensitive.
1763
+ # @param account_name [String] The name of the storage account within the
1764
+ # specified resource group. Storage account names must be between 3 and 24
1765
+ # characters in length and use numbers and lower-case letters only.
1766
+ # @param container_name [String] The name of the blob container within the
1767
+ # specified storage account. Blob container names must be between 3 and 63
1768
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1769
+ # Every dash (-) character must be immediately preceded and followed by a
1770
+ # letter or number.
1771
+ # @param parameters [LeaseContainerRequest] Lease Container request body.
1772
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1773
+ # will be added to the HTTP request.
1774
+ #
1775
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1776
+ #
1777
+ def lease_with_http_info(resource_group_name, account_name, container_name, parameters:nil, custom_headers:nil)
1778
+ lease_async(resource_group_name, account_name, container_name, parameters:parameters, custom_headers:custom_headers).value!
1779
+ end
1780
+
1781
+ #
1782
+ # The Lease Container operation establishes and manages a lock on a container
1783
+ # for delete operations. The lock duration can be 15 to 60 seconds, or can be
1784
+ # infinite.
1785
+ #
1786
+ # @param resource_group_name [String] The name of the resource group within the
1787
+ # user's subscription. The name is case insensitive.
1788
+ # @param account_name [String] The name of the storage account within the
1789
+ # specified resource group. Storage account names must be between 3 and 24
1790
+ # characters in length and use numbers and lower-case letters only.
1791
+ # @param container_name [String] The name of the blob container within the
1792
+ # specified storage account. Blob container names must be between 3 and 63
1793
+ # characters in length and use numbers, lower-case letters and dash (-) only.
1794
+ # Every dash (-) character must be immediately preceded and followed by a
1795
+ # letter or number.
1796
+ # @param parameters [LeaseContainerRequest] Lease Container request body.
1797
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1798
+ # to the HTTP request.
1799
+ #
1800
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1801
+ #
1802
+ def lease_async(resource_group_name, account_name, container_name, parameters:nil, custom_headers:nil)
1803
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1804
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1805
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1806
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1807
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1808
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1809
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1810
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1811
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MaxLength': '63'" if !container_name.nil? && container_name.length > 63
1812
+ fail ArgumentError, "'container_name' should satisfy the constraint - 'MinLength': '3'" if !container_name.nil? && container_name.length < 3
1813
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1814
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1815
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1816
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1817
+
1818
+
1819
+ request_headers = {}
1820
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1821
+
1822
+ # Set Headers
1823
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1824
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1825
+
1826
+ # Serialize Request
1827
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::LeaseContainerRequest.mapper()
1828
+ request_content = @client.serialize(request_mapper, parameters)
1829
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1830
+
1831
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease'
1832
+
1833
+ request_url = @base_url || @client.base_url
1834
+
1835
+ options = {
1836
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1837
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'containerName' => container_name,'subscriptionId' => @client.subscription_id},
1838
+ query_params: {'api-version' => @client.api_version},
1839
+ body: request_content,
1840
+ headers: request_headers.merge(custom_headers || {}),
1841
+ base_url: request_url
1842
+ }
1843
+ promise = @client.make_request_async(:post, path_template, options)
1844
+
1845
+ promise = promise.then do |result|
1846
+ http_response = result.response
1847
+ status_code = http_response.status
1848
+ response_content = http_response.body
1849
+ unless status_code == 200
1850
+ error_model = JSON.load(response_content)
1851
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1852
+ end
1853
+
1854
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1855
+ # Deserialize Response
1856
+ if status_code == 200
1857
+ begin
1858
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1859
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::LeaseContainerResponse.mapper()
1860
+ result.body = @client.deserialize(result_mapper, parsed_response)
1861
+ rescue Exception => e
1862
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1863
+ end
1864
+ end
1865
+
1866
+ result
1867
+ end
1868
+
1869
+ promise.execute
1870
+ end
1871
+
1872
+ end
1873
+ end