class Biosphere::ResourceProxy

Attributes

caller[R]
output[R]

Public Class Methods

new(caller) click to toggle source
# File lib/biosphere/terraformproxy.rb, line 43
def initialize(caller)
    @output = {}
    @caller = caller
end

Public Instance Methods

get(symbol) click to toggle source
# File lib/biosphere/terraformproxy.rb, line 71
def get(symbol)
    return @output[symbol]
end
id_of(type,name) click to toggle source
# File lib/biosphere/terraformproxy.rb, line 83
def id_of(type,name)
    if self.name
        name = self.name + "_" + name
    end
    "${#{type}.#{name}.id}"
end
method_missing(symbol, *args) click to toggle source
# File lib/biosphere/terraformproxy.rb, line 98
def method_missing(symbol, *args)
    return @caller.method(symbol).call(*args)
end
node() click to toggle source
# File lib/biosphere/terraformproxy.rb, line 75
def node
    return @caller.node
end
output_of(type, name, *values) click to toggle source
# File lib/biosphere/terraformproxy.rb, line 90
def output_of(type, name, *values)
    if self.name
        name = self.name + "_" + name
    end
    
    "${#{type}.#{name}.#{values.join(".")}}"
end
respond_to?(symbol, include_private = false) click to toggle source
# File lib/biosphere/terraformproxy.rb, line 48
def respond_to?(symbol, include_private = false)
    return true
end
set(symbol, value) click to toggle source
# File lib/biosphere/terraformproxy.rb, line 52
def set(symbol, value)

    # Support setter here
    if [:ingress, :egress, :route].include?(symbol)
        @output[symbol] ||= []
        if value.kind_of?(Array)
            @output[symbol] += value
        else
            @output[symbol] << value
        end
    else
        @output[symbol] = value
    end

    if symbol === :user_data
      @output[symbol] = Base64.strict_encode64(Zlib::Deflate.new(nil, 31).deflate(value, Zlib::FINISH))
    end
end
state() click to toggle source
# File lib/biosphere/terraformproxy.rb, line 79
def state
    return @caller.state.node
end