dtk_crd_parser 0.0.26 → 0.0.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cdcbdad09bb7b562a1286d5591acc8870a5cfd6efd8f1a5869efea6dbc05bb67
4
- data.tar.gz: de12bedadf813addb332eb2a002148c123efa9fd777bb05dbb398ebec613c603
3
+ metadata.gz: b196e537b25a0f488ad6718e84c21c1d8f9d3574d8604f5a0cd4a2a8469935e9
4
+ data.tar.gz: cd3f8ef7279a659eafa6bb6c77f43386eef287615354c6db72166c457e7ab3bd
5
5
  SHA512:
6
- metadata.gz: 8519f5ebd6b0e20b6dbffb4a0ced97661b01b372d22935f1c3c7b2988fa6d860332e6b9043da1021b4d39b10d8d54efa0c74124c4dac9314c451bfa9ffb289ac
7
- data.tar.gz: fc06e3c1a71b18121855cb89566ea08250e60ae70efe57d787a3899313af2d51ebe8af34d08f4d277ded3bbfe446b5f4747088b334dcf33aff1e6ab9ce5de59a
6
+ metadata.gz: 80977810781f46c56e286f5658424d7ddc58188dae4cfcdafb428a5b2f3f851f727f76c3daf78eb649d6bc2737dba3b1914145afc20bc1223c7f376a20009f57
7
+ data.tar.gz: af4a4774775931cf98a7696833571c90d4255b01c25b704c5dac39b5d8266a8ba115f5c0cb94849c91808c5bb86b4aaae1be35a4bf945e9e4ee6a305034a5850
data/lib/crd_parser.rb CHANGED
@@ -11,5 +11,12 @@ module DTK
11
11
  #component name is, for example, network-aws::vpc[vpc1]
12
12
  Component.create_from_kube(client, component_instance, component_name)
13
13
  end
14
+
15
+ def self.parse_crd_to_action(client, component_instance, action_instance)
16
+ #component instance has a name and a namespace {name: xxx, namespace: yyy}
17
+ #client is kube client
18
+ #action instance, for example, {name: xxx, namespace: xxx, id: xxx}
19
+ Action.create_from_kube(client, component_instance, action_instance)
20
+ end
14
21
  end
15
22
  end
@@ -0,0 +1,23 @@
1
+ module DTK::CrdParser
2
+ class Action < BaseClass
3
+
4
+ def initialize(name, id, component)
5
+ @name = name #
6
+ @component = component #this wil point to the corresponding component
7
+ @id = id #action subtask id
8
+ end
9
+
10
+ def self.create_from_kube(client, component_instance, action_instance)
11
+ action_obj = client.get_action(action_instance[:name], action_instance[:namespace])
12
+ component_name = action_obj[:spec][:action][:subtasks][action_instance[:id]]
13
+ component = Component.create_from_kube(client, component_instance, component_name)
14
+
15
+ Action.new(action_instance[:name], action_instance[:id], component)
16
+ end
17
+
18
+ protected
19
+
20
+ attr_reader :name, :component, :id
21
+
22
+ end
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtk_crd_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - DTK
@@ -17,6 +17,7 @@ extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
19
  - lib/crd_parser.rb
20
+ - lib/crd_parser/action.rb
20
21
  - lib/crd_parser/base_class.rb
21
22
  - lib/crd_parser/base_class/helper_mixins.rb
22
23
  - lib/crd_parser/component.rb