#[non_exhaustive]pub struct GrantConstraints {
pub encryption_context_subset: Option<HashMap<String, String>>,
pub encryption_context_equals: Option<HashMap<String, String>>,
pub source_arn: Option<String>,
}Expand description
Use this structure to allow cryptographic operations in the grant only when the operation request meets the specified constraints.
KMS supports the following grant constraints:
-
EncryptionContextEqualsandEncryptionContextSubset— These encryption context constraints apply only to cryptographic operations that support an encryption context, that is, all cryptographic operations with a symmetric KMS key. Encryption context grant constraints are not applied to operations that do not support an encryption context, such as cryptographic operations with asymmetric KMS keys and management operations, such asDescribeKeyorRetireGrant.In a cryptographic operation, the encryption context in the decryption operation must be an exact, case-sensitive match for the keys and values in the encryption context of the encryption operation. Only the order of the pairs can vary.
However, in a grant constraint, the key in each key-value pair is not case sensitive, but the value is case sensitive.
To avoid confusion, do not use multiple encryption context pairs that differ only by case. To require a fully case-sensitive encryption context, use the
kms:EncryptionContext:andkms:EncryptionContextKeysconditions in an IAM or key policy. For details, see kms:EncryptionContext:context-key in the Key Management Service Developer Guide . -
SourceArn— This grant constraint allows the permissions in the grant only when the request is made on behalf of a specific Amazon Web Services resource, identified by its Amazon Resource Name (ARN). This is effectively the same as having the aws:SourceArn global condition key in the grant. The SourceArn constraint is supported on grants for all types of KMS keys and can also be applied to theDescribeKeyoperation when specified in the request. However, it does not apply toRetireGrantoperation.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.encryption_context_subset: Option<HashMap<String, String>>A list of key-value pairs that must be included in the encryption context of the cryptographic operation request. The grant allows the cryptographic operation only when the encryption context in the request includes the key-value pairs specified in this constraint, although it can include additional key-value pairs.
encryption_context_equals: Option<HashMap<String, String>>A list of key-value pairs that must match the encryption context in the cryptographic operation request. The grant allows the operation only when the encryption context in the request is the same as the encryption context specified in this constraint.
source_arn: Option<String>The Amazon Resource Name (ARN) of an Amazon Web Services resource on behalf of which the request is made. This is effectively the same as having the aws:SourceArn global condition key in the grant. The SourceArn constraint ensures that the principal can use the KMS key only when the request is made on behalf of the specified resource.
Implementations§
Source§impl GrantConstraints
impl GrantConstraints
Sourcepub fn encryption_context_subset(&self) -> Option<&HashMap<String, String>>
pub fn encryption_context_subset(&self) -> Option<&HashMap<String, String>>
A list of key-value pairs that must be included in the encryption context of the cryptographic operation request. The grant allows the cryptographic operation only when the encryption context in the request includes the key-value pairs specified in this constraint, although it can include additional key-value pairs.
Sourcepub fn encryption_context_equals(&self) -> Option<&HashMap<String, String>>
pub fn encryption_context_equals(&self) -> Option<&HashMap<String, String>>
A list of key-value pairs that must match the encryption context in the cryptographic operation request. The grant allows the operation only when the encryption context in the request is the same as the encryption context specified in this constraint.
Sourcepub fn source_arn(&self) -> Option<&str>
pub fn source_arn(&self) -> Option<&str>
The Amazon Resource Name (ARN) of an Amazon Web Services resource on behalf of which the request is made. This is effectively the same as having the aws:SourceArn global condition key in the grant. The SourceArn constraint ensures that the principal can use the KMS key only when the request is made on behalf of the specified resource.
Source§impl GrantConstraints
impl GrantConstraints
Sourcepub fn builder() -> GrantConstraintsBuilder
pub fn builder() -> GrantConstraintsBuilder
Creates a new builder-style object to manufacture GrantConstraints.
Trait Implementations§
Source§impl Clone for GrantConstraints
impl Clone for GrantConstraints
Source§fn clone(&self) -> GrantConstraints
fn clone(&self) -> GrantConstraints
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GrantConstraints
impl Debug for GrantConstraints
Source§impl PartialEq for GrantConstraints
impl PartialEq for GrantConstraints
impl StructuralPartialEq for GrantConstraints
Auto Trait Implementations§
impl Freeze for GrantConstraints
impl RefUnwindSafe for GrantConstraints
impl Send for GrantConstraints
impl Sync for GrantConstraints
impl Unpin for GrantConstraints
impl UnsafeUnpin for GrantConstraints
impl UnwindSafe for GrantConstraints
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more