Class: Fog::AWS::RDS::Snapshot

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

Instance Method Summary collapse

Instance Method Details

#clusterObject



59
60
61
62
# File 'lib/fog/aws/models/rds/snapshot.rb', line 59

def cluster
  requires :cluster_id
  service.clusters.get(cluster_id)
end

#destroyObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fog/aws/models/rds/snapshot.rb', line 29

def destroy
  requires :id
  requires_one :instance_id, :cluster_id

  if instance_id
    service.delete_db_snapshot(id)
  else
    service.delete_db_cluster_snapshot(id)
  end
  true
end

#ready?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/fog/aws/models/rds/snapshot.rb', line 25

def ready?
  state == 'available'
end

#saveObject



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/fog/aws/models/rds/snapshot.rb', line 41

def save
  requires_one :instance_id, :cluster_id
  requires :id

  data = if instance_id
           service.create_db_snapshot(instance_id, id).body['CreateDBSnapshotResult']['DBSnapshot']
         elsif cluster_id
           service.create_db_cluster_snapshot(cluster_id, id).body['CreateDBClusterSnapshotResult']['DBClusterSnapshot']
         end
  merge_attributes(data)
  true
end

#serverObject



54
55
56
57
# File 'lib/fog/aws/models/rds/snapshot.rb', line 54

def server
  requires :instance_id
  service.servers.get(instance_id)
end