Class: DTK::State::ComponentDef

Inherits:
Object
  • Object
show all
Defined in:
lib/state/component_def.rb,
lib/state/component_def/attribute_type_info.rb

Defined Under Namespace

Classes: AttributeTypeInfo

Constant Summary collapse

COMPONENT_DEF_CRD_VERSION =
ENV["COMPONENT_DEF_CRD_VERSION"]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespace, name, content) ⇒ ComponentDef

Returns a new instance of ComponentDef.



9
10
11
12
13
14
# File 'lib/state/component_def.rb', line 9

def initialize(namespace, name, content)
  @name                = name
  @namespace           = namespace
  @executable_actions  = content[:spec][:actions] || {}
  @attribute_type_info  = AttributeTypeInfo.create_from_kube_hash(content[:spec][:attributes] || {})
end

Instance Attribute Details

#attribute_type_infoObject (readonly)

Returns the value of attribute attribute_type_info.



7
8
9
# File 'lib/state/component_def.rb', line 7

def attribute_type_info
  @attribute_type_info
end

#executable_actionsObject (readonly)

Returns the value of attribute executable_actions.



7
8
9
# File 'lib/state/component_def.rb', line 7

def executable_actions
  @executable_actions
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/state/component_def.rb', line 7

def name
  @name
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



7
8
9
# File 'lib/state/component_def.rb', line 7

def namespace
  @namespace
end

Class Method Details

.get(namespace, name, opts = {}) ⇒ Object



16
17
18
19
20
# File 'lib/state/component_def.rb', line 16

def self.get(namespace, name, opts = {})
  opts[:apiVersion] = COMPONENT_DEF_CRD_VERSION
  crd_component_def = ::DTK::CrdClient.get_kubeclient(opts).get_componentdef(name, namespace)
  ComponentDef.new(namespace, name, crd_component_def)
end