azure_mgmt_storage 0.18.1 → 0.18.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-05-01-preview/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  3. data/lib/2015-06-15/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  4. data/lib/2016-01-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  5. data/lib/2016-12-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  6. data/lib/2017-06-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  7. data/lib/2017-10-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  8. data/lib/2018-02-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  9. data/lib/2018-03-01-preview/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  10. data/lib/2018-07-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  11. data/lib/2018-11-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  12. data/lib/2019-04-01/generated/azure_mgmt_storage.rb +22 -20
  13. data/lib/2019-04-01/generated/azure_mgmt_storage/models/active_directory_properties.rb +103 -0
  14. data/lib/2019-04-01/generated/azure_mgmt_storage/models/azure_files_identity_based_authentication.rb +13 -1
  15. data/lib/2019-04-01/generated/azure_mgmt_storage/models/directory_service_options.rb +1 -0
  16. data/lib/2019-04-01/generated/azure_mgmt_storage/models/list_key_expand.rb +15 -0
  17. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_regenerate_key_parameters.rb +1 -1
  18. data/lib/2019-04-01/generated/azure_mgmt_storage/storage_accounts.rb +27 -15
  19. data/lib/2019-04-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  20. data/lib/2019-06-01/generated/azure_mgmt_storage.rb +152 -0
  21. data/lib/2019-06-01/generated/azure_mgmt_storage/blob_containers.rb +2034 -0
  22. data/lib/2019-06-01/generated/azure_mgmt_storage/blob_services.rb +383 -0
  23. data/lib/2019-06-01/generated/azure_mgmt_storage/file_services.rb +377 -0
  24. data/lib/2019-06-01/generated/azure_mgmt_storage/file_shares.rb +798 -0
  25. data/lib/2019-06-01/generated/azure_mgmt_storage/management_policies.rb +361 -0
  26. data/lib/2019-06-01/generated/azure_mgmt_storage/models/access_tier.rb +16 -0
  27. data/lib/2019-06-01/generated/azure_mgmt_storage/models/account_sas_parameters.rb +136 -0
  28. data/lib/2019-06-01/generated/azure_mgmt_storage/models/account_status.rb +16 -0
  29. data/lib/2019-06-01/generated/azure_mgmt_storage/models/action.rb +15 -0
  30. data/lib/2019-06-01/generated/azure_mgmt_storage/models/active_directory_properties.rb +103 -0
  31. data/lib/2019-06-01/generated/azure_mgmt_storage/models/azure_entity_resource.rb +75 -0
  32. data/lib/2019-06-01/generated/azure_mgmt_storage/models/azure_files_identity_based_authentication.rb +59 -0
  33. data/lib/2019-06-01/generated/azure_mgmt_storage/models/blob_container.rb +217 -0
  34. data/lib/2019-06-01/generated/azure_mgmt_storage/models/blob_service_items.rb +57 -0
  35. data/lib/2019-06-01/generated/azure_mgmt_storage/models/blob_service_properties.rb +141 -0
  36. data/lib/2019-06-01/generated/azure_mgmt_storage/models/bypass.rb +18 -0
  37. data/lib/2019-06-01/generated/azure_mgmt_storage/models/change_feed.rb +47 -0
  38. data/lib/2019-06-01/generated/azure_mgmt_storage/models/check_name_availability_result.rb +77 -0
  39. data/lib/2019-06-01/generated/azure_mgmt_storage/models/cors_rule.rb +128 -0
  40. data/lib/2019-06-01/generated/azure_mgmt_storage/models/cors_rules.rb +57 -0
  41. data/lib/2019-06-01/generated/azure_mgmt_storage/models/custom_domain.rb +60 -0
  42. data/lib/2019-06-01/generated/azure_mgmt_storage/models/date_after_creation.rb +50 -0
  43. data/lib/2019-06-01/generated/azure_mgmt_storage/models/date_after_modification.rb +51 -0
  44. data/lib/2019-06-01/generated/azure_mgmt_storage/models/default_action.rb +16 -0
  45. data/lib/2019-06-01/generated/azure_mgmt_storage/models/delete_retention_policy.rb +64 -0
  46. data/lib/2019-06-01/generated/azure_mgmt_storage/models/dimension.rb +57 -0
  47. data/lib/2019-06-01/generated/azure_mgmt_storage/models/directory_service_options.rb +17 -0
  48. data/lib/2019-06-01/generated/azure_mgmt_storage/models/encryption.rb +74 -0
  49. data/lib/2019-06-01/generated/azure_mgmt_storage/models/encryption_service.rb +62 -0
  50. data/lib/2019-06-01/generated/azure_mgmt_storage/models/encryption_services.rb +89 -0
  51. data/lib/2019-06-01/generated/azure_mgmt_storage/models/endpoints.rb +108 -0
  52. data/lib/2019-06-01/generated/azure_mgmt_storage/models/error_response.rb +59 -0
  53. data/lib/2019-06-01/generated/azure_mgmt_storage/models/file_service_items.rb +57 -0
  54. data/lib/2019-06-01/generated/azure_mgmt_storage/models/file_service_properties.rb +90 -0
  55. data/lib/2019-06-01/generated/azure_mgmt_storage/models/file_share.rb +121 -0
  56. data/lib/2019-06-01/generated/azure_mgmt_storage/models/file_share_item.rb +120 -0
  57. data/lib/2019-06-01/generated/azure_mgmt_storage/models/file_share_items.rb +103 -0
  58. data/lib/2019-06-01/generated/azure_mgmt_storage/models/geo_replication_stats.rb +85 -0
  59. data/lib/2019-06-01/generated/azure_mgmt_storage/models/geo_replication_status.rb +17 -0
  60. data/lib/2019-06-01/generated/azure_mgmt_storage/models/http_protocol.rb +16 -0
  61. data/lib/2019-06-01/generated/azure_mgmt_storage/models/identity.rb +72 -0
  62. data/lib/2019-06-01/generated/azure_mgmt_storage/models/immutability_policy.rb +98 -0
  63. data/lib/2019-06-01/generated/azure_mgmt_storage/models/immutability_policy_properties.rb +95 -0
  64. data/lib/2019-06-01/generated/azure_mgmt_storage/models/immutability_policy_state.rb +16 -0
  65. data/lib/2019-06-01/generated/azure_mgmt_storage/models/immutability_policy_update_type.rb +17 -0
  66. data/lib/2019-06-01/generated/azure_mgmt_storage/models/iprule.rb +61 -0
  67. data/lib/2019-06-01/generated/azure_mgmt_storage/models/key_permission.rb +16 -0
  68. data/lib/2019-06-01/generated/azure_mgmt_storage/models/key_source.rb +16 -0
  69. data/lib/2019-06-01/generated/azure_mgmt_storage/models/key_vault_properties.rb +68 -0
  70. data/lib/2019-06-01/generated/azure_mgmt_storage/models/kind.rb +19 -0
  71. data/lib/2019-06-01/generated/azure_mgmt_storage/models/large_file_shares_state.rb +16 -0
  72. data/lib/2019-06-01/generated/azure_mgmt_storage/models/lease_container_request.rb +97 -0
  73. data/lib/2019-06-01/generated/azure_mgmt_storage/models/lease_container_response.rb +60 -0
  74. data/lib/2019-06-01/generated/azure_mgmt_storage/models/lease_duration.rb +16 -0
  75. data/lib/2019-06-01/generated/azure_mgmt_storage/models/lease_state.rb +19 -0
  76. data/lib/2019-06-01/generated/azure_mgmt_storage/models/lease_status.rb +16 -0
  77. data/lib/2019-06-01/generated/azure_mgmt_storage/models/legal_hold.rb +71 -0
  78. data/lib/2019-06-01/generated/azure_mgmt_storage/models/legal_hold_properties.rb +72 -0
  79. data/lib/2019-06-01/generated/azure_mgmt_storage/models/list_account_sas_response.rb +47 -0
  80. data/lib/2019-06-01/generated/azure_mgmt_storage/models/list_container_item.rb +216 -0
  81. data/lib/2019-06-01/generated/azure_mgmt_storage/models/list_container_items.rb +103 -0
  82. data/lib/2019-06-01/generated/azure_mgmt_storage/models/list_key_expand.rb +15 -0
  83. data/lib/2019-06-01/generated/azure_mgmt_storage/models/list_service_sas_response.rb +47 -0
  84. data/lib/2019-06-01/generated/azure_mgmt_storage/models/management_policy.rb +89 -0
  85. data/lib/2019-06-01/generated/azure_mgmt_storage/models/management_policy_action.rb +62 -0
  86. data/lib/2019-06-01/generated/azure_mgmt_storage/models/management_policy_base_blob.rb +73 -0
  87. data/lib/2019-06-01/generated/azure_mgmt_storage/models/management_policy_definition.rb +60 -0
  88. data/lib/2019-06-01/generated/azure_mgmt_storage/models/management_policy_filter.rb +76 -0
  89. data/lib/2019-06-01/generated/azure_mgmt_storage/models/management_policy_rule.rb +87 -0
  90. data/lib/2019-06-01/generated/azure_mgmt_storage/models/management_policy_schema.rb +58 -0
  91. data/lib/2019-06-01/generated/azure_mgmt_storage/models/management_policy_snap_shot.rb +47 -0
  92. data/lib/2019-06-01/generated/azure_mgmt_storage/models/metric_specification.rb +145 -0
  93. data/lib/2019-06-01/generated/azure_mgmt_storage/models/network_rule_set.rb +106 -0
  94. data/lib/2019-06-01/generated/azure_mgmt_storage/models/operation.rb +83 -0
  95. data/lib/2019-06-01/generated/azure_mgmt_storage/models/operation_display.rb +79 -0
  96. data/lib/2019-06-01/generated/azure_mgmt_storage/models/operation_list_result.rb +57 -0
  97. data/lib/2019-06-01/generated/azure_mgmt_storage/models/permissions.rb +22 -0
  98. data/lib/2019-06-01/generated/azure_mgmt_storage/models/private_endpoint.rb +47 -0
  99. data/lib/2019-06-01/generated/azure_mgmt_storage/models/private_endpoint_connection.rb +101 -0
  100. data/lib/2019-06-01/generated/azure_mgmt_storage/models/private_endpoint_connection_provisioning_state.rb +18 -0
  101. data/lib/2019-06-01/generated/azure_mgmt_storage/models/private_endpoint_service_connection_status.rb +17 -0
  102. data/lib/2019-06-01/generated/azure_mgmt_storage/models/private_link_resource.rb +115 -0
  103. data/lib/2019-06-01/generated/azure_mgmt_storage/models/private_link_resource_list_result.rb +55 -0
  104. data/lib/2019-06-01/generated/azure_mgmt_storage/models/private_link_service_connection_state.rb +72 -0
  105. data/lib/2019-06-01/generated/azure_mgmt_storage/models/provisioning_state.rb +17 -0
  106. data/lib/2019-06-01/generated/azure_mgmt_storage/models/proxy_resource.rb +63 -0
  107. data/lib/2019-06-01/generated/azure_mgmt_storage/models/public_access.rb +17 -0
  108. data/lib/2019-06-01/generated/azure_mgmt_storage/models/reason.rb +16 -0
  109. data/lib/2019-06-01/generated/azure_mgmt_storage/models/reason_code.rb +16 -0
  110. data/lib/2019-06-01/generated/azure_mgmt_storage/models/resource.rb +83 -0
  111. data/lib/2019-06-01/generated/azure_mgmt_storage/models/restriction.rb +85 -0
  112. data/lib/2019-06-01/generated/azure_mgmt_storage/models/service_sas_parameters.rb +247 -0
  113. data/lib/2019-06-01/generated/azure_mgmt_storage/models/service_specification.rb +56 -0
  114. data/lib/2019-06-01/generated/azure_mgmt_storage/models/services.rb +18 -0
  115. data/lib/2019-06-01/generated/azure_mgmt_storage/models/signed_resource.rb +18 -0
  116. data/lib/2019-06-01/generated/azure_mgmt_storage/models/signed_resource_types.rb +17 -0
  117. data/lib/2019-06-01/generated/azure_mgmt_storage/models/sku.rb +157 -0
  118. data/lib/2019-06-01/generated/azure_mgmt_storage/models/sku_name.rb +22 -0
  119. data/lib/2019-06-01/generated/azure_mgmt_storage/models/sku_tier.rb +16 -0
  120. data/lib/2019-06-01/generated/azure_mgmt_storage/models/skucapability.rb +63 -0
  121. data/lib/2019-06-01/generated/azure_mgmt_storage/models/state.rb +19 -0
  122. data/lib/2019-06-01/generated/azure_mgmt_storage/models/storage_account.rb +410 -0
  123. data/lib/2019-06-01/generated/azure_mgmt_storage/models/storage_account_check_name_availability_parameters.rb +63 -0
  124. data/lib/2019-06-01/generated/azure_mgmt_storage/models/storage_account_create_parameters.rb +215 -0
  125. data/lib/2019-06-01/generated/azure_mgmt_storage/models/storage_account_expand.rb +15 -0
  126. data/lib/2019-06-01/generated/azure_mgmt_storage/models/storage_account_key.rb +73 -0
  127. data/lib/2019-06-01/generated/azure_mgmt_storage/models/storage_account_list_keys_result.rb +57 -0
  128. data/lib/2019-06-01/generated/azure_mgmt_storage/models/storage_account_list_result.rb +103 -0
  129. data/lib/2019-06-01/generated/azure_mgmt_storage/models/storage_account_regenerate_key_parameters.rb +47 -0
  130. data/lib/2019-06-01/generated/azure_mgmt_storage/models/storage_account_update_parameters.rb +192 -0
  131. data/lib/2019-06-01/generated/azure_mgmt_storage/models/storage_sku_list_result.rb +57 -0
  132. data/lib/2019-06-01/generated/azure_mgmt_storage/models/tag_property.rb +97 -0
  133. data/lib/2019-06-01/generated/azure_mgmt_storage/models/tracked_resource.rb +92 -0
  134. data/lib/2019-06-01/generated/azure_mgmt_storage/models/update_history_property.rb +114 -0
  135. data/lib/2019-06-01/generated/azure_mgmt_storage/models/usage.rb +89 -0
  136. data/lib/2019-06-01/generated/azure_mgmt_storage/models/usage_list_result.rb +56 -0
  137. data/lib/2019-06-01/generated/azure_mgmt_storage/models/usage_name.rb +59 -0
  138. data/lib/2019-06-01/generated/azure_mgmt_storage/models/usage_unit.rb +20 -0
  139. data/lib/2019-06-01/generated/azure_mgmt_storage/models/virtual_network_rule.rb +75 -0
  140. data/lib/2019-06-01/generated/azure_mgmt_storage/module_definition.rb +9 -0
  141. data/lib/2019-06-01/generated/azure_mgmt_storage/operations.rb +110 -0
  142. data/lib/2019-06-01/generated/azure_mgmt_storage/private_endpoint_connections.rb +388 -0
  143. data/lib/2019-06-01/generated/azure_mgmt_storage/private_link_resources.rb +138 -0
  144. data/lib/2019-06-01/generated/azure_mgmt_storage/skus.rb +116 -0
  145. data/lib/2019-06-01/generated/azure_mgmt_storage/storage_accounts.rb +1754 -0
  146. data/lib/2019-06-01/generated/azure_mgmt_storage/storage_management_client.rb +171 -0
  147. data/lib/2019-06-01/generated/azure_mgmt_storage/usages.rb +120 -0
  148. data/lib/azure_mgmt_storage.rb +1 -0
  149. data/lib/profiles/latest/modules/storage_profile_module.rb +305 -261
  150. data/lib/version.rb +1 -1
  151. metadata +132 -2
