Class: DTK::State::Workflow

Inherits:
Object
  • Object
show all
Defined in:
lib/state/workflow.rb

Constant Summary collapse

WORKFLOW_CRD_VERSION =
ENV["WORKFLOW_CRD_VERSION"]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespace, name, crd_content) ⇒ Workflow

Returns a new instance of Workflow.



9
10
11
12
13
14
15
16
17
18
# File 'lib/state/workflow.rb', line 9

def initialize(namespace, name, crd_content)
  @name      = name
  @namespace = namespace

  @references = crd_content.references
  @assembly   = @references.assembly
  @workflow   = crd_content.spec.workflow || {}

  @attribute_type_info = ::DTK::State::WorkflowInstance::AttributeTypeInfo.create_from_kube_hash(crd_content.spec.attributes.to_h || {})
end

Instance Attribute Details

#assemblyObject (readonly)

Returns the value of attribute assembly.



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

def assembly
  @assembly
end

#attribute_type_infoObject (readonly)

Returns the value of attribute attribute_type_info.



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

def attribute_type_info
  @attribute_type_info
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



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

def namespace
  @namespace
end

#referencesObject (readonly)

Returns the value of attribute references.



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

def references
  @references
end

#workflowObject (readonly)

Returns the value of attribute workflow.



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

def workflow
  @workflow
end

Class Method Details

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



20
21
22
23
24
# File 'lib/state/workflow.rb', line 20

def self.get(namespace, name, opts = {})
  opts[:apiVersion] = WORKFLOW_CRD_VERSION
  workflow = ::DTK::CrdClient.get_kubeclient(opts).get_workflow(name, namespace)
  Workflow.new(namespace, name, workflow)
end