class RdsConcerto::Aurora::Resource
Attributes
name[R]
rds_client[R]
Public Class Methods
new(rds_client: , name: )
click to toggle source
# File lib/rds_concerto/aurora/resource.rb, line 4 def initialize(rds_client: , name: ) @rds_client = rds_client @name = name end
Public Instance Methods
create!(tags: , instance_class: )
click to toggle source
# File lib/rds_concerto/aurora/resource.rb, line 15 def create!(tags: , instance_class: ) { db_cluster_response: restore_db_cluster!(name: name, tags: tags), db_instance_response: create_db_instance!(name: name, tags: tags, instance_class: instance_class), } end
delete!(skip_final_snapshot: )
click to toggle source
# File lib/rds_concerto/aurora/resource.rb, line 9 def delete!(skip_final_snapshot: ) { db_instance_response: rds_client.delete_db_instance(db_instance_identifier: name, skip_final_snapshot: skip_final_snapshot), rdb_cluster_response: rds_client.delete_db_cluster(db_cluster_identifier: name, skip_final_snapshot: skip_final_snapshot), } end
start!()
click to toggle source
# File lib/rds_concerto/aurora/resource.rb, line 21 def start! { start_db_cluster_response: rds_client.start_db_cluster(db_cluster_identifier: name) } end
stop!()
click to toggle source
docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/RDS/Client.html#stop_db_cluster-instance_method
# File lib/rds_concerto/aurora/resource.rb, line 26 def stop! { stop_db_cluster_response: rds_client.stop_db_cluster(db_cluster_identifier: name) } end
Private Instance Methods
create_db_instance!(name: , tags: , instance_class: )
click to toggle source
# File lib/rds_concerto/aurora/resource.rb, line 44 def create_db_instance!(name: , tags: , instance_class: ) rds_client.create_db_instance( db_instance_identifier: name, db_cluster_identifier: name, db_instance_class: instance_class, engine: "aurora-mysql", multi_az: false, publicly_accessible: true, db_subnet_group_name: RdsConcerto::Config.db_subnet_group_name, db_parameter_group_name: RdsConcerto::Config.db_parameter_group_name, tags: tags, ) end
restore_db_cluster!(name: , tags: )
click to toggle source
# File lib/rds_concerto/aurora/resource.rb, line 32 def restore_db_cluster!(name: , tags: ) rds_client.restore_db_cluster_to_point_in_time( db_cluster_identifier: name, source_db_cluster_identifier: RdsConcerto::Config.source_cluster_identifier, restore_type: "copy-on-write", use_latest_restorable_time: true, db_cluster_parameter_group_name: RdsConcerto::Config.db_cluster_parameter_group_name, db_subnet_group_name: RdsConcerto::Config.db_subnet_group_name, tags: tags, ) end