Class: Hiera::Backend::Aws::RDS

Inherits:
Base
  • Object
show all
Defined in:
lib/hiera/backend/aws/rds.rb

Overview

Implementation of Hiera keys for aws/rds

Instance Attribute Summary

Attributes inherited from Base

#scope

Instance Method Summary collapse

Methods inherited from Base

#aws_account_number, #aws_region, #puppet_fact, #stringify_keys

Constructor Details

#initialize(scope = {}) ⇒ RDS

Returns a new instance of RDS.



8
9
10
11
# File 'lib/hiera/backend/aws/rds.rb', line 8

def initialize(scope = {})
  super(scope)
  @client = AWS::RDS::Client.new
end

Instance Method Details

#lookup(key, scope) ⇒ Object

Override default key lookup to implement custom format. Examples:

- hiera("rds_instances")
- hiera("rds_instances environment=dev")
- hiera("rds_instances role=mgmt-db")
- hiera("rds_instances environment=production role=mgmt-db")


18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/hiera/backend/aws/rds.rb', line 18

def lookup(key, scope)
  r = super(key, scope)
  return r if r

  args = key.split
  return if args.shift != "rds_instances"
  if args.length > 0
    tags = Hash[args.map { |t| t.split("=") }]
    db_instances_with_tags(tags)
  else
    db_instances
  end.map { |i| prepare_instance_data(i) }
end