class WinRM::WSMV::KeepAlive

WSMV keep alive message

Attributes

shell_id[RW]

Public Class Methods

new(session_opts, shell_id) click to toggle source
# File lib/winrm/wsmv/keep_alive.rb, line 23
def initialize(session_opts, shell_id)
  @session_opts = session_opts
  @shell_id = shell_id
end

Protected Instance Methods

create_body(body) click to toggle source
# File lib/winrm/wsmv/keep_alive.rb, line 34
def create_body(body)
  body.tag!("#{NS_WIN_SHELL}:Receive") { |s| s << Gyoku.xml(keep_alive_body) }
end
create_header(header) click to toggle source
# File lib/winrm/wsmv/keep_alive.rb, line 30
def create_header(header)
  header << Gyoku.xml(keep_alive_headers)
end

Private Instance Methods

header_opts() click to toggle source
# File lib/winrm/wsmv/keep_alive.rb, line 52
def header_opts
  {
    "#{NS_WSMAN_DMTF}:OptionSet" => {
      "#{NS_WSMAN_DMTF}:Option" => 'TRUE',
      :attributes! => {
        "#{NS_WSMAN_DMTF}:Option" => {
          'Name' => 'WSMAN_CMDSHELL_OPTION_KEEPALIVE'
        }
      }
    }
  }
end
keep_alive_body() click to toggle source
# File lib/winrm/wsmv/keep_alive.rb, line 40
def keep_alive_body
  { "#{NS_WIN_SHELL}:DesiredStream" => 'stdout' }
end
keep_alive_headers() click to toggle source
# File lib/winrm/wsmv/keep_alive.rb, line 44
def keep_alive_headers
  merge_headers(shared_headers(@session_opts),
                resource_uri_shell(RESOURCE_URI_POWERSHELL),
                action_receive,
                header_opts,
                selector_shell_id(shell_id))
end