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.



909
910
911
912
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 909

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: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.



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
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 944

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, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil?
  fail ArgumentError, 'node_name is nil' if node_name.nil?
  fail ArgumentError, "'node_name' should satisfy the constraint - 'MaxLength': '256'" if !node_name.nil? && node_name.length > 256
  fail ArgumentError, "'node_name' should satisfy the constraint - 'MinLength': '1'" if !node_name.nil? && node_name.length < 1
  fail ArgumentError, "'node_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !node_name.nil? && node_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
  fail ArgumentError, 'session is nil' if session.nil?
  fail ArgumentError, 'pssession is nil' if pssession.nil?


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

  # 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.



927
928
929
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 927

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: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.



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

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: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.



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
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 606

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, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil?
  fail ArgumentError, 'node_name is nil' if node_name.nil?
  fail ArgumentError, "'node_name' should satisfy the constraint - 'MaxLength': '256'" if !node_name.nil? && node_name.length > 256
  fail ArgumentError, "'node_name' should satisfy the constraint - 'MinLength': '1'" if !node_name.nil? && node_name.length < 1
  fail ArgumentError, "'node_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !node_name.nil? && node_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
  fail ArgumentError, 'session is nil' if session.nil?
  fail ArgumentError, 'pssession is nil' if pssession.nil?


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

  # 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.



589
590
591
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 589

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: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.



788
789
790
791
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 788

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:command, custom_headers: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.



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
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 825

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, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil?
  fail ArgumentError, 'node_name is nil' if node_name.nil?
  fail ArgumentError, "'node_name' should satisfy the constraint - 'MaxLength': '256'" if !node_name.nil? && node_name.length > 256
  fail ArgumentError, "'node_name' should satisfy the constraint - 'MinLength': '1'" if !node_name.nil? && node_name.length < 1
  fail ArgumentError, "'node_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !node_name.nil? && node_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

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

  # 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.



807
808
809
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 807

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:command, custom_headers: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.



679
680
681
682
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 679

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: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.



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
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 714

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, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil?
  fail ArgumentError, 'node_name is nil' if node_name.nil?
  fail ArgumentError, "'node_name' should satisfy the constraint - 'MaxLength': '256'" if !node_name.nil? && node_name.length > 256
  fail ArgumentError, "'node_name' should satisfy the constraint - 'MinLength': '1'" if !node_name.nil? && node_name.length < 1
  fail ArgumentError, "'node_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !node_name.nil? && node_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
  fail ArgumentError, 'session is nil' if session.nil?
  fail ArgumentError, 'pssession is nil' if pssession.nil?


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

  # 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.



697
698
699
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 697

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: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.



401
402
403
404
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 401

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: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



418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 418

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: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.



141
142
143
144
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 141

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: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



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 158

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: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.



191
192
193
194
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 191

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:expand, custom_headers: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.



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
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 230

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, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil?
  fail ArgumentError, 'node_name is nil' if node_name.nil?
  fail ArgumentError, "'node_name' should satisfy the constraint - 'MaxLength': '256'" if !node_name.nil? && node_name.length > 256
  fail ArgumentError, "'node_name' should satisfy the constraint - 'MinLength': '1'" if !node_name.nil? && node_name.length < 1
  fail ArgumentError, "'node_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !node_name.nil? && node_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
  fail ArgumentError, 'session is nil' if session.nil?
  fail ArgumentError, 'pssession is nil' if pssession.nil?


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

  # 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.



211
212
213
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 211

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:expand, custom_headers: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.



352
353
354
355
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 352

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:command, custom_headers: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



370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 370

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:command, custom_headers: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: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
121
122
123
124
125
126
# 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, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil?
  fail ArgumentError, 'node_name is nil' if node_name.nil?
  fail ArgumentError, "'node_name' should satisfy the constraint - 'MaxLength': '256'" if !node_name.nil? && node_name.length > 256
  fail ArgumentError, "'node_name' should satisfy the constraint - 'MinLength': '1'" if !node_name.nil? && node_name.length < 1
  fail ArgumentError, "'node_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !node_name.nil? && node_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
  fail ArgumentError, 'session is nil' if session.nil?


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

  # 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: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.



450
451
452
453
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 450

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:command, custom_headers: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.



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
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 487

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, "'resource_group_name' should satisfy the constraint - 'MinLength': '3'" if !resource_group_name.nil? && resource_group_name.length < 3
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '[a-zA-Z0-9]+'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^[a-zA-Z0-9]+$')).nil?
  fail ArgumentError, 'node_name is nil' if node_name.nil?
  fail ArgumentError, "'node_name' should satisfy the constraint - 'MaxLength': '256'" if !node_name.nil? && node_name.length > 256
  fail ArgumentError, "'node_name' should satisfy the constraint - 'MinLength': '1'" if !node_name.nil? && node_name.length < 1
  fail ArgumentError, "'node_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !node_name.nil? && node_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

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

  # 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.



469
470
471
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 469

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:command, custom_headers: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.



303
304
305
306
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 303

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: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



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
# File 'lib/2016-07-01-preview/generated/azure_mgmt_server_management/power_shell.rb', line 320

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: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