@@ -0,0 +1,361 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Storage::Mgmt::V2019_06_01
7
+ #
8
+ # The Azure Storage Management API.
9
+ #
10
+ class 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
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
117
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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_06_01::Models::ManagementPolicy.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
+ # Sets the managementpolicy to the specified storage account.
137
+ #
138
+ # @param resource_group_name [String] The name of the resource group within the
139
+ # user's subscription. The name is case insensitive.
140
+ # @param account_name [String] The name of the storage account within the
141
+ # specified resource group. Storage account names must be between 3 and 24
142
+ # characters in length and use numbers and lower-case letters only.
143
+ # @param properties [ManagementPolicy] The ManagementPolicy set to a storage
144
+ # account.
145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
146
+ # will be added to the HTTP request.
147
+ #
148
+ # @return [ManagementPolicy] operation results.
149
+ #
150
+ def create_or_update(resource_group_name, account_name, properties, custom_headers:nil)
151
+ response = create_or_update_async(resource_group_name, account_name, properties, custom_headers:custom_headers).value!
152
+ response.body unless response.nil?
153
+ end
154
+
155
+ #
156
+ # Sets the managementpolicy to the specified storage account.
157
+ #
158
+ # @param resource_group_name [String] The name of the resource group within the
159
+ # user's subscription. The name is case insensitive.
160
+ # @param account_name [String] The name of the storage account within the
161
+ # specified resource group. Storage account names must be between 3 and 24
162
+ # characters in length and use numbers and lower-case letters only.
163
+ # @param properties [ManagementPolicy] The ManagementPolicy set to a storage
164
+ # account.
165
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
166
+ # will be added to the HTTP request.
167
+ #
168
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
169
+ #
170
+ def create_or_update_with_http_info(resource_group_name, account_name, properties, custom_headers:nil)
171
+ create_or_update_async(resource_group_name, account_name, properties, custom_headers:custom_headers).value!
172
+ end
173
+
174
+ #
175
+ # Sets the managementpolicy to the specified storage account.
176
+ #
177
+ # @param resource_group_name [String] The name of the resource group within the
178
+ # user's subscription. The name is case insensitive.
179
+ # @param account_name [String] The name of the storage account within the
180
+ # specified resource group. Storage account names must be between 3 and 24
181
+ # characters in length and use numbers and lower-case letters only.
182
+ # @param properties [ManagementPolicy] The ManagementPolicy set to a storage
183
+ # account.
184
+ # @param [Hash{String => String}] A hash of custom headers that will be added
185
+ # to the HTTP request.
186
+ #
187
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
188
+ #
189
+ def create_or_update_async(resource_group_name, account_name, properties, custom_headers:nil)
190
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
191
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
192
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
193
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
194
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
195
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
196
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
197
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
198
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
199
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
200
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
201
+ management_policy_name = 'default'
202
+ fail ArgumentError, 'properties is nil' if properties.nil?
203
+
204
+
205
+ request_headers = {}
206
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
207
+
208
+ # Set Headers
209
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
210
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
211
+
212
+ # Serialize Request
213
+ request_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::ManagementPolicy.mapper()
214
+ request_content = @client.serialize(request_mapper, properties)
215
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
216
+
217
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'
218
+
219
+ request_url = @base_url || @client.base_url
220
+
221
+ options = {
222
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
223
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'managementPolicyName' => management_policy_name},
224
+ query_params: {'api-version' => @client.api_version},
225
+ body: request_content,
226
+ headers: request_headers.merge(custom_headers || {}),
227
+ base_url: request_url
228
+ }
229
+ promise = @client.make_request_async(:put, path_template, options)
230
+
231
+ promise = promise.then do |result|
232
+ http_response = result.response
233
+ status_code = http_response.status
234
+ response_content = http_response.body
235
+ unless status_code == 200
236
+ error_model = JSON.load(response_content)
237
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
238
+ end
239
+
240
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
241
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
242
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
243
+ # Deserialize Response
244
+ if status_code == 200
245
+ begin
246
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
247
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::ManagementPolicy.mapper()
248
+ result.body = @client.deserialize(result_mapper, parsed_response)
249
+ rescue Exception => e
250
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
251
+ end
252
+ end
253
+
254
+ result
255
+ end
256
+
257
+ promise.execute
258
+ end
259
+
260
+ #
261
+ # Deletes the managementpolicy associated with the specified storage account.
262
+ #
263
+ # @param resource_group_name [String] The name of the resource group within the
264
+ # user's subscription. The name is case insensitive.
265
+ # @param account_name [String] The name of the storage account within the
266
+ # specified resource group. Storage account names must be between 3 and 24
267
+ # characters in length and use numbers and lower-case letters only.
268
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
269
+ # will be added to the HTTP request.
270
+ #
271
+ #
272
+ def delete(resource_group_name, account_name, custom_headers:nil)
273
+ response = delete_async(resource_group_name, account_name, custom_headers:custom_headers).value!
274
+ nil
275
+ end
276
+
277
+ #
278
+ # Deletes the managementpolicy associated with the specified storage account.
279
+ #
280
+ # @param resource_group_name [String] The name of the resource group within the
281
+ # user's subscription. The name is case insensitive.
282
+ # @param account_name [String] The name of the storage account within the
283
+ # specified resource group. Storage account names must be between 3 and 24
284
+ # characters in length and use numbers and lower-case letters only.
285
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
286
+ # will be added to the HTTP request.
287
+ #
288
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
289
+ #
290
+ def delete_with_http_info(resource_group_name, account_name, custom_headers:nil)
291
+ delete_async(resource_group_name, account_name, custom_headers:custom_headers).value!
292
+ end
293
+
294
+ #
295
+ # Deletes the managementpolicy associated with the specified storage account.
296
+ #
297
+ # @param resource_group_name [String] The name of the resource group within the
298
+ # user's subscription. The name is case insensitive.
299
+ # @param account_name [String] The name of the storage account within the
300
+ # specified resource group. Storage account names must be between 3 and 24
301
+ # characters in length and use numbers and lower-case letters only.
302
+ # @param [Hash{String => String}] A hash of custom headers that will be added
303
+ # to the HTTP request.
304
+ #
305
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
306
+ #
307
+ def delete_async(resource_group_name, account_name, custom_headers:nil)
308
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
309
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
310
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
311
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
312
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
313
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
314
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
315
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
316
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
317
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
318
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
319
+ management_policy_name = 'default'
320
+
321
+
322
+ request_headers = {}
323
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
324
+
325
+ # Set Headers
326
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
327
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
328
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}'
329
+
330
+ request_url = @base_url || @client.base_url
331
+
332
+ options = {
333
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
334
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'managementPolicyName' => management_policy_name},
335
+ query_params: {'api-version' => @client.api_version},
336
+ headers: request_headers.merge(custom_headers || {}),
337
+ base_url: request_url
338
+ }
339
+ promise = @client.make_request_async(:delete, path_template, options)
340
+
341
+ promise = promise.then do |result|
342
+ http_response = result.response
343
+ status_code = http_response.status
344
+ response_content = http_response.body
345
+ unless status_code == 200 || status_code == 204
346
+ error_model = JSON.load(response_content)
347
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
348
+ end
349
+
350
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
351
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
352
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
353
+
354
+ result
355
+ end
356
+
357
+ promise.execute
358
+ end
359
+
360
+ end
361
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Storage::Mgmt::V2019_06_01
7
+ module Models
8
+ #
9
+ # Defines values for AccessTier
10
+ #
11
+ module AccessTier
12
+ Hot = "Hot"
13
+ Cool = "Cool"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,136 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Storage::Mgmt::V2019_06_01
7
+ module Models
8
+ #
9
+ # The parameters to list SAS credentials of a storage account.
10
+ #
11
+ class AccountSasParameters
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Services] The signed services accessible with the account SAS.
16
+ # Possible values include: Blob (b), Queue (q), Table (t), File (f).
17
+ # Possible values include: 'b', 'q', 't', 'f'
18
+ attr_accessor :services
19
+
20
+ # @return [SignedResourceTypes] The signed resource types that are
21
+ # accessible with the account SAS. Service (s): Access to service-level
22
+ # APIs; Container (c): Access to container-level APIs; Object (o): Access
23
+ # to object-level APIs for blobs, queue messages, table entities, and
24
+ # files. Possible values include: 's', 'c', 'o'
25
+ attr_accessor :resource_types
26
+
27
+ # @return [Permissions] The signed permissions for the account SAS.
28
+ # Possible values include: Read (r), Write (w), Delete (d), List (l), Add
29
+ # (a), Create (c), Update (u) and Process (p). Possible values include:
30
+ # 'r', 'd', 'w', 'l', 'a', 'c', 'u', 'p'
31
+ attr_accessor :permissions
32
+
33
+ # @return [String] An IP address or a range of IP addresses from which to
34
+ # accept requests.
35
+ attr_accessor :ipaddress_or_range
36
+
37
+ # @return [HttpProtocol] The protocol permitted for a request made with
38
+ # the account SAS. Possible values include: 'https,http', 'https'
39
+ attr_accessor :protocols
40
+
41
+ # @return [DateTime] The time at which the SAS becomes valid.
42
+ attr_accessor :shared_access_start_time
43
+
44
+ # @return [DateTime] The time at which the shared access signature
45
+ # becomes invalid.
46
+ attr_accessor :shared_access_expiry_time
47
+
48
+ # @return [String] The key to sign the account SAS token with.
49
+ attr_accessor :key_to_sign
50
+
51
+
52
+ #
53
+ # Mapper for AccountSasParameters class as Ruby Hash.
54
+ # This will be used for serialization/deserialization.
55
+ #
56
+ def self.mapper()
57
+ {
58
+ client_side_validation: true,
59
+ required: false,
60
+ serialized_name: 'AccountSasParameters',
61
+ type: {
62
+ name: 'Composite',
63
+ class_name: 'AccountSasParameters',
64
+ model_properties: {
65
+ services: {
66
+ client_side_validation: true,
67
+ required: true,
68
+ serialized_name: 'signedServices',
69
+ type: {
70
+ name: 'String'
71
+ }
72
+ },
73
+ resource_types: {
74
+ client_side_validation: true,
75
+ required: true,
76
+ serialized_name: 'signedResourceTypes',
77
+ type: {
78
+ name: 'String'
79
+ }
80
+ },
81
+ permissions: {
82
+ client_side_validation: true,
83
+ required: true,
84
+ serialized_name: 'signedPermission',
85
+ type: {
86
+ name: 'String'
87
+ }
88
+ },
89
+ ipaddress_or_range: {
90
+ client_side_validation: true,
91
+ required: false,
92
+ serialized_name: 'signedIp',
93
+ type: {
94
+ name: 'String'
95
+ }
96
+ },
97
+ protocols: {
98
+ client_side_validation: true,
99
+ required: false,
100
+ serialized_name: 'signedProtocol',
101
+ type: {
102
+ name: 'Enum',
103
+ module: 'HttpProtocol'
104
+ }
105
+ },
106
+ shared_access_start_time: {
107
+ client_side_validation: true,
108
+ required: false,
109
+ serialized_name: 'signedStart',
110
+ type: {
111
+ name: 'DateTime'
112
+ }
113
+ },
114
+ shared_access_expiry_time: {
115
+ client_side_validation: true,
116
+ required: true,
117
+ serialized_name: 'signedExpiry',
118
+ type: {
119
+ name: 'DateTime'
120
+ }
121
+ },
122
+ key_to_sign: {
123
+ client_side_validation: true,
124
+ required: false,
125
+ serialized_name: 'keyToSign',
126
+ type: {
127
+ name: 'String'
128
+ }
129
+ }
130
+ }
131
+ }
132
+ }
133
+ end
134
+ end
135
+ end
136
+ end