Class: OSESecretSerializer
- Inherits:
-
Object
- Object
- OSESecretSerializer
- Defined in:
- lib/serializers/ose_secret_serializer.rb
Class Method Summary collapse
-
.from_yaml(yaml) ⇒ Object
rubocop:disable Metrics/MethodLength.
-
.to_encryptable(secret) ⇒ Object
rubocop:enable Metrics/MethodLength.
- .to_yaml(secret) ⇒ Object
Class Method Details
.from_yaml(yaml) ⇒ Object
rubocop:disable Metrics/MethodLength
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/serializers/ose_secret_serializer.rb', line 9 def from_yaml(yaml) secret_hash = Psych.load(yaml) data = { 'apiVersion' => secret_hash['apiVersion'], 'data' => decoded_data(secret_hash['data']), 'kind' => secret_hash['kind'], 'metadata' => { 'name' => secret_hash['metadata']['name'], 'labels' => secret_hash['metadata']['labels'] } }.to_yaml OSESecret.new(secret_hash['metadata']['name'], data.to_s) end |
.to_encryptable(secret) ⇒ Object
rubocop:enable Metrics/MethodLength
24 25 26 |
# File 'lib/serializers/ose_secret_serializer.rb', line 24 def to_encryptable(secret) Encryptable.new(name: secret.name, ose_secret: secret.ose_secret, type: 'ose_secret') end |
.to_yaml(secret) ⇒ Object
28 29 30 31 32 |
# File 'lib/serializers/ose_secret_serializer.rb', line 28 def to_yaml(secret) secret_hash = Psych.load(secret.ose_secret) secret_hash['data'] = encoded_data(secret_hash['data']) secret_hash.to_yaml end |