azure_mgmt_server_management 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/LICENSE.txt +21 -0
  4. data/Rakefile +5 -0
  5. data/azure_mgmt_server_management.gemspec +34 -0
  6. data/lib/azure_mgmt_server_management.rb +5 -0
  7. data/lib/generated/azure_mgmt_server_management.rb +57 -0
  8. data/lib/generated/azure_mgmt_server_management/gateway.rb +1394 -0
  9. data/lib/generated/azure_mgmt_server_management/models/auto_upgrade.rb +16 -0
  10. data/lib/generated/azure_mgmt_server_management/models/error.rb +64 -0
  11. data/lib/generated/azure_mgmt_server_management/models/gateway_expand_option.rb +15 -0
  12. data/lib/generated/azure_mgmt_server_management/models/gateway_parameters.rb +67 -0
  13. data/lib/generated/azure_mgmt_server_management/models/gateway_profile.rb +136 -0
  14. data/lib/generated/azure_mgmt_server_management/models/gateway_resource.rb +178 -0
  15. data/lib/generated/azure_mgmt_server_management/models/gateway_resources.rb +93 -0
  16. data/lib/generated/azure_mgmt_server_management/models/gateway_status.rb +153 -0
  17. data/lib/generated/azure_mgmt_server_management/models/node_parameters.rb +94 -0
  18. data/lib/generated/azure_mgmt_server_management/models/node_resource.rb +128 -0
  19. data/lib/generated/azure_mgmt_server_management/models/node_resources.rb +93 -0
  20. data/lib/generated/azure_mgmt_server_management/models/power_shell_command_parameters.rb +44 -0
  21. data/lib/generated/azure_mgmt_server_management/models/power_shell_command_result.rb +146 -0
  22. data/lib/generated/azure_mgmt_server_management/models/power_shell_command_results.rb +82 -0
  23. data/lib/generated/azure_mgmt_server_management/models/power_shell_command_status.rb +135 -0
  24. data/lib/generated/azure_mgmt_server_management/models/power_shell_expand_option.rb +15 -0
  25. data/lib/generated/azure_mgmt_server_management/models/power_shell_session_resource.rb +160 -0
  26. data/lib/generated/azure_mgmt_server_management/models/power_shell_session_resources.rb +63 -0
  27. data/lib/generated/azure_mgmt_server_management/models/power_shell_tab_completion_parameters.rb +44 -0
  28. data/lib/generated/azure_mgmt_server_management/models/power_shell_tab_completion_results.rb +52 -0
  29. data/lib/generated/azure_mgmt_server_management/models/prompt_field_description.rb +87 -0
  30. data/lib/generated/azure_mgmt_server_management/models/prompt_field_type.rb +17 -0
  31. data/lib/generated/azure_mgmt_server_management/models/prompt_message_response.rb +51 -0
  32. data/lib/generated/azure_mgmt_server_management/models/session_parameters.rb +54 -0
  33. data/lib/generated/azure_mgmt_server_management/models/session_resource.rb +118 -0
  34. data/lib/generated/azure_mgmt_server_management/models/version.rb +94 -0
  35. data/lib/generated/azure_mgmt_server_management/module_definition.rb +8 -0
  36. data/lib/generated/azure_mgmt_server_management/node.rb +996 -0
  37. data/lib/generated/azure_mgmt_server_management/power_shell.rb +989 -0
  38. data/lib/generated/azure_mgmt_server_management/server_management.rb +80 -0
  39. data/lib/generated/azure_mgmt_server_management/session.rb +398 -0
  40. data/lib/generated/azure_mgmt_server_management/version.rb +8 -0
  41. metadata +153 -0
