Sha256: 0dea7f9ac1b226f9a4abf102e983106d1319c4c949808c015b6431f5496805bd

Contents?: true

Size: 1.2 KB

Versions: 7

Compression:

Stored size: 1.2 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
        #
        # @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

7 entries across 7 versions & 2 rubygems

Version Path
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-brightbox-0.9.0/lib/fog/brightbox/requests/compute/snapshot_server.rb
fog-brightbox-0.9.0 lib/fog/brightbox/requests/compute/snapshot_server.rb
fog-brightbox-0.8.0 lib/fog/brightbox/requests/compute/snapshot_server.rb
fog-brightbox-0.7.2 lib/fog/brightbox/requests/compute/snapshot_server.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-brightbox-0.7.1/lib/fog/brightbox/requests/compute/snapshot_server.rb
fog-brightbox-0.7.1 lib/fog/brightbox/requests/compute/snapshot_server.rb
fog-brightbox-0.7.0 lib/fog/brightbox/requests/compute/snapshot_server.rb