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.15.0.20130927082724 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-1.15.0 lib/fog/aws/requests/compute/copy_snapshot.rb
gapinc-fog-1.14.0 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-maestrodev-1.14.0.20130806165225 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-1.14.0 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-1.13.0 lib/fog/aws/requests/compute/copy_snapshot.rb
gapinc-fog-1.12.1.2 lib/fog/aws/requests/compute/copy_snapshot.rb
gapinc-fog-1.12.1.1 lib/fog/aws/requests/compute/copy_snapshot.rb
gapinc-fog-1.12.1a lib/fog/aws/requests/compute/copy_snapshot.rb
gapinc-fog-1.12.1 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-1.12.1 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-1.12.0 lib/fog/aws/requests/compute/copy_snapshot.rb
hpfog-0.0.20 lib/fog/aws/requests/compute/copy_snapshot.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/aws/requests/compute/copy_snapshot.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/aws/requests/compute/copy_snapshot.rb
fog-1.11.1 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-1.11.0 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-1.10.1 lib/fog/aws/requests/compute/copy_snapshot.rb
fog-test-me-1.10.0 lib/fog/aws/requests/compute/copy_snapshot.rb