Sha256: 5b2d65c62d0ee7f6d922d4ebc2cdc3926e12b9231398fca54607ecc54e7fe7f9

Contents?: true

Size: 1.67 KB

Versions: 65

Compression:

Stored size: 1.67 KB

Contents

module Fog
  module Compute
    class AWS
      class Real

        require 'fog/aws/parsers/compute/copy_snapshot'

        # Copy a snapshot to a different region
        #
        # ==== Parameters
        # * source_snapshot_id<~String> - Id of snapshot
        # * source_region<~String>      - Region to move it from
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'requestId'<~String> - id of request
        #     * 'snapshotId'<~String> - id of snapshot
        #
        # {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CopySnapshot.html]
        def copy_snapshot(source_snapshot_id, source_region, description = nil)
          request(
            'Action'          => 'CopySnapshot',
            'SourceSnapshotId'=> source_snapshot_id,
            'SourceRegion'    => source_region,
            'Description'     => description,
            :parser       => Fog::Parsers::Compute::AWS::CopySnapshot.new
          )
        end

      end

      class Mock

        #
        # Usage
        #
        # AWS[:compute].copy_snapshot("snap-1db0a957", 'us-east-1')
        #

        def copy_snapshot(source_snapshot_id, source_region, description = nil)
          response = Excon::Response.new
          response.status = 200
          snapshot_id = Fog::AWS::Mock.snapshot_id
          data = {
            'snapshotId'  => snapshot_id,
          }
          self.data[:snapshots][snapshot_id] = data
          response.body = {
            'requestId' => Fog::AWS::Mock.request_id
          }.merge!(data)
          response
        end

      end
    end
  end
end

Version data entries

65 entries across 65 versions & 6 rubygems

Version Path
fog-1.10.0 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-1.9.0 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.8.0.20130114204828 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.8.0.20130111070250 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.8.0.20130109172219 lib/fog/aws/requests/compute/copy_snapshot.rb