KeyGrants
- class aws_cdk.aws_kms.KeyGrants(*args: Any, **kwargs)
Bases:
objectCollection of grant methods for an IKey.
- ExampleMetadata:
infused
Example:
# principal: iam.IPrincipal # key: kms.IKeyRef # can be either an L1 or L2 kms.KeyGrants.from_key(key).sign(principal)
Methods
- actions(grantee, *actions)
Grant the indicated permissions on this key to the given principal.
This modifies both the principal’s policy as well as the resource policy, since the default CloudFormation setup for KMS keys is that the policy must not be empty and so default grants won’t work.
- Parameters:
grantee (
IGrantable)actions (
str)
- Return type:
- admin(grantee)
Grant admins permissions using this key to the given principal.
Key administrators have permissions to manage the key (e.g., change permissions, revoke), but do not have permissions to use the key in cryptographic operations (e.g., encrypt, decrypt).
- Parameters:
grantee (
IGrantable)- Return type:
- decrypt(grantee)
Grant decryption permissions using this key to the given principal.
- Parameters:
grantee (
IGrantable)- Return type:
- encrypt(grantee)
Grant encryption permissions using this key to the given principal.
- Parameters:
grantee (
IGrantable)- Return type:
- encrypt_decrypt(grantee)
Grant encryption and decryption permissions using this key to the given principal.
- Parameters:
grantee (
IGrantable)- Return type:
- generate_mac(grantee)
Grant permissions to generating MACs to the given principal.
- Parameters:
grantee (
IGrantable)- Return type:
- sign(grantee)
Grant sign permissions using this key to the given principal.
- Parameters:
grantee (
IGrantable)- Return type:
- sign_verify(grantee)
Grant sign and verify permissions using this key to the given principal.
- Parameters:
grantee (
IGrantable)- Return type:
- verify(grantee)
Grant verify permissions using this key to the given principal.
- Parameters:
grantee (
IGrantable)- Return type:
- verify_mac(grantee)
Grant permissions to verifying MACs to the given principal.
- Parameters:
grantee (
IGrantable)- Return type:
Static Methods