1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00
fog--fog-aws/lib/fog/aws/models/rds/cluster_snapshots.rb
Eugene Howe 5635a7c5da 1.8 fix
2016-03-01 13:55:42 -05:00

48 lines
1.3 KiB
Ruby

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