Sha256: 2ddbf51659e44e919889ab53a9fb8db1af38b43c8321019c97bddb8fac5d3e73

Contents?: true

Size: 1.74 KB

Versions: 21

Compression:

Stored size: 1.74 KB

Contents

module Fog
  module OpenStack
    class Compute
      class Real
        # Get a vnc console for an instance.
        # For microversion >= 2.6
        #
        # === Parameters
        # * server_id <~String> - The ID of the server.
        # * protocol <~String> - The protocol of remote console. The valid values are vnc, spice, rdp, serial and mks.
        #   The protocol mks is added since Microversion 2.8.
        # * type <~String> - The type of remote console. The valid values are novnc, xvpvnc, rdp-html5, spice-html5,
        #   serial, and webmks. The type webmks is added since Microversion 2.8.
        # === Returns
        # * response <~Excon::Response>:
        #   * body <~Hash>:
        #     * url <~String>
        #     * type <~String>
        #     * protocol <~String>
        def remote_consoles(server_id, protocol, type)
          if microversion_newer_than?('2.6')
            body = {
              'remote_console' => {
                'protocol' => protocol, 'type' => type
              }
            }

            request(
              :body    => Fog::JSON.encode(body),
              :expects => 200,
              :method  => 'POST',
              :path    => "servers/#{server_id}/remote-consoles"
            )
          end
        end
      end

      class Mock
        def remote_consoles(_server_id, _protocol, _type)
          response = Excon::Response.new
          response.status = 200
          response.body = {
            "remote_console" => {
              "url"      => "http://192.168.27.100:6080/vnc_auto.html?token=e629bcbf-6f9e-4276-9ea1-d6eb0e618da5",
              "type"     => "novnc",
              "protocol" => "vnc"
            }
          }
          response
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 3 rubygems

Version Path
fog-openstack-1.1.4 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-1.1.3 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-1.1.2 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-fork-99 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-1.1.0 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-1.1.0.pre lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-apibank-1.0.102 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-1.0.11 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-apibank-1.0.101 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-1.0.10 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-1.0.9 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-1.0.8 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-1.0.7 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-1.0.6 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-1.0.5 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-1.0.4 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-1.0.3 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-1.0.2 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-1.0.1 lib/fog/openstack/compute/requests/remote_consoles.rb
fog-openstack-1.0.0 lib/fog/openstack/compute/requests/remote_consoles.rb