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-maestrodev-1.18.0.20131209090811 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/aws/requests/compute/copy_snapshot.rb
gapinc-fog-1.12.1.2.1 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-1.18.0 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-1.17.0 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-1.16.0 lib/fog/aws/requests/compute/copy_snapshot.rb