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.

CreateGrantInput

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

type CreateGrantInput struct { Constraints *GrantConstraints `type:"structure"` GrantTokens []*string `type:"list"` GranteePrincipal *string `min:"1" type:"string" required:"true"` KeyId *string `min:"1" type:"string" required:"true"` Name *string `min:"1" type:"string"` Operations []*string `type:"list" required:"true"` RetiringPrincipal *string `min:"1" type:"string"` }

Constraints

A structure that you can use to allow certain operations in the grant only when the desired encryption context is present. For more information about encryption context, see Encryption Context (https://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html) in the AWS Key Management Service Developer Guide.

Grant constraints apply only to operations that accept encryption context as input. For example, the DescribeKey operation does not accept encryption context as input. A grant that allows the DescribeKey operation does so regardless of the grant constraints. In constrast, the Encrypt operation accepts encryption context as input. A grant that allows the Encrypt operation does so only when the encryption context of the Encrypt operation satisfies the grant constraints.

GrantTokens

Type: []*string

A list of grant tokens.

For more information, see Grant Tokens (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token) in the AWS Key Management Service Developer Guide.

GranteePrincipal

Type: *string

The principal that is given permission to perform the operations that the grant permits.

To specify the principal, use the Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) of an AWS principal. Valid AWS principals include AWS accounts (root), IAM users, IAM roles, federated users, and assumed role users. For examples of the ARN syntax to use for specifying a principal, see AWS Identity and Access Management (IAM) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-iam) in the Example ARNs section of the AWS General Reference.

GranteePrincipal is a required field

KeyId

Type: *string

The unique identifier for the customer master key (CMK) that the grant applies to.

Specify the key ID or the Amazon Resource Name (ARN) of the CMK. To specify a CMK in a different AWS account, you must use the key ARN.

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

Name

Type: *string

A friendly name for identifying the grant. Use this value to prevent unintended creation of duplicate grants when retrying this request.

When this value is absent, all CreateGrant requests result in a new grant with a unique GrantId even if all the supplied parameters are identical. This can result in unintended duplicates when you retry the CreateGrant request.

When this value is present, you can retry a CreateGrant request with identical parameters; if the grant already exists, the original GrantId is returned without creating a new grant. Note that the returned grant token is unique with every CreateGrant request, even when a duplicate GrantId is returned. All grant tokens obtained in this way can be used interchangeably.

Operations

Type: []*string

A list of operations that the grant permits.

Operations is a required field

RetiringPrincipal

Type: *string

The principal that is given permission to retire the grant by using RetireGrant operation.

To specify the principal, use the Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) of an AWS principal. Valid AWS principals include AWS accounts (root), IAM users, federated users, and assumed role users. For examples of the ARN syntax to use for specifying a principal, see AWS Identity and Access Management (IAM) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-iam) in the Example ARNs section of the AWS General Reference.

Method

GoString

func (s CreateGrantInput) GoString() string

GoString returns the string representation

SetConstraints

func (s *CreateGrantInput) SetConstraints(v *GrantConstraints) *CreateGrantInput

SetConstraints sets the Constraints field's value.

SetGrantTokens

func (s *CreateGrantInput) SetGrantTokens(v []*string) *CreateGrantInput

SetGrantTokens sets the GrantTokens field's value.

SetGranteePrincipal

func (s *CreateGrantInput) SetGranteePrincipal(v string) *CreateGrantInput

SetGranteePrincipal sets the GranteePrincipal field's value.

SetKeyId

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

SetKeyId sets the KeyId field's value.

SetName

func (s *CreateGrantInput) SetName(v string) *CreateGrantInput

SetName sets the Name field's value.

SetOperations

func (s *CreateGrantInput) SetOperations(v []*string) *CreateGrantInput

SetOperations sets the Operations field's value.

SetRetiringPrincipal

func (s *CreateGrantInput) SetRetiringPrincipal(v string) *CreateGrantInput

SetRetiringPrincipal sets the RetiringPrincipal field's value.

String

func (s CreateGrantInput) String() string

String returns the string representation

Validate

func (s *CreateGrantInput) Validate() error

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

On this page: