Class: Kelbim::Client
- Inherits:
-
Object
- Object
- Kelbim::Client
- Includes:
- Logger::ClientHelper
- Defined in:
- lib/kelbim/client.rb
Instance Method Summary collapse
- #apply(file) ⇒ Object
- #export(opts = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #load_balancers ⇒ Object
- #policies ⇒ Object
- #test(file) ⇒ Object
Methods included from Logger::ClientHelper
Constructor Details
Instance Method Details
#apply(file) ⇒ Object
22 23 24 |
# File 'lib/kelbim/client.rb', line 22 def apply(file) AWS.memoize { walk(file) } end |
#export(opts = {}) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/kelbim/client.rb', line 77 def export(opts = {}) exported = nil instance_names = nil AWS.memoize do exported = Exporter.export(@options.elb, opts) instance_names = @options.ec2.instance_names end if block_given? converter = proc do |src| DSL.convert(src, instance_names) end yield(exported, converter) else DSL.convert(exported, instance_names) end end |
#load_balancers ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/kelbim/client.rb', line 33 def load_balancers exported = nil AWS.memoize do exported = Exporter.export(@options.elb) end retval = {} exported.map do |vpc, lbs| vpc = vpc || 'classic' retval[vpc] = {} lbs.map do |name, attrs| retval[vpc][name] = attrs[:dns_name] end end return retval end |
#policies ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/kelbim/client.rb', line 54 def policies exported = nil AWS.memoize do exported = Exporter.export(@options.elb, :fetch_policies => true) end retval = {} exported.map do |vpc, lbs| vpc = vpc || 'classic' lbs.map do |name, attrs| if attrs[:policies] retval[vpc] ||= {} retval[vpc][name] = attrs[:policies] end end end return retval end |