Sha256: b00fe5a13434a81917edc1399e6e66ee67da1165abce9bcf8dbf8c89c3dc2d1f

Contents?: true

Size: 1.49 KB

Versions: 33

Compression:

Stored size: 1.49 KB

Contents

module Fog
  module AWS
    module EC2
      class Real

        require 'fog/aws/parsers/ec2/get_console_output'

        # Retrieve console output for specified instance
        #
        # ==== Parameters
        # * instance_id<~String> - Id of instance to get console output from
        #
        # ==== Returns
        # # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'instanceId'<~String> - Id of instance
        #     * 'output'<~String> - Console output
        #     * 'requestId'<~String> - Id of request
        #     * 'timestamp'<~Time> - Timestamp of last update to output
        def get_console_output(instance_id)
          request(
            'Action'      => 'GetConsoleOutput',
            'InstanceId'  => instance_id,
            :idempotent   => true,
            :parser       => Fog::Parsers::AWS::EC2::GetConsoleOutput.new
          )
        end

      end

      class Mock

        def get_console_output(instance_id)
          response = Excon::Response.new
          if instance = @data[:instances][instance_id]
            response.status = 200
            response.body = {
              'instanceId'    => instance_id,
              'output'        => nil,
              'requestId'     => Fog::AWS::Mock.request_id,
              'timestamp'     => Time.now
            }
            response
          else;
            raise Fog::AWS::EC2::NotFound.new("The instance ID '#{instance_id}' does not exist")
          end
        end

      end
    end
  end
end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
fog-0.2.10 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.2.9 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.2.8 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.2.7 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.2.6 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.2.5 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.2.4 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.2.3 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.2.2 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.2.1 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.2.0 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.1.10 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.1.9 lib/fog/aws/requests/ec2/get_console_output.rb