dtk_crd_parser 0.0.26 → 0.0.27
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 +4 -4
- data/lib/crd_parser.rb +7 -0
- data/lib/crd_parser/action.rb +23 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b196e537b25a0f488ad6718e84c21c1d8f9d3574d8604f5a0cd4a2a8469935e9
|
|
4
|
+
data.tar.gz: cd3f8ef7279a659eafa6bb6c77f43386eef287615354c6db72166c457e7ab3bd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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
|