Class: Fog::AWS::RDS::ClusterSnapshots

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/aws/models/rds/cluster_snapshots.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ ClusterSnapshots

Returns a new instance of ClusterSnapshots.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/aws/models/rds/cluster_snapshots.rb', line 11

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

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

Instance Method Details

#all(filters_arg = filters) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/fog/aws/models/rds/cluster_snapshots.rb', line 23

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

#create(params = {}) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/fog/aws/models/rds/cluster_snapshots.rb', line 38

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

#get(identity) ⇒ Object



31
32
33
34
35
36
# File 'lib/fog/aws/models/rds/cluster_snapshots.rb', line 31

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