azure_mgmt_storage 0.17.8 → 0.17.9

Sign up to get free protection for your applications and to get access to all the features.
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,266 @@
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 BlobServices
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the BlobServices 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
+ # Sets the properties of a storage account’s Blob service, including properties
26
+ # for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
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 parameters [BlobServiceProperties] The properties of a storage
34
+ # account’s Blob service, including properties for Storage Analytics and CORS
35
+ # (Cross-Origin Resource Sharing) rules.
36
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
+ # will be added to the HTTP request.
38
+ #
39
+ # @return [BlobServiceProperties] operation results.
40
+ #
41
+ def set_service_properties(resource_group_name, account_name, parameters, custom_headers:nil)
42
+ response = set_service_properties_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
43
+ response.body unless response.nil?
44
+ end
45
+
46
+ #
47
+ # Sets the properties of a storage account’s Blob service, including properties
48
+ # for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
49
+ #
50
+ # @param resource_group_name [String] The name of the resource group within the
51
+ # user's subscription. The name is case insensitive.
52
+ # @param account_name [String] The name of the storage account within the
53
+ # specified resource group. Storage account names must be between 3 and 24
54
+ # characters in length and use numbers and lower-case letters only.
55
+ # @param parameters [BlobServiceProperties] The properties of a storage
56
+ # account’s Blob service, including properties for Storage Analytics and CORS
57
+ # (Cross-Origin Resource Sharing) rules.
58
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
59
+ # will be added to the HTTP request.
60
+ #
61
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
62
+ #
63
+ def set_service_properties_with_http_info(resource_group_name, account_name, parameters, custom_headers:nil)
64
+ set_service_properties_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
65
+ end
66
+
67
+ #
68
+ # Sets the properties of a storage account’s Blob service, including properties
69
+ # for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
70
+ #
71
+ # @param resource_group_name [String] The name of the resource group within the
72
+ # user's subscription. The name is case insensitive.
73
+ # @param account_name [String] The name of the storage account within the
74
+ # specified resource group. Storage account names must be between 3 and 24
75
+ # characters in length and use numbers and lower-case letters only.
76
+ # @param parameters [BlobServiceProperties] The properties of a storage
77
+ # account’s Blob service, including properties for Storage Analytics and CORS
78
+ # (Cross-Origin Resource Sharing) rules.
79
+ # @param [Hash{String => String}] A hash of custom headers that will be added
80
+ # to the HTTP request.
81
+ #
82
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
83
+ #
84
+ def set_service_properties_async(resource_group_name, account_name, parameters, custom_headers:nil)
85
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
86
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
87
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
88
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
89
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
90
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
91
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
92
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
93
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
94
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
95
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
96
+ blob_services_name = 'default'
97
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
98
+
99
+
100
+ request_headers = {}
101
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
102
+
103
+ # Set Headers
104
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
105
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
106
+
107
+ # Serialize Request
108
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::BlobServiceProperties.mapper()
109
+ request_content = @client.serialize(request_mapper, parameters)
110
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
111
+
112
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'
113
+
114
+ request_url = @base_url || @client.base_url
115
+
116
+ options = {
117
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
118
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'BlobServicesName' => blob_services_name},
119
+ query_params: {'api-version' => @client.api_version},
120
+ body: request_content,
121
+ headers: request_headers.merge(custom_headers || {}),
122
+ base_url: request_url
123
+ }
124
+ promise = @client.make_request_async(:put, path_template, options)
125
+
126
+ promise = promise.then do |result|
127
+ http_response = result.response
128
+ status_code = http_response.status
129
+ response_content = http_response.body
130
+ unless status_code == 200
131
+ error_model = JSON.load(response_content)
132
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
133
+ end
134
+
135
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
136
+ # Deserialize Response
137
+ if status_code == 200
138
+ begin
139
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
140
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::BlobServiceProperties.mapper()
141
+ result.body = @client.deserialize(result_mapper, parsed_response)
142
+ rescue Exception => e
143
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
144
+ end
145
+ end
146
+
147
+ result
148
+ end
149
+
150
+ promise.execute
151
+ end
152
+
153
+ #
154
+ # Gets the properties of a storage account’s Blob service, including properties
155
+ # for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
156
+ #
157
+ # @param resource_group_name [String] The name of the resource group within the
158
+ # user's subscription. The name is case insensitive.
159
+ # @param account_name [String] The name of the storage account within the
160
+ # specified resource group. Storage account names must be between 3 and 24
161
+ # characters in length and use numbers and lower-case letters only.
162
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
163
+ # will be added to the HTTP request.
164
+ #
165
+ # @return [BlobServiceProperties] operation results.
166
+ #
167
+ def get_service_properties(resource_group_name, account_name, custom_headers:nil)
168
+ response = get_service_properties_async(resource_group_name, account_name, custom_headers:custom_headers).value!
169
+ response.body unless response.nil?
170
+ end
171
+
172
+ #
173
+ # Gets the properties of a storage account’s Blob service, including properties
174
+ # for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
175
+ #
176
+ # @param resource_group_name [String] The name of the resource group within the
177
+ # user's subscription. The name is case insensitive.
178
+ # @param account_name [String] The name of the storage account within the
179
+ # specified resource group. Storage account names must be between 3 and 24
180
+ # characters in length and use numbers and lower-case letters only.
181
+ # @param 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 get_service_properties_with_http_info(resource_group_name, account_name, custom_headers:nil)
187
+ get_service_properties_async(resource_group_name, account_name, custom_headers:custom_headers).value!
188
+ end
189
+
190
+ #
191
+ # Gets the properties of a storage account’s Blob service, including properties
192
+ # for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
193
+ #
194
+ # @param resource_group_name [String] The name of the resource group within the
195
+ # user's subscription. The name is case insensitive.
196
+ # @param account_name [String] The name of the storage account within the
197
+ # specified resource group. Storage account names must be between 3 and 24
198
+ # characters in length and use numbers and lower-case letters only.
199
+ # @param [Hash{String => String}] A hash of custom headers that will be added
200
+ # to the HTTP request.
201
+ #
202
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
203
+ #
204
+ def get_service_properties_async(resource_group_name, account_name, custom_headers:nil)
205
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
206
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
207
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
208
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
209
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
210
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
211
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
212
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
213
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
214
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
215
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
216
+ blob_services_name = 'default'
217
+
218
+
219
+ request_headers = {}
220
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
221
+
222
+ # Set Headers
223
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
224
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
225
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}'
226
+
227
+ request_url = @base_url || @client.base_url
228
+
229
+ options = {
230
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
231
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'BlobServicesName' => blob_services_name},
232
+ query_params: {'api-version' => @client.api_version},
233
+ headers: request_headers.merge(custom_headers || {}),
234
+ base_url: request_url
235
+ }
236
+ promise = @client.make_request_async(:get, path_template, options)
237
+
238
+ promise = promise.then do |result|
239
+ http_response = result.response
240
+ status_code = http_response.status
241
+ response_content = http_response.body
242
+ unless status_code == 200
243
+ error_model = JSON.load(response_content)
244
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
245
+ end
246
+
247
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
248
+ # Deserialize Response
249
+ if status_code == 200
250
+ begin
251
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
252
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::BlobServiceProperties.mapper()
253
+ result.body = @client.deserialize(result_mapper, parsed_response)
254
+ rescue Exception => e
255
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
256
+ end
257
+ end
258
+
259
+ result
260
+ end
261
+
262
+ promise.execute
263
+ end
264
+
265
+ end
266
+ end
@@ -0,0 +1,355 @@
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 ManagementPolicies
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ManagementPolicies 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
+ # Gets the managementpolicy associated with the specified storage account.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group within the
28
+ # user's subscription. The name is case insensitive.
29
+ # @param account_name [String] The name of the storage account within the
30
+ # specified resource group. Storage account names must be between 3 and 24
31
+ # characters in length and use numbers and lower-case letters only.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [ManagementPolicy] operation results.
36
+ #
37
+ def get(resource_group_name, account_name, custom_headers:nil)
38
+ response = get_async(resource_group_name, account_name, custom_headers:custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # Gets the managementpolicy associated with the specified storage account.
44
+ #
45
+ # @param resource_group_name [String] The name of the resource group within the
46
+ # user's subscription. The name is case insensitive.
47
+ # @param account_name [String] The name of the storage account within the
48
+ # specified resource group. Storage account names must be between 3 and 24
49
+ # characters in length and use numbers and lower-case letters only.
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def get_with_http_info(resource_group_name, account_name, custom_headers:nil)
56
+ get_async(resource_group_name, account_name, custom_headers:custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # Gets the managementpolicy associated with the specified storage account.
61
+ #
62
+ # @param resource_group_name [String] The name of the resource group within the
63
+ # user's subscription. The name is case insensitive.
64
+ # @param account_name [String] The name of the storage account within the
65
+ # specified resource group. Storage account names must be between 3 and 24
66
+ # characters in length and use numbers and lower-case letters only.
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def get_async(resource_group_name, account_name, custom_headers:nil)
73
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
74
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
75
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
76
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
77
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
78
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
79
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
80
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
81
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
82
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
83
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
84
+ management_policy_name = 'default'
85
+
86
+
87
+ request_headers = {}
88
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
89
+
90
+ # Set Headers
91
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
92
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
93
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'
94
+
95
+ request_url = @base_url || @client.base_url
96
+
97
+ options = {
98
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
99
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'managementPolicyName' => management_policy_name},
100
+ query_params: {'api-version' => @client.api_version},
101
+ headers: request_headers.merge(custom_headers || {}),
102
+ base_url: request_url
103
+ }
104
+ promise = @client.make_request_async(:get, path_template, options)
105
+
106
+ promise = promise.then do |result|
107
+ http_response = result.response
108
+ status_code = http_response.status
109
+ response_content = http_response.body
110
+ unless status_code == 200
111
+ error_model = JSON.load(response_content)
112
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
113
+ end
114
+
115
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
116
+ # Deserialize Response
117
+ if status_code == 200
118
+ begin
119
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
120
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::ManagementPolicy.mapper()
121
+ result.body = @client.deserialize(result_mapper, parsed_response)
122
+ rescue Exception => e
123
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
124
+ end
125
+ end
126
+
127
+ result
128
+ end
129
+
130
+ promise.execute
131
+ end
132
+
133
+ #
134
+ # Sets the managementpolicy to the specified storage account.
135
+ #
136
+ # @param resource_group_name [String] The name of the resource group within the
137
+ # user's subscription. The name is case insensitive.
138
+ # @param account_name [String] The name of the storage account within the
139
+ # specified resource group. Storage account names must be between 3 and 24
140
+ # characters in length and use numbers and lower-case letters only.
141
+ # @param properties [ManagementPolicy] The ManagementPolicy set to a storage
142
+ # account.
143
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
144
+ # will be added to the HTTP request.
145
+ #
146
+ # @return [ManagementPolicy] operation results.
147
+ #
148
+ def create_or_update(resource_group_name, account_name, properties, custom_headers:nil)
149
+ response = create_or_update_async(resource_group_name, account_name, properties, custom_headers:custom_headers).value!
150
+ response.body unless response.nil?
151
+ end
152
+
153
+ #
154
+ # Sets the managementpolicy to the specified storage account.
155
+ #
156
+ # @param resource_group_name [String] The name of the resource group within the
157
+ # user's subscription. The name is case insensitive.
158
+ # @param account_name [String] The name of the storage account within the
159
+ # specified resource group. Storage account names must be between 3 and 24
160
+ # characters in length and use numbers and lower-case letters only.
161
+ # @param properties [ManagementPolicy] The ManagementPolicy set to a storage
162
+ # account.
163
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
164
+ # will be added to the HTTP request.
165
+ #
166
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
167
+ #
168
+ def create_or_update_with_http_info(resource_group_name, account_name, properties, custom_headers:nil)
169
+ create_or_update_async(resource_group_name, account_name, properties, custom_headers:custom_headers).value!
170
+ end
171
+
172
+ #
173
+ # Sets the managementpolicy to the specified storage account.
174
+ #
175
+ # @param resource_group_name [String] The name of the resource group within the
176
+ # user's subscription. The name is case insensitive.
177
+ # @param account_name [String] The name of the storage account within the
178
+ # specified resource group. Storage account names must be between 3 and 24
179
+ # characters in length and use numbers and lower-case letters only.
180
+ # @param properties [ManagementPolicy] The ManagementPolicy set to a storage
181
+ # account.
182
+ # @param [Hash{String => String}] A hash of custom headers that will be added
183
+ # to the HTTP request.
184
+ #
185
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
186
+ #
187
+ def create_or_update_async(resource_group_name, account_name, properties, custom_headers:nil)
188
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
189
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
190
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
191
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
192
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
193
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
194
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
195
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
196
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
197
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
198
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
199
+ management_policy_name = 'default'
200
+ fail ArgumentError, 'properties is nil' if properties.nil?
201
+
202
+
203
+ request_headers = {}
204
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
205
+
206
+ # Set Headers
207
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
208
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
209
+
210
+ # Serialize Request
211
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::ManagementPolicy.mapper()
212
+ request_content = @client.serialize(request_mapper, properties)
213
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
214
+
215
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'
216
+
217
+ request_url = @base_url || @client.base_url
218
+
219
+ options = {
220
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
221
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'managementPolicyName' => management_policy_name},
222
+ query_params: {'api-version' => @client.api_version},
223
+ body: request_content,
224
+ headers: request_headers.merge(custom_headers || {}),
225
+ base_url: request_url
226
+ }
227
+ promise = @client.make_request_async(:put, path_template, options)
228
+
229
+ promise = promise.then do |result|
230
+ http_response = result.response
231
+ status_code = http_response.status
232
+ response_content = http_response.body
233
+ unless status_code == 200
234
+ error_model = JSON.load(response_content)
235
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
236
+ end
237
+
238
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
239
+ # Deserialize Response
240
+ if status_code == 200
241
+ begin
242
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
243
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::ManagementPolicy.mapper()
244
+ result.body = @client.deserialize(result_mapper, parsed_response)
245
+ rescue Exception => e
246
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
247
+ end
248
+ end
249
+
250
+ result
251
+ end
252
+
253
+ promise.execute
254
+ end
255
+
256
+ #
257
+ # Deletes the managementpolicy associated with the specified storage account.
258
+ #
259
+ # @param resource_group_name [String] The name of the resource group within the
260
+ # user's subscription. The name is case insensitive.
261
+ # @param account_name [String] The name of the storage account within the
262
+ # specified resource group. Storage account names must be between 3 and 24
263
+ # characters in length and use numbers and lower-case letters only.
264
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
265
+ # will be added to the HTTP request.
266
+ #
267
+ #
268
+ def delete(resource_group_name, account_name, custom_headers:nil)
269
+ response = delete_async(resource_group_name, account_name, custom_headers:custom_headers).value!
270
+ nil
271
+ end
272
+
273
+ #
274
+ # Deletes the managementpolicy associated with the specified storage account.
275
+ #
276
+ # @param resource_group_name [String] The name of the resource group within the
277
+ # user's subscription. The name is case insensitive.
278
+ # @param account_name [String] The name of the storage account within the
279
+ # specified resource group. Storage account names must be between 3 and 24
280
+ # characters in length and use numbers and lower-case letters only.
281
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
282
+ # will be added to the HTTP request.
283
+ #
284
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
285
+ #
286
+ def delete_with_http_info(resource_group_name, account_name, custom_headers:nil)
287
+ delete_async(resource_group_name, account_name, custom_headers:custom_headers).value!
288
+ end
289
+
290
+ #
291
+ # Deletes the managementpolicy associated with the specified storage account.
292
+ #
293
+ # @param resource_group_name [String] The name of the resource group within the
294
+ # user's subscription. The name is case insensitive.
295
+ # @param account_name [String] The name of the storage account within the
296
+ # specified resource group. Storage account names must be between 3 and 24
297
+ # characters in length and use numbers and lower-case letters only.
298
+ # @param [Hash{String => String}] A hash of custom headers that will be added
299
+ # to the HTTP request.
300
+ #
301
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
302
+ #
303
+ def delete_async(resource_group_name, account_name, custom_headers:nil)
304
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
305
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
306
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
307
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
308
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
309
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
310
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
311
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
312
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
313
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
314
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
315
+ management_policy_name = 'default'
316
+
317
+
318
+ request_headers = {}
319
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
320
+
321
+ # Set Headers
322
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
323
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
324
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'
325
+
326
+ request_url = @base_url || @client.base_url
327
+
328
+ options = {
329
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
330
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'managementPolicyName' => management_policy_name},
331
+ query_params: {'api-version' => @client.api_version},
332
+ headers: request_headers.merge(custom_headers || {}),
333
+ base_url: request_url
334
+ }
335
+ promise = @client.make_request_async(:delete, path_template, options)
336
+
337
+ promise = promise.then do |result|
338
+ http_response = result.response
339
+ status_code = http_response.status
340
+ response_content = http_response.body
341
+ unless status_code == 200 || status_code == 204
342
+ error_model = JSON.load(response_content)
343
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
344
+ end
345
+
346
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
347
+
348
+ result
349
+ end
350
+
351
+ promise.execute
352
+ end
353
+
354
+ end
355
+ end