azure_mgmt_azurestack_hci 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci.rb +46 -0
  4. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/azure_stack_hciclient.rb +135 -0
  5. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/clusters.rb +850 -0
  6. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/azure_entity_resource.rb +75 -0
  7. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/cluster.rb +184 -0
  8. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/cluster_list.rb +99 -0
  9. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/cluster_node.rb +144 -0
  10. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/cluster_reported_properties.rb +105 -0
  11. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/cluster_update.rb +54 -0
  12. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/error_additional_info.rb +59 -0
  13. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/error_response.rb +47 -0
  14. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/error_response_error.rb +113 -0
  15. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/operation.rb +59 -0
  16. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/operation_display.rb +79 -0
  17. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/operation_list.rb +67 -0
  18. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/provisioning_state.rb +19 -0
  19. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/proxy_resource.rb +63 -0
  20. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/resource.rb +83 -0
  21. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/status.rb +19 -0
  22. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/tracked_resource.rb +92 -0
  23. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/module_definition.rb +9 -0
  24. data/lib/2020-03-01-preview/generated/azure_mgmt_azurestack_hci/operations.rb +110 -0
  25. data/lib/azure_mgmt_azurestack_hci.rb +6 -0
  26. data/lib/module_definition.rb +7 -0
  27. data/lib/profiles/latest/azurestackhci_latest_profile_client.rb +40 -0
  28. data/lib/profiles/latest/azurestackhci_module_definition.rb +8 -0
  29. data/lib/profiles/latest/modules/azurestackhci_profile_module.rb +131 -0
  30. data/lib/version.rb +7 -0
  31. metadata +146 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 07347ec1c614d639b706df890ee1561397f282e33f4c1878113129b8577c5904
