class Chef::Provisioning::AWSDriver::TaggingStrategy::Elasticsearch

Attributes

arn[R]
client[R]
desired_tags[R]

Public Class Methods

new(client, arn, desired_tags) click to toggle source
# File lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb, line 7
def initialize(client, arn, desired_tags)
  @client = client
  @arn = arn
  @desired_tags = desired_tags
end

Public Instance Methods

current_tags() click to toggle source
# File lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb, line 13
def current_tags
  resp = client.list_tags(arn: arn)
  Hash[resp.tag_list.map { |t| [t.key, t.value] }]
rescue ::Aws::ElasticsearchService::Errors::ResourceNotFoundException
  {}
end
delete_tags(tag_keys) click to toggle source
# File lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb, line 34
def delete_tags(tag_keys)
  client.remove_tags(arn: arn,
                     tag_keys: tag_keys)
end
set_tags(tags) click to toggle source
# File lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb, line 20
def set_tags(tags)
  tags = tags.map do |k, v|
    if v.nil?
      { key: k }
    else
      { key: k, value: v }
    end
  end
  client.add_tags(
    arn: arn,
    tag_list: tags
  )
end