Class: Chef::Provisioning::AWSDriver::TaggingStrategy::RDS
- Inherits:
-
Object
- Object
- Chef::Provisioning::AWSDriver::TaggingStrategy::RDS
- Defined in:
- lib/chef/provisioning/aws_driver/tagging_strategy/rds.rb
Instance Attribute Summary collapse
-
#desired_tags ⇒ Object
readonly
Returns the value of attribute desired_tags.
-
#rds_client ⇒ Object
readonly
Returns the value of attribute rds_client.
-
#rds_object_arn ⇒ Object
readonly
Returns the value of attribute rds_object_arn.
Instance Method Summary collapse
- #current_tags ⇒ Object
- #delete_tags(tag_keys) ⇒ Object
-
#initialize(rds_client, rds_object_arn, desired_tags) ⇒ RDS
constructor
A new instance of RDS.
- #set_tags(tags) ⇒ Object
Constructor Details
#initialize(rds_client, rds_object_arn, desired_tags) ⇒ RDS
Returns a new instance of RDS.
53 54 55 56 57 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/rds.rb', line 53 def initialize(rds_client, rds_object_arn, ) @rds_client = rds_client @rds_object_arn = rds_object_arn @desired_tags = end |
Instance Attribute Details
#desired_tags ⇒ Object (readonly)
Returns the value of attribute desired_tags.
51 52 53 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/rds.rb', line 51 def @desired_tags end |
#rds_client ⇒ Object (readonly)
Returns the value of attribute rds_client.
51 52 53 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/rds.rb', line 51 def rds_client @rds_client end |
#rds_object_arn ⇒ Object (readonly)
Returns the value of attribute rds_object_arn.
51 52 53 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/rds.rb', line 51 def rds_object_arn @rds_object_arn end |
Instance Method Details
#current_tags ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/rds.rb', line 59 def # http://docs.aws.amazon.com/sdkforruby/api/Aws/RDS/Client.html#list_tags_for_resource-instance_method resp = rds_client.({ resource_name: rds_object_arn }) Hash[resp.tag_list.map {|t| [t.key, t.value]}] end |
#delete_tags(tag_keys) ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/rds.rb', line 83 def (tag_keys) # http://docs.aws.amazon.com/sdkforruby/api/Aws/RDS/Client.html#remove_tags_from_resource-instance_method rds_client.({ resource_name: rds_object_arn, tag_keys: tag_keys }) end |
#set_tags(tags) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/rds.rb', line 67 def () # http://docs.aws.amazon.com/sdkforruby/api/Aws/RDS/Client.html#add_tags_to_resource-instance_method # Unlike EC2, RDS tags can have a nil value = .map {|k,v| if v.nil? {key: k} else {key: k, value: v} end } rds_client.({ resource_name: rds_object_arn, tags: }) end |