Class: Chef::Provisioning::AWSDriver::TaggingStrategy::ELB
- Inherits:
-
Object
- Object
- Chef::Provisioning::AWSDriver::TaggingStrategy::ELB
- Defined in:
- lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb
Instance Attribute Summary collapse
-
#access_point_name ⇒ Object
readonly
Returns the value of attribute access_point_name.
-
#desired_tags ⇒ Object
readonly
Returns the value of attribute desired_tags.
-
#elb_client ⇒ Object
readonly
Returns the value of attribute elb_client.
Instance Method Summary collapse
- #current_tags ⇒ Object
- #delete_tags(tag_keys) ⇒ Object
-
#initialize(elb_client, access_point_name, desired_tags) ⇒ ELB
constructor
A new instance of ELB.
- #set_tags(tags) ⇒ Object
Constructor Details
#initialize(elb_client, access_point_name, desired_tags) ⇒ ELB
Returns a new instance of ELB.
8 9 10 11 12 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb', line 8 def initialize(elb_client, access_point_name, ) @elb_client = elb_client @access_point_name = access_point_name @desired_tags = end |
Instance Attribute Details
#access_point_name ⇒ Object (readonly)
Returns the value of attribute access_point_name.
6 7 8 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb', line 6 def access_point_name @access_point_name end |
#desired_tags ⇒ Object (readonly)
Returns the value of attribute desired_tags.
6 7 8 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb', line 6 def @desired_tags end |
#elb_client ⇒ Object (readonly)
Returns the value of attribute elb_client.
6 7 8 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb', line 6 def elb_client @elb_client end |
Instance Method Details
#current_tags ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb', line 14 def # http://docs.aws.amazon.com/sdkforruby/api/Aws/ElasticLoadBalancing/Client.html#describe_tags-instance_method resp = elb_client.({ load_balancer_names: [access_point_name] }) Hash[resp.tag_descriptions[0]..map {|t| [t.key, t.value]}] end |
#delete_tags(tag_keys) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb', line 30 def (tag_keys) # http://docs.aws.amazon.com/sdkforruby/api/Aws/ElasticLoadBalancing/Client.html#remove_tags-instance_method elb_client.({ load_balancer_names: [access_point_name], tags: tag_keys.map {|k| {key: k} } }) end |
#set_tags(tags) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb', line 22 def () # http://docs.aws.amazon.com/sdkforruby/api/Aws/ElasticLoadBalancing/Client.html#add_tags-instance_method elb_client.({ load_balancer_names: [access_point_name], tags: .map {|k,v| {key: k, value: v} } }) end |