Class: Chef::Provisioning::AWSDriver::TaggingStrategy::Elasticsearch
- Inherits:
-
Object
- Object
- Chef::Provisioning::AWSDriver::TaggingStrategy::Elasticsearch
- Defined in:
- lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb
Instance Attribute Summary collapse
-
#arn ⇒ Object
readonly
Returns the value of attribute arn.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#desired_tags ⇒ Object
readonly
Returns the value of attribute desired_tags.
Instance Method Summary collapse
- #current_tags ⇒ Object
- #delete_tags(tag_keys) ⇒ Object
-
#initialize(client, arn, desired_tags) ⇒ Elasticsearch
constructor
A new instance of Elasticsearch.
- #set_tags(tags) ⇒ Object
Constructor Details
#initialize(client, arn, desired_tags) ⇒ Elasticsearch
Returns a new instance of Elasticsearch.
7 8 9 10 11 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb', line 7 def initialize(client, arn, ) @client = client @arn = arn = end |
Instance Attribute Details
#arn ⇒ Object (readonly)
Returns the value of attribute arn.
5 6 7 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb', line 5 def arn @arn end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb', line 5 def client @client end |
#desired_tags ⇒ Object (readonly)
Returns the value of attribute desired_tags.
5 6 7 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb', line 5 def end |
Instance Method Details
#current_tags ⇒ Object
13 14 15 16 17 18 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb', line 13 def resp = client.(arn: arn) Hash[resp.tag_list.map { |t| [t.key, t.value] }] rescue ::Aws::ElasticsearchService::Errors::ResourceNotFoundException {} end |
#delete_tags(tag_keys) ⇒ Object
34 35 36 37 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb', line 34 def (tag_keys) client.(arn: arn, tag_keys: tag_keys) end |
#set_tags(tags) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb', line 20 def () = .map do |k, v| if v.nil? { key: k } else { key: k, value: v } end end client.( arn: arn, tag_list: ) end |