Class: Chef::Provider::AwsRdsSubnetGroup
- Inherits:
-
Chef::Provisioning::AWSDriver::AWSProvider
- Object
- LWRPBase
- Chef::Provisioning::AWSDriver::AWSProvider
- Chef::Provider::AwsRdsSubnetGroup
- Defined in:
- lib/chef/provider/aws_rds_subnet_group.rb
Constant Summary
Constants inherited from Chef::Provisioning::AWSDriver::AWSProvider
Chef::Provisioning::AWSDriver::AWSProvider::AWSResource
Instance Attribute Summary
Attributes inherited from Chef::Provisioning::AWSDriver::AWSProvider
Instance Method Summary collapse
- #create_aws_object ⇒ Object
- #desired_options ⇒ Object
- #destroy_aws_object(object) ⇒ Object
-
#required_updates(object) ⇒ Object
Given an existing object, return an array of update descriptions representing the updates that need to be made.
- #update_aws_object(object) ⇒ Object
Methods included from Chef::Provisioning::AWSDriver::TaggingStrategy::RDSConvergeTags
#aws_tagger, #construct_arn, #converge_tags
Methods inherited from Chef::Provisioning::AWSDriver::AWSProvider
#action_handler, #converge_by, #region, #whyrun_supported?
Instance Method Details
#create_aws_object ⇒ Object
9 10 11 12 13 |
# File 'lib/chef/provider/aws_rds_subnet_group.rb', line 9 def create_aws_object converge_by "create RDS subnet group #{new_resource.name} in #{region}" do driver.create_db_subnet_group() end end |
#desired_options ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/chef/provider/aws_rds_subnet_group.rb', line 30 def @desired_options ||= begin opts = {} opts[:db_subnet_group_name] = new_resource.name opts[:db_subnet_group_description] = new_resource.description opts[:subnet_ids] = new_resource.subnets AWSResource.(opts, resource: new_resource) end end |
#destroy_aws_object(object) ⇒ Object
15 16 17 18 19 |
# File 'lib/chef/provider/aws_rds_subnet_group.rb', line 15 def destroy_aws_object(object) converge_by "delete RDS subnet group #{new_resource.name} in #{region}" do driver.delete_db_subnet_group(db_subnet_group_name: new_resource.name) end end |
#required_updates(object) ⇒ Object
Given an existing object, return an array of update descriptions representing the updates that need to be made.
If no updates are needed, an empty array is returned.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/chef/provider/aws_rds_subnet_group.rb', line 45 def required_updates(object) ret = [] if [:db_subnet_group_description] != object[:db_subnet_group_description] ret << " set group description to #{[:db_subnet_group_description]}" end if ! xor_array([:subnet_ids], subnet_ids(object[:subnets])).empty? ret << " set subnets to #{[:subnet_ids]}" end if ! ([:aws_tags].nil? || [:aws_tags].empty?) # modify_db_subnet_group doesn't support the tags key according to # http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/RDS/Client.html#modify_db_subnet_group-instance_method Chef::Log.warn "Updating tags for RDS subnet groups is not supported." end ret.unshift("update RDS subnet group #{new_resource.name} in #{region}") unless ret.empty? ret end |
#update_aws_object(object) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/chef/provider/aws_rds_subnet_group.rb', line 21 def update_aws_object(object) updates = required_updates(object) if ! updates.empty? converge_by updates do driver.modify_db_subnet_group() end end end |