1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00
fog--fog-aws/lib/fog/aws/models/kms/key.rb
Josh Lane f402dce5aa kms service
* list, describe, and create keys
2015-05-12 13:50:55 -07:00

34 lines
888 B
Ruby

module Fog
module AWS
class KMS
class Key < Fog::Model
identity :id, :aliases => 'KeyId'
attribute :account_id, :aliases => 'AWSAccountId'
attribute :arn, :aliases => 'KeyArn'
attribute :created_at, :aliases => 'CreationDate', :type => :time
attribute :description, :aliases => 'Description'
attribute :enabled, :aliases => 'Enabled', :type => :boolean
attribute :usage, :aliases => 'KeyUsage'
attr_writer :policy
def reload
requires :identity
data = service.describe_key(self.identity)
merge_attributes(data.body['KeyMetadata'])
self
end
def save
data = service.create_key(@policy, description, usage)
merge_attributes(data.body['KeyMetadata'])
true
end
end
end
end
end