Sha256: b469a519cc5d1f6a1f421035aeeac5c64f66141d8819aa191c1200557714dfba

Contents?: true

Size: 1.58 KB

Versions: 37

Compression:

Stored size: 1.58 KB

Contents

module Fog
  module AWS
    class Compute
      class Real
        require 'fog/aws/parsers/compute/describe_instance_status'

        # http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInstanceStatus.html
        #
        def describe_instance_status(filters = {})
          raise ArgumentError.new("Filters must be a hash, but is a #{filters.class}.") unless filters.is_a?(Hash)
          next_token = filters.delete('nextToken') || filters.delete('NextToken')
          max_results = filters.delete('maxResults') || filters.delete('MaxResults')
          all_instances = filters.delete('includeAllInstances') || filters.delete('IncludeAllInstances')

          params = Fog::AWS.indexed_request_param('InstanceId', filters.delete('InstanceId'))

          params.merge!(Fog::AWS.indexed_filters(filters))

          params['NextToken'] = next_token if next_token
          params['MaxResults'] = max_results if max_results
          params['IncludeAllInstances'] = all_instances if all_instances

          request({
            'Action'    => 'DescribeInstanceStatus',
            :idempotent => true,
            :parser     => Fog::Parsers::AWS::Compute::DescribeInstanceStatus.new
          }.merge!(params))
        end
      end

      class Mock
        def describe_instance_status(filters = {})
          response = Excon::Response.new
          response.status = 200

          response.body = {
            'instanceStatusSet' => [],
            'requestId' => Fog::AWS::Mock.request_id
          }

          response
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
fog-aws-3.30.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.29.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.28.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.27.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.26.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.25.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.24.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.23.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.22.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.21.1 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.21.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.20.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.19.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.18.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.17.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.16.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.15.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.14.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.13.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-aws-3.12.0 lib/fog/aws/requests/compute/describe_instance_status.rb