Struct: kms.CreateGrantInput

import "../ibm-cos-sdk-go/service/kms"

Implemented Interfaces

s3crypto.Cipher, s3manager.ReadSeekerWriteTo, request.Validator, s3manager.WriterReadFrom

Structure Field Summary collapse

Service Operations collapse

Structure Field Details

Constraints *GrantConstraints `type:"structure"`

Specifies a grant constraint.

Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.

KMS supports the EncryptionContextEquals and EncryptionContextSubset grant constraints, which allow the permissions in the grant only when the encryption context in the request matches (EncryptionContextEquals) or includes (EncryptionContextSubset) the encryption context specified in the constraint.

The encryption context grant constraints are supported only on grant operations (docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-grant-operations) that include an EncryptionContext parameter, such as cryptographic operations on symmetric encryption KMS keys. Grants with grant constraints can include the DescribeKey and RetireGrant operations, but the constraint doesn't apply to these operations. If a grant with a grant constraint includes the CreateGrant operation, the constraint requires that any grants created with the CreateGrant permission have an equally strict or stricter encryption context constraint.

You cannot use an encryption context grant constraint for cryptographic operations with asymmetric KMS keys or HMAC KMS keys. Operations with these keys don't support an encryption context.

Each constraint value can include up to 8 encryption context pairs. The encryption context value in each constraint cannot exceed 384 characters. For information about grant constraints, see Using grant constraints (docs.aws.amazon.com/kms/latest/developerguide/create-grant-overview.html#grant-constraints) in the Key Management Service Developer Guide. For more information about encryption context, see Encryption context (docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) in the Key Management Service Developer Guide .

GrantTokens []*string `type:"list"`

A list of grant tokens.

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

GranteePrincipal *string `min:"1" type:"string" required:"true"`

The identity that gets the permissions specified in the grant.

To specify the grantee principal, use the Amazon Resource Name (ARN) of an Amazon Web Services principal. Valid principals include Amazon Web Services accounts, IAM users, IAM roles, federated users, and assumed role users. For help with the ARN syntax for a principal, see IAM ARNs (docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns) in the Identity and Access Management User Guide .

GranteePrincipal is a required field

KeyId *string `min:"1" type:"string" required:"true"`

Identifies the KMS key for the grant. The grant gives principals permission to use this KMS key.

Specify the key ID or key ARN of the KMS key. To specify a KMS key in a different Amazon Web Services 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 KMS key, use ListKeys or DescribeKey.

KeyId is a required field

Name *string `min:"1" type:"string"`

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

Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.

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 for the same grant ID can be used interchangeably.

Operations []*string `type:"list" required:"true" enum:"GrantOperation"`

A list of operations that the grant permits.

Operations is a required field

RetiringPrincipal *string `min:"1" type:"string"`

The principal that has permission to use the RetireGrant operation to retire the grant.

To specify the principal, use the Amazon Resource Name (ARN) (docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) of an Amazon Web Services principal. Valid principals include Amazon Web Services accounts, IAM users, IAM roles, federated users, and assumed role users. For help with the ARN syntax for a principal, see IAM ARNs (docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns) in the Identity and Access Management User Guide .

The grant determines the retiring principal. Other principals might have permission to retire the grant or revoke the grant. For details, see RevokeGrant and Retiring and revoking grants (docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#grant-delete) in the Key Management Service Developer Guide.

_ struct{} `type:"structure"`

Method Details

func (s CreateGrantInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as “sensitive” in the API will not be included in the string output. The member name will be present, but the value will be replaced with “sensitive”.



8971
8972
8973
// File 'service/kms/api.go', line 8971

func (s CreateGrantInput) GoString() string { return s.String() }

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

SetConstraints sets the Constraints field's value.



9007
9008
9009
9010
// File 'service/kms/api.go', line 9007

func (s *CreateGrantInput) SetConstraints(v *GrantConstraints) *CreateGrantInput { s.Constraints = v return s }

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

SetGranteePrincipal sets the GranteePrincipal field's value.



9019
9020
9021
9022
// File 'service/kms/api.go', line 9019

func (s *CreateGrantInput) SetGranteePrincipal(v string) *CreateGrantInput { s.GranteePrincipal = &v return s }

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

SetGrantTokens sets the GrantTokens field's value.



9013
9014
9015
9016
// File 'service/kms/api.go', line 9013

func (s *CreateGrantInput) SetGrantTokens(v []*string) *CreateGrantInput { s.GrantTokens = v return s }

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

SetKeyId sets the KeyId field's value.



9025
9026
9027
9028
// File 'service/kms/api.go', line 9025

func (s *CreateGrantInput) SetKeyId(v string) *CreateGrantInput { s.KeyId = &v return s }

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

SetName sets the Name field's value.



9031
9032
9033
9034
// File 'service/kms/api.go', line 9031

func (s *CreateGrantInput) SetName(v string) *CreateGrantInput { s.Name = &v return s }

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

SetOperations sets the Operations field's value.



9037
9038
9039
9040
// File 'service/kms/api.go', line 9037

func (s *CreateGrantInput) SetOperations(v []*string) *CreateGrantInput { s.Operations = v return s }

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

SetRetiringPrincipal sets the RetiringPrincipal field's value.



9043
9044
9045
9046
// File 'service/kms/api.go', line 9043

func (s *CreateGrantInput) SetRetiringPrincipal(v string) *CreateGrantInput { s.RetiringPrincipal = &v return s }

func (s CreateGrantInput) String() string

String returns the string representation.

API parameter values that are decorated as “sensitive” in the API will not be included in the string output. The member name will be present, but the value will be replaced with “sensitive”.



8962
8963
8964
// File 'service/kms/api.go', line 8962

func (s CreateGrantInput) String() string { return awsutil.Prettify(s) }

func (s *CreateGrantInput) Validate() error

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



8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
// File 'service/kms/api.go', line 8976

func (s *CreateGrantInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "CreateGrantInput"} if s.GranteePrincipal == nil { invalidParams.Add(request.NewErrParamRequired("GranteePrincipal")) } if s.GranteePrincipal != nil && len(*s.GranteePrincipal) < 1 { invalidParams.Add(request.NewErrParamMinLen("GranteePrincipal", 1)) } if s.KeyId == nil { invalidParams.Add(request.NewErrParamRequired("KeyId")) } if s.KeyId != nil && len(*s.KeyId) < 1 { invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) } if s.Name != nil && len(*s.Name) < 1 { invalidParams.Add(request.NewErrParamMinLen("Name", 1)) } if s.Operations == nil { invalidParams.Add(request.NewErrParamRequired("Operations")) } if s.RetiringPrincipal != nil && len(*s.RetiringPrincipal) < 1 { invalidParams.Add(request.NewErrParamMinLen("RetiringPrincipal", 1)) } if invalidParams.Len() > 0 { return invalidParams } return nil }