@@ -0,0 +1,989 @@
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 PowerShell
11
+ include Azure::ARM::ServerManagement::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the PowerShell 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
+ # Gets a list of the active sessions.
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 custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [PowerShellSessionResources] operation results.
36
+ #
37
+ def list_session(resource_group_name, node_name, session, custom_headers = nil)
38
+ response = list_session_async(resource_group_name, node_name, session, custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # Gets a list of the active sessions.
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 custom_headers [Hash{String => String}] A hash of custom headers that
50
+ # will be added to the HTTP request.
51
+ #
52
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
53
+ #
54
+ def list_session_with_http_info(resource_group_name, node_name, session, custom_headers = nil)
55
+ list_session_async(resource_group_name, node_name, session, custom_headers).value!
56
+ end
57
+
58
+ #
59
+ # Gets a list of the active sessions.
60
+ #
61
+ # @param resource_group_name [String] The resource group name uniquely
62
+ # identifies the resource group within the user subscriptionId.
63
+ # @param node_name [String] The node name (256 characters maximum).
64
+ # @param session [String] The sessionId from the user
65
+ # @param [Hash{String => String}] A hash of custom headers that will be added
66
+ # to the HTTP request.
67
+ #
68
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
69
+ #
70
+ def list_session_async(resource_group_name, node_name, session, custom_headers = nil)
71
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
72
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
73
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
74
+ fail ArgumentError, 'node_name is nil' if node_name.nil?
75
+ fail ArgumentError, 'session is nil' if session.nil?
76
+
77
+
78
+ request_headers = {}
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
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions'
84
+ options = {
85
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
86
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session},
87
+ query_params: {'api-version' => @client.api_version},
88
+ headers: request_headers.merge(custom_headers || {})
89
+ }
90
+
91
+ request_url = @base_url || @client.base_url
92
+
93
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
94
+ promise = request.run_promise do |req|
95
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
96
+ end
97
+
98
+ promise = promise.then do |http_response|
99
+ status_code = http_response.status
100
+ response_content = http_response.body
101
+ unless status_code == 200
102
+ error_model = JSON.load(response_content)
103
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
104
+ end
105
+
106
+ # Create Result
107
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
108
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
109
+ # Deserialize Response
110
+ if status_code == 200
111
+ begin
112
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
113
+ result_mapper = PowerShellSessionResources.mapper()
114
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
115
+ rescue Exception => e
116
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
117
+ end
118
+ end
119
+
120
+ result
121
+ end
122
+
123
+ promise.execute
124
+ end
125
+
126
+ #
127
+ # Creates a PowerShell session
128
+ #
129
+ # @param resource_group_name [String] The resource group name uniquely
130
+ # identifies the resource group within the user subscriptionId.
131
+ # @param node_name [String] The node name (256 characters maximum).
132
+ # @param session [String] The sessionId from the user
133
+ # @param pssession [String] The PowerShell sessionId from the user
134
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
135
+ # will be added to the HTTP request.
136
+ #
137
+ # @return [PowerShellSessionResource] operation results.
138
+ #
139
+ def create_session(resource_group_name, node_name, session, pssession, custom_headers = nil)
140
+ response = create_session_async(resource_group_name, node_name, session, pssession, custom_headers).value!
141
+ response.body unless response.nil?
142
+ end
143
+
144
+ #
145
+ # @param resource_group_name [String] The resource group name uniquely
146
+ # identifies the resource group within the user subscriptionId.
147
+ # @param node_name [String] The node name (256 characters maximum).
148
+ # @param session [String] The sessionId from the user
149
+ # @param pssession [String] The PowerShell sessionId from the user
150
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
151
+ # will be added to the HTTP request.
152
+ #
153
+ # @return [Concurrent::Promise] promise which provides async access to http
154
+ # response.
155
+ #
156
+ def create_session_async(resource_group_name, node_name, session, pssession, custom_headers = nil)
157
+ # Send request
158
+ promise = begin_create_session_async(resource_group_name, node_name, session, pssession, custom_headers)
159
+
160
+ promise = promise.then do |response|
161
+ # Defining deserialization method.
162
+ deserialize_method = lambda do |parsed_response|
163
+ result_mapper = PowerShellSessionResource.mapper()
164
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
165
+ end
166
+
167
+ # Waiting for response.
168
+ @client.get_long_running_operation_result(response, deserialize_method)
169
+ end
170
+
171
+ promise
172
+ end
173
+
174
+ #
175
+ # Creates a PowerShell session
176
+ #
177
+ # @param resource_group_name [String] The resource group name uniquely
178
+ # identifies the resource group within the user subscriptionId.
179
+ # @param node_name [String] The node name (256 characters maximum).
180
+ # @param session [String] The sessionId from the user
181
+ # @param pssession [String] The PowerShell sessionId from the user
182
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
183
+ # will be added to the HTTP request.
184
+ #
185
+ # @return [PowerShellSessionResource] operation results.
186
+ #
187
+ def begin_create_session(resource_group_name, node_name, session, pssession, custom_headers = nil)
188
+ response = begin_create_session_async(resource_group_name, node_name, session, pssession, custom_headers).value!
189
+ response.body unless response.nil?
190
+ end
191
+
192
+ #
193
+ # Creates a PowerShell session
194
+ #
195
+ # @param resource_group_name [String] The resource group name uniquely
196
+ # identifies the resource group within the user subscriptionId.
197
+ # @param node_name [String] The node name (256 characters maximum).
198
+ # @param session [String] The sessionId from the user
199
+ # @param pssession [String] The PowerShell sessionId from the user
200
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
201
+ # will be added to the HTTP request.
202
+ #
203
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
204
+ #
205
+ def begin_create_session_with_http_info(resource_group_name, node_name, session, pssession, custom_headers = nil)
206
+ begin_create_session_async(resource_group_name, node_name, session, pssession, custom_headers).value!
207
+ end
208
+
209
+ #
210
+ # Creates a PowerShell session
211
+ #
212
+ # @param resource_group_name [String] The resource group name uniquely
213
+ # identifies the resource group within the user subscriptionId.
214
+ # @param node_name [String] The node name (256 characters maximum).
215
+ # @param session [String] The sessionId from the user
216
+ # @param pssession [String] The PowerShell sessionId from the user
217
+ # @param [Hash{String => String}] A hash of custom headers that will be added
218
+ # to the HTTP request.
219
+ #
220
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
221
+ #
222
+ def begin_create_session_async(resource_group_name, node_name, session, pssession, custom_headers = nil)
223
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
224
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
225
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
226
+ fail ArgumentError, 'node_name is nil' if node_name.nil?
227
+ fail ArgumentError, 'session is nil' if session.nil?
228
+ fail ArgumentError, 'pssession is nil' if pssession.nil?
229
+
230
+
231
+ request_headers = {}
232
+
233
+ # Set Headers
234
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
235
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
236
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}'
237
+ options = {
238
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
239
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session,'pssession' => pssession},
240
+ query_params: {'api-version' => @client.api_version},
241
+ headers: request_headers.merge(custom_headers || {})
242
+ }
243
+
244
+ request_url = @base_url || @client.base_url
245
+
246
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
247
+ promise = request.run_promise do |req|
248
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
249
+ end
250
+
251
+ promise = promise.then do |http_response|
252
+ status_code = http_response.status
253
+ response_content = http_response.body
254
+ unless status_code == 200 || status_code == 202
255
+ error_model = JSON.load(response_content)
256
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
257
+ end
258
+
259
+ # Create Result
260
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
261
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
262
+ # Deserialize Response
263
+ if status_code == 200
264
+ begin
265
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
266
+ result_mapper = PowerShellSessionResource.mapper()
267
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
268
+ rescue Exception => e
269
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
270
+ end
271
+ end
272
+
273
+ result
274
+ end
275
+
276
+ promise.execute
277
+ end
278
+
279
+ #
280
+ # Gets the status of a command.
281
+ #
282
+ # @param resource_group_name [String] The resource group name uniquely
283
+ # identifies the resource group within the user subscriptionId.
284
+ # @param node_name [String] The node name (256 characters maximum).
285
+ # @param session [String] The sessionId from the user
286
+ # @param pssession [String] The PowerShell sessionId from the user
287
+ # @param expand [PowerShellExpandOption] Gets current output from an ongoing
288
+ # call. Possible values include: 'output'
289
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
290
+ # will be added to the HTTP request.
291
+ #
292
+ # @return [PowerShellCommandStatus] operation results.
293
+ #
294
+ def get_command_status(resource_group_name, node_name, session, pssession, expand = nil, custom_headers = nil)
295
+ response = get_command_status_async(resource_group_name, node_name, session, pssession, expand, custom_headers).value!
296
+ response.body unless response.nil?
297
+ end
298
+
299
+ #
300
+ # Gets the status of a command.
301
+ #
302
+ # @param resource_group_name [String] The resource group name uniquely
303
+ # identifies the resource group within the user subscriptionId.
304
+ # @param node_name [String] The node name (256 characters maximum).
305
+ # @param session [String] The sessionId from the user
306
+ # @param pssession [String] The PowerShell sessionId from the user
307
+ # @param expand [PowerShellExpandOption] Gets current output from an ongoing
308
+ # call. Possible values include: 'output'
309
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
310
+ # will be added to the HTTP request.
311
+ #
312
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
313
+ #
314
+ def get_command_status_with_http_info(resource_group_name, node_name, session, pssession, expand = nil, custom_headers = nil)
315
+ get_command_status_async(resource_group_name, node_name, session, pssession, expand, custom_headers).value!
316
+ end
317
+
318
+ #
319
+ # Gets the status of a command.
320
+ #
321
+ # @param resource_group_name [String] The resource group name uniquely
322
+ # identifies the resource group within the user subscriptionId.
323
+ # @param node_name [String] The node name (256 characters maximum).
324
+ # @param session [String] The sessionId from the user
325
+ # @param pssession [String] The PowerShell sessionId from the user
326
+ # @param expand [PowerShellExpandOption] Gets current output from an ongoing
327
+ # call. Possible values include: 'output'
328
+ # @param [Hash{String => String}] A hash of custom headers that will be added
329
+ # to the HTTP request.
330
+ #
331
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
332
+ #
333
+ def get_command_status_async(resource_group_name, node_name, session, pssession, expand = nil, custom_headers = nil)
334
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
335
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
336
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
337
+ fail ArgumentError, 'node_name is nil' if node_name.nil?
338
+ fail ArgumentError, 'session is nil' if session.nil?
339
+ fail ArgumentError, 'pssession is nil' if pssession.nil?
340
+
341
+
342
+ request_headers = {}
343
+
344
+ # Set Headers
345
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
346
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
347
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}'
348
+ options = {
349
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
350
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session,'pssession' => pssession},
351
+ query_params: {'api-version' => @client.api_version,'$expand' => expand},
352
+ headers: request_headers.merge(custom_headers || {})
353
+ }
354
+
355
+ request_url = @base_url || @client.base_url
356
+
357
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
358
+ promise = request.run_promise do |req|
359
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
360
+ end
361
+
362
+ promise = promise.then do |http_response|
363
+ status_code = http_response.status
364
+ response_content = http_response.body
365
+ unless status_code == 200
366
+ error_model = JSON.load(response_content)
367
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
368
+ end
369
+
370
+ # Create Result
371
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
372
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
373
+ # Deserialize Response
374
+ if status_code == 200
375
+ begin
376
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
377
+ result_mapper = PowerShellCommandStatus.mapper()
378
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
379
+ rescue Exception => e
380
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
381
+ end
382
+ end
383
+
384
+ result
385
+ end
386
+
387
+ promise.execute
388
+ end
389
+
390
+ #
391
+ # updates a running PowerShell command with more data.
392
+ #
393
+ # @param resource_group_name [String] The resource group name uniquely
394
+ # identifies the resource group within the user subscriptionId.
395
+ # @param node_name [String] The node name (256 characters maximum).
396
+ # @param session [String] The sessionId from the user
397
+ # @param pssession [String] The PowerShell sessionId from the user
398
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
399
+ # will be added to the HTTP request.
400
+ #
401
+ # @return [PowerShellCommandResults] operation results.
402
+ #
403
+ def update_command(resource_group_name, node_name, session, pssession, custom_headers = nil)
404
+ response = update_command_async(resource_group_name, node_name, session, pssession, custom_headers).value!
405
+ response.body unless response.nil?
406
+ end
407
+
408
+ #
409
+ # @param resource_group_name [String] The resource group name uniquely
410
+ # identifies the resource group within the user subscriptionId.
411
+ # @param node_name [String] The node name (256 characters maximum).
412
+ # @param session [String] The sessionId from the user
413
+ # @param pssession [String] The PowerShell sessionId from the user
414
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
415
+ # will be added to the HTTP request.
416
+ #
417
+ # @return [Concurrent::Promise] promise which provides async access to http
418
+ # response.
419
+ #
420
+ def update_command_async(resource_group_name, node_name, session, pssession, custom_headers = nil)
421
+ # Send request
422
+ promise = begin_update_command_async(resource_group_name, node_name, session, pssession, custom_headers)
423
+
424
+ promise = promise.then do |response|
425
+ # Defining deserialization method.
426
+ deserialize_method = lambda do |parsed_response|
427
+ result_mapper = PowerShellCommandResults.mapper()
428
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
429
+ end
430
+
431
+ # Waiting for response.
432
+ @client.get_long_running_operation_result(response, deserialize_method)
433
+ end
434
+
435
+ promise
436
+ end
437
+
438
+ #
439
+ # updates a running PowerShell command with more data.
440
+ #
441
+ # @param resource_group_name [String] The resource group name uniquely
442
+ # identifies the resource group within the user subscriptionId.
443
+ # @param node_name [String] The node name (256 characters maximum).
444
+ # @param session [String] The sessionId from the user
445
+ # @param pssession [String] The PowerShell sessionId from the user
446
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
447
+ # will be added to the HTTP request.
448
+ #
449
+ # @return [PowerShellCommandResults] operation results.
450
+ #
451
+ def begin_update_command(resource_group_name, node_name, session, pssession, custom_headers = nil)
452
+ response = begin_update_command_async(resource_group_name, node_name, session, pssession, custom_headers).value!
453
+ response.body unless response.nil?
454
+ end
455
+
456
+ #
457
+ # updates a running PowerShell command with more data.
458
+ #
459
+ # @param resource_group_name [String] The resource group name uniquely
460
+ # identifies the resource group within the user subscriptionId.
461
+ # @param node_name [String] The node name (256 characters maximum).
462
+ # @param session [String] The sessionId from the user
463
+ # @param pssession [String] The PowerShell sessionId from the user
464
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
465
+ # will be added to the HTTP request.
466
+ #
467
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
468
+ #
469
+ def begin_update_command_with_http_info(resource_group_name, node_name, session, pssession, custom_headers = nil)
470
+ begin_update_command_async(resource_group_name, node_name, session, pssession, custom_headers).value!
471
+ end
472
+
473
+ #
474
+ # updates a running PowerShell command with more data.
475
+ #
476
+ # @param resource_group_name [String] The resource group name uniquely
477
+ # identifies the resource group within the user subscriptionId.
478
+ # @param node_name [String] The node name (256 characters maximum).
479
+ # @param session [String] The sessionId from the user
480
+ # @param pssession [String] The PowerShell sessionId from the user
481
+ # @param [Hash{String => String}] A hash of custom headers that will be added
482
+ # to the HTTP request.
483
+ #
484
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
485
+ #
486
+ def begin_update_command_async(resource_group_name, node_name, session, pssession, custom_headers = nil)
487
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
488
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
489
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
490
+ fail ArgumentError, 'node_name is nil' if node_name.nil?
491
+ fail ArgumentError, 'session is nil' if session.nil?
492
+ fail ArgumentError, 'pssession is nil' if pssession.nil?
493
+
494
+
495
+ request_headers = {}
496
+
497
+ # Set Headers
498
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
499
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
500
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}'
501
+ options = {
502
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
503
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session,'pssession' => pssession},
504
+ query_params: {'api-version' => @client.api_version},
505
+ headers: request_headers.merge(custom_headers || {})
506
+ }
507
+
508
+ request_url = @base_url || @client.base_url
509
+
510
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
511
+ promise = request.run_promise do |req|
512
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
513
+ end
514
+
515
+ promise = promise.then do |http_response|
516
+ status_code = http_response.status
517
+ response_content = http_response.body
518
+ unless status_code == 200 || status_code == 202
519
+ error_model = JSON.load(response_content)
520
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
521
+ end
522
+
523
+ # Create Result
524
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
525
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
526
+ # Deserialize Response
527
+ if status_code == 200
528
+ begin
529
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
530
+ result_mapper = PowerShellCommandResults.mapper()
531
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
532
+ rescue Exception => e
533
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
534
+ end
535
+ end
536
+
537
+ result
538
+ end
539
+
540
+ promise.execute
541
+ end
542
+
543
+ #
544
+ # Creates a PowerShell script and invokes it.
545
+ #
546
+ # @param resource_group_name [String] The resource group name uniquely
547
+ # identifies the resource group within the user subscriptionId.
548
+ # @param node_name [String] The node name (256 characters maximum).
549
+ # @param session [String] The sessionId from the user
550
+ # @param pssession [String] The PowerShell sessionId from the user
551
+ # @param command [String] Script to execute
552
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
553
+ # will be added to the HTTP request.
554
+ #
555
+ # @return [PowerShellCommandResults] operation results.
556
+ #
557
+ def invoke_command(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil)
558
+ response = invoke_command_async(resource_group_name, node_name, session, pssession, command, custom_headers).value!
559
+ response.body unless response.nil?
560
+ end
561
+
562
+ #
563
+ # @param resource_group_name [String] The resource group name uniquely
564
+ # identifies the resource group within the user subscriptionId.
565
+ # @param node_name [String] The node name (256 characters maximum).
566
+ # @param session [String] The sessionId from the user
567
+ # @param pssession [String] The PowerShell sessionId from the user
568
+ # @param command [String] Script to execute
569
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
570
+ # will be added to the HTTP request.
571
+ #
572
+ # @return [Concurrent::Promise] promise which provides async access to http
573
+ # response.
574
+ #
575
+ def invoke_command_async(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil)
576
+ # Send request
577
+ promise = begin_invoke_command_async(resource_group_name, node_name, session, pssession, command, custom_headers)
578
+
579
+ promise = promise.then do |response|
580
+ # Defining deserialization method.
581
+ deserialize_method = lambda do |parsed_response|
582
+ result_mapper = PowerShellCommandResults.mapper()
583
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
584
+ end
585
+
586
+ # Waiting for response.
587
+ @client.get_long_running_operation_result(response, deserialize_method)
588
+ end
589
+
590
+ promise
591
+ end
592
+
593
+ #
594
+ # Creates a PowerShell script and invokes it.
595
+ #
596
+ # @param resource_group_name [String] The resource group name uniquely
597
+ # identifies the resource group within the user subscriptionId.
598
+ # @param node_name [String] The node name (256 characters maximum).
599
+ # @param session [String] The sessionId from the user
600
+ # @param pssession [String] The PowerShell sessionId from the user
601
+ # @param command [String] Script to execute
602
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
603
+ # will be added to the HTTP request.
604
+ #
605
+ # @return [PowerShellCommandResults] operation results.
606
+ #
607
+ def begin_invoke_command(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil)
608
+ response = begin_invoke_command_async(resource_group_name, node_name, session, pssession, command, custom_headers).value!
609
+ response.body unless response.nil?
610
+ end
611
+
612
+ #
613
+ # Creates a PowerShell script and invokes it.
614
+ #
615
+ # @param resource_group_name [String] The resource group name uniquely
616
+ # identifies the resource group within the user subscriptionId.
617
+ # @param node_name [String] The node name (256 characters maximum).
618
+ # @param session [String] The sessionId from the user
619
+ # @param pssession [String] The PowerShell sessionId from the user
620
+ # @param command [String] Script to execute
621
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
622
+ # will be added to the HTTP request.
623
+ #
624
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
625
+ #
626
+ def begin_invoke_command_with_http_info(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil)
627
+ begin_invoke_command_async(resource_group_name, node_name, session, pssession, command, custom_headers).value!
628
+ end
629
+
630
+ #
631
+ # Creates a PowerShell script and invokes it.
632
+ #
633
+ # @param resource_group_name [String] The resource group name uniquely
634
+ # identifies the resource group within the user subscriptionId.
635
+ # @param node_name [String] The node name (256 characters maximum).
636
+ # @param session [String] The sessionId from the user
637
+ # @param pssession [String] The PowerShell sessionId from the user
638
+ # @param command [String] Script to execute
639
+ # @param [Hash{String => String}] A hash of custom headers that will be added
640
+ # to the HTTP request.
641
+ #
642
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
643
+ #
644
+ def begin_invoke_command_async(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil)
645
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
646
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
647
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
648
+ fail ArgumentError, 'node_name is nil' if node_name.nil?
649
+ fail ArgumentError, 'session is nil' if session.nil?
650
+ fail ArgumentError, 'pssession is nil' if pssession.nil?
651
+
652
+ power_shell_command_parameters = PowerShellCommandParameters.new
653
+ unless command.nil?
654
+ power_shell_command_parameters.command = command
655
+ end
656
+
657
+ request_headers = {}
658
+
659
+ # Set Headers
660
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
661
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
662
+
663
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
664
+
665
+ # Serialize Request
666
+ request_mapper = PowerShellCommandParameters.mapper()
667
+ request_content = @client.serialize(request_mapper, power_shell_command_parameters, 'power_shell_command_parameters')
668
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
669
+
670
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/invokeCommand'
671
+ options = {
672
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
673
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session,'pssession' => pssession},
674
+ query_params: {'api-version' => @client.api_version},
675
+ body: request_content,
676
+ headers: request_headers.merge(custom_headers || {})
677
+ }
678
+
679
+ request_url = @base_url || @client.base_url
680
+
681
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
682
+ promise = request.run_promise do |req|
683
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
684
+ end
685
+
686
+ promise = promise.then do |http_response|
687
+ status_code = http_response.status
688
+ response_content = http_response.body
689
+ unless status_code == 200 || status_code == 202
690
+ error_model = JSON.load(response_content)
691
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
692
+ end
693
+
694
+ # Create Result
695
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
696
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
697
+ # Deserialize Response
698
+ if status_code == 200
699
+ begin
700
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
701
+ result_mapper = PowerShellCommandResults.mapper()
702
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
703
+ rescue Exception => e
704
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
705
+ end
706
+ end
707
+
708
+ result
709
+ end
710
+
711
+ promise.execute
712
+ end
713
+
714
+ #
715
+ # Cancels a PowerShell command.
716
+ #
717
+ # @param resource_group_name [String] The resource group name uniquely
718
+ # identifies the resource group within the user subscriptionId.
719
+ # @param node_name [String] The node name (256 characters maximum).
720
+ # @param session [String] The sessionId from the user
721
+ # @param pssession [String] The PowerShell sessionId from the user
722
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
723
+ # will be added to the HTTP request.
724
+ #
725
+ # @return [PowerShellCommandResults] operation results.
726
+ #
727
+ def cancel_command(resource_group_name, node_name, session, pssession, custom_headers = nil)
728
+ response = cancel_command_async(resource_group_name, node_name, session, pssession, custom_headers).value!
729
+ response.body unless response.nil?
730
+ end
731
+
732
+ #
733
+ # @param resource_group_name [String] The resource group name uniquely
734
+ # identifies the resource group within the user subscriptionId.
735
+ # @param node_name [String] The node name (256 characters maximum).
736
+ # @param session [String] The sessionId from the user
737
+ # @param pssession [String] The PowerShell sessionId from the user
738
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
739
+ # will be added to the HTTP request.
740
+ #
741
+ # @return [Concurrent::Promise] promise which provides async access to http
742
+ # response.
743
+ #
744
+ def cancel_command_async(resource_group_name, node_name, session, pssession, custom_headers = nil)
745
+ # Send request
746
+ promise = begin_cancel_command_async(resource_group_name, node_name, session, pssession, custom_headers)
747
+
748
+ promise = promise.then do |response|
749
+ # Defining deserialization method.
750
+ deserialize_method = lambda do |parsed_response|
751
+ result_mapper = PowerShellCommandResults.mapper()
752
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
753
+ end
754
+
755
+ # Waiting for response.
756
+ @client.get_long_running_operation_result(response, deserialize_method)
757
+ end
758
+
759
+ promise
760
+ end
761
+
762
+ #
763
+ # Cancels a PowerShell command.
764
+ #
765
+ # @param resource_group_name [String] The resource group name uniquely
766
+ # identifies the resource group within the user subscriptionId.
767
+ # @param node_name [String] The node name (256 characters maximum).
768
+ # @param session [String] The sessionId from the user
769
+ # @param pssession [String] The PowerShell sessionId from the user
770
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
771
+ # will be added to the HTTP request.
772
+ #
773
+ # @return [PowerShellCommandResults] operation results.
774
+ #
775
+ def begin_cancel_command(resource_group_name, node_name, session, pssession, custom_headers = nil)
776
+ response = begin_cancel_command_async(resource_group_name, node_name, session, pssession, custom_headers).value!
777
+ response.body unless response.nil?
778
+ end
779
+
780
+ #
781
+ # Cancels a PowerShell command.
782
+ #
783
+ # @param resource_group_name [String] The resource group name uniquely
784
+ # identifies the resource group within the user subscriptionId.
785
+ # @param node_name [String] The node name (256 characters maximum).
786
+ # @param session [String] The sessionId from the user
787
+ # @param pssession [String] The PowerShell sessionId from the user
788
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
789
+ # will be added to the HTTP request.
790
+ #
791
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
792
+ #
793
+ def begin_cancel_command_with_http_info(resource_group_name, node_name, session, pssession, custom_headers = nil)
794
+ begin_cancel_command_async(resource_group_name, node_name, session, pssession, custom_headers).value!
795
+ end
796
+
797
+ #
798
+ # Cancels a PowerShell command.
799
+ #
800
+ # @param resource_group_name [String] The resource group name uniquely
801
+ # identifies the resource group within the user subscriptionId.
802
+ # @param node_name [String] The node name (256 characters maximum).
803
+ # @param session [String] The sessionId from the user
804
+ # @param pssession [String] The PowerShell sessionId from the user
805
+ # @param [Hash{String => String}] A hash of custom headers that will be added
806
+ # to the HTTP request.
807
+ #
808
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
809
+ #
810
+ def begin_cancel_command_async(resource_group_name, node_name, session, pssession, custom_headers = nil)
811
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
812
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
813
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
814
+ fail ArgumentError, 'node_name is nil' if node_name.nil?
815
+ fail ArgumentError, 'session is nil' if session.nil?
816
+ fail ArgumentError, 'pssession is nil' if pssession.nil?
817
+
818
+
819
+ request_headers = {}
820
+
821
+ # Set Headers
822
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
823
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
824
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/cancel'
825
+ options = {
826
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
827
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session,'pssession' => pssession},
828
+ query_params: {'api-version' => @client.api_version},
829
+ headers: request_headers.merge(custom_headers || {})
830
+ }
831
+
832
+ request_url = @base_url || @client.base_url
833
+
834
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
835
+ promise = request.run_promise do |req|
836
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
837
+ end
838
+
839
+ promise = promise.then do |http_response|
840
+ status_code = http_response.status
841
+ response_content = http_response.body
842
+ unless status_code == 200 || status_code == 202
843
+ error_model = JSON.load(response_content)
844
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
845
+ end
846
+
847
+ # Create Result
848
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
849
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
850
+ # Deserialize Response
851
+ if status_code == 200
852
+ begin
853
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
854
+ result_mapper = PowerShellCommandResults.mapper()
855
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
856
+ rescue Exception => e
857
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
858
+ end
859
+ end
860
+
861
+ result
862
+ end
863
+
864
+ promise.execute
865
+ end
866
+
867
+ #
868
+ # gets tab completion values for a command.
869
+ #
870
+ # @param resource_group_name [String] The resource group name uniquely
871
+ # identifies the resource group within the user subscriptionId.
872
+ # @param node_name [String] The node name (256 characters maximum).
873
+ # @param session [String] The sessionId from the user
874
+ # @param pssession [String] The PowerShell sessionId from the user
875
+ # @param command [String] Command to get tab completion for.
876
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
877
+ # will be added to the HTTP request.
878
+ #
879
+ # @return [PowerShellTabCompletionResults] operation results.
880
+ #
881
+ def tab_completion(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil)
882
+ response = tab_completion_async(resource_group_name, node_name, session, pssession, command, custom_headers).value!
883
+ response.body unless response.nil?
884
+ end
885
+
886
+ #
887
+ # gets tab completion values for a command.
888
+ #
889
+ # @param resource_group_name [String] The resource group name uniquely
890
+ # identifies the resource group within the user subscriptionId.
891
+ # @param node_name [String] The node name (256 characters maximum).
892
+ # @param session [String] The sessionId from the user
893
+ # @param pssession [String] The PowerShell sessionId from the user
894
+ # @param command [String] Command to get tab completion for.
895
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
896
+ # will be added to the HTTP request.
897
+ #
898
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
899
+ #
900
+ def tab_completion_with_http_info(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil)
901
+ tab_completion_async(resource_group_name, node_name, session, pssession, command, custom_headers).value!
902
+ end
903
+
904
+ #
905
+ # gets tab completion values for a command.
906
+ #
907
+ # @param resource_group_name [String] The resource group name uniquely
908
+ # identifies the resource group within the user subscriptionId.
909
+ # @param node_name [String] The node name (256 characters maximum).
910
+ # @param session [String] The sessionId from the user
911
+ # @param pssession [String] The PowerShell sessionId from the user
912
+ # @param command [String] Command to get tab completion for.
913
+ # @param [Hash{String => String}] A hash of custom headers that will be added
914
+ # to the HTTP request.
915
+ #
916
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
917
+ #
918
+ def tab_completion_async(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil)
919
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
920
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
921
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
922
+ fail ArgumentError, 'node_name is nil' if node_name.nil?
923
+ fail ArgumentError, 'session is nil' if session.nil?
924
+ fail ArgumentError, 'pssession is nil' if pssession.nil?
925
+
926
+ power_shell_tab_completion_paramters = PowerShellTabCompletionParameters.new
927
+ unless command.nil?
928
+ power_shell_tab_completion_paramters.command = command
929
+ end
930
+
931
+ request_headers = {}
932
+
933
+ # Set Headers
934
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
935
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
936
+
937
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
938
+
939
+ # Serialize Request
940
+ request_mapper = PowerShellTabCompletionParameters.mapper()
941
+ request_content = @client.serialize(request_mapper, power_shell_tab_completion_paramters, 'power_shell_tab_completion_paramters')
942
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
943
+
944
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/tab'
945
+ options = {
946
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
947
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session,'pssession' => pssession},
948
+ query_params: {'api-version' => @client.api_version},
949
+ body: request_content,
950
+ headers: request_headers.merge(custom_headers || {})
951
+ }
952
+
953
+ request_url = @base_url || @client.base_url
954
+
955
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
956
+ promise = request.run_promise do |req|
957
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
958
+ end
959
+
960
+ promise = promise.then do |http_response|
961
+ status_code = http_response.status
962
+ response_content = http_response.body
963
+ unless status_code == 200
964
+ error_model = JSON.load(response_content)
965
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
966
+ end
967
+
968
+ # Create Result
969
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
970
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
971
+ # Deserialize Response
972
+ if status_code == 200
973
+ begin
974
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
975
+ result_mapper = PowerShellTabCompletionResults.mapper()
976
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
977
+ rescue Exception => e
978
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
979
+ end
980
+ end
981
+
982
+ result
983
+ end
984
+
985
+ promise.execute
986
+ end
987
+
988
+ end
989
+ end