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.
7 8 9 10 11 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb', line 7 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.
5 6 7 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb', line 5 def access_point_name @access_point_name end |
#desired_tags ⇒ Object (readonly)
Returns the value of attribute desired_tags.
5 6 7 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb', line 5 def @desired_tags end |
#elb_client ⇒ Object (readonly)
Returns the value of attribute elb_client.
5 6 7 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb', line 5 def elb_client @elb_client end |
Instance Method Details
#current_tags ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb', line 13 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
29 30 31 32 33 34 35 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb', line 29 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
21 22 23 24 25 26 27 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb', line 21 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 |