Class: Piculet::Client
- Inherits:
-
Object
- Object
- Piculet::Client
- Includes:
- Logger::ClientHelper
- Defined in:
- lib/piculet/client.rb
Instance Method Summary collapse
- #apply(file) ⇒ Object
- #export(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #should_skip(sg_name, sg) ⇒ Object
Methods included from Logger::ClientHelper
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 |
# File 'lib/piculet/client.rb', line 5 def initialize( = {}) = OpenStruct.new() = .ec2 = AWS::EC2.new end |
Instance Method Details
#apply(file) ⇒ Object
11 12 13 14 |
# File 'lib/piculet/client.rb', line 11 def apply(file) .ec2.owner_id AWS.memoize { walk(file) } end |
#export(options = {}) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/piculet/client.rb', line 40 def export( = {}) exported = AWS.memoize do Exporter.export(.ec2, .merge()) end converter = proc do |src| if [:without_convert] exported else DSL.convert(src, .ec2.owner_id) end end if block_given? yield(exported, converter) else converter.call(exported) end end |
#should_skip(sg_name, sg) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/piculet/client.rb', line 16 def should_skip(sg_name, sg) # Name if .sg_names if not .sg_names.include?(sg_name) return true end end if .exclude_sgs if .exclude_sgs.any? {|regex| sg_name =~ regex} return true end end # Tag if . if sg and (. & sg..keys).any? return true end end false end |