Class: Kelbim::Client
- Inherits:
-
Object
- Object
- Kelbim::Client
- Includes:
- Logger::ClientHelper, Utils::Helper
- 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 Utils::Helper
Methods included from Logger::ClientHelper
Constructor Details
Instance Method Details
#apply(file) ⇒ Object
13 14 15 |
# File 'lib/kelbim/client.rb', line 13 def apply(file) AWS.memoize { walk(file) } end |
#export(opts = {}) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/kelbim/client.rb', line 68 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
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/kelbim/client.rb', line 24 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
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/kelbim/client.rb', line 45 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 |