Sha256: 41b37a58437a157e08e15126ccb7e4c7d50b1e67f61961baa116638fd70949c2

Contents?: true

Size: 1.41 KB

Versions: 46

Compression:

Stored size: 1.41 KB

Contents

module Fog
  module AWS
    class Compute
      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',
            :idempotent => true,
            :parser     => Fog::Parsers::AWS::Compute::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
            }
            response
          else
            raise Fog::AWS::Compute::NotFound.new("The instance ID #{instance_id.inspect} does not exist")
          end
        end

      end
    end
  end
end

Version data entries

46 entries across 46 versions & 3 rubygems

Version Path
fog-0.5.3 lib/fog/compute/requests/aws/reboot_instances.rb
fog-0.5.2 lib/fog/compute/requests/aws/reboot_instances.rb
fog-0.5.1 lib/fog/compute/requests/aws/reboot_instances.rb
fog-0.5.0 lib/fog/compute/requests/aws/reboot_instances.rb
phpfog-fog-0.4.1.3 lib/fog/compute/requests/aws/reboot_instances.rb
phpfog-fog-0.4.1.2 lib/fog/compute/requests/aws/reboot_instances.rb
phpfog-fog-0.4.1.1 lib/fog/compute/requests/aws/reboot_instances.rb
phpfog-fog-0.4.1 lib/fog/compute/requests/aws/reboot_instances.rb
fog-0.4.1 lib/fog/compute/requests/aws/reboot_instances.rb
fog-0.4.0 lib/fog/aws/requests/compute/reboot_instances.rb
fog-0.3.34 lib/fog/aws/requests/compute/reboot_instances.rb
fog-0.3.33 lib/fog/aws/requests/compute/reboot_instances.rb
fog-0.3.32 lib/fog/aws/requests/compute/reboot_instances.rb
fog-0.3.31 lib/fog/aws/requests/compute/reboot_instances.rb
fog-0.3.30 lib/fog/aws/requests/compute/reboot_instances.rb
fog-0.3.29 lib/fog/aws/requests/compute/reboot_instances.rb
fog-0.3.28 lib/fog/aws/requests/compute/reboot_instances.rb
fog-0.3.27 lib/fog/aws/requests/compute/reboot_instances.rb
fog-0.3.26 lib/fog/aws/requests/compute/reboot_instances.rb
fog-0.3.25 lib/fog/aws/requests/compute/reboot_instances.rb