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,116 @@
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 Skus
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Skus 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 the available SKUs supported by Microsoft.Storage for given
26
+ # subscription.
27
+ #
28
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
29
+ # will be added to the HTTP request.
30
+ #
31
+ # @return [StorageSkuListResult] operation results.
32
+ #
33
+ def list(custom_headers:nil)
34
+ response = list_async(custom_headers:custom_headers).value!
35
+ response.body unless response.nil?
36
+ end
37
+
38
+ #
39
+ # Lists the available SKUs supported by Microsoft.Storage for given
40
+ # subscription.
41
+ #
42
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
43
+ # will be added to the HTTP request.
44
+ #
45
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
46
+ #
47
+ def list_with_http_info(custom_headers:nil)
48
+ list_async(custom_headers:custom_headers).value!
49
+ end
50
+
51
+ #
52
+ # Lists the available SKUs supported by Microsoft.Storage for given
53
+ # subscription.
54
+ #
55
+ # @param [Hash{String => String}] A hash of custom headers that will be added
56
+ # to the HTTP request.
57
+ #
58
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
59
+ #
60
+ def list_async(custom_headers:nil)
61
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
62
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
63
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
64
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
65
+
66
+
67
+ request_headers = {}
68
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
69
+
70
+ # Set Headers
71
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
72
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
73
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus'
74
+
75
+ request_url = @base_url || @client.base_url
76
+
77
+ options = {
78
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
79
+ path_params: {'subscriptionId' => @client.subscription_id},
80
+ query_params: {'api-version' => @client.api_version},
81
+ headers: request_headers.merge(custom_headers || {}),
82
+ base_url: request_url
83
+ }
84
+ promise = @client.make_request_async(:get, path_template, options)
85
+
86
+ promise = promise.then do |result|
87
+ http_response = result.response
88
+ status_code = http_response.status
89
+ response_content = http_response.body
90
+ unless status_code == 200
91
+ error_model = JSON.load(response_content)
92
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
93
+ end
94
+
95
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
96
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
97
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
98
+ # Deserialize Response
99
+ if status_code == 200
100
+ begin
101
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
102
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::StorageSkuListResult.mapper()
103
+ result.body = @client.deserialize(result_mapper, parsed_response)
104
+ rescue Exception => e
105
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
106
+ end
107
+ end
108
+
109
+ result
110
+ end
111
+
112
+ promise.execute
113
+ end
114
+
115
+ end
116
+ end
@@ -0,0 +1,1754 @@
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 StorageAccounts
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the StorageAccounts 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
+ # Checks that the storage account name is valid and is not already in use.
26
+ #
27
+ # @param account_name [StorageAccountCheckNameAvailabilityParameters] The name
28
+ # of the storage account within the specified resource group. Storage account
29
+ # names must be between 3 and 24 characters in length and use numbers and
30
+ # lower-case letters only.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [CheckNameAvailabilityResult] operation results.
35
+ #
36
+ def check_name_availability(account_name, custom_headers:nil)
37
+ response = check_name_availability_async(account_name, custom_headers:custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Checks that the storage account name is valid and is not already in use.
43
+ #
44
+ # @param account_name [StorageAccountCheckNameAvailabilityParameters] The name
45
+ # of the storage account within the specified resource group. Storage account
46
+ # names must be between 3 and 24 characters in length and use numbers and
47
+ # lower-case letters only.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
52
+ #
53
+ def check_name_availability_with_http_info(account_name, custom_headers:nil)
54
+ check_name_availability_async(account_name, custom_headers:custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # Checks that the storage account name is valid and is not already in use.
59
+ #
60
+ # @param account_name [StorageAccountCheckNameAvailabilityParameters] The name
61
+ # of the storage account within the specified resource group. Storage account
62
+ # names must be between 3 and 24 characters in length and use numbers and
63
+ # lower-case letters only.
64
+ # @param [Hash{String => String}] A hash of custom headers that will be added
65
+ # to the HTTP request.
66
+ #
67
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
68
+ #
69
+ def check_name_availability_async(account_name, custom_headers:nil)
70
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
71
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
72
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
73
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
74
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
75
+
76
+
77
+ request_headers = {}
78
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
79
+
80
+ # Set Headers
81
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
82
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
83
+
84
+ # Serialize Request
85
+ request_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::StorageAccountCheckNameAvailabilityParameters.mapper()
86
+ request_content = @client.serialize(request_mapper, account_name)
87
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
88
+
89
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'
90
+
91
+ request_url = @base_url || @client.base_url
92
+
93
+ options = {
94
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
95
+ path_params: {'subscriptionId' => @client.subscription_id},
96
+ query_params: {'api-version' => @client.api_version},
97
+ body: request_content,
98
+ headers: request_headers.merge(custom_headers || {}),
99
+ base_url: request_url
100
+ }
101
+ promise = @client.make_request_async(:post, path_template, options)
102
+
103
+ promise = promise.then do |result|
104
+ http_response = result.response
105
+ status_code = http_response.status
106
+ response_content = http_response.body
107
+ unless status_code == 200
108
+ error_model = JSON.load(response_content)
109
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
110
+ end
111
+
112
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
113
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
114
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
115
+ # Deserialize Response
116
+ if status_code == 200
117
+ begin
118
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
119
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::CheckNameAvailabilityResult.mapper()
120
+ result.body = @client.deserialize(result_mapper, parsed_response)
121
+ rescue Exception => e
122
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
123
+ end
124
+ end
125
+
126
+ result
127
+ end
128
+
129
+ promise.execute
130
+ end
131
+
132
+ #
133
+ # Asynchronously creates a new storage account with the specified parameters.
134
+ # If an account is already created and a subsequent create request is issued
135
+ # with different properties, the account properties will be updated. If an
136
+ # account is already created and a subsequent create or update request is
137
+ # issued with the exact same set of properties, the request will succeed.
138
+ #
139
+ # @param resource_group_name [String] The name of the resource group within the
140
+ # user's subscription. The name is case insensitive.
141
+ # @param account_name [String] The name of the storage account within the
142
+ # specified resource group. Storage account names must be between 3 and 24
143
+ # characters in length and use numbers and lower-case letters only.
144
+ # @param parameters [StorageAccountCreateParameters] The parameters to provide
145
+ # for the created account.
146
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
147
+ # will be added to the HTTP request.
148
+ #
149
+ # @return [StorageAccount] operation results.
150
+ #
151
+ def create(resource_group_name, account_name, parameters, custom_headers:nil)
152
+ response = create_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
153
+ response.body unless response.nil?
154
+ end
155
+
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 parameters [StorageAccountCreateParameters] The parameters to provide
163
+ # for the created account.
164
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
165
+ # will be added to the HTTP request.
166
+ #
167
+ # @return [Concurrent::Promise] promise which provides async access to http
168
+ # response.
169
+ #
170
+ def create_async(resource_group_name, account_name, parameters, custom_headers:nil)
171
+ # Send request
172
+ promise = begin_create_async(resource_group_name, account_name, parameters, custom_headers:custom_headers)
173
+
174
+ promise = promise.then do |response|
175
+ # Defining deserialization method.
176
+ deserialize_method = lambda do |parsed_response|
177
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::StorageAccount.mapper()
178
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
179
+ end
180
+
181
+ # Waiting for response.
182
+ @client.get_long_running_operation_result(response, deserialize_method)
183
+ end
184
+
185
+ promise
186
+ end
187
+
188
+ #
189
+ # Deletes a storage account in Microsoft Azure.
190
+ #
191
+ # @param resource_group_name [String] The name of the resource group within the
192
+ # user's subscription. The name is case insensitive.
193
+ # @param account_name [String] The name of the storage account within the
194
+ # specified resource group. Storage account names must be between 3 and 24
195
+ # characters in length and use numbers and lower-case letters only.
196
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
197
+ # will be added to the HTTP request.
198
+ #
199
+ #
200
+ def delete(resource_group_name, account_name, custom_headers:nil)
201
+ response = delete_async(resource_group_name, account_name, custom_headers:custom_headers).value!
202
+ nil
203
+ end
204
+
205
+ #
206
+ # Deletes a storage account in Microsoft Azure.
207
+ #
208
+ # @param resource_group_name [String] The name of the resource group within the
209
+ # user's subscription. The name is case insensitive.
210
+ # @param account_name [String] The name of the storage account within the
211
+ # specified resource group. Storage account names must be between 3 and 24
212
+ # characters in length and use numbers and lower-case letters only.
213
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
214
+ # will be added to the HTTP request.
215
+ #
216
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
217
+ #
218
+ def delete_with_http_info(resource_group_name, account_name, custom_headers:nil)
219
+ delete_async(resource_group_name, account_name, custom_headers:custom_headers).value!
220
+ end
221
+
222
+ #
223
+ # Deletes a storage account in Microsoft Azure.
224
+ #
225
+ # @param resource_group_name [String] The name of the resource group within the
226
+ # user's subscription. The name is case insensitive.
227
+ # @param account_name [String] The name of the storage account within the
228
+ # specified resource group. Storage account names must be between 3 and 24
229
+ # characters in length and use numbers and lower-case letters only.
230
+ # @param [Hash{String => String}] A hash of custom headers that will be added
231
+ # to the HTTP request.
232
+ #
233
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
234
+ #
235
+ def delete_async(resource_group_name, account_name, custom_headers:nil)
236
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
237
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
238
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
239
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
240
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
241
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
242
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
243
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
244
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
245
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
246
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
247
+
248
+
249
+ request_headers = {}
250
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
251
+
252
+ # Set Headers
253
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
254
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
255
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'
256
+
257
+ request_url = @base_url || @client.base_url
258
+
259
+ options = {
260
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
261
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
262
+ query_params: {'api-version' => @client.api_version},
263
+ headers: request_headers.merge(custom_headers || {}),
264
+ base_url: request_url
265
+ }
266
+ promise = @client.make_request_async(:delete, path_template, options)
267
+
268
+ promise = promise.then do |result|
269
+ http_response = result.response
270
+ status_code = http_response.status
271
+ response_content = http_response.body
272
+ unless status_code == 200 || status_code == 204
273
+ error_model = JSON.load(response_content)
274
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
275
+ end
276
+
277
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
278
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
279
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
280
+
281
+ result
282
+ end
283
+
284
+ promise.execute
285
+ end
286
+
287
+ #
288
+ # Returns the properties for the specified storage account including but not
289
+ # limited to name, SKU name, location, and account status. The ListKeys
290
+ # operation should be used to retrieve storage keys.
291
+ #
292
+ # @param resource_group_name [String] The name of the resource group within the
293
+ # user's subscription. The name is case insensitive.
294
+ # @param account_name [String] The name of the storage account within the
295
+ # specified resource group. Storage account names must be between 3 and 24
296
+ # characters in length and use numbers and lower-case letters only.
297
+ # @param expand [StorageAccountExpand] May be used to expand the properties
298
+ # within account's properties. By default, data is not included when fetching
299
+ # properties. Currently we only support geoReplicationStats. Possible values
300
+ # include: 'geoReplicationStats'
301
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
302
+ # will be added to the HTTP request.
303
+ #
304
+ # @return [StorageAccount] operation results.
305
+ #
306
+ def get_properties(resource_group_name, account_name, expand:nil, custom_headers:nil)
307
+ response = get_properties_async(resource_group_name, account_name, expand:expand, custom_headers:custom_headers).value!
308
+ response.body unless response.nil?
309
+ end
310
+
311
+ #
312
+ # Returns the properties for the specified storage account including but not
313
+ # limited to name, SKU name, location, and account status. The ListKeys
314
+ # operation should be used to retrieve storage keys.
315
+ #
316
+ # @param resource_group_name [String] The name of the resource group within the
317
+ # user's subscription. The name is case insensitive.
318
+ # @param account_name [String] The name of the storage account within the
319
+ # specified resource group. Storage account names must be between 3 and 24
320
+ # characters in length and use numbers and lower-case letters only.
321
+ # @param expand [StorageAccountExpand] May be used to expand the properties
322
+ # within account's properties. By default, data is not included when fetching
323
+ # properties. Currently we only support geoReplicationStats. Possible values
324
+ # include: 'geoReplicationStats'
325
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
326
+ # will be added to the HTTP request.
327
+ #
328
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
329
+ #
330
+ def get_properties_with_http_info(resource_group_name, account_name, expand:nil, custom_headers:nil)
331
+ get_properties_async(resource_group_name, account_name, expand:expand, custom_headers:custom_headers).value!
332
+ end
333
+
334
+ #
335
+ # Returns the properties for the specified storage account including but not
336
+ # limited to name, SKU name, location, and account status. The ListKeys
337
+ # operation should be used to retrieve storage keys.
338
+ #
339
+ # @param resource_group_name [String] The name of the resource group within the
340
+ # user's subscription. The name is case insensitive.
341
+ # @param account_name [String] The name of the storage account within the
342
+ # specified resource group. Storage account names must be between 3 and 24
343
+ # characters in length and use numbers and lower-case letters only.
344
+ # @param expand [StorageAccountExpand] May be used to expand the properties
345
+ # within account's properties. By default, data is not included when fetching
346
+ # properties. Currently we only support geoReplicationStats. Possible values
347
+ # include: 'geoReplicationStats'
348
+ # @param [Hash{String => String}] A hash of custom headers that will be added
349
+ # to the HTTP request.
350
+ #
351
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
352
+ #
353
+ def get_properties_async(resource_group_name, account_name, expand:nil, custom_headers:nil)
354
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
355
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
356
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
357
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
358
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
359
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
360
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
361
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
362
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
363
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
364
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
365
+
366
+
367
+ request_headers = {}
368
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
369
+
370
+ # Set Headers
371
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
372
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
373
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'
374
+
375
+ request_url = @base_url || @client.base_url
376
+
377
+ options = {
378
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
379
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
380
+ query_params: {'api-version' => @client.api_version,'$expand' => expand},
381
+ headers: request_headers.merge(custom_headers || {}),
382
+ base_url: request_url
383
+ }
384
+ promise = @client.make_request_async(:get, path_template, options)
385
+
386
+ promise = promise.then do |result|
387
+ http_response = result.response
388
+ status_code = http_response.status
389
+ response_content = http_response.body
390
+ unless status_code == 200
391
+ error_model = JSON.load(response_content)
392
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
393
+ end
394
+
395
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
396
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
397
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
398
+ # Deserialize Response
399
+ if status_code == 200
400
+ begin
401
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
402
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::StorageAccount.mapper()
403
+ result.body = @client.deserialize(result_mapper, parsed_response)
404
+ rescue Exception => e
405
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
406
+ end
407
+ end
408
+
409
+ result
410
+ end
411
+
412
+ promise.execute
413
+ end
414
+
415
+ #
416
+ # The update operation can be used to update the SKU, encryption, access tier,
417
+ # or tags for a storage account. It can also be used to map the account to a
418
+ # custom domain. Only one custom domain is supported per storage account; the
419
+ # replacement/change of custom domain is not supported. In order to replace an
420
+ # old custom domain, the old value must be cleared/unregistered before a new
421
+ # value can be set. The update of multiple properties is supported. This call
422
+ # does not change the storage keys for the account. If you want to change the
423
+ # storage account keys, use the regenerate keys operation. The location and
424
+ # name of the storage account cannot be changed after creation.
425
+ #
426
+ # @param resource_group_name [String] The name of the resource group within the
427
+ # user's subscription. The name is case insensitive.
428
+ # @param account_name [String] The name of the storage account within the
429
+ # specified resource group. Storage account names must be between 3 and 24
430
+ # characters in length and use numbers and lower-case letters only.
431
+ # @param parameters [StorageAccountUpdateParameters] The parameters to provide
432
+ # for the updated account.
433
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
434
+ # will be added to the HTTP request.
435
+ #
436
+ # @return [StorageAccount] operation results.
437
+ #
438
+ def update(resource_group_name, account_name, parameters, custom_headers:nil)
439
+ response = update_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
440
+ response.body unless response.nil?
441
+ end
442
+
443
+ #
444
+ # The update operation can be used to update the SKU, encryption, access tier,
445
+ # or tags for a storage account. It can also be used to map the account to a
446
+ # custom domain. Only one custom domain is supported per storage account; the
447
+ # replacement/change of custom domain is not supported. In order to replace an
448
+ # old custom domain, the old value must be cleared/unregistered before a new
449
+ # value can be set. The update of multiple properties is supported. This call
450
+ # does not change the storage keys for the account. If you want to change the
451
+ # storage account keys, use the regenerate keys operation. The location and
452
+ # name of the storage account cannot be changed after creation.
453
+ #
454
+ # @param resource_group_name [String] The name of the resource group within the
455
+ # user's subscription. The name is case insensitive.
456
+ # @param account_name [String] The name of the storage account within the
457
+ # specified resource group. Storage account names must be between 3 and 24
458
+ # characters in length and use numbers and lower-case letters only.
459
+ # @param parameters [StorageAccountUpdateParameters] The parameters to provide
460
+ # for the updated account.
461
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
462
+ # will be added to the HTTP request.
463
+ #
464
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
465
+ #
466
+ def update_with_http_info(resource_group_name, account_name, parameters, custom_headers:nil)
467
+ update_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
468
+ end
469
+
470
+ #
471
+ # The update operation can be used to update the SKU, encryption, access tier,
472
+ # or tags for a storage account. It can also be used to map the account to a
473
+ # custom domain. Only one custom domain is supported per storage account; the
474
+ # replacement/change of custom domain is not supported. In order to replace an
475
+ # old custom domain, the old value must be cleared/unregistered before a new
476
+ # value can be set. The update of multiple properties is supported. This call
477
+ # does not change the storage keys for the account. If you want to change the
478
+ # storage account keys, use the regenerate keys operation. The location and
479
+ # name of the storage account cannot be changed after creation.
480
+ #
481
+ # @param resource_group_name [String] The name of the resource group within the
482
+ # user's subscription. The name is case insensitive.
483
+ # @param account_name [String] The name of the storage account within the
484
+ # specified resource group. Storage account names must be between 3 and 24
485
+ # characters in length and use numbers and lower-case letters only.
486
+ # @param parameters [StorageAccountUpdateParameters] The parameters to provide
487
+ # for the updated account.
488
+ # @param [Hash{String => String}] A hash of custom headers that will be added
489
+ # to the HTTP request.
490
+ #
491
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
492
+ #
493
+ def update_async(resource_group_name, account_name, parameters, custom_headers:nil)
494
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
495
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
496
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
497
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
498
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
499
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
500
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
501
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
502
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
503
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
504
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
505
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
506
+
507
+
508
+ request_headers = {}
509
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
510
+
511
+ # Set Headers
512
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
513
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
514
+
515
+ # Serialize Request
516
+ request_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::StorageAccountUpdateParameters.mapper()
517
+ request_content = @client.serialize(request_mapper, parameters)
518
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
519
+
520
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'
521
+
522
+ request_url = @base_url || @client.base_url
523
+
524
+ options = {
525
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
526
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
527
+ query_params: {'api-version' => @client.api_version},
528
+ body: request_content,
529
+ headers: request_headers.merge(custom_headers || {}),
530
+ base_url: request_url
531
+ }
532
+ promise = @client.make_request_async(:patch, path_template, options)
533
+
534
+ promise = promise.then do |result|
535
+ http_response = result.response
536
+ status_code = http_response.status
537
+ response_content = http_response.body
538
+ unless status_code == 200
539
+ error_model = JSON.load(response_content)
540
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
541
+ end
542
+
543
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
544
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
545
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
546
+ # Deserialize Response
547
+ if status_code == 200
548
+ begin
549
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
550
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::StorageAccount.mapper()
551
+ result.body = @client.deserialize(result_mapper, parsed_response)
552
+ rescue Exception => e
553
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
554
+ end
555
+ end
556
+
557
+ result
558
+ end
559
+
560
+ promise.execute
561
+ end
562
+
563
+ #
564
+ # Lists all the storage accounts available under the subscription. Note that
565
+ # storage keys are not returned; use the ListKeys operation for this.
566
+ #
567
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
568
+ # will be added to the HTTP request.
569
+ #
570
+ # @return [Array<StorageAccount>] operation results.
571
+ #
572
+ def list(custom_headers:nil)
573
+ first_page = list_as_lazy(custom_headers:custom_headers)
574
+ first_page.get_all_items
575
+ end
576
+
577
+ #
578
+ # Lists all the storage accounts available under the subscription. Note that
579
+ # storage keys are not returned; use the ListKeys operation for this.
580
+ #
581
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
582
+ # will be added to the HTTP request.
583
+ #
584
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
585
+ #
586
+ def list_with_http_info(custom_headers:nil)
587
+ list_async(custom_headers:custom_headers).value!
588
+ end
589
+
590
+ #
591
+ # Lists all the storage accounts available under the subscription. Note that
592
+ # storage keys are not returned; use the ListKeys operation for this.
593
+ #
594
+ # @param [Hash{String => String}] A hash of custom headers that will be added
595
+ # to the HTTP request.
596
+ #
597
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
598
+ #
599
+ def list_async(custom_headers:nil)
600
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
601
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
602
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
603
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
604
+
605
+
606
+ request_headers = {}
607
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
608
+
609
+ # Set Headers
610
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
611
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
612
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'
613
+
614
+ request_url = @base_url || @client.base_url
615
+
616
+ options = {
617
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
618
+ path_params: {'subscriptionId' => @client.subscription_id},
619
+ query_params: {'api-version' => @client.api_version},
620
+ headers: request_headers.merge(custom_headers || {}),
621
+ base_url: request_url
622
+ }
623
+ promise = @client.make_request_async(:get, path_template, options)
624
+
625
+ promise = promise.then do |result|
626
+ http_response = result.response
627
+ status_code = http_response.status
628
+ response_content = http_response.body
629
+ unless status_code == 200
630
+ error_model = JSON.load(response_content)
631
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
632
+ end
633
+
634
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
635
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
636
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
637
+ # Deserialize Response
638
+ if status_code == 200
639
+ begin
640
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
641
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::StorageAccountListResult.mapper()
642
+ result.body = @client.deserialize(result_mapper, parsed_response)
643
+ rescue Exception => e
644
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
645
+ end
646
+ end
647
+
648
+ result
649
+ end
650
+
651
+ promise.execute
652
+ end
653
+
654
+ #
655
+ # Lists all the storage accounts available under the given resource group. Note
656
+ # that storage keys are not returned; use the ListKeys operation for this.
657
+ #
658
+ # @param resource_group_name [String] The name of the resource group within the
659
+ # user's subscription. The name is case insensitive.
660
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
661
+ # will be added to the HTTP request.
662
+ #
663
+ # @return [StorageAccountListResult] operation results.
664
+ #
665
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
666
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
667
+ response.body unless response.nil?
668
+ end
669
+
670
+ #
671
+ # Lists all the storage accounts available under the given resource group. Note
672
+ # that storage keys are not returned; use the ListKeys operation for this.
673
+ #
674
+ # @param resource_group_name [String] The name of the resource group within the
675
+ # user's subscription. The name is case insensitive.
676
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
677
+ # will be added to the HTTP request.
678
+ #
679
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
680
+ #
681
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
682
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
683
+ end
684
+
685
+ #
686
+ # Lists all the storage accounts available under the given resource group. Note
687
+ # that storage keys are not returned; use the ListKeys operation for this.
688
+ #
689
+ # @param resource_group_name [String] The name of the resource group within the
690
+ # user's subscription. The name is case insensitive.
691
+ # @param [Hash{String => String}] A hash of custom headers that will be added
692
+ # to the HTTP request.
693
+ #
694
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
695
+ #
696
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
697
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
698
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
699
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
700
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
701
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
702
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
703
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
704
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
705
+
706
+
707
+ request_headers = {}
708
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
709
+
710
+ # Set Headers
711
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
712
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
713
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'
714
+
715
+ request_url = @base_url || @client.base_url
716
+
717
+ options = {
718
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
719
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
720
+ query_params: {'api-version' => @client.api_version},
721
+ headers: request_headers.merge(custom_headers || {}),
722
+ base_url: request_url
723
+ }
724
+ promise = @client.make_request_async(:get, path_template, options)
725
+
726
+ promise = promise.then do |result|
727
+ http_response = result.response
728
+ status_code = http_response.status
729
+ response_content = http_response.body
730
+ unless status_code == 200
731
+ error_model = JSON.load(response_content)
732
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
733
+ end
734
+
735
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
736
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
737
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
738
+ # Deserialize Response
739
+ if status_code == 200
740
+ begin
741
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
742
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::StorageAccountListResult.mapper()
743
+ result.body = @client.deserialize(result_mapper, parsed_response)
744
+ rescue Exception => e
745
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
746
+ end
747
+ end
748
+
749
+ result
750
+ end
751
+
752
+ promise.execute
753
+ end
754
+
755
+ #
756
+ # Lists the access keys or Kerberos keys (if active directory enabled) for the
757
+ # specified storage account.
758
+ #
759
+ # @param resource_group_name [String] The name of the resource group within the
760
+ # user's subscription. The name is case insensitive.
761
+ # @param account_name [String] The name of the storage account within the
762
+ # specified resource group. Storage account names must be between 3 and 24
763
+ # characters in length and use numbers and lower-case letters only.
764
+ # @param expand [ListKeyExpand] Specifies type of the key to be listed.
765
+ # Possible value is kerb. Possible values include: 'kerb'
766
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
767
+ # will be added to the HTTP request.
768
+ #
769
+ # @return [StorageAccountListKeysResult] operation results.
770
+ #
771
+ def list_keys(resource_group_name, account_name, expand:nil, custom_headers:nil)
772
+ response = list_keys_async(resource_group_name, account_name, expand:expand, custom_headers:custom_headers).value!
773
+ response.body unless response.nil?
774
+ end
775
+
776
+ #
777
+ # Lists the access keys or Kerberos keys (if active directory enabled) for the
778
+ # specified storage account.
779
+ #
780
+ # @param resource_group_name [String] The name of the resource group within the
781
+ # user's subscription. The name is case insensitive.
782
+ # @param account_name [String] The name of the storage account within the
783
+ # specified resource group. Storage account names must be between 3 and 24
784
+ # characters in length and use numbers and lower-case letters only.
785
+ # @param expand [ListKeyExpand] Specifies type of the key to be listed.
786
+ # Possible value is kerb. Possible values include: 'kerb'
787
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
788
+ # will be added to the HTTP request.
789
+ #
790
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
791
+ #
792
+ def list_keys_with_http_info(resource_group_name, account_name, expand:nil, custom_headers:nil)
793
+ list_keys_async(resource_group_name, account_name, expand:expand, custom_headers:custom_headers).value!
794
+ end
795
+
796
+ #
797
+ # Lists the access keys or Kerberos keys (if active directory enabled) for the
798
+ # specified storage account.
799
+ #
800
+ # @param resource_group_name [String] The name of the resource group within the
801
+ # user's subscription. The name is case insensitive.
802
+ # @param account_name [String] The name of the storage account within the
803
+ # specified resource group. Storage account names must be between 3 and 24
804
+ # characters in length and use numbers and lower-case letters only.
805
+ # @param expand [ListKeyExpand] Specifies type of the key to be listed.
806
+ # Possible value is kerb. Possible values include: 'kerb'
807
+ # @param [Hash{String => String}] A hash of custom headers that will be added
808
+ # to the HTTP request.
809
+ #
810
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
811
+ #
812
+ def list_keys_async(resource_group_name, account_name, expand:nil, custom_headers:nil)
813
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
814
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
815
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
816
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
817
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
818
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
819
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
820
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
821
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
822
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
823
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
824
+
825
+
826
+ request_headers = {}
827
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
828
+
829
+ # Set Headers
830
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
831
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
832
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'
833
+
834
+ request_url = @base_url || @client.base_url
835
+
836
+ options = {
837
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
838
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
839
+ query_params: {'api-version' => @client.api_version,'$expand' => expand},
840
+ headers: request_headers.merge(custom_headers || {}),
841
+ base_url: request_url
842
+ }
843
+ promise = @client.make_request_async(:post, path_template, options)
844
+
845
+ promise = promise.then do |result|
846
+ http_response = result.response
847
+ status_code = http_response.status
848
+ response_content = http_response.body
849
+ unless status_code == 200
850
+ error_model = JSON.load(response_content)
851
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
852
+ end
853
+
854
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
855
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
856
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
857
+ # Deserialize Response
858
+ if status_code == 200
859
+ begin
860
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
861
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::StorageAccountListKeysResult.mapper()
862
+ result.body = @client.deserialize(result_mapper, parsed_response)
863
+ rescue Exception => e
864
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
865
+ end
866
+ end
867
+
868
+ result
869
+ end
870
+
871
+ promise.execute
872
+ end
873
+
874
+ #
875
+ # Regenerates one of the access keys or Kerberos keys for the specified storage
876
+ # account.
877
+ #
878
+ # @param resource_group_name [String] The name of the resource group within the
879
+ # user's subscription. The name is case insensitive.
880
+ # @param account_name [String] The name of the storage account within the
881
+ # specified resource group. Storage account names must be between 3 and 24
882
+ # characters in length and use numbers and lower-case letters only.
883
+ # @param regenerate_key [StorageAccountRegenerateKeyParameters] Specifies name
884
+ # of the key which should be regenerated -- key1, key2, kerb1, kerb2.
885
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
886
+ # will be added to the HTTP request.
887
+ #
888
+ # @return [StorageAccountListKeysResult] operation results.
889
+ #
890
+ def regenerate_key(resource_group_name, account_name, regenerate_key, custom_headers:nil)
891
+ response = regenerate_key_async(resource_group_name, account_name, regenerate_key, custom_headers:custom_headers).value!
892
+ response.body unless response.nil?
893
+ end
894
+
895
+ #
896
+ # Regenerates one of the access keys or Kerberos keys for the specified storage
897
+ # account.
898
+ #
899
+ # @param resource_group_name [String] The name of the resource group within the
900
+ # user's subscription. The name is case insensitive.
901
+ # @param account_name [String] The name of the storage account within the
902
+ # specified resource group. Storage account names must be between 3 and 24
903
+ # characters in length and use numbers and lower-case letters only.
904
+ # @param regenerate_key [StorageAccountRegenerateKeyParameters] Specifies name
905
+ # of the key which should be regenerated -- key1, key2, kerb1, kerb2.
906
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
907
+ # will be added to the HTTP request.
908
+ #
909
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
910
+ #
911
+ def regenerate_key_with_http_info(resource_group_name, account_name, regenerate_key, custom_headers:nil)
912
+ regenerate_key_async(resource_group_name, account_name, regenerate_key, custom_headers:custom_headers).value!
913
+ end
914
+
915
+ #
916
+ # Regenerates one of the access keys or Kerberos keys for the specified storage
917
+ # account.
918
+ #
919
+ # @param resource_group_name [String] The name of the resource group within the
920
+ # user's subscription. The name is case insensitive.
921
+ # @param account_name [String] The name of the storage account within the
922
+ # specified resource group. Storage account names must be between 3 and 24
923
+ # characters in length and use numbers and lower-case letters only.
924
+ # @param regenerate_key [StorageAccountRegenerateKeyParameters] Specifies name
925
+ # of the key which should be regenerated -- key1, key2, kerb1, kerb2.
926
+ # @param [Hash{String => String}] A hash of custom headers that will be added
927
+ # to the HTTP request.
928
+ #
929
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
930
+ #
931
+ def regenerate_key_async(resource_group_name, account_name, regenerate_key, custom_headers:nil)
932
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
933
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
934
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
935
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
936
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
937
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
938
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
939
+ fail ArgumentError, 'regenerate_key is nil' if regenerate_key.nil?
940
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
941
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
942
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
943
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
944
+
945
+
946
+ request_headers = {}
947
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
948
+
949
+ # Set Headers
950
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
951
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
952
+
953
+ # Serialize Request
954
+ request_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::StorageAccountRegenerateKeyParameters.mapper()
955
+ request_content = @client.serialize(request_mapper, regenerate_key)
956
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
957
+
958
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'
959
+
960
+ request_url = @base_url || @client.base_url
961
+
962
+ options = {
963
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
964
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
965
+ query_params: {'api-version' => @client.api_version},
966
+ body: request_content,
967
+ headers: request_headers.merge(custom_headers || {}),
968
+ base_url: request_url
969
+ }
970
+ promise = @client.make_request_async(:post, path_template, options)
971
+
972
+ promise = promise.then do |result|
973
+ http_response = result.response
974
+ status_code = http_response.status
975
+ response_content = http_response.body
976
+ unless status_code == 200
977
+ error_model = JSON.load(response_content)
978
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
979
+ end
980
+
981
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
982
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
983
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
984
+ # Deserialize Response
985
+ if status_code == 200
986
+ begin
987
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
988
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::StorageAccountListKeysResult.mapper()
989
+ result.body = @client.deserialize(result_mapper, parsed_response)
990
+ rescue Exception => e
991
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
992
+ end
993
+ end
994
+
995
+ result
996
+ end
997
+
998
+ promise.execute
999
+ end
1000
+
1001
+ #
1002
+ # List SAS credentials of a storage account.
1003
+ #
1004
+ # @param resource_group_name [String] The name of the resource group within the
1005
+ # user's subscription. The name is case insensitive.
1006
+ # @param account_name [String] The name of the storage account within the
1007
+ # specified resource group. Storage account names must be between 3 and 24
1008
+ # characters in length and use numbers and lower-case letters only.
1009
+ # @param parameters [AccountSasParameters] The parameters to provide to list
1010
+ # SAS credentials for the storage account.
1011
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1012
+ # will be added to the HTTP request.
1013
+ #
1014
+ # @return [ListAccountSasResponse] operation results.
1015
+ #
1016
+ def list_account_sas(resource_group_name, account_name, parameters, custom_headers:nil)
1017
+ response = list_account_sas_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
1018
+ response.body unless response.nil?
1019
+ end
1020
+
1021
+ #
1022
+ # List SAS credentials of a storage account.
1023
+ #
1024
+ # @param resource_group_name [String] The name of the resource group within the
1025
+ # user's subscription. The name is case insensitive.
1026
+ # @param account_name [String] The name of the storage account within the
1027
+ # specified resource group. Storage account names must be between 3 and 24
1028
+ # characters in length and use numbers and lower-case letters only.
1029
+ # @param parameters [AccountSasParameters] The parameters to provide to list
1030
+ # SAS credentials for the storage account.
1031
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1032
+ # will be added to the HTTP request.
1033
+ #
1034
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1035
+ #
1036
+ def list_account_sas_with_http_info(resource_group_name, account_name, parameters, custom_headers:nil)
1037
+ list_account_sas_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
1038
+ end
1039
+
1040
+ #
1041
+ # List SAS credentials of a storage account.
1042
+ #
1043
+ # @param resource_group_name [String] The name of the resource group within the
1044
+ # user's subscription. The name is case insensitive.
1045
+ # @param account_name [String] The name of the storage account within the
1046
+ # specified resource group. Storage account names must be between 3 and 24
1047
+ # characters in length and use numbers and lower-case letters only.
1048
+ # @param parameters [AccountSasParameters] The parameters to provide to list
1049
+ # SAS credentials for the storage account.
1050
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1051
+ # to the HTTP request.
1052
+ #
1053
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1054
+ #
1055
+ def list_account_sas_async(resource_group_name, account_name, parameters, custom_headers:nil)
1056
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1057
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1058
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1059
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1060
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1061
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1062
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1063
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1064
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1065
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1066
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1067
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1068
+
1069
+
1070
+ request_headers = {}
1071
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1072
+
1073
+ # Set Headers
1074
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1075
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1076
+
1077
+ # Serialize Request
1078
+ request_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::AccountSasParameters.mapper()
1079
+ request_content = @client.serialize(request_mapper, parameters)
1080
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1081
+
1082
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'
1083
+
1084
+ request_url = @base_url || @client.base_url
1085
+
1086
+ options = {
1087
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1088
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
1089
+ query_params: {'api-version' => @client.api_version},
1090
+ body: request_content,
1091
+ headers: request_headers.merge(custom_headers || {}),
1092
+ base_url: request_url
1093
+ }
1094
+ promise = @client.make_request_async(:post, path_template, options)
1095
+
1096
+ promise = promise.then do |result|
1097
+ http_response = result.response
1098
+ status_code = http_response.status
1099
+ response_content = http_response.body
1100
+ unless status_code == 200
1101
+ error_model = JSON.load(response_content)
1102
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1103
+ end
1104
+
1105
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1106
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1107
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1108
+ # Deserialize Response
1109
+ if status_code == 200
1110
+ begin
1111
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1112
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::ListAccountSasResponse.mapper()
1113
+ result.body = @client.deserialize(result_mapper, parsed_response)
1114
+ rescue Exception => e
1115
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1116
+ end
1117
+ end
1118
+
1119
+ result
1120
+ end
1121
+
1122
+ promise.execute
1123
+ end
1124
+
1125
+ #
1126
+ # List service SAS credentials of a specific resource.
1127
+ #
1128
+ # @param resource_group_name [String] The name of the resource group within the
1129
+ # user's subscription. The name is case insensitive.
1130
+ # @param account_name [String] The name of the storage account within the
1131
+ # specified resource group. Storage account names must be between 3 and 24
1132
+ # characters in length and use numbers and lower-case letters only.
1133
+ # @param parameters [ServiceSasParameters] The parameters to provide to list
1134
+ # service SAS credentials.
1135
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1136
+ # will be added to the HTTP request.
1137
+ #
1138
+ # @return [ListServiceSasResponse] operation results.
1139
+ #
1140
+ def list_service_sas(resource_group_name, account_name, parameters, custom_headers:nil)
1141
+ response = list_service_sas_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
1142
+ response.body unless response.nil?
1143
+ end
1144
+
1145
+ #
1146
+ # List service SAS credentials of a specific resource.
1147
+ #
1148
+ # @param resource_group_name [String] The name of the resource group within the
1149
+ # user's subscription. The name is case insensitive.
1150
+ # @param account_name [String] The name of the storage account within the
1151
+ # specified resource group. Storage account names must be between 3 and 24
1152
+ # characters in length and use numbers and lower-case letters only.
1153
+ # @param parameters [ServiceSasParameters] The parameters to provide to list
1154
+ # service SAS credentials.
1155
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1156
+ # will be added to the HTTP request.
1157
+ #
1158
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1159
+ #
1160
+ def list_service_sas_with_http_info(resource_group_name, account_name, parameters, custom_headers:nil)
1161
+ list_service_sas_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
1162
+ end
1163
+
1164
+ #
1165
+ # List service SAS credentials of a specific resource.
1166
+ #
1167
+ # @param resource_group_name [String] The name of the resource group within the
1168
+ # user's subscription. The name is case insensitive.
1169
+ # @param account_name [String] The name of the storage account within the
1170
+ # specified resource group. Storage account names must be between 3 and 24
1171
+ # characters in length and use numbers and lower-case letters only.
1172
+ # @param parameters [ServiceSasParameters] The parameters to provide to list
1173
+ # service SAS credentials.
1174
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1175
+ # to the HTTP request.
1176
+ #
1177
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1178
+ #
1179
+ def list_service_sas_async(resource_group_name, account_name, parameters, custom_headers:nil)
1180
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1181
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1182
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1183
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1184
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1185
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1186
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1187
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1188
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1189
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1190
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1191
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1192
+
1193
+
1194
+ request_headers = {}
1195
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1196
+
1197
+ # Set Headers
1198
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1199
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1200
+
1201
+ # Serialize Request
1202
+ request_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::ServiceSasParameters.mapper()
1203
+ request_content = @client.serialize(request_mapper, parameters)
1204
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1205
+
1206
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'
1207
+
1208
+ request_url = @base_url || @client.base_url
1209
+
1210
+ options = {
1211
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1212
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
1213
+ query_params: {'api-version' => @client.api_version},
1214
+ body: request_content,
1215
+ headers: request_headers.merge(custom_headers || {}),
1216
+ base_url: request_url
1217
+ }
1218
+ promise = @client.make_request_async(:post, path_template, options)
1219
+
1220
+ promise = promise.then do |result|
1221
+ http_response = result.response
1222
+ status_code = http_response.status
1223
+ response_content = http_response.body
1224
+ unless status_code == 200
1225
+ error_model = JSON.load(response_content)
1226
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1227
+ end
1228
+
1229
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1230
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1231
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1232
+ # Deserialize Response
1233
+ if status_code == 200
1234
+ begin
1235
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1236
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::ListServiceSasResponse.mapper()
1237
+ result.body = @client.deserialize(result_mapper, parsed_response)
1238
+ rescue Exception => e
1239
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1240
+ end
1241
+ end
1242
+
1243
+ result
1244
+ end
1245
+
1246
+ promise.execute
1247
+ end
1248
+
1249
+ #
1250
+ # Failover request can be triggered for a storage account in case of
1251
+ # availability issues. The failover occurs from the storage account's primary
1252
+ # cluster to secondary cluster for RA-GRS accounts. The secondary cluster will
1253
+ # become primary after failover.
1254
+ #
1255
+ # @param resource_group_name [String] The name of the resource group within the
1256
+ # user's subscription. The name is case insensitive.
1257
+ # @param account_name [String] The name of the storage account within the
1258
+ # specified resource group. Storage account names must be between 3 and 24
1259
+ # characters in length and use numbers and lower-case letters only.
1260
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1261
+ # will be added to the HTTP request.
1262
+ #
1263
+ def failover(resource_group_name, account_name, custom_headers:nil)
1264
+ response = failover_async(resource_group_name, account_name, custom_headers:custom_headers).value!
1265
+ nil
1266
+ end
1267
+
1268
+ #
1269
+ # @param resource_group_name [String] The name of the resource group within the
1270
+ # user's subscription. The name is case insensitive.
1271
+ # @param account_name [String] The name of the storage account within the
1272
+ # specified resource group. Storage account names must be between 3 and 24
1273
+ # characters in length and use numbers and lower-case letters only.
1274
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1275
+ # will be added to the HTTP request.
1276
+ #
1277
+ # @return [Concurrent::Promise] promise which provides async access to http
1278
+ # response.
1279
+ #
1280
+ def failover_async(resource_group_name, account_name, custom_headers:nil)
1281
+ # Send request
1282
+ promise = begin_failover_async(resource_group_name, account_name, custom_headers:custom_headers)
1283
+
1284
+ promise = promise.then do |response|
1285
+ # Defining deserialization method.
1286
+ deserialize_method = lambda do |parsed_response|
1287
+ end
1288
+
1289
+ # Waiting for response.
1290
+ @client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::LOCATION)
1291
+ end
1292
+
1293
+ promise
1294
+ end
1295
+
1296
+ #
1297
+ # Revoke user delegation keys.
1298
+ #
1299
+ # @param resource_group_name [String] The name of the resource group within the
1300
+ # user's subscription. The name is case insensitive.
1301
+ # @param account_name [String] The name of the storage account within the
1302
+ # specified resource group. Storage account names must be between 3 and 24
1303
+ # characters in length and use numbers and lower-case letters only.
1304
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1305
+ # will be added to the HTTP request.
1306
+ #
1307
+ #
1308
+ def revoke_user_delegation_keys(resource_group_name, account_name, custom_headers:nil)
1309
+ response = revoke_user_delegation_keys_async(resource_group_name, account_name, custom_headers:custom_headers).value!
1310
+ nil
1311
+ end
1312
+
1313
+ #
1314
+ # Revoke user delegation keys.
1315
+ #
1316
+ # @param resource_group_name [String] The name of the resource group within the
1317
+ # user's subscription. The name is case insensitive.
1318
+ # @param account_name [String] The name of the storage account within the
1319
+ # specified resource group. Storage account names must be between 3 and 24
1320
+ # characters in length and use numbers and lower-case letters only.
1321
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1322
+ # will be added to the HTTP request.
1323
+ #
1324
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1325
+ #
1326
+ def revoke_user_delegation_keys_with_http_info(resource_group_name, account_name, custom_headers:nil)
1327
+ revoke_user_delegation_keys_async(resource_group_name, account_name, custom_headers:custom_headers).value!
1328
+ end
1329
+
1330
+ #
1331
+ # Revoke user delegation keys.
1332
+ #
1333
+ # @param resource_group_name [String] The name of the resource group within the
1334
+ # user's subscription. The name is case insensitive.
1335
+ # @param account_name [String] The name of the storage account within the
1336
+ # specified resource group. Storage account names must be between 3 and 24
1337
+ # characters in length and use numbers and lower-case letters only.
1338
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1339
+ # to the HTTP request.
1340
+ #
1341
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1342
+ #
1343
+ def revoke_user_delegation_keys_async(resource_group_name, account_name, custom_headers:nil)
1344
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1345
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1346
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1347
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1348
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1349
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1350
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1351
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1352
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1353
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1354
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1355
+
1356
+
1357
+ request_headers = {}
1358
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1359
+
1360
+ # Set Headers
1361
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1362
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1363
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'
1364
+
1365
+ request_url = @base_url || @client.base_url
1366
+
1367
+ options = {
1368
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1369
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
1370
+ query_params: {'api-version' => @client.api_version},
1371
+ headers: request_headers.merge(custom_headers || {}),
1372
+ base_url: request_url
1373
+ }
1374
+ promise = @client.make_request_async(:post, path_template, options)
1375
+
1376
+ promise = promise.then do |result|
1377
+ http_response = result.response
1378
+ status_code = http_response.status
1379
+ response_content = http_response.body
1380
+ unless status_code == 200
1381
+ error_model = JSON.load(response_content)
1382
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1383
+ end
1384
+
1385
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1386
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1387
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1388
+
1389
+ result
1390
+ end
1391
+
1392
+ promise.execute
1393
+ end
1394
+
1395
+ #
1396
+ # Asynchronously creates a new storage account with the specified parameters.
1397
+ # If an account is already created and a subsequent create request is issued
1398
+ # with different properties, the account properties will be updated. If an
1399
+ # account is already created and a subsequent create or update request is
1400
+ # issued with the exact same set of properties, the request will succeed.
1401
+ #
1402
+ # @param resource_group_name [String] The name of the resource group within the
1403
+ # user's subscription. The name is case insensitive.
1404
+ # @param account_name [String] The name of the storage account within the
1405
+ # specified resource group. Storage account names must be between 3 and 24
1406
+ # characters in length and use numbers and lower-case letters only.
1407
+ # @param parameters [StorageAccountCreateParameters] The parameters to provide
1408
+ # for the created account.
1409
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1410
+ # will be added to the HTTP request.
1411
+ #
1412
+ # @return [StorageAccount] operation results.
1413
+ #
1414
+ def begin_create(resource_group_name, account_name, parameters, custom_headers:nil)
1415
+ response = begin_create_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
1416
+ response.body unless response.nil?
1417
+ end
1418
+
1419
+ #
1420
+ # Asynchronously creates a new storage account with the specified parameters.
1421
+ # If an account is already created and a subsequent create request is issued
1422
+ # with different properties, the account properties will be updated. If an
1423
+ # account is already created and a subsequent create or update request is
1424
+ # issued with the exact same set of properties, the request will succeed.
1425
+ #
1426
+ # @param resource_group_name [String] The name of the resource group within the
1427
+ # user's subscription. The name is case insensitive.
1428
+ # @param account_name [String] The name of the storage account within the
1429
+ # specified resource group. Storage account names must be between 3 and 24
1430
+ # characters in length and use numbers and lower-case letters only.
1431
+ # @param parameters [StorageAccountCreateParameters] The parameters to provide
1432
+ # for the created account.
1433
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1434
+ # will be added to the HTTP request.
1435
+ #
1436
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1437
+ #
1438
+ def begin_create_with_http_info(resource_group_name, account_name, parameters, custom_headers:nil)
1439
+ begin_create_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
1440
+ end
1441
+
1442
+ #
1443
+ # Asynchronously creates a new storage account with the specified parameters.
1444
+ # If an account is already created and a subsequent create request is issued
1445
+ # with different properties, the account properties will be updated. If an
1446
+ # account is already created and a subsequent create or update request is
1447
+ # issued with the exact same set of properties, the request will succeed.
1448
+ #
1449
+ # @param resource_group_name [String] The name of the resource group within the
1450
+ # user's subscription. The name is case insensitive.
1451
+ # @param account_name [String] The name of the storage account within the
1452
+ # specified resource group. Storage account names must be between 3 and 24
1453
+ # characters in length and use numbers and lower-case letters only.
1454
+ # @param parameters [StorageAccountCreateParameters] The parameters to provide
1455
+ # for the created account.
1456
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1457
+ # to the HTTP request.
1458
+ #
1459
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1460
+ #
1461
+ def begin_create_async(resource_group_name, account_name, parameters, custom_headers:nil)
1462
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1463
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1464
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1465
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1466
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1467
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1468
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1469
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1470
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1471
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1472
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1473
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1474
+
1475
+
1476
+ request_headers = {}
1477
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1478
+
1479
+ # Set Headers
1480
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1481
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1482
+
1483
+ # Serialize Request
1484
+ request_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::StorageAccountCreateParameters.mapper()
1485
+ request_content = @client.serialize(request_mapper, parameters)
1486
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1487
+
1488
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'
1489
+
1490
+ request_url = @base_url || @client.base_url
1491
+
1492
+ options = {
1493
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1494
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
1495
+ query_params: {'api-version' => @client.api_version},
1496
+ body: request_content,
1497
+ headers: request_headers.merge(custom_headers || {}),
1498
+ base_url: request_url
1499
+ }
1500
+ promise = @client.make_request_async(:put, path_template, options)
1501
+
1502
+ promise = promise.then do |result|
1503
+ http_response = result.response
1504
+ status_code = http_response.status
1505
+ response_content = http_response.body
1506
+ unless status_code == 200 || status_code == 202
1507
+ error_model = JSON.load(response_content)
1508
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1509
+ end
1510
+
1511
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1512
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1513
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1514
+ # Deserialize Response
1515
+ if status_code == 200
1516
+ begin
1517
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1518
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::StorageAccount.mapper()
1519
+ result.body = @client.deserialize(result_mapper, parsed_response)
1520
+ rescue Exception => e
1521
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1522
+ end
1523
+ end
1524
+
1525
+ result
1526
+ end
1527
+
1528
+ promise.execute
1529
+ end
1530
+
1531
+ #
1532
+ # Failover request can be triggered for a storage account in case of
1533
+ # availability issues. The failover occurs from the storage account's primary
1534
+ # cluster to secondary cluster for RA-GRS accounts. The secondary cluster will
1535
+ # become primary after failover.
1536
+ #
1537
+ # @param resource_group_name [String] The name of the resource group within the
1538
+ # user's subscription. The name is case insensitive.
1539
+ # @param account_name [String] The name of the storage account within the
1540
+ # specified resource group. Storage account names must be between 3 and 24
1541
+ # characters in length and use numbers and lower-case letters only.
1542
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1543
+ # will be added to the HTTP request.
1544
+ #
1545
+ #
1546
+ def begin_failover(resource_group_name, account_name, custom_headers:nil)
1547
+ response = begin_failover_async(resource_group_name, account_name, custom_headers:custom_headers).value!
1548
+ nil
1549
+ end
1550
+
1551
+ #
1552
+ # Failover request can be triggered for a storage account in case of
1553
+ # availability issues. The failover occurs from the storage account's primary
1554
+ # cluster to secondary cluster for RA-GRS accounts. The secondary cluster will
1555
+ # become primary after failover.
1556
+ #
1557
+ # @param resource_group_name [String] The name of the resource group within the
1558
+ # user's subscription. The name is case insensitive.
1559
+ # @param account_name [String] The name of the storage account within the
1560
+ # specified resource group. Storage account names must be between 3 and 24
1561
+ # characters in length and use numbers and lower-case letters only.
1562
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1563
+ # will be added to the HTTP request.
1564
+ #
1565
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1566
+ #
1567
+ def begin_failover_with_http_info(resource_group_name, account_name, custom_headers:nil)
1568
+ begin_failover_async(resource_group_name, account_name, custom_headers:custom_headers).value!
1569
+ end
1570
+
1571
+ #
1572
+ # Failover request can be triggered for a storage account in case of
1573
+ # availability issues. The failover occurs from the storage account's primary
1574
+ # cluster to secondary cluster for RA-GRS accounts. The secondary cluster will
1575
+ # become primary after failover.
1576
+ #
1577
+ # @param resource_group_name [String] The name of the resource group within the
1578
+ # user's subscription. The name is case insensitive.
1579
+ # @param account_name [String] The name of the storage account within the
1580
+ # specified resource group. Storage account names must be between 3 and 24
1581
+ # characters in length and use numbers and lower-case letters only.
1582
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1583
+ # to the HTTP request.
1584
+ #
1585
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1586
+ #
1587
+ def begin_failover_async(resource_group_name, account_name, custom_headers:nil)
1588
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1589
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1590
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1591
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1592
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1593
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1594
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1595
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1596
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1597
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1598
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1599
+
1600
+
1601
+ request_headers = {}
1602
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1603
+
1604
+ # Set Headers
1605
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1606
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1607
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'
1608
+
1609
+ request_url = @base_url || @client.base_url
1610
+
1611
+ options = {
1612
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1613
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
1614
+ query_params: {'api-version' => @client.api_version},
1615
+ headers: request_headers.merge(custom_headers || {}),
1616
+ base_url: request_url
1617
+ }
1618
+ promise = @client.make_request_async(:post, path_template, options)
1619
+
1620
+ promise = promise.then do |result|
1621
+ http_response = result.response
1622
+ status_code = http_response.status
1623
+ response_content = http_response.body
1624
+ unless status_code == 200 || status_code == 202
1625
+ error_model = JSON.load(response_content)
1626
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1627
+ end
1628
+
1629
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1630
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1631
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1632
+
1633
+ result
1634
+ end
1635
+
1636
+ promise.execute
1637
+ end
1638
+
1639
+ #
1640
+ # Lists all the storage accounts available under the subscription. Note that
1641
+ # storage keys are not returned; use the ListKeys operation for this.
1642
+ #
1643
+ # @param next_page_link [String] The NextLink from the previous successful call
1644
+ # to List operation.
1645
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1646
+ # will be added to the HTTP request.
1647
+ #
1648
+ # @return [StorageAccountListResult] operation results.
1649
+ #
1650
+ def list_next(next_page_link, custom_headers:nil)
1651
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
1652
+ response.body unless response.nil?
1653
+ end
1654
+
1655
+ #
1656
+ # Lists all the storage accounts available under the subscription. Note that
1657
+ # storage keys are not returned; use the ListKeys operation for this.
1658
+ #
1659
+ # @param next_page_link [String] The NextLink from the previous successful call
1660
+ # to List operation.
1661
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1662
+ # will be added to the HTTP request.
1663
+ #
1664
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1665
+ #
1666
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
1667
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
1668
+ end
1669
+
1670
+ #
1671
+ # Lists all the storage accounts available under the subscription. Note that
1672
+ # storage keys are not returned; use the ListKeys operation for this.
1673
+ #
1674
+ # @param next_page_link [String] The NextLink from the previous successful call
1675
+ # to List operation.
1676
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1677
+ # to the HTTP request.
1678
+ #
1679
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1680
+ #
1681
+ def list_next_async(next_page_link, custom_headers:nil)
1682
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1683
+
1684
+
1685
+ request_headers = {}
1686
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1687
+
1688
+ # Set Headers
1689
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1690
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1691
+ path_template = '{nextLink}'
1692
+
1693
+ request_url = @base_url || @client.base_url
1694
+
1695
+ options = {
1696
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1697
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1698
+ headers: request_headers.merge(custom_headers || {}),
1699
+ base_url: request_url
1700
+ }
1701
+ promise = @client.make_request_async(:get, 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
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1714
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1715
+ # Deserialize Response
1716
+ if status_code == 200
1717
+ begin
1718
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1719
+ result_mapper = Azure::Storage::Mgmt::V2019_06_01::Models::StorageAccountListResult.mapper()
1720
+ result.body = @client.deserialize(result_mapper, parsed_response)
1721
+ rescue Exception => e
1722
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1723
+ end
1724
+ end
1725
+
1726
+ result
1727
+ end
1728
+
1729
+ promise.execute
1730
+ end
1731
+
1732
+ #
1733
+ # Lists all the storage accounts available under the subscription. Note that
1734
+ # storage keys are not returned; use the ListKeys operation for this.
1735
+ #
1736
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1737
+ # will be added to the HTTP request.
1738
+ #
1739
+ # @return [StorageAccountListResult] which provide lazy access to pages of the
1740
+ # response.
1741
+ #
1742
+ def list_as_lazy(custom_headers:nil)
1743
+ response = list_async(custom_headers:custom_headers).value!
1744
+ unless response.nil?
1745
+ page = response.body
1746
+ page.next_method = Proc.new do |next_page_link|
1747
+ list_next_async(next_page_link, custom_headers:custom_headers)
1748
+ end
1749
+ page
1750
+ end
1751
+ end
1752
+
1753
+ end
1754
+ end