Sha256: b48e6ea1bc0733c4030be8ac717db737f06338905df80b62aafb61819a64e89e

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

module Fog
  module AWS
    class EC2

      def snapshots
        Fog::AWS::EC2::Snapshots.new(:connection => self)
      end

      class Snapshots < Fog::Collection

        def all(snapshot_id = [])
          data = connection.describe_snapshots(snapshot_id)
          snapshots = Fog::AWS::EC2::Snapshots.new(:connection => connection)
          data['snapshotSet'].each do |volume|
            snapshots << Fog::AWS::EC2::Snapshot.new({
              :connection => connection
            }.merge!(snapshot))
          end
          snapshots
        end

        def create(attributes = {})
          volume = new(attributes)
          volume.save
          volume
        end

        def new(attributes = {})
          Fog::AWS::S3::Snapshot.new({
            :connection => connection,
            :volume     => @volume,
            :snapshots  => self
          }.merge!(attributes))
        end

        def volume
          @volume
        end

        private

        def volume=(new_volume)
          @volume = new_volume
        end

      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fog-0.0.9 lib/fog/aws/models/ec2/snapshots.rb
fog-0.0.8 lib/fog/aws/models/ec2/snapshots.rb
fog-0.0.7 lib/fog/aws/models/ec2/snapshots.rb
fog-0.0.6 lib/fog/aws/models/ec2/snapshots.rb
fog-0.0.5 lib/fog/aws/models/ec2/snapshots.rb