persistence-providers 0.0.3 → 0.0.3.1

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: f9aa5cb5e377b4262fe27dd1a3bd212f8370a4affb6e4820dcfc6249bddfa0b4
4
- data.tar.gz: 8a847ddafae1a301ce87292f1df010eb5ea8532543b1ad01b5af80aedc3d4e2e
3
+ metadata.gz: 7ac2828e10383c9590347d210c09ffd97640c80794cc0078290de10d8010685c
4
+ data.tar.gz: ef1e7376786ed2c13d7e2457351185285f385c1d99818ead0c5171d921d094e7
5
5
  SHA512:
6
- metadata.gz: 3cc59c36dee2b51f1ad45e3f1b87c00a4805b9ad4a5c1f217fe613b614d77550acf2393c6aace0a87f98cfe9196a74ccad4267dac6cc78661f4a410fce64fce9
7
- data.tar.gz: 1aa2aaf99c6f0198f9242639576a722478b4bc832d28d094004c555edae9c3ad9f3560a49322c290bdd61cc22f6a37f6b56a434f91f6843c3639c7dfea862f8a
6
+ metadata.gz: d13cb086750ea5407ad6c9e932672031adbb9aee66c85d15043bd0af770ddeb6e605acf721d3bea50f534198cdd6ac58d95ff6313bf796e75751b3616b4f55ae
7
+ data.tar.gz: 61c45ed7d35a5f68beab292ee7f4830298b58060b83dc29e145340352195cb82095812c778a9df36c51f20356f1a0b6ce767f26168ff5138cd9ff20c389875d0
@@ -10,7 +10,7 @@ module DTK::State
10
10
  @component_defs = parent.references.component_def
11
11
  @component_def = get_component_def(opts)
12
12
 
13
- @attribute_objs = Attribute.create_from_kube_hash(component_content[:attributes])# convert_to_attribute_objects(component_content[:attributes])
13
+ @attribute_objs = Attribute.create_from_kube_hash(component_content[:attributes] || {})# convert_to_attribute_objects(component_content[:attributes])
14
14
  end
15
15
 
16
16
  # opts can have keys
@@ -9,7 +9,7 @@ module DTK::State
9
9
  @namespace = namespace
10
10
  @executable_actions = content[:spec][:actions]
11
11
  # @attributes = AttributeTypeInfo.create_from_kube_array(content[:spec][:attributes])
12
- @attribute_type_info = AttributeTypeInfo.create_from_kube_array(content[:spec][:attributes])
12
+ @attribute_type_info = AttributeTypeInfo.create_from_kube_array(content[:spec][:attributes] || [])
13
13
  end
14
14
 
15
15
  def self.get(namespace, name, opts = {})
@@ -1,16 +1,17 @@
1
1
  module DTK::State
2
2
  class WorkflowInstance
3
- attr_reader :name, :namespace, :assembly, :workflow_template, :attributes, :workflow
3
+ require_relative 'workflow_instance/attribute_type_info'
4
+
5
+ attr_reader :name, :namespace, :assembly, :workflow_template, :attributes, :workflow, :attribute_type_info
4
6
 
5
7
  def initialize(namespace, name, crd_content)
6
8
  @name = name
7
9
  @namespace = namespace
8
- # @crd_content = crd_content
9
- # @references = crd_content.references
10
10
  @assembly = crd_content.references.assembly
11
11
  @workflow_template = crd_content.references.workflow
12
12
  @attributes = crd_content.spec.attributes
13
13
  @workflow = crd_content.spec.workflow
14
+ @attribute_type_info = AttributeTypeInfo.create_from_kube_obj(@attributes.to_h || {})
14
15
  end
15
16
 
16
17
  def self.get(namespace, name, opts = {})
@@ -20,8 +21,7 @@ module DTK::State
20
21
 
21
22
  def self.get_attributes(namespace, name, opts = {})
22
23
  workflow_instance = get(namespace, name, opts)
23
- # workflow_instance.attributes.to_h
24
- workflow_instance.attributes.map{ |attr| attr.to_hash }
24
+ workflow_instance.attributes.to_h
25
25
  end
26
26
  end
27
27
  end
@@ -0,0 +1,28 @@
1
+
2
+ module DTK::State
3
+ class WorkflowInstance
4
+ class AttributeTypeInfo
5
+
6
+ attr_reader :name, :type, :value, :required, :dynamic, :encrypted, :temporal
7
+
8
+ def initialize(name, params)
9
+ @name = name.to_s
10
+ @type = params[:type]
11
+ @value = params[:value] || nil
12
+ @required = params[:required] || false
13
+ @dynamic = params[:dynamic] || false
14
+ @temporal = params[:temporal] || false
15
+ @encrypted = params[:encrypted] || false
16
+ end
17
+
18
+ def self.create_from_kube_obj(kube_attributes)
19
+ attributes = []
20
+ kube_attributes.each do |name, content|
21
+ attributes.push(AttributeTypeInfo.new(name, content))
22
+ end
23
+ attributes
24
+ end
25
+
26
+ end
27
+ end
28
+ 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
+ spec.version = '0.0.3.1'
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
4
+ version: 0.0.3.1
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-17 00:00:00.000000000 Z
11
+ date: 2020-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kubeclient
@@ -76,6 +76,7 @@ files:
76
76
  - lib/state/crd_component.rb
77
77
  - lib/state/executable_action.rb
78
78
  - lib/state/workflow_instance.rb
79
+ - lib/state/workflow_instance/attribute_type_info.rb
79
80
  - persistence-providers.gemspec
80
81
  - test-destroy-influxdb.rb
81
82
  - test-influxdb.rb