Class: Moonshot::Plugins::EncryptedParameters::KmsKey
- Inherits:
-
Object
- Object
- Moonshot::Plugins::EncryptedParameters::KmsKey
- Defined in:
- lib/plugins/encrypted_parameters/kms_key.rb
Overview
Class that manages KMS keys in AWS.
Instance Attribute Summary collapse
-
#arn ⇒ Object
readonly
Returns the value of attribute arn.
Class Method Summary collapse
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize(arn) ⇒ KmsKey
constructor
A new instance of KmsKey.
- #update ⇒ Object
Constructor Details
#initialize(arn) ⇒ KmsKey
Returns a new instance of KmsKey.
28 29 30 31 |
# File 'lib/plugins/encrypted_parameters/kms_key.rb', line 28 def initialize(arn) @arn = arn @kms_client = Aws::KMS::Client.new end |
Instance Attribute Details
#arn ⇒ Object (readonly)
Returns the value of attribute arn.
10 11 12 |
# File 'lib/plugins/encrypted_parameters/kms_key.rb', line 10 def arn @arn end |
Class Method Details
.create ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/plugins/encrypted_parameters/kms_key.rb', line 13 def create = resp = Aws::KMS::Client.new.create_key({ tags: # An array of tags. }) arn = resp..arn new(arn) end |
Instance Method Details
#delete ⇒ Object
41 42 43 |
# File 'lib/plugins/encrypted_parameters/kms_key.rb', line 41 def delete @kms_client.schedule_key_deletion(key_id: @arn, pending_window_in_days: 7) end |
#update ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/plugins/encrypted_parameters/kms_key.rb', line 33 def update = self.class. @kms_client.tag_resource({ key_id: @arn, # arn of the CMK being tagged tags: # An array of tags. }) end |