Sha256: d6e850a46cce092d9ab01954f82bc7107c06f4b02796c2aa04ae06383e4b53ee

Contents?: true

Size: 1.32 KB

Versions: 13

Compression:

Stored size: 1.32 KB

Contents

module Fog
  module Compute
    class Brightbox
      class Real
        # Will issue a request to snapshot the Server
        #
        # @param [String] identifier Unique reference to identify the resource
        # @param [Hash] options
        # @option options [Boolean] :return_link Return the Link header as a second return value
        # @option options [Boolean] :nested passed through with the API request. When true nested resources are expanded.
        #
        # @return [Hash] if successful Hash version of JSON object
        #
        # @see https://api.gb1.brightbox.com/1.0/#server_snapshot_server
        #
        def snapshot_server(identifier, options = {})
          return nil if identifier.nil? || identifier == ""

          method = "POST"
          path = "/1.0/servers/#{identifier}/snapshot"
          expected = [202]

          if options[:return_link]
            request_parameters = {
              :method => method, :path => path, :expects => expected
            }
            response = request(request_parameters)
            data = Fog::JSON.decode(response.body)
            image_id = Fog::Brightbox::LinkHelper.new(response.headers["Link"]).identifier
            return data, image_id
          else
            wrapped_request(method, path, expected)
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 11 versions & 2 rubygems

Version Path
fog-brightbox-1.0.0.rc1 lib/fog/brightbox/requests/compute/snapshot_server.rb
fog-brightbox-0.16.1 lib/fog/brightbox/requests/compute/snapshot_server.rb
fog-brightbox-0.16.0 lib/fog/brightbox/requests/compute/snapshot_server.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-brightbox-0.15.0/lib/fog/brightbox/requests/compute/snapshot_server.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-brightbox-0.15.0/lib/fog/brightbox/requests/compute/snapshot_server.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-brightbox-0.15.0/lib/fog/brightbox/requests/compute/snapshot_server.rb
fog-brightbox-0.15.0 lib/fog/brightbox/requests/compute/snapshot_server.rb
fog-brightbox-0.14.0 lib/fog/brightbox/requests/compute/snapshot_server.rb
fog-brightbox-0.13.0 lib/fog/brightbox/requests/compute/snapshot_server.rb
fog-brightbox-0.12.0 lib/fog/brightbox/requests/compute/snapshot_server.rb
fog-brightbox-0.11.0 lib/fog/brightbox/requests/compute/snapshot_server.rb
fog-brightbox-0.10.1 lib/fog/brightbox/requests/compute/snapshot_server.rb
fog-brightbox-0.10.0 lib/fog/brightbox/requests/compute/snapshot_server.rb