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.22.0 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-1.21.0 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-1.20.0 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-1.19.0 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/requests/compute/copy_snapshot.rb