azure_mgmt_server_management 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/LICENSE.txt +21 -0
- data/Rakefile +5 -0
- data/azure_mgmt_server_management.gemspec +34 -0
- data/lib/azure_mgmt_server_management.rb +5 -0
- data/lib/generated/azure_mgmt_server_management.rb +57 -0
- data/lib/generated/azure_mgmt_server_management/gateway.rb +1394 -0
- data/lib/generated/azure_mgmt_server_management/models/auto_upgrade.rb +16 -0
- data/lib/generated/azure_mgmt_server_management/models/error.rb +64 -0
- data/lib/generated/azure_mgmt_server_management/models/gateway_expand_option.rb +15 -0
- data/lib/generated/azure_mgmt_server_management/models/gateway_parameters.rb +67 -0
- data/lib/generated/azure_mgmt_server_management/models/gateway_profile.rb +136 -0
- data/lib/generated/azure_mgmt_server_management/models/gateway_resource.rb +178 -0
- data/lib/generated/azure_mgmt_server_management/models/gateway_resources.rb +93 -0
- data/lib/generated/azure_mgmt_server_management/models/gateway_status.rb +153 -0
- data/lib/generated/azure_mgmt_server_management/models/node_parameters.rb +94 -0
- data/lib/generated/azure_mgmt_server_management/models/node_resource.rb +128 -0
- data/lib/generated/azure_mgmt_server_management/models/node_resources.rb +93 -0
- data/lib/generated/azure_mgmt_server_management/models/power_shell_command_parameters.rb +44 -0
- data/lib/generated/azure_mgmt_server_management/models/power_shell_command_result.rb +146 -0
- data/lib/generated/azure_mgmt_server_management/models/power_shell_command_results.rb +82 -0
- data/lib/generated/azure_mgmt_server_management/models/power_shell_command_status.rb +135 -0
- data/lib/generated/azure_mgmt_server_management/models/power_shell_expand_option.rb +15 -0
- data/lib/generated/azure_mgmt_server_management/models/power_shell_session_resource.rb +160 -0
- data/lib/generated/azure_mgmt_server_management/models/power_shell_session_resources.rb +63 -0
- data/lib/generated/azure_mgmt_server_management/models/power_shell_tab_completion_parameters.rb +44 -0
- data/lib/generated/azure_mgmt_server_management/models/power_shell_tab_completion_results.rb +52 -0
- data/lib/generated/azure_mgmt_server_management/models/prompt_field_description.rb +87 -0
- data/lib/generated/azure_mgmt_server_management/models/prompt_field_type.rb +17 -0
- data/lib/generated/azure_mgmt_server_management/models/prompt_message_response.rb +51 -0
- data/lib/generated/azure_mgmt_server_management/models/session_parameters.rb +54 -0
- data/lib/generated/azure_mgmt_server_management/models/session_resource.rb +118 -0
- data/lib/generated/azure_mgmt_server_management/models/version.rb +94 -0
- data/lib/generated/azure_mgmt_server_management/module_definition.rb +8 -0
- data/lib/generated/azure_mgmt_server_management/node.rb +996 -0
- data/lib/generated/azure_mgmt_server_management/power_shell.rb +989 -0
- data/lib/generated/azure_mgmt_server_management/server_management.rb +80 -0
- data/lib/generated/azure_mgmt_server_management/session.rb +398 -0
- data/lib/generated/azure_mgmt_server_management/version.rb +8 -0
- metadata +153 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::ServerManagement
|
7
|
+
#
|
8
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class ServerManagement < MsRestAzure::AzureServiceClient
|
11
|
+
include MsRest::Serialization
|
12
|
+
include MsRestAzure
|
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] Gets subscription credentials which uniquely identify
|
21
|
+
# Microsoft Azure subscription. The subscription ID forms part of the URI
|
22
|
+
# for every service call.
|
23
|
+
attr_accessor :subscription_id
|
24
|
+
|
25
|
+
# @return [String] Client Api Version.
|
26
|
+
attr_reader :api_version
|
27
|
+
|
28
|
+
# @return [String] Gets or sets the preferred language for the response.
|
29
|
+
attr_accessor :accept_language
|
30
|
+
|
31
|
+
# @return [Integer] Gets or sets the retry timeout in seconds for Long
|
32
|
+
# Running Operations. Default value is 30.
|
33
|
+
attr_accessor :long_running_operation_retry_timeout
|
34
|
+
|
35
|
+
# @return [Boolean] When set to true a unique x-ms-client-request-id value
|
36
|
+
# is generated and included in each request. Default is true.
|
37
|
+
attr_accessor :generate_client_request_id
|
38
|
+
|
39
|
+
# @return Subscription credentials which uniquely identify client
|
40
|
+
# subscription.
|
41
|
+
attr_accessor :credentials
|
42
|
+
|
43
|
+
# @return [Gateway] gateway
|
44
|
+
attr_reader :gateway
|
45
|
+
|
46
|
+
# @return [Node] node
|
47
|
+
attr_reader :node
|
48
|
+
|
49
|
+
# @return [Session] session
|
50
|
+
attr_reader :session
|
51
|
+
|
52
|
+
# @return [PowerShell] power_shell
|
53
|
+
attr_reader :power_shell
|
54
|
+
|
55
|
+
#
|
56
|
+
# Creates initializes a new instance of the ServerManagement class.
|
57
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
58
|
+
# @param base_url [String] the base URI of the service.
|
59
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
60
|
+
#
|
61
|
+
def initialize(credentials, base_url = nil, options = nil)
|
62
|
+
super(credentials, options)
|
63
|
+
@base_url = base_url || 'https://management.azure.com'
|
64
|
+
|
65
|
+
fail ArgumentError, 'credentials is nil' if credentials.nil?
|
66
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials)
|
67
|
+
@credentials = credentials
|
68
|
+
|
69
|
+
@gateway = Gateway.new(self)
|
70
|
+
@node = Node.new(self)
|
71
|
+
@session = Session.new(self)
|
72
|
+
@power_shell = PowerShell.new(self)
|
73
|
+
@api_version = '2015-07-01-preview'
|
74
|
+
@accept_language = 'en-US'
|
75
|
+
@long_running_operation_retry_timeout = 30
|
76
|
+
@generate_client_request_id = true
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,398 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::ServerManagement
|
7
|
+
#
|
8
|
+
# REST API for Azure Server Management Service
|
9
|
+
#
|
10
|
+
class Session
|
11
|
+
include Azure::ARM::ServerManagement::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the Session class.
|
16
|
+
# @param client service class for accessing basic functionality.
|
17
|
+
#
|
18
|
+
def initialize(client)
|
19
|
+
@client = client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return reference to the ServerManagement
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# Creates a session for a node
|
27
|
+
#
|
28
|
+
# @param resource_group_name [String] The resource group name uniquely
|
29
|
+
# identifies the resource group within the user subscriptionId.
|
30
|
+
# @param node_name [String] The node name (256 characters maximum).
|
31
|
+
# @param session [String] The sessionId from the user
|
32
|
+
# @param user_name [String] User name to be used to connect to node
|
33
|
+
# @param password [String] Password associated with user name
|
34
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
35
|
+
# will be added to the HTTP request.
|
36
|
+
#
|
37
|
+
# @return [SessionResource] operation results.
|
38
|
+
#
|
39
|
+
def create(resource_group_name, node_name, session, user_name = nil, password = nil, custom_headers = nil)
|
40
|
+
response = create_async(resource_group_name, node_name, session, user_name, password, custom_headers).value!
|
41
|
+
response.body unless response.nil?
|
42
|
+
end
|
43
|
+
|
44
|
+
#
|
45
|
+
# @param resource_group_name [String] The resource group name uniquely
|
46
|
+
# identifies the resource group within the user subscriptionId.
|
47
|
+
# @param node_name [String] The node name (256 characters maximum).
|
48
|
+
# @param session [String] The sessionId from the user
|
49
|
+
# @param user_name [String] User name to be used to connect to node
|
50
|
+
# @param password [String] Password associated with user name
|
51
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
52
|
+
# will be added to the HTTP request.
|
53
|
+
#
|
54
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
55
|
+
# response.
|
56
|
+
#
|
57
|
+
def create_async(resource_group_name, node_name, session, user_name = nil, password = nil, custom_headers = nil)
|
58
|
+
# Send request
|
59
|
+
promise = begin_create_async(resource_group_name, node_name, session, user_name, password, custom_headers)
|
60
|
+
|
61
|
+
promise = promise.then do |response|
|
62
|
+
# Defining deserialization method.
|
63
|
+
deserialize_method = lambda do |parsed_response|
|
64
|
+
result_mapper = SessionResource.mapper()
|
65
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
|
66
|
+
end
|
67
|
+
|
68
|
+
# Waiting for response.
|
69
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
70
|
+
end
|
71
|
+
|
72
|
+
promise
|
73
|
+
end
|
74
|
+
|
75
|
+
#
|
76
|
+
# Creates a session for a node
|
77
|
+
#
|
78
|
+
# @param resource_group_name [String] The resource group name uniquely
|
79
|
+
# identifies the resource group within the user subscriptionId.
|
80
|
+
# @param node_name [String] The node name (256 characters maximum).
|
81
|
+
# @param session [String] The sessionId from the user
|
82
|
+
# @param user_name [String] User name to be used to connect to node
|
83
|
+
# @param password [String] Password associated with user name
|
84
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
85
|
+
# will be added to the HTTP request.
|
86
|
+
#
|
87
|
+
# @return [SessionResource] operation results.
|
88
|
+
#
|
89
|
+
def begin_create(resource_group_name, node_name, session, user_name = nil, password = nil, custom_headers = nil)
|
90
|
+
response = begin_create_async(resource_group_name, node_name, session, user_name, password, custom_headers).value!
|
91
|
+
response.body unless response.nil?
|
92
|
+
end
|
93
|
+
|
94
|
+
#
|
95
|
+
# Creates a session for a node
|
96
|
+
#
|
97
|
+
# @param resource_group_name [String] The resource group name uniquely
|
98
|
+
# identifies the resource group within the user subscriptionId.
|
99
|
+
# @param node_name [String] The node name (256 characters maximum).
|
100
|
+
# @param session [String] The sessionId from the user
|
101
|
+
# @param user_name [String] User name to be used to connect to node
|
102
|
+
# @param password [String] Password associated with user name
|
103
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
104
|
+
# will be added to the HTTP request.
|
105
|
+
#
|
106
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
107
|
+
#
|
108
|
+
def begin_create_with_http_info(resource_group_name, node_name, session, user_name = nil, password = nil, custom_headers = nil)
|
109
|
+
begin_create_async(resource_group_name, node_name, session, user_name, password, custom_headers).value!
|
110
|
+
end
|
111
|
+
|
112
|
+
#
|
113
|
+
# Creates a session for a node
|
114
|
+
#
|
115
|
+
# @param resource_group_name [String] The resource group name uniquely
|
116
|
+
# identifies the resource group within the user subscriptionId.
|
117
|
+
# @param node_name [String] The node name (256 characters maximum).
|
118
|
+
# @param session [String] The sessionId from the user
|
119
|
+
# @param user_name [String] User name to be used to connect to node
|
120
|
+
# @param password [String] Password associated with user name
|
121
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
122
|
+
# to the HTTP request.
|
123
|
+
#
|
124
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
125
|
+
#
|
126
|
+
def begin_create_async(resource_group_name, node_name, session, user_name = nil, password = nil, custom_headers = nil)
|
127
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
128
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
129
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
130
|
+
fail ArgumentError, 'node_name is nil' if node_name.nil?
|
131
|
+
fail ArgumentError, 'session is nil' if session.nil?
|
132
|
+
|
133
|
+
session_parameters = SessionParameters.new
|
134
|
+
unless user_name.nil? && password.nil?
|
135
|
+
session_parameters.user_name = user_name
|
136
|
+
session_parameters.password = password
|
137
|
+
end
|
138
|
+
|
139
|
+
request_headers = {}
|
140
|
+
|
141
|
+
# Set Headers
|
142
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
143
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
144
|
+
|
145
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
146
|
+
|
147
|
+
# Serialize Request
|
148
|
+
request_mapper = SessionParameters.mapper()
|
149
|
+
request_content = @client.serialize(request_mapper, session_parameters, 'session_parameters')
|
150
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
151
|
+
|
152
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}'
|
153
|
+
options = {
|
154
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
155
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session},
|
156
|
+
query_params: {'api-version' => @client.api_version},
|
157
|
+
body: request_content,
|
158
|
+
headers: request_headers.merge(custom_headers || {})
|
159
|
+
}
|
160
|
+
|
161
|
+
request_url = @base_url || @client.base_url
|
162
|
+
|
163
|
+
request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
|
164
|
+
promise = request.run_promise do |req|
|
165
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
166
|
+
end
|
167
|
+
|
168
|
+
promise = promise.then do |http_response|
|
169
|
+
status_code = http_response.status
|
170
|
+
response_content = http_response.body
|
171
|
+
unless status_code == 200 || status_code == 201 || status_code == 202
|
172
|
+
error_model = JSON.load(response_content)
|
173
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
174
|
+
end
|
175
|
+
|
176
|
+
# Create Result
|
177
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
178
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
179
|
+
# Deserialize Response
|
180
|
+
if status_code == 200
|
181
|
+
begin
|
182
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
183
|
+
result_mapper = SessionResource.mapper()
|
184
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
185
|
+
rescue Exception => e
|
186
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
# Deserialize Response
|
190
|
+
if status_code == 201
|
191
|
+
begin
|
192
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
193
|
+
result_mapper = SessionResource.mapper()
|
194
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
195
|
+
rescue Exception => e
|
196
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
result
|
201
|
+
end
|
202
|
+
|
203
|
+
promise.execute
|
204
|
+
end
|
205
|
+
|
206
|
+
#
|
207
|
+
# Deletes a session for a node
|
208
|
+
#
|
209
|
+
# @param resource_group_name [String] The resource group name uniquely
|
210
|
+
# identifies the resource group within the user subscriptionId.
|
211
|
+
# @param node_name [String] The node name (256 characters maximum).
|
212
|
+
# @param session [String] The sessionId from the user
|
213
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
214
|
+
# will be added to the HTTP request.
|
215
|
+
#
|
216
|
+
#
|
217
|
+
def delete(resource_group_name, node_name, session, custom_headers = nil)
|
218
|
+
response = delete_async(resource_group_name, node_name, session, custom_headers).value!
|
219
|
+
nil
|
220
|
+
end
|
221
|
+
|
222
|
+
#
|
223
|
+
# Deletes a session for a node
|
224
|
+
#
|
225
|
+
# @param resource_group_name [String] The resource group name uniquely
|
226
|
+
# identifies the resource group within the user subscriptionId.
|
227
|
+
# @param node_name [String] The node name (256 characters maximum).
|
228
|
+
# @param session [String] The sessionId from the user
|
229
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
230
|
+
# will be added to the HTTP request.
|
231
|
+
#
|
232
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
233
|
+
#
|
234
|
+
def delete_with_http_info(resource_group_name, node_name, session, custom_headers = nil)
|
235
|
+
delete_async(resource_group_name, node_name, session, custom_headers).value!
|
236
|
+
end
|
237
|
+
|
238
|
+
#
|
239
|
+
# Deletes a session for a node
|
240
|
+
#
|
241
|
+
# @param resource_group_name [String] The resource group name uniquely
|
242
|
+
# identifies the resource group within the user subscriptionId.
|
243
|
+
# @param node_name [String] The node name (256 characters maximum).
|
244
|
+
# @param session [String] The sessionId from the user
|
245
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
246
|
+
# to the HTTP request.
|
247
|
+
#
|
248
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
249
|
+
#
|
250
|
+
def delete_async(resource_group_name, node_name, session, custom_headers = nil)
|
251
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
252
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
253
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
254
|
+
fail ArgumentError, 'node_name is nil' if node_name.nil?
|
255
|
+
fail ArgumentError, 'session is nil' if session.nil?
|
256
|
+
|
257
|
+
|
258
|
+
request_headers = {}
|
259
|
+
|
260
|
+
# Set Headers
|
261
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
262
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
263
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}'
|
264
|
+
options = {
|
265
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
266
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session},
|
267
|
+
query_params: {'api-version' => @client.api_version},
|
268
|
+
headers: request_headers.merge(custom_headers || {})
|
269
|
+
}
|
270
|
+
|
271
|
+
request_url = @base_url || @client.base_url
|
272
|
+
|
273
|
+
request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
|
274
|
+
promise = request.run_promise do |req|
|
275
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
276
|
+
end
|
277
|
+
|
278
|
+
promise = promise.then do |http_response|
|
279
|
+
status_code = http_response.status
|
280
|
+
response_content = http_response.body
|
281
|
+
unless status_code == 200 || status_code == 204
|
282
|
+
error_model = JSON.load(response_content)
|
283
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
284
|
+
end
|
285
|
+
|
286
|
+
# Create Result
|
287
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
288
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
289
|
+
|
290
|
+
result
|
291
|
+
end
|
292
|
+
|
293
|
+
promise.execute
|
294
|
+
end
|
295
|
+
|
296
|
+
#
|
297
|
+
# Gets a session for a node
|
298
|
+
#
|
299
|
+
# @param resource_group_name [String] The resource group name uniquely
|
300
|
+
# identifies the resource group within the user subscriptionId.
|
301
|
+
# @param node_name [String] The node name (256 characters maximum).
|
302
|
+
# @param session [String] The sessionId from the user
|
303
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
304
|
+
# will be added to the HTTP request.
|
305
|
+
#
|
306
|
+
# @return [SessionResource] operation results.
|
307
|
+
#
|
308
|
+
def get(resource_group_name, node_name, session, custom_headers = nil)
|
309
|
+
response = get_async(resource_group_name, node_name, session, custom_headers).value!
|
310
|
+
response.body unless response.nil?
|
311
|
+
end
|
312
|
+
|
313
|
+
#
|
314
|
+
# Gets a session for a node
|
315
|
+
#
|
316
|
+
# @param resource_group_name [String] The resource group name uniquely
|
317
|
+
# identifies the resource group within the user subscriptionId.
|
318
|
+
# @param node_name [String] The node name (256 characters maximum).
|
319
|
+
# @param session [String] The sessionId from the user
|
320
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
321
|
+
# will be added to the HTTP request.
|
322
|
+
#
|
323
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
324
|
+
#
|
325
|
+
def get_with_http_info(resource_group_name, node_name, session, custom_headers = nil)
|
326
|
+
get_async(resource_group_name, node_name, session, custom_headers).value!
|
327
|
+
end
|
328
|
+
|
329
|
+
#
|
330
|
+
# Gets a session for a node
|
331
|
+
#
|
332
|
+
# @param resource_group_name [String] The resource group name uniquely
|
333
|
+
# identifies the resource group within the user subscriptionId.
|
334
|
+
# @param node_name [String] The node name (256 characters maximum).
|
335
|
+
# @param session [String] The sessionId from the user
|
336
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
337
|
+
# to the HTTP request.
|
338
|
+
#
|
339
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
340
|
+
#
|
341
|
+
def get_async(resource_group_name, node_name, session, custom_headers = nil)
|
342
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
343
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
344
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
345
|
+
fail ArgumentError, 'node_name is nil' if node_name.nil?
|
346
|
+
fail ArgumentError, 'session is nil' if session.nil?
|
347
|
+
|
348
|
+
|
349
|
+
request_headers = {}
|
350
|
+
|
351
|
+
# Set Headers
|
352
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
353
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
354
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}'
|
355
|
+
options = {
|
356
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
357
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session},
|
358
|
+
query_params: {'api-version' => @client.api_version},
|
359
|
+
headers: request_headers.merge(custom_headers || {})
|
360
|
+
}
|
361
|
+
|
362
|
+
request_url = @base_url || @client.base_url
|
363
|
+
|
364
|
+
request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
|
365
|
+
promise = request.run_promise do |req|
|
366
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
367
|
+
end
|
368
|
+
|
369
|
+
promise = promise.then do |http_response|
|
370
|
+
status_code = http_response.status
|
371
|
+
response_content = http_response.body
|
372
|
+
unless status_code == 200
|
373
|
+
error_model = JSON.load(response_content)
|
374
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
375
|
+
end
|
376
|
+
|
377
|
+
# Create Result
|
378
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
379
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
380
|
+
# Deserialize Response
|
381
|
+
if status_code == 200
|
382
|
+
begin
|
383
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
384
|
+
result_mapper = SessionResource.mapper()
|
385
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
386
|
+
rescue Exception => e
|
387
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
result
|
392
|
+
end
|
393
|
+
|
394
|
+
promise.execute
|
395
|
+
end
|
396
|
+
|
397
|
+
end
|
398
|
+
end
|