4
+ data.tar.gz: 5e53d0e96ddc33000d84ad02c63bebc86e7c8caf1cfa516da6dc991a3064ea3e
5
+ SHA512:
6
+ metadata.gz: a1b8e844d1d4f7bf68219b46aa563f7874a7a875518ccbd34b842048028e347d935d23697ce892df5c99ede861ba0a8fbf175f6adf5e55446afeff35d81f62a3
7
+ data.tar.gz: 39a039e9c9bd2d1f24c869c490702fa0e00efc52f79d5d86cbd10c5a58d624416e64118bdc3f00d28a5a9e5ef511a088e71b64082d13886e4a4ac36eff79f912
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,46 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::AzureStackHCI::Mgmt::V2020_03_01_preview
23
+ autoload :Operations, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/operations.rb'
24
+ autoload :Clusters, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/clusters.rb'
25
+ autoload :AzureStackHCIClient, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/azure_stack_hciclient.rb'
26
+
27
+ module Models
28
+ autoload :OperationList, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/operation_list.rb'
29
+ autoload :Operation, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/operation.rb'
30
+ autoload :ClusterNode, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/cluster_node.rb'
31
+ autoload :ErrorAdditionalInfo, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/error_additional_info.rb'
32
+ autoload :ClusterList, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/cluster_list.rb'
33
+ autoload :OperationDisplay, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/operation_display.rb'
34
+ autoload :ErrorResponse, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/error_response.rb'
35
+ autoload :ClusterUpdate, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/cluster_update.rb'
36
+ autoload :Resource, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/resource.rb'
37
+ autoload :ClusterReportedProperties, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/cluster_reported_properties.rb'
38
+ autoload :ErrorResponseError, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/error_response_error.rb'
39
+ autoload :Cluster, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/cluster.rb'
40
+ autoload :ProxyResource, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/proxy_resource.rb'
41
+ autoload :AzureEntityResource, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/azure_entity_resource.rb'
42
+ autoload :TrackedResource, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/tracked_resource.rb'
43
+ autoload :ProvisioningState, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/provisioning_state.rb'
44
+ autoload :Status, '2020-03-01-preview/generated/azure_mgmt_azurestack_hci/models/status.rb'
45
+ end
46
+ end
@@ -0,0 +1,135 @@
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::AzureStackHCI::Mgmt::V2020_03_01_preview
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class AzureStackHCIClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] The API version to use for this operation.
21
+ attr_reader :api_version
22
+
23
+ # @return [String] The ID of the target subscription.
24
+ attr_accessor :subscription_id
25
+
26
+ # @return [String] The preferred language for the response.
27
+ attr_accessor :accept_language
28
+
29
+ # @return [Integer] The retry timeout in seconds for Long Running
30
+ # Operations. Default value is 30.
31
+ attr_accessor :long_running_operation_retry_timeout
32
+
33
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
34
+ # generated. When set to true a unique x-ms-client-request-id value is
35
+ # generated and included in each request. Default is true.
36
+ attr_accessor :generate_client_request_id
37
+
38
+ # @return [Operations] operations
39
+ attr_reader :operations
40
+
41
+ # @return [Clusters] clusters
42
+ attr_reader :clusters
43
+
44
+ #
45
+ # Creates initializes a new instance of the AzureStackHCIClient class.
46
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
47
+ # @param base_url [String] the base URI of the service.
48
+ # @param options [Array] filters to be applied to the HTTP requests.
49
+ #
50
+ def initialize(credentials = nil, base_url = nil, options = nil)
51
+ super(credentials, options)
52
+ @base_url = base_url || 'https://management.azure.com'
53
+
54
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
55
+ @credentials = credentials
56
+
57
+ @operations = Operations.new(self)
58
+ @clusters = Clusters.new(self)
59
+ @api_version = '2020-03-01-preview'
60
+ @accept_language = 'en-US'
61
+ @long_running_operation_retry_timeout = 30
62
+ @generate_client_request_id = true
63
+ add_telemetry
64
+ end
65
+
66
+ #
67
+ # Makes a request and returns the body of the response.
68
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
69
+ # @param path [String] the path, relative to {base_url}.
70
+ # @param options [Hash{String=>String}] specifying any request options like :body.
71
+ # @return [Hash{String=>String}] containing the body of the response.
72
+ # Example:
73
+ #
74
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
75
+ # path = "/path"
76
+ # options = {
77
+ # body: request_content,
78
+ # query_params: {'api-version' => '2016-02-01'}
79
+ # }
80
+ # result = @client.make_request(:put, path, options)
81
+ #
82
+ def make_request(method, path, options = {})
83
+ result = make_request_with_http_info(method, path, options)
84
+ result.body unless result.nil?
85
+ end
86
+
87
+ #
88
+ # Makes a request and returns the operation response.
89
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
90
+ # @param path [String] the path, relative to {base_url}.
91
+ # @param options [Hash{String=>String}] specifying any request options like :body.
92
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
93
+ #
94
+ def make_request_with_http_info(method, path, options = {})
95
+ result = make_request_async(method, path, options).value!
96
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
97
+ result
98
+ end
99
+
100
+ #
101
+ # Makes a request asynchronously.
102
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
103
+ # @param path [String] the path, relative to {base_url}.
104
+ # @param options [Hash{String=>String}] specifying any request options like :body.
105
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
106
+ #
107
+ def make_request_async(method, path, options = {})
108
+ fail ArgumentError, 'method is nil' if method.nil?
109
+ fail ArgumentError, 'path is nil' if path.nil?
110
+
111
+ request_url = options[:base_url] || @base_url
112
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
113
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
114
+ end
115
+
116
+ request_headers = @request_headers
117
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
118
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
119
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
120
+
121
+ super(request_url, method, path, options)
122
+ end
123
+
124
+
125
+ private
126
+ #
127
+ # Adds telemetry information.
128
+ #
129
+ def add_telemetry
130
+ sdk_information = 'azure_mgmt_azurestack_hci'
131
+ sdk_information = "#{sdk_information}/0.17.0"
132
+ add_user_agent_information(sdk_information)
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,850 @@
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::AzureStackHCI::Mgmt::V2020_03_01_preview
7
+ #
8
+ # Azure Stack HCI management service
9
+ #
10
+ class Clusters
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Clusters class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [AzureStackHCIClient] reference to the AzureStackHCIClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # List all HCI clusters in a subscription.
26
+ #
27
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
28
+ # will be added to the HTTP request.
29
+ #
30
+ # @return [Array<Cluster>] operation results.
31
+ #
32
+ def list(custom_headers:nil)
33
+ first_page = list_as_lazy(custom_headers:custom_headers)
34
+ first_page.get_all_items
35
+ end
36
+
37
+ #
38
+ # List all HCI clusters in a subscription.
39
+ #
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
44
+ #
45
+ def list_with_http_info(custom_headers:nil)
46
+ list_async(custom_headers:custom_headers).value!
47
+ end
48
+
49
+ #
50
+ # List all HCI clusters in a subscription.
51
+ #
52
+ # @param [Hash{String => String}] A hash of custom headers that will be added
53
+ # to the HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
+ #
57
+ def list_async(custom_headers:nil)
58
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
59
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
60
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
61
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
62
+
63
+
64
+ request_headers = {}
65
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
66
+
67
+ # Set Headers
68
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
69
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
70
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters'
71
+
72
+ request_url = @base_url || @client.base_url
73
+
74
+ options = {
75
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
76
+ path_params: {'subscriptionId' => @client.subscription_id},
77
+ query_params: {'api-version' => @client.api_version},
78
+ headers: request_headers.merge(custom_headers || {}),
79
+ base_url: request_url
80
+ }
81
+ promise = @client.make_request_async(:get, path_template, options)
82
+
83
+ promise = promise.then do |result|
84
+ http_response = result.response
85
+ status_code = http_response.status
86
+ response_content = http_response.body
87
+ unless status_code == 200
88
+ error_model = JSON.load(response_content)
89
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
90
+ end
91
+
92
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
93
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
94
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
95
+ # Deserialize Response
96
+ if status_code == 200
97
+ begin
98
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
99
+ result_mapper = Azure::AzureStackHCI::Mgmt::V2020_03_01_preview::Models::ClusterList.mapper()
100
+ result.body = @client.deserialize(result_mapper, parsed_response)
101
+ rescue Exception => e
102
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
103
+ end
104
+ end
105
+
106
+ result
107
+ end
108
+
109
+ promise.execute
110
+ end
111
+
112
+ #
113
+ # List all HCI clusters in a resource group.
114
+ #
115
+ # @param resource_group_name [String] The name of the resource group. The name
116
+ # is case insensitive.
117
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
118
+ # will be added to the HTTP request.
119
+ #
120
+ # @return [Array<Cluster>] operation results.
121
+ #
122
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
123
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
124
+ first_page.get_all_items
125
+ end
126
+
127
+ #
128
+ # List all HCI clusters in a resource group.
129
+ #
130
+ # @param resource_group_name [String] The name of the resource group. The name
131
+ # is case insensitive.
132
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
133
+ # will be added to the HTTP request.
134
+ #
135
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
136
+ #
137
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
138
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
139
+ end
140
+
141
+ #
142
+ # List all HCI clusters in a resource group.
143
+ #
144
+ # @param resource_group_name [String] The name of the resource group. The name
145
+ # is case insensitive.
146
+ # @param [Hash{String => String}] A hash of custom headers that will be added
147
+ # to the HTTP request.
148
+ #
149
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
150
+ #
151
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
152
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
153
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
154
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
155
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
156
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
157
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
158
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
159
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
160
+
161
+
162
+ request_headers = {}
163
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
164
+
165
+ # Set Headers
166
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
167
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
168
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters'
169
+
170
+ request_url = @base_url || @client.base_url
171
+
172
+ options = {
173
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
174
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
175
+ query_params: {'api-version' => @client.api_version},
176
+ headers: request_headers.merge(custom_headers || {}),
177
+ base_url: request_url
178
+ }
179
+ promise = @client.make_request_async(:get, path_template, options)
180
+
181
+ promise = promise.then do |result|
182
+ http_response = result.response
183
+ status_code = http_response.status
184
+ response_content = http_response.body
185
+ unless status_code == 200
186
+ error_model = JSON.load(response_content)
187
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
188
+ end
189
+
190
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
191
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
192
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
193
+ # Deserialize Response
194
+ if status_code == 200
195
+ begin
196
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
197
+ result_mapper = Azure::AzureStackHCI::Mgmt::V2020_03_01_preview::Models::ClusterList.mapper()
198
+ result.body = @client.deserialize(result_mapper, parsed_response)
199
+ rescue Exception => e
200
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
201
+ end
202
+ end
203
+
204
+ result
205
+ end
206
+
207
+ promise.execute
208
+ end
209
+
210
+ #
211
+ # Get HCI cluster.
212
+ #
213
+ # @param resource_group_name [String] The name of the resource group. The name
214
+ # is case insensitive.
215
+ # @param cluster_name [String] The name of the cluster.
216
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
217
+ # will be added to the HTTP request.
218
+ #
219
+ # @return [Cluster] operation results.
220
+ #
221
+ def get(resource_group_name, cluster_name, custom_headers:nil)
222
+ response = get_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
223
+ response.body unless response.nil?
224
+ end
225
+
226
+ #
227
+ # Get HCI cluster.
228
+ #
229
+ # @param resource_group_name [String] The name of the resource group. The name
230
+ # is case insensitive.
231
+ # @param cluster_name [String] The name of the cluster.
232
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
233
+ # will be added to the HTTP request.
234
+ #
235
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
236
+ #
237
+ def get_with_http_info(resource_group_name, cluster_name, custom_headers:nil)
238
+ get_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
239
+ end
240
+
241
+ #
242
+ # Get HCI cluster.
243
+ #
244
+ # @param resource_group_name [String] The name of the resource group. The name
245
+ # is case insensitive.
246
+ # @param cluster_name [String] The name of the cluster.
247
+ # @param [Hash{String => String}] A hash of custom headers that will be added
248
+ # to the HTTP request.
249
+ #
250
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
251
+ #
252
+ def get_async(resource_group_name, cluster_name, custom_headers:nil)
253
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
254
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
255
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
256
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
257
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
258
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
259
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
260
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
261
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
262
+
263
+
264
+ request_headers = {}
265
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
266
+
267
+ # Set Headers
268
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
269
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
270
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'
271
+
272
+ request_url = @base_url || @client.base_url
273
+
274
+ options = {
275
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
276
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'clusterName' => cluster_name},
277
+ query_params: {'api-version' => @client.api_version},
278
+ headers: request_headers.merge(custom_headers || {}),
279
+ base_url: request_url
280
+ }
281
+ promise = @client.make_request_async(:get, path_template, options)
282
+
283
+ promise = promise.then do |result|
284
+ http_response = result.response
285
+ status_code = http_response.status
286
+ response_content = http_response.body
287
+ unless status_code == 200
288
+ error_model = JSON.load(response_content)
289
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
290
+ end
291
+
292
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
293
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
294
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
295
+ # Deserialize Response
296
+ if status_code == 200
297
+ begin
298
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
299
+ result_mapper = Azure::AzureStackHCI::Mgmt::V2020_03_01_preview::Models::Cluster.mapper()
300
+ result.body = @client.deserialize(result_mapper, parsed_response)
301
+ rescue Exception => e
302
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
303
+ end
304
+ end
305
+
306
+ result
307
+ end
308
+
309
+ promise.execute
310
+ end
311
+
312
+ #
313
+ # Create an HCI cluster.
314
+ #
315
+ # @param resource_group_name [String] The name of the resource group. The name
316
+ # is case insensitive.
317
+ # @param cluster_name [String] The name of the cluster.
318
+ # @param cluster [Cluster] Details of the HCI cluster.
319
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
320
+ # will be added to the HTTP request.
321
+ #
322
+ # @return [Cluster] operation results.
323
+ #
324
+ def create(resource_group_name, cluster_name, cluster, custom_headers:nil)
325
+ response = create_async(resource_group_name, cluster_name, cluster, custom_headers:custom_headers).value!
326
+ response.body unless response.nil?
327
+ end
328
+
329
+ #
330
+ # Create an HCI cluster.
331
+ #
332
+ # @param resource_group_name [String] The name of the resource group. The name
333
+ # is case insensitive.
334
+ # @param cluster_name [String] The name of the cluster.
335
+ # @param cluster [Cluster] Details of the HCI cluster.
336
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
337
+ # will be added to the HTTP request.
338
+ #
339
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
340
+ #
341
+ def create_with_http_info(resource_group_name, cluster_name, cluster, custom_headers:nil)
342
+ create_async(resource_group_name, cluster_name, cluster, custom_headers:custom_headers).value!
343
+ end
344
+
345
+ #
346
+ # Create an HCI cluster.
347
+ #
348
+ # @param resource_group_name [String] The name of the resource group. The name
349
+ # is case insensitive.
350
+ # @param cluster_name [String] The name of the cluster.
351
+ # @param cluster [Cluster] Details of the HCI cluster.
352
+ # @param [Hash{String => String}] A hash of custom headers that will be added
353
+ # to the HTTP request.
354
+ #
355
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
356
+ #
357
+ def create_async(resource_group_name, cluster_name, cluster, custom_headers:nil)
358
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
359
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
360
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
361
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
362
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
363
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
364
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
365
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
366
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
367
+ fail ArgumentError, 'cluster is nil' if cluster.nil?
368
+
369
+
370
+ request_headers = {}
371
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
372
+
373
+ # Set Headers
374
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
375
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
376
+
377
+ # Serialize Request
378
+ request_mapper = Azure::AzureStackHCI::Mgmt::V2020_03_01_preview::Models::Cluster.mapper()
379
+ request_content = @client.serialize(request_mapper, cluster)
380
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
381
+
382
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'
383
+
384
+ request_url = @base_url || @client.base_url
385
+
386
+ options = {
387
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
388
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'clusterName' => cluster_name},
389
+ query_params: {'api-version' => @client.api_version},
390
+ body: request_content,
391
+ headers: request_headers.merge(custom_headers || {}),
392
+ base_url: request_url
393
+ }
394
+ promise = @client.make_request_async(:put, path_template, options)
395
+
396
+ promise = promise.then do |result|
397
+ http_response = result.response
398
+ status_code = http_response.status
399
+ response_content = http_response.body
400
+ unless status_code == 200
401
+ error_model = JSON.load(response_content)
402
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
403
+ end
404
+
405
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
406
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
407
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
408
+ # Deserialize Response
409
+ if status_code == 200
410
+ begin
411
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
412
+ result_mapper = Azure::AzureStackHCI::Mgmt::V2020_03_01_preview::Models::Cluster.mapper()
413
+ result.body = @client.deserialize(result_mapper, parsed_response)
414
+ rescue Exception => e
415
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
416
+ end
417
+ end
418
+
419
+ result
420
+ end
421
+
422
+ promise.execute
423
+ end
424
+
425
+ #
426
+ # Update an HCI cluster.
427
+ #
428
+ # @param resource_group_name [String] The name of the resource group. The name
429
+ # is case insensitive.
430
+ # @param cluster_name [String] The name of the cluster.
431
+ # @param cluster [ClusterUpdate] Details of the HCI cluster.
432
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
433
+ # will be added to the HTTP request.
434
+ #
435
+ # @return [Cluster] operation results.
436
+ #
437
+ def update(resource_group_name, cluster_name, cluster, custom_headers:nil)
438
+ response = update_async(resource_group_name, cluster_name, cluster, custom_headers:custom_headers).value!
439
+ response.body unless response.nil?
440
+ end
441
+
442
+ #
443
+ # Update an HCI cluster.
444
+ #
445
+ # @param resource_group_name [String] The name of the resource group. The name
446
+ # is case insensitive.
447
+ # @param cluster_name [String] The name of the cluster.
448
+ # @param cluster [ClusterUpdate] Details of the HCI cluster.
449
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
450
+ # will be added to the HTTP request.
451
+ #
452
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
453
+ #
454
+ def update_with_http_info(resource_group_name, cluster_name, cluster, custom_headers:nil)
455
+ update_async(resource_group_name, cluster_name, cluster, custom_headers:custom_headers).value!
456
+ end
457
+
458
+ #
459
+ # Update an HCI cluster.
460
+ #
461
+ # @param resource_group_name [String] The name of the resource group. The name
462
+ # is case insensitive.
463
+ # @param cluster_name [String] The name of the cluster.
464
+ # @param cluster [ClusterUpdate] Details of the HCI cluster.
465
+ # @param [Hash{String => String}] A hash of custom headers that will be added
466
+ # to the HTTP request.
467
+ #
468
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
469
+ #
470
+ def update_async(resource_group_name, cluster_name, cluster, custom_headers:nil)
471
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
472
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
473
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
474
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
475
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
476
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
477
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
478
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
479
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
480
+ fail ArgumentError, 'cluster is nil' if cluster.nil?
481
+
482
+
483
+ request_headers = {}
484
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
485
+
486
+ # Set Headers
487
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
488
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
489
+
490
+ # Serialize Request
491
+ request_mapper = Azure::AzureStackHCI::Mgmt::V2020_03_01_preview::Models::ClusterUpdate.mapper()
492
+ request_content = @client.serialize(request_mapper, cluster)
493
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
494
+
495
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'
496
+
497
+ request_url = @base_url || @client.base_url
498
+
499
+ options = {
500
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
501
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'clusterName' => cluster_name},
502
+ query_params: {'api-version' => @client.api_version},
503
+ body: request_content,
504
+ headers: request_headers.merge(custom_headers || {}),
505
+ base_url: request_url
506
+ }
507
+ promise = @client.make_request_async(:patch, path_template, options)
508
+
509
+ promise = promise.then do |result|
510
+ http_response = result.response
511
+ status_code = http_response.status
512
+ response_content = http_response.body
513
+ unless status_code == 200
514
+ error_model = JSON.load(response_content)
515
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
516
+ end
517
+
518
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
519
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
520
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
521
+ # Deserialize Response
522
+ if status_code == 200
523
+ begin
524
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
525
+ result_mapper = Azure::AzureStackHCI::Mgmt::V2020_03_01_preview::Models::Cluster.mapper()
526
+ result.body = @client.deserialize(result_mapper, parsed_response)
527
+ rescue Exception => e
528
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
529
+ end
530
+ end
531
+
532
+ result
533
+ end
534
+
535
+ promise.execute
536
+ end
537
+
538
+ #
539
+ # Delete an HCI cluster.
540
+ #
541
+ # @param resource_group_name [String] The name of the resource group. The name
542
+ # is case insensitive.
543
+ # @param cluster_name [String] The name of the cluster.
544
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
545
+ # will be added to the HTTP request.
546
+ #
547
+ #
548
+ def delete(resource_group_name, cluster_name, custom_headers:nil)
549
+ response = delete_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
550
+ nil
551
+ end
552
+
553
+ #
554
+ # Delete an HCI cluster.
555
+ #
556
+ # @param resource_group_name [String] The name of the resource group. The name
557
+ # is case insensitive.
558
+ # @param cluster_name [String] The name of the cluster.
559
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
560
+ # will be added to the HTTP request.
561
+ #
562
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
563
+ #
564
+ def delete_with_http_info(resource_group_name, cluster_name, custom_headers:nil)
565
+ delete_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
566
+ end
567
+
568
+ #
569
+ # Delete an HCI cluster.
570
+ #
571
+ # @param resource_group_name [String] The name of the resource group. The name
572
+ # is case insensitive.
573
+ # @param cluster_name [String] The name of the cluster.
574
+ # @param [Hash{String => String}] A hash of custom headers that will be added
575
+ # to the HTTP request.
576
+ #
577
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
578
+ #
579
+ def delete_async(resource_group_name, cluster_name, custom_headers:nil)
580
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
581
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
582
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
583
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
584
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
585
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
586
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
587
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
588
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
589
+
590
+
591
+ request_headers = {}
592
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
593
+
594
+ # Set Headers
595
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
596
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
597
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'
598
+
599
+ request_url = @base_url || @client.base_url
600
+
601
+ options = {
602
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
603
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'clusterName' => cluster_name},
604
+ query_params: {'api-version' => @client.api_version},
605
+ headers: request_headers.merge(custom_headers || {}),
606
+ base_url: request_url
607
+ }
608
+ promise = @client.make_request_async(:delete, path_template, options)
609
+
610
+ promise = promise.then do |result|
611
+ http_response = result.response
612
+ status_code = http_response.status
613
+ response_content = http_response.body
614
+ unless status_code == 200 || status_code == 204
615
+ error_model = JSON.load(response_content)
616
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
617
+ end
618
+
619
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
620
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
621
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
622
+
623
+ result
624
+ end
625
+
626
+ promise.execute
627
+ end
628
+
629
+ #
630
+ # List all HCI clusters in a subscription.
631
+ #
632
+ # @param next_page_link [String] The NextLink from the previous successful call
633
+ # to List operation.
634
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
635
+ # will be added to the HTTP request.
636
+ #
637
+ # @return [ClusterList] operation results.
638
+ #
639
+ def list_next(next_page_link, custom_headers:nil)
640
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
641
+ response.body unless response.nil?
642
+ end
643
+
644
+ #
645
+ # List all HCI clusters in a subscription.
646
+ #
647
+ # @param next_page_link [String] The NextLink from the previous successful call
648
+ # to List operation.
649
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
650
+ # will be added to the HTTP request.
651
+ #
652
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
653
+ #
654
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
655
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
656
+ end
657
+
658
+ #
659
+ # List all HCI clusters in a subscription.
660
+ #
661
+ # @param next_page_link [String] The NextLink from the previous successful call
662
+ # to List operation.
663
+ # @param [Hash{String => String}] A hash of custom headers that will be added
664
+ # to the HTTP request.
665
+ #
666
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
667
+ #
668
+ def list_next_async(next_page_link, custom_headers:nil)
669
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
670
+
671
+
672
+ request_headers = {}
673
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
674
+
675
+ # Set Headers
676
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
677
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
678
+ path_template = '{nextLink}'
679
+
680
+ request_url = @base_url || @client.base_url
681
+
682
+ options = {
683
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
684
+ skip_encoding_path_params: {'nextLink' => next_page_link},
685
+ headers: request_headers.merge(custom_headers || {}),
686
+ base_url: request_url
687
+ }
688
+ promise = @client.make_request_async(:get, path_template, options)
689
+
690
+ promise = promise.then do |result|
691
+ http_response = result.response
692
+ status_code = http_response.status
693
+ response_content = http_response.body
694
+ unless status_code == 200
695
+ error_model = JSON.load(response_content)
696
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
697
+ end
698
+
699
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
700
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
701
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
702
+ # Deserialize Response
703
+ if status_code == 200
704
+ begin
705
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
706
+ result_mapper = Azure::AzureStackHCI::Mgmt::V2020_03_01_preview::Models::ClusterList.mapper()
707
+ result.body = @client.deserialize(result_mapper, parsed_response)
708
+ rescue Exception => e
709
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
710
+ end
711
+ end
712
+
713
+ result
714
+ end
715
+
716
+ promise.execute
717
+ end
718
+
719
+ #
720
+ # List all HCI clusters in a resource group.
721
+ #
722
+ # @param next_page_link [String] The NextLink from the previous successful call
723
+ # to List operation.
724
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
725
+ # will be added to the HTTP request.
726
+ #
727
+ # @return [ClusterList] operation results.
728
+ #
729
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
730
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
731
+ response.body unless response.nil?
732
+ end
733
+
734
+ #
735
+ # List all HCI clusters in a resource group.
736
+ #
737
+ # @param next_page_link [String] The NextLink from the previous successful call
738
+ # to List operation.
739
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
740
+ # will be added to the HTTP request.
741
+ #
742
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
743
+ #
744
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
745
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
746
+ end
747
+
748
+ #
749
+ # List all HCI clusters in a resource group.
750
+ #
751
+ # @param next_page_link [String] The NextLink from the previous successful call
752
+ # to List operation.
753
+ # @param [Hash{String => String}] A hash of custom headers that will be added
754
+ # to the HTTP request.
755
+ #
756
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
757
+ #
758
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
759
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
760
+
761
+
762
+ request_headers = {}
763
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
764
+
765
+ # Set Headers
766
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
767
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
768
+ path_template = '{nextLink}'
769
+
770
+ request_url = @base_url || @client.base_url
771
+
772
+ options = {
773
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
774
+ skip_encoding_path_params: {'nextLink' => next_page_link},
775
+ headers: request_headers.merge(custom_headers || {}),
776
+ base_url: request_url
777
+ }
778
+ promise = @client.make_request_async(:get, path_template, options)
779
+
780
+ promise = promise.then do |result|
781
+ http_response = result.response
782
+ status_code = http_response.status
783
+ response_content = http_response.body
784
+ unless status_code == 200
785
+ error_model = JSON.load(response_content)
786
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
787
+ end
788
+
789
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
790
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
791
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
792
+ # Deserialize Response
793
+ if status_code == 200
794
+ begin
795
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
796
+ result_mapper = Azure::AzureStackHCI::Mgmt::V2020_03_01_preview::Models::ClusterList.mapper()
797
+ result.body = @client.deserialize(result_mapper, parsed_response)
798
+ rescue Exception => e
799
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
800
+ end
801
+ end
802
+
803
+ result
804
+ end
805
+
806
+ promise.execute
807
+ end
808
+
809
+ #
810
+ # List all HCI clusters in a subscription.
811
+ #
812
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
813
+ # will be added to the HTTP request.
814
+ #
815
+ # @return [ClusterList] which provide lazy access to pages of the response.
816
+ #
817
+ def list_as_lazy(custom_headers:nil)
818
+ response = list_async(custom_headers:custom_headers).value!
819
+ unless response.nil?
820
+ page = response.body
821
+ page.next_method = Proc.new do |next_page_link|
822
+ list_next_async(next_page_link, custom_headers:custom_headers)
823
+ end
824
+ page
825
+ end
826
+ end
827
+
828
+ #
829
+ # List all HCI clusters in a resource group.
830
+ #
831
+ # @param resource_group_name [String] The name of the resource group. The name
832
+ # is case insensitive.
833
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
834
+ # will be added to the HTTP request.
835
+ #
836
+ # @return [ClusterList] which provide lazy access to pages of the response.
837
+ #
838
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
839
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
840
+ unless response.nil?
841
+ page = response.body
842
+ page.next_method = Proc.new do |next_page_link|
843
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
844
+ end
845
+ page
846
+ end
847
+ end
848
+
849
+ end
850
+ end