get_key_policy¶
Operation¶
get_key_policy
async
¶
get_key_policy(request: GetKeyPolicyInput | GetKeyPolicyInputDict, /, *, plugins: list[Plugin] | None = None) -> GetKeyPolicyOutput
get_key_policy(*, plugins: list[Plugin] | None = None, **kwargs: Unpack[GetKeyPolicyInputDict]) -> GetKeyPolicyOutput
Gets a key policy attached to the specified KMS key.
Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.
Required permissions: kms:GetKeyPolicy (key policy)
Related operations: PutKeyPolicy
Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
Returns:
| Type | Description |
|---|---|
GetKeyPolicyOutput
|
An instance of |
Input¶
Pass the input fields as keyword arguments, or pass a model or dictionary as the first positional argument. Pass plugins separately as a keyword argument.
Model¶
GetKeyPolicyInput
dataclass
¶
Bases: _SerdeShape
Dataclass for GetKeyPolicyInput structure.
Attributes¶
key_id
class-attribute
instance-attribute
¶
key_id: str | None = ...
Gets the key policy for the specified KMS key.
Specify the key ID or key ARN of the KMS key.
For example:
-
Key ID:
1234abcd-12ab-34cd-56ef-1234567890ab -
Key ARN:
arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
Dictionaries¶
GetKeyPolicyInputDict
¶
Bases: TypedDict
Dictionary form of GetKeyPolicyInput.
Attributes¶
key_id
instance-attribute
¶
Gets the key policy for the specified KMS key.
Specify the key ID or key ARN of the KMS key.
For example:
-
Key ID:
1234abcd-12ab-34cd-56ef-1234567890ab -
Key ARN:
arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
Output¶
GetKeyPolicyOutput
dataclass
¶
Bases: _SerdeShape
Dataclass for GetKeyPolicyOutput structure.
Attributes¶
policy
class-attribute
instance-attribute
¶
policy: str | None = ...
A key policy document in JSON format.
policy_name
class-attribute
instance-attribute
¶
policy_name: str | None = ...
The name of the key policy. The only valid value is default.
response_metadata
class-attribute
instance-attribute
¶
Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.