Class: Kubecontrol::Resources::Secret
- Inherits:
-
Object
- Object
- Kubecontrol::Resources::Secret
- Defined in:
- lib/kubecontrol/resources/secret.rb
Constant Summary collapse
- RESOURCE_NAME =
'secrets'.freeze
Instance Attribute Summary collapse
-
#age ⇒ Object
readonly
Returns the value of attribute age.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #data_values ⇒ Object
-
#initialize(name, type, data, age, namespace, client) ⇒ Secret
constructor
A new instance of Secret.
Constructor Details
#initialize(name, type, data, age, namespace, client) ⇒ Secret
Returns a new instance of Secret.
11 12 13 14 15 16 17 18 |
# File 'lib/kubecontrol/resources/secret.rb', line 11 def initialize(name, type, data, age, namespace, client) @name = name @type = type @data = data @age = age @namespace = namespace @client = client end |
Instance Attribute Details
#age ⇒ Object (readonly)
Returns the value of attribute age.
9 10 11 |
# File 'lib/kubecontrol/resources/secret.rb', line 9 def age @age end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
9 10 11 |
# File 'lib/kubecontrol/resources/secret.rb', line 9 def client @client end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
9 10 11 |
# File 'lib/kubecontrol/resources/secret.rb', line 9 def data @data end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/kubecontrol/resources/secret.rb', line 9 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
9 10 11 |
# File 'lib/kubecontrol/resources/secret.rb', line 9 def namespace @namespace end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/kubecontrol/resources/secret.rb', line 9 def type @type end |
Instance Method Details
#data_values ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/kubecontrol/resources/secret.rb', line 20 def data_values @data_values ||= begin std_out, _std_err, exit_code = @client.kubectl_command("get secret #{@name} -o json") if exit_code.zero? json_secret = JSON.parse(std_out) json_secret['data'].reduce({}) {|h, (k,v)| h[k] = Base64.decode64(v); h } else {} end end end |