Module: Awspec::Helper::Finder::SsmParameter

Included in:
Awspec::Helper::Finder
Defined in:
lib/awspec/helper/finder/ssm_parameter.rb

Instance Method Summary collapse

Instance Method Details

#find_parameter_tag(id, tag_key) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/awspec/helper/finder/ssm_parameter.rb', line 19

def find_parameter_tag(id, tag_key)
  tag = nil
  begin
    response = ssm_client.list_tags_for_resource(
      resource_type: 'Parameter',
      resource_id: id
    )
    tag_set = response.tag_list
    tag = tag_set.find { |tag_obj| tag_obj.key == tag_key }
  rescue Aws::SSM::Errors::ServiceError
    nil
  end
  return tag if tag
end

#find_ssm_parameter(name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/awspec/helper/finder/ssm_parameter.rb', line 6

def find_ssm_parameter(name)
  ssm_client.describe_parameters(
    {
      filters:  [
        {
          key: 'Name',
          values: [name]
        }
      ]
    }
  ).parameters[0]
end