Sha256: 757463fdea24dd2f2de718aaa74b5dd4cca9dd67c07ef148e2aff9b54ebddc18

Contents?: true

Size: 1.58 KB

Versions: 76

Compression:

Stored size: 1.58 KB

Contents

module Fog
  module Compute
    class AWS
      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::Compute::AWS::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

76 entries across 76 versions & 11 rubygems

Version Path
fog-1.22.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-1.21.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-1.20.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-1.19.0 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/requests/compute/describe_instance_status.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/requests/compute/describe_instance_status.rb