Sha256: cb9330b3b54267cd3d416e97b643a4cffb29007dabccceb02b4e105c8918a670

Contents?: true

Size: 1.26 KB

Versions: 60

Compression:

Stored size: 1.26 KB

Contents

require 'fog/aws/models/rds/snapshot'

module Fog
  module AWS
    class RDS
      class ClusterSnapshots < Fog::Collection
        attribute :cluster
        attribute :filters
        model Fog::AWS::RDS::Snapshot

        def initialize(attributes)
          self.filters ||= {}
          if attributes[:cluster]
            filters[:identifier] = attributes[:cluster].id
          end

          if attributes[:type]
            filters[:type] = attributes[:type]
          end
          super
        end

        def all(filters_arg = filters)
          filters.merge!(filters_arg)

          page = service.describe_db_cluster_snapshots(filters).body['DescribeDBClusterSnapshotsResult']
          filters[:marker] = page['Marker']
          load(page['DBClusterSnapshots'])
        end

        def get(identity)
          data = service.describe_db_cluster_snapshots(:snapshot_id => identity).body['DescribeDBClusterSnapshotsResult']['DBClusterSnapshots'].first
          new(data) # data is an attribute hash
        rescue Fog::AWS::RDS::NotFound
          nil
        end

        def create(params={})
          if cluster
            super(params.merge(:cluster_id => cluster.id))
          else
            super(params)
          end
        end
      end
    end
  end
end

Version data entries

60 entries across 58 versions & 2 rubygems

Version Path
fog-aws-3.30.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.29.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.28.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.27.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.26.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.25.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.24.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.23.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.22.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.21.1 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.21.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.20.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.19.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.18.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.17.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.16.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.15.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.14.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.13.0 lib/fog/aws/models/rds/cluster_snapshots.rb
fog-aws-3.12.0 lib/fog/aws/models/rds/cluster_snapshots.rb