Class: Azure::ARM::ServerManagement::PowerShell

Inherits:
Object
  • Object
show all
Includes:
Models, MsRestAzure
Defined in:
lib/generated/azure_mgmt_server_management/power_shell.rb

Overview

REST API for Azure Server Management Service

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ PowerShell

Creates and initializes a new instance of the PowerShell class.

Parameters:

  • client

    service class for accessing basic functionality.



18
19
20
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 18

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientServerManagement (readonly)

Returns reference to the ServerManagement.

Returns:



23
24
25
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 23

def client
  @client
end

Instance Method Details

#begin_cancel_command(resource_group_name, node_name, session, pssession, custom_headers = nil) ⇒ PowerShellCommandResults

Cancels a PowerShell command.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



775
776
777
778
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 775

def begin_cancel_command(resource_group_name, node_name, session, pssession, custom_headers = nil)
  response = begin_cancel_command_async(resource_group_name, node_name, session, pssession, custom_headers).value!
  response.body unless response.nil?
end

#begin_cancel_command_async(resource_group_name, node_name, session, pssession, custom_headers = nil) ⇒ Concurrent::Promise

Cancels a PowerShell command.

identifies the resource group within the user subscriptionId. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 810

def begin_cancel_command_async(resource_group_name, node_name, session, pssession, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'node_name is nil' if node_name.nil?
  fail ArgumentError, 'session is nil' if session.nil?
  fail ArgumentError, 'pssession is nil' if pssession.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/cancel'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session,'pssession' => pssession},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = PowerShellCommandResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_cancel_command_with_http_info(resource_group_name, node_name, session, pssession, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Cancels a PowerShell command.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



793
794
795
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 793

def begin_cancel_command_with_http_info(resource_group_name, node_name, session, pssession, custom_headers = nil)
  begin_cancel_command_async(resource_group_name, node_name, session, pssession, custom_headers).value!
end

#begin_create_session(resource_group_name, node_name, session, pssession, custom_headers = nil) ⇒ PowerShellSessionResource

Creates a PowerShell session

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



187
188
189
190
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 187

def begin_create_session(resource_group_name, node_name, session, pssession, custom_headers = nil)
  response = begin_create_session_async(resource_group_name, node_name, session, pssession, custom_headers).value!
  response.body unless response.nil?
end

#begin_create_session_async(resource_group_name, node_name, session, pssession, custom_headers = nil) ⇒ Concurrent::Promise

Creates a PowerShell session

identifies the resource group within the user subscriptionId. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 222

def begin_create_session_async(resource_group_name, node_name, session, pssession, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'node_name is nil' if node_name.nil?
  fail ArgumentError, 'session is nil' if session.nil?
  fail ArgumentError, 'pssession is nil' if pssession.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session,'pssession' => pssession},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = PowerShellSessionResource.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_create_session_with_http_info(resource_group_name, node_name, session, pssession, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Creates a PowerShell session

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



205
206
207
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 205

def begin_create_session_with_http_info(resource_group_name, node_name, session, pssession, custom_headers = nil)
  begin_create_session_async(resource_group_name, node_name, session, pssession, custom_headers).value!
end

#begin_invoke_command(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil) ⇒ PowerShellCommandResults

Creates a PowerShell script and invokes it.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • command (String) (defaults to: nil)

    Script to execute

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



607
608
609
610
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 607

def begin_invoke_command(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil)
  response = begin_invoke_command_async(resource_group_name, node_name, session, pssession, command, custom_headers).value!
  response.body unless response.nil?
end

#begin_invoke_command_async(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil) ⇒ Concurrent::Promise

Creates a PowerShell script and invokes it.

identifies the resource group within the user subscriptionId. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • command (String) (defaults to: nil)

    Script to execute

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 644

def begin_invoke_command_async(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'node_name is nil' if node_name.nil?
  fail ArgumentError, 'session is nil' if session.nil?
  fail ArgumentError, 'pssession is nil' if pssession.nil?

  power_shell_command_parameters = PowerShellCommandParameters.new
  unless command.nil?
    power_shell_command_parameters.command = command
  end

  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = PowerShellCommandParameters.mapper()
  request_content = @client.serialize(request_mapper,  power_shell_command_parameters, 'power_shell_command_parameters')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/invokeCommand'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session,'pssession' => pssession},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = PowerShellCommandResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_invoke_command_with_http_info(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Creates a PowerShell script and invokes it.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • command (String) (defaults to: nil)

    Script to execute

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



626
627
628
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 626

def begin_invoke_command_with_http_info(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil)
  begin_invoke_command_async(resource_group_name, node_name, session, pssession, command, custom_headers).value!
end

#begin_update_command(resource_group_name, node_name, session, pssession, custom_headers = nil) ⇒ PowerShellCommandResults

updates a running PowerShell command with more data.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



451
452
453
454
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 451

def begin_update_command(resource_group_name, node_name, session, pssession, custom_headers = nil)
  response = begin_update_command_async(resource_group_name, node_name, session, pssession, custom_headers).value!
  response.body unless response.nil?
end

#begin_update_command_async(resource_group_name, node_name, session, pssession, custom_headers = nil) ⇒ Concurrent::Promise

updates a running PowerShell command with more data.

identifies the resource group within the user subscriptionId. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 486

def begin_update_command_async(resource_group_name, node_name, session, pssession, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'node_name is nil' if node_name.nil?
  fail ArgumentError, 'session is nil' if session.nil?
  fail ArgumentError, 'pssession is nil' if pssession.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session,'pssession' => pssession},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = PowerShellCommandResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_update_command_with_http_info(resource_group_name, node_name, session, pssession, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

updates a running PowerShell command with more data.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



469
470
471
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 469

def begin_update_command_with_http_info(resource_group_name, node_name, session, pssession, custom_headers = nil)
  begin_update_command_async(resource_group_name, node_name, session, pssession, custom_headers).value!
end

#cancel_command(resource_group_name, node_name, session, pssession, custom_headers = nil) ⇒ PowerShellCommandResults

Cancels a PowerShell command.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



727
728
729
730
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 727

def cancel_command(resource_group_name, node_name, session, pssession, custom_headers = nil)
  response = cancel_command_async(resource_group_name, node_name, session, pssession, custom_headers).value!
  response.body unless response.nil?
end

#cancel_command_async(resource_group_name, node_name, session, pssession, custom_headers = nil) ⇒ Concurrent::Promise

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 744

def cancel_command_async(resource_group_name, node_name, session, pssession, custom_headers = nil)
  # Send request
  promise = begin_cancel_command_async(resource_group_name, node_name, session, pssession, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = PowerShellCommandResults.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#create_session(resource_group_name, node_name, session, pssession, custom_headers = nil) ⇒ PowerShellSessionResource

Creates a PowerShell session

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



139
140
141
142
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 139

def create_session(resource_group_name, node_name, session, pssession, custom_headers = nil)
  response = create_session_async(resource_group_name, node_name, session, pssession, custom_headers).value!
  response.body unless response.nil?
end

#create_session_async(resource_group_name, node_name, session, pssession, custom_headers = nil) ⇒ Concurrent::Promise

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 156

def create_session_async(resource_group_name, node_name, session, pssession, custom_headers = nil)
  # Send request
  promise = begin_create_session_async(resource_group_name, node_name, session, pssession, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = PowerShellSessionResource.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#get_command_status(resource_group_name, node_name, session, pssession, expand = nil, custom_headers = nil) ⇒ PowerShellCommandStatus

Gets the status of a command.

identifies the resource group within the user subscriptionId. call. Possible values include: ‘output’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • expand (PowerShellExpandOption) (defaults to: nil)

    Gets current output from an ongoing

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



294
295
296
297
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 294

def get_command_status(resource_group_name, node_name, session, pssession, expand = nil, custom_headers = nil)
  response = get_command_status_async(resource_group_name, node_name, session, pssession, expand, custom_headers).value!
  response.body unless response.nil?
end

#get_command_status_async(resource_group_name, node_name, session, pssession, expand = nil, custom_headers = nil) ⇒ Concurrent::Promise

Gets the status of a command.

identifies the resource group within the user subscriptionId. call. Possible values include: ‘output’ to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • expand (PowerShellExpandOption) (defaults to: nil)

    Gets current output from an ongoing

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 333

def get_command_status_async(resource_group_name, node_name, session, pssession, expand = nil, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'node_name is nil' if node_name.nil?
  fail ArgumentError, 'session is nil' if session.nil?
  fail ArgumentError, 'pssession is nil' if pssession.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session,'pssession' => pssession},
      query_params: {'api-version' => @client.api_version,'$expand' => expand},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = PowerShellCommandStatus.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_command_status_with_http_info(resource_group_name, node_name, session, pssession, expand = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the status of a command.

identifies the resource group within the user subscriptionId. call. Possible values include: ‘output’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • expand (PowerShellExpandOption) (defaults to: nil)

    Gets current output from an ongoing

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



314
315
316
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 314

def get_command_status_with_http_info(resource_group_name, node_name, session, pssession, expand = nil, custom_headers = nil)
  get_command_status_async(resource_group_name, node_name, session, pssession, expand, custom_headers).value!
end

#invoke_command(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil) ⇒ PowerShellCommandResults

Creates a PowerShell script and invokes it.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • command (String) (defaults to: nil)

    Script to execute

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



557
558
559
560
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 557

def invoke_command(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil)
  response = invoke_command_async(resource_group_name, node_name, session, pssession, command, custom_headers).value!
  response.body unless response.nil?
end

#invoke_command_async(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil) ⇒ Concurrent::Promise

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • command (String) (defaults to: nil)

    Script to execute

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 575

def invoke_command_async(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil)
  # Send request
  promise = begin_invoke_command_async(resource_group_name, node_name, session, pssession, command, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = PowerShellCommandResults.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#list_session(resource_group_name, node_name, session, custom_headers = nil) ⇒ PowerShellSessionResources

Gets a list of the active sessions.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



37
38
39
40
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 37

def list_session(resource_group_name, node_name, session, custom_headers = nil)
  response = list_session_async(resource_group_name, node_name, session, custom_headers).value!
  response.body unless response.nil?
end

#list_session_async(resource_group_name, node_name, session, custom_headers = nil) ⇒ Concurrent::Promise

Gets a list of the active sessions.

identifies the resource group within the user subscriptionId. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 70

def list_session_async(resource_group_name, node_name, session, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'node_name is nil' if node_name.nil?
  fail ArgumentError, 'session is nil' if session.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = PowerShellSessionResources.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_session_with_http_info(resource_group_name, node_name, session, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of the active sessions.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



54
55
56
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 54

def list_session_with_http_info(resource_group_name, node_name, session, custom_headers = nil)
  list_session_async(resource_group_name, node_name, session, custom_headers).value!
end

#tab_completion(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil) ⇒ PowerShellTabCompletionResults

gets tab completion values for a command.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • command (String) (defaults to: nil)

    Command to get tab completion for.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



881
882
883
884
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 881

def tab_completion(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil)
  response = tab_completion_async(resource_group_name, node_name, session, pssession, command, custom_headers).value!
  response.body unless response.nil?
end

#tab_completion_async(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil) ⇒ Concurrent::Promise

gets tab completion values for a command.

identifies the resource group within the user subscriptionId. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • command (String) (defaults to: nil)

    Command to get tab completion for.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 918

def tab_completion_async(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'node_name is nil' if node_name.nil?
  fail ArgumentError, 'session is nil' if session.nil?
  fail ArgumentError, 'pssession is nil' if pssession.nil?

  power_shell_tab_completion_paramters = PowerShellTabCompletionParameters.new
  unless command.nil?
    power_shell_tab_completion_paramters.command = command
  end

  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = PowerShellTabCompletionParameters.mapper()
  request_content = @client.serialize(request_mapper,  power_shell_tab_completion_paramters, 'power_shell_tab_completion_paramters')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/tab'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'nodeName' => node_name,'session' => session,'pssession' => pssession},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = PowerShellTabCompletionResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#tab_completion_with_http_info(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

gets tab completion values for a command.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • command (String) (defaults to: nil)

    Command to get tab completion for.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



900
901
902
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 900

def tab_completion_with_http_info(resource_group_name, node_name, session, pssession, command = nil, custom_headers = nil)
  tab_completion_async(resource_group_name, node_name, session, pssession, command, custom_headers).value!
end

#update_command(resource_group_name, node_name, session, pssession, custom_headers = nil) ⇒ PowerShellCommandResults

updates a running PowerShell command with more data.

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



403
404
405
406
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 403

def update_command(resource_group_name, node_name, session, pssession, custom_headers = nil)
  response = update_command_async(resource_group_name, node_name, session, pssession, custom_headers).value!
  response.body unless response.nil?
end

#update_command_async(resource_group_name, node_name, session, pssession, custom_headers = nil) ⇒ Concurrent::Promise

identifies the resource group within the user subscriptionId. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The resource group name uniquely

  • node_name (String)

    The node name (256 characters maximum).

  • session (String)

    The sessionId from the user

  • pssession (String)

    The PowerShell sessionId from the user

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/generated/azure_mgmt_server_management/power_shell.rb', line 420

def update_command_async(resource_group_name, node_name, session, pssession, custom_headers = nil)
  # Send request
  promise = begin_update_command_async(resource_group_name, node_name, session, pssession, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = PowerShellCommandResults.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end