Class PutKeyPolicyRequest
- java.lang.Object
-
- software.amazon.awssdk.core.SdkRequest
-
- software.amazon.awssdk.awscore.AwsRequest
-
- software.amazon.awssdk.services.kms.model.KmsRequest
-
- software.amazon.awssdk.services.kms.model.PutKeyPolicyRequest
-
- All Implemented Interfaces:
SdkPojo,ToCopyableBuilder<PutKeyPolicyRequest.Builder,PutKeyPolicyRequest>
@Generated("software.amazon.awssdk:codegen") public final class PutKeyPolicyRequest extends KmsRequest implements ToCopyableBuilder<PutKeyPolicyRequest.Builder,PutKeyPolicyRequest>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfacePutKeyPolicyRequest.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PutKeyPolicyRequest.Builderbuilder()BooleanbypassPolicyLockoutSafetyCheck()Skips ("bypasses") the key policy lockout safety check.booleanequals(Object obj)booleanequalsBySdkFields(Object obj)<T> Optional<T>getValueForField(String fieldName, Class<T> clazz)inthashCode()StringkeyId()Sets the key policy on the specified KMS key.Stringpolicy()The key policy to attach to the KMS key.StringpolicyName()The name of the key policy.Map<String,SdkField<?>>sdkFieldNameToField()List<SdkField<?>>sdkFields()static Class<? extends PutKeyPolicyRequest.Builder>serializableBuilderClass()PutKeyPolicyRequest.BuildertoBuilder()StringtoString()Returns a string representation of this object.-
Methods inherited from class software.amazon.awssdk.awscore.AwsRequest
overrideConfiguration
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface software.amazon.awssdk.utils.builder.ToCopyableBuilder
copy
-
-
-
-
Method Detail
-
keyId
public final String keyId()
Sets the key policy on 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.
- Returns:
- Sets the key policy on 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.
-
-
-
policyName
public final String policyName()
The name of the key policy. If no policy name is specified, the default value is
default. The only valid value isdefault.- Returns:
- The name of the key policy. If no policy name is specified, the default value is
default. The only valid value isdefault.
-
policy
public final String policy()
The key policy to attach to the KMS key.
The key policy must meet the following criteria:
-
The key policy must allow the calling principal to make a subsequent
PutKeyPolicyrequest on the KMS key. This reduces the risk that the KMS key becomes unmanageable. For more information, see Default key policy in the Key Management Service Developer Guide. (To omit this condition, setBypassPolicyLockoutSafetyCheckto true.) -
Each statement in the key policy must contain one or more principals. The principals in the key policy must exist and be visible to KMS. When you create a new Amazon Web Services principal, you might need to enforce a delay before including the new principal in a key policy because the new principal might not be immediately visible to KMS. For more information, see Changes that I make are not always immediately visible in the Amazon Web Services Identity and Access Management User Guide.
A key policy document can include only the following characters:
-
Printable ASCII characters from the space character (
) through the end of the ASCII character range. -
Printable characters in the Basic Latin and Latin-1 Supplement character set (through
ÿ). -
The tab (
), line feed (), and carriage return () special characters
For information about key policies, see Key policies in KMS in the Key Management Service Developer Guide.For help writing and formatting a JSON policy document, see the IAM JSON Policy Reference in the Identity and Access Management User Guide .
- Returns:
- The key policy to attach to the KMS key.
The key policy must meet the following criteria:
-
The key policy must allow the calling principal to make a subsequent
PutKeyPolicyrequest on the KMS key. This reduces the risk that the KMS key becomes unmanageable. For more information, see Default key policy in the Key Management Service Developer Guide. (To omit this condition, setBypassPolicyLockoutSafetyCheckto true.) -
Each statement in the key policy must contain one or more principals. The principals in the key policy must exist and be visible to KMS. When you create a new Amazon Web Services principal, you might need to enforce a delay before including the new principal in a key policy because the new principal might not be immediately visible to KMS. For more information, see Changes that I make are not always immediately visible in the Amazon Web Services Identity and Access Management User Guide.
A key policy document can include only the following characters:
-
Printable ASCII characters from the space character (
) through the end of the ASCII character range. -
Printable characters in the Basic Latin and Latin-1 Supplement character set (through
ÿ). -
The tab (
), line feed (), and carriage return () special characters
For information about key policies, see Key policies in KMS in the Key Management Service Developer Guide.For help writing and formatting a JSON policy document, see the IAM JSON Policy Reference in the Identity and Access Management User Guide .
-
-
-
bypassPolicyLockoutSafetyCheck
public final Boolean bypassPolicyLockoutSafetyCheck()
Skips ("bypasses") the key policy lockout safety check. The default value is false.
Setting this value to true increases the risk that the KMS key becomes unmanageable. Do not set this value to true indiscriminately.
For more information, see Default key policy in the Key Management Service Developer Guide.
Use this parameter only when you intend to prevent the principal that is making the request from making a subsequent PutKeyPolicy request on the KMS key.
- Returns:
- Skips ("bypasses") the key policy lockout safety check. The default value is false.
Setting this value to true increases the risk that the KMS key becomes unmanageable. Do not set this value to true indiscriminately.
For more information, see Default key policy in the Key Management Service Developer Guide.
Use this parameter only when you intend to prevent the principal that is making the request from making a subsequent PutKeyPolicy request on the KMS key.
-
toBuilder
public PutKeyPolicyRequest.Builder toBuilder()
- Specified by:
toBuilderin interfaceToCopyableBuilder<PutKeyPolicyRequest.Builder,PutKeyPolicyRequest>- Specified by:
toBuilderin classKmsRequest
-
builder
public static PutKeyPolicyRequest.Builder builder()
-
serializableBuilderClass
public static Class<? extends PutKeyPolicyRequest.Builder> serializableBuilderClass()
-
hashCode
public final int hashCode()
- Overrides:
hashCodein classAwsRequest
-
equals
public final boolean equals(Object obj)
- Overrides:
equalsin classAwsRequest
-
equalsBySdkFields
public final boolean equalsBySdkFields(Object obj)
- Specified by:
equalsBySdkFieldsin interfaceSdkPojo
-
toString
public final String toString()
Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be redacted from this string using a placeholder value.
-
getValueForField
public final <T> Optional<T> getValueForField(String fieldName, Class<T> clazz)
- Overrides:
getValueForFieldin classSdkRequest
-
sdkFieldNameToField
public final Map<String,SdkField<?>> sdkFieldNameToField()
- Specified by:
sdkFieldNameToFieldin interfaceSdkPojo
-
-