persistence-providers 0.0.3.3 → 0.0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59e42a6523c2d6174ede530cc548395abb6a312aa02cda2339911e826e3b7c74
4
- data.tar.gz: d7fe828c7edea2f815a02fb0266f954147b78c821e20e2faafe6dfda746f368f
3
+ metadata.gz: b03aea719007459fa5bbbc7511a9bfbb7954ea02946e46de899af9e258f5954c
4
+ data.tar.gz: a258ff130fd0083d9e2dea997ad5e7dab842a6e687351e039abd5b2f421b53b6
5
5
  SHA512:
6
- metadata.gz: 3da2506d197ca4da363862b8a3b37ecfc7a96d8196f6c4748d84b40a64ffaf5edcdf2475e318ad18a31185b1700d76a8a5ded2a92d8f20324fb78b0d1f02b3f2
7
- data.tar.gz: 40663bb7fbb15f8fe50a25dd9f6f2da9108f478e94b3a57409f0e9856190a7fdac53d561eebde6e8cf3e25b3579e242a8782f31f93b8a6ea597fd69faf82ecd3
6
+ metadata.gz: 441f55458ed7e431479bbc8651d1f7757d7dfc5b74eeacdae06d0d1b20778570eaed87abefb054de962dcaee9a1a4fd52449a0f3d90b7ae4b722ed2978040b49
7
+ data.tar.gz: 93b8f0502f34f89f4d01683bb253d82fd4c4fefb8d6bc2fa26c4d6565762aeed229a5ceda2ae3b7c71aa119fa8bcc8e53b55197532efcde4d173162b81035e2e
@@ -8,12 +8,10 @@ module DTK::State
8
8
  @name = name
9
9
  @namespace = namespace
10
10
  @executable_actions = content[:spec][:actions]
11
- # @attributes = AttributeTypeInfo.create_from_kube_array(content[:spec][:attributes])
12
11
  @attribute_type_info = AttributeTypeInfo.create_from_kube_array(content[:spec][:attributes] || [])
13
12
  end
14
13
 
15
14
  def self.get(namespace, name, opts = {})
16
- # crd_component_def = ::DTK::CrdClient.instance(opts).kubeclient.get_componentdef(name, namespace)
17
15
  crd_component_def = ::DTK::CrdClient.get_kubeclient(opts).get_componentdef(name, namespace)
18
16
  ComponentDef.new(namespace, name, crd_component_def)
19
17
  end
@@ -0,0 +1,24 @@
1
+ module DTK::State
2
+ class ExecutableAction
3
+ class AttributeTypeInfo
4
+
5
+ attr_reader :name, :type, :required, :dynamic, :encrypted, :temporal
6
+
7
+ def initialize(params)
8
+ @name = params[:name]
9
+ @type = params[:type]
10
+ @required = params[:required] || false
11
+ @dynamic = params[:dynamic] || false
12
+ @temporal = params[:temporal] || false
13
+ @encrypted = params[:encrypted] || false
14
+ end
15
+
16
+ def self.create_from_kube_array(kube_attributes)
17
+ kube_attributes.map do |attribute_content|
18
+ AttributeTypeInfo.new(attribute_content)
19
+ end
20
+ end
21
+
22
+ end
23
+ end
24
+ end
@@ -1,12 +1,15 @@
1
1
  module DTK::State
2
2
  class ExecutableAction
3
- attr_reader :entrypoint, :bash_script, :name, :type
3
+ require_relative 'executable_action/attribute_type_info'
4
+
5
+ attr_reader :entrypoint, :bash_script, :name, :type, :attribute_type_info
4
6
 
5
7
  def initialize(params)
6
8
  @name = params[:name]
7
9
  @entrypoint = params[:entrypoint]
8
10
  @type = params[:type]
9
11
  @bash_script = params[:bash_script]
12
+ @attribute_type_info = AttributeTypeInfo.create_from_kube_array(params[:attributes] || [])
10
13
  end
11
14
 
12
15
  def self.get(crd_assembly_namespace, crd_assembly_name, component_name, action_name, opts = {})
@@ -21,7 +24,8 @@ module DTK::State
21
24
  name: action_name,
22
25
  entrypoint: action[:entrypoint] || '',
23
26
  type: action[:type] || '',
24
- bash_script: action[:bash_script] || ''
27
+ bash_script: action[:bash_script] || '',
28
+ attributes: action[:attributes] || []
25
29
  }
26
30
  )
27
31
  end
@@ -23,5 +23,29 @@ module DTK::State
23
23
  workflow_instance = get(namespace, name, opts)
24
24
  workflow_instance.attributes.to_h
25
25
  end
26
+
27
+ def self.get_action_attributes(namespace, name, action_id, opts = {})
28
+ workflow_instance = get(namespace, name, opts)
29
+ action = workflow_instance.find_action(action_id)
30
+ return nil unless action
31
+ attributes = action[:attributes] || {}
32
+ attributes.to_h
33
+ end
34
+
35
+ def find_action(id, workflow = @workflow)
36
+ action = nil
37
+ subtasks = workflow[:subtasks]
38
+ subtasks.each do |subtask|
39
+ if(subtask.id.to_s == id.to_s)
40
+ action = subtask
41
+ break
42
+ elsif subtask[:subtasks]
43
+ action = find_action(id, subtask)
44
+ break unless action.nil?
45
+ end
46
+ end
47
+ action
48
+ end
49
+
26
50
  end
27
51
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'persistence-providers'
3
- spec.version = '0.0.3.3'
3
+ spec.version = '0.0.3.4'
4
4
  spec.author = 'Reactor8'
5
5
  spec.email = 'support@reactor8.com'
6
6
  spec.description = %q{Persistence providers plugin}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: persistence-providers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.3
4
+ version: 0.0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reactor8
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-28 00:00:00.000000000 Z
11
+ date: 2020-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kubeclient
@@ -75,6 +75,7 @@ files:
75
75
  - lib/state/component_def/attribute_type_info.rb
76
76
  - lib/state/crd_assembly.rb
77
77
  - lib/state/executable_action.rb
78
+ - lib/state/executable_action/attribute_type_info.rb
78
79
  - lib/state/workflow_instance.rb
79
80
  - lib/state/workflow_instance/attribute_type_info.rb
80
81
  - persistence-providers.gemspec