Add support for KMS key rotation operations

This adds support for the following KMS endpoints:

* EnableKeyRotation
* DisableKeyRotation
* GetKeyRotationStatus

Signed-off-by: Jesse Szwedko <jesse.szwedko@getbraintree.com>
This commit is contained in:
Andrew Garrett 2015-11-24 23:44:55 +00:00 committed by Jesse Szwedko
commit f1566cecf4
3 changed files with 122 additions and 0 deletions

View file

@ -15,6 +15,7 @@ class Key(object):
self.enabled = True
self.region = region
self.account_id = "0123456789012"
self.key_rotation_status = False
@property
def arn(self):
@ -68,6 +69,16 @@ class KmsBackend(BaseBackend):
def get_all_aliases(self):
return self.key_to_aliases
def enable_key_rotation(self, key_id):
self.keys[key_id].key_rotation_status = True
def disable_key_rotation(self, key_id):
self.keys[key_id].key_rotation_status = False
def get_key_rotation_status(self, key_id):
return self.keys[key_id].key_rotation_status
kms_backends = {}
for region in boto.kms.regions():
kms_backends[region.name] = KmsBackend()