Sha256: 3cc5fd895faaed18db8b60fc307d1a966f10c3c43dafd66c40fa87a7f724f9f7

Contents?: true

Size: 1.37 KB

Versions: 30

Compression:

Stored size: 1.37 KB

Contents

module Fog
  module AWS
    module EC2
      class Real

        # Reboot specified instances
        #
        # ==== Parameters
        # * instance_id<~Array> - Ids of instances to reboot
        #
        # ==== Returns
        # # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'requestId'<~String> - Id of request
        #     * 'return'<~Boolean> - success?
        def reboot_instances(instance_id = [])
          params = AWS.indexed_param('InstanceId', instance_id)
          request({
            'Action'  => 'RebootInstances',
            :parser   => Fog::Parsers::AWS::EC2::Basic.new
          }.merge!(params))
        end

      end

      class Mock

        def reboot_instances(instance_id = [])
          response = Excon::Response.new
          instance_id = [*instance_id]
          if (@data[:instances].keys & instance_id).length == instance_id.length
            for instance_id in instance_id
              @data[:instances][instance_id]['status'] = 'rebooting'
            end
            response.status = 200
            response.body = {
              'requestId' => Fog::AWS::Mock.request_id,
              'return'    => true
            }
          else
            response.status = 400
            raise(Excon::Errors.status_error({:expects => 200}, response))
          end
          response
        end

      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
fog-0.1.1 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.1.0 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.100 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.99 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.98 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.97 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.96 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.95 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.94 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.93 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.92 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.91 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.90 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.89 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.88 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.87 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.86 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.85 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.84 lib/fog/aws/requests/ec2/reboot_instances.rb
fog-0.0.83 lib/fog/aws/requests/ec2/reboot_instances.rb