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.
8 9 10 11 12 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb', line 8 def initialize(client, arn, ) @client = client @arn = arn @desired_tags = end |
Instance Attribute Details
#arn ⇒ Object (readonly)
Returns the value of attribute arn.
6 7 8 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb', line 6 def arn @arn end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb', line 6 def client @client end |
#desired_tags ⇒ Object (readonly)
Returns the value of attribute desired_tags.
6 7 8 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb', line 6 def @desired_tags end |
Instance Method Details
#current_tags ⇒ Object
14 15 16 17 18 19 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb', line 14 def resp = client.({arn: arn}) Hash[resp.tag_list.map {|t| [t.key, t.value]}] rescue ::Aws::ElasticsearchService::Errors::ResourceNotFoundException Hash.new end |
#delete_tags(tag_keys) ⇒ Object
35 36 37 38 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb', line 35 def (tag_keys) client.({arn: arn, tag_keys: tag_keys}) end |
#set_tags(tags) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb', line 21 def () = .map {|k,v| if v.nil? {key: k} else {key: k, value: v} end } client.({ arn: arn, tag_list: }) end |