Sha256: 85d66230f1288af78f7f5d351c6e393c4d2ab40838e1b93d4f16766e75e24d55

Contents?: true

Size: 1.49 KB

Versions: 16

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,
            :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'        => Fog::AWS::Mock.console_output,
              'requestId'     => Fog::AWS::Mock.request_id,
              'timestamp'     => Time.now
            }
          else
            response.status = 400
            raise(Excon::Errors.status_error({:expects => 200}, response))
          end
          response
        end

      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
fog-0.0.72 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.0.71 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.0.70 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.0.69 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.0.68 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.0.67 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.0.66 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.0.65 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.0.64 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.0.63 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.0.62 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.0.61 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.0.60 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.0.59 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.0.58 lib/fog/aws/requests/ec2/get_console_output.rb
fog-0.0.57 lib/fog/aws/requests/ec2/get_console_output.rb