Class: Azure::ServerManagement::Mgmt::V2016_07_01_preview::PowerShell

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2016-07-01-preview/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.



17
18
19
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientServerManagement (readonly)

Returns reference to the ServerManagement.

Returns:



22
23
24
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 22

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:

  • (PowerShellCommandResults)

    operation results.



877
878
879
880
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 877

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.



912
913
914
915
916
917
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
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 912

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'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    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 = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::PowerShellCommandResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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.



895
896
897
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 895

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:

  • (PowerShellSessionResource)

    operation results.



555
556
557
558
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 555

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.



590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 590

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}'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    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 = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::PowerShellSessionResource.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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.



573
574
575
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 573

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:

  • (PowerShellCommandResults)

    operation results.



760
761
762
763
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 760

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.



797
798
799
800
801
802
803
804
805
806
807
808
809
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
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 797

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 = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::PowerShellCommandParameters.mapper()
  request_content = @client.serialize(request_mapper,  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'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    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 = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::PowerShellCommandResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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.



779
780
781
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 779

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:

  • (PowerShellCommandResults)

    operation results.



657
658
659
660
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 657

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.



692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 692

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}'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:patch, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    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 = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::PowerShellCommandResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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.



675
676
677
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 675

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:

  • (PowerShellCommandResults)

    operation results.



389
390
391
392
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 389

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



406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 406

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 = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::PowerShellCommandResults.mapper()
      parsed_response = @client.deserialize(result_mapper, 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:

  • (PowerShellSessionResource)

    operation results.



135
136
137
138
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 135

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



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 152

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 = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::PowerShellSessionResource.mapper()
      parsed_response = @client.deserialize(result_mapper, 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:

  • (PowerShellCommandStatus)

    operation results.



185
186
187
188
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 185

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.



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
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 224

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}'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    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 = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::PowerShellCommandStatus.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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.



205
206
207
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 205

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:

  • (PowerShellCommandResults)

    operation results.



340
341
342
343
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 340

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



358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 358

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 = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::PowerShellCommandResults.mapper()
      parsed_response = @client.deserialize(result_mapper, 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:

  • (PowerShellSessionResources)

    operation results.



36
37
38
39
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 36

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.



69
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
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 69

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'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    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 = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::PowerShellSessionResources.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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.



53
54
55
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 53

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:

  • (PowerShellTabCompletionResults)

    operation results.



438
439
440
441
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 438

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.



475
476
477
478
479
480
481
482
483
484
485
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
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 475

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 = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::PowerShellTabCompletionParameters.mapper()
  request_content = @client.serialize(request_mapper,  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'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    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 = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::PowerShellTabCompletionResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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.



457
458
459
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 457

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:

  • (PowerShellCommandResults)

    operation results.



291
292
293
294
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 291

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



308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 308

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 = Azure::ServerManagement::Mgmt::V2016_07_01_preview::Models::PowerShellCommandResults.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

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

  promise
end