AWS SDK for Go (PILOT)
API Reference

PREVIEW DOCUMENTATION - This is a preview of a new format for the AWS SDK for Go API Reference documentation. For the current AWS SDK for Go API Reference, see https://docs.aws.amazon.com/sdk-for-go/api/.

We welcome your feedback on this new version of the documentation. Send your comments to aws-sdkdocs-feedback@amazon.com.

PutKeyPolicyInput

import "github.com/aws/aws-sdk-go/service/kms"

type PutKeyPolicyInput struct { BypassPolicyLockoutSafetyCheck *bool `type:"boolean"` KeyId *string `min:"1" type:"string" required:"true"` Policy *string `min:"1" type:"string" required:"true"` PolicyName *string `min:"1" type:"string" required:"true"` }

BypassPolicyLockoutSafetyCheck

Type: *bool

A flag to indicate whether to bypass the key policy lockout safety check.

Setting this value to true increases the risk that the CMK becomes unmanageable. Do not set this value to true indiscriminately.

For more information, refer to the scenario in the Default Key Policy (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam) section in the AWS 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 CMK.

The default value is false.

KeyId

Type: *string

A unique identifier for the customer master key (CMK).

Specify the key ID or the Amazon Resource Name (ARN) of the CMK.

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 CMK, use ListKeys or DescribeKey.

KeyId is a required field

Policy

Type: *string

The key policy to attach to the CMK.

The key policy must meet the following criteria:

  • Each statement in the key policy must contain one or more principals. The principals in the key policy must exist and be visible to AWS KMS. When you create a new AWS principal (for example, an IAM user or role), 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 AWS KMS. For more information, see Changes that I make are not always immediately visible (https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency) in the AWS Identity and Access Management User Guide.

The key policy size limit is 32 kilobytes (32768 bytes).

Policy is a required field

PolicyName

Type: *string

The name of the key policy. The only valid value is default.

PolicyName is a required field

Method

GoString

func (s PutKeyPolicyInput) GoString() string

GoString returns the string representation

SetBypassPolicyLockoutSafetyCheck

func (s *PutKeyPolicyInput) SetBypassPolicyLockoutSafetyCheck(v bool) *PutKeyPolicyInput

SetBypassPolicyLockoutSafetyCheck sets the BypassPolicyLockoutSafetyCheck field's value.

SetKeyId

func (s *PutKeyPolicyInput) SetKeyId(v string) *PutKeyPolicyInput

SetKeyId sets the KeyId field's value.

SetPolicy

func (s *PutKeyPolicyInput) SetPolicy(v string) *PutKeyPolicyInput

SetPolicy sets the Policy field's value.

SetPolicyName

func (s *PutKeyPolicyInput) SetPolicyName(v string) *PutKeyPolicyInput

SetPolicyName sets the PolicyName field's value.

String

func (s PutKeyPolicyInput) String() string

String returns the string representation

Validate

func (s *PutKeyPolicyInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

On this page: