Class: Quark::MdkIntrospection::Aws::Ec2Host

Inherits:
DatawireQuarkCore::QuarkObject show all
Extended by:
DatawireQuarkCore::Static
Defined in:
lib/mdk_introspection/aws.rb

Constant Summary

Constants included from DatawireQuarkCore::Static

DatawireQuarkCore::Static::Unassigned

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DatawireQuarkCore::Static

_lazy_statics, static, unlazy_statics

Methods inherited from DatawireQuarkCore::QuarkObject

#to_s

Constructor Details

#initialize(env, scope) ⇒ Ec2Host

Returns a new instance of Ec2Host.



23
24
25
26
27
28
29
30
# File 'lib/mdk_introspection/aws.rb', line 23

def initialize(env, scope)
    
    self.__init_fields__
    (self).scope = (scope).upcase
    (self).env = env

    nil
end

Instance Attribute Details

#envObject

Returns the value of attribute env.



16
17
18
# File 'lib/mdk_introspection/aws.rb', line 16

def env
  @env
end

#scopeObject

Returns the value of attribute scope.



16
17
18
# File 'lib/mdk_introspection/aws.rb', line 16

def scope
  @scope
end

Class Method Details

.metadataHost(env) ⇒ Object



35
36
37
38
39
40
# File 'lib/mdk_introspection/aws.rb', line 35

def self.metadataHost(env)
    
    return env.var("DATAWIRE_METADATA_HOST_OVERRIDE").orElseGet("169.254.169.254")

    nil
end

Instance Method Details

#__init_fields__Object



87
88
89
90
91
92
93
# File 'lib/mdk_introspection/aws.rb', line 87

def __init_fields__()
    
    self.scope = nil
    self.env = nil

    nil
end

#_getClassObject



55
56
57
58
59
60
# File 'lib/mdk_introspection/aws.rb', line 55

def _getClass()
    
    return "mdk_introspection.aws.Ec2Host"

    nil
end

#_getField(name) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/mdk_introspection/aws.rb', line 62

def _getField(name)
    
    if ((name) == ("scope"))
        return (self).scope
    end
    if ((name) == ("env"))
        return (self).env
    end
    return nil

    nil
end

#_setField(name, value) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/mdk_introspection/aws.rb', line 75

def _setField(name, value)
    
    if ((name) == ("scope"))
        (self).scope = ::DatawireQuarkCore.cast(value) { ::String }
    end
    if ((name) == ("env"))
        (self).env = ::DatawireQuarkCore.cast(value) { ::Quark.mdk_runtime.EnvironmentVariables }
    end

    nil
end

#getObject



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/mdk_introspection/aws.rb', line 42

def get()
    
    if ((@scope) == ("INTERNAL"))
        return ::DatawireQuarkCore.url_get((("http://") + (::Quark.mdk_introspection.aws.Ec2Host.metadataHost(@env))) + ("/latest/meta-data/local-hostname"))
    end
    if ((@scope) == ("PUBLIC"))
        return ::DatawireQuarkCore.url_get((("http://") + (::Quark.mdk_introspection.aws.Ec2Host.metadataHost(@env))) + ("/latest/meta-data/public-hostname"))
    end
    return ::DatawireQuarkCore.cast(nil) { ::String }

    nil
end