Struct: kms.GenerateDataKeyInput

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

EncryptionContext map[string]*string `type:"map"`

Specifies the encryption context that will be used when encrypting the data key.

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

An encryption context is a collection of non-secret key-value pairs that represent additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is supported only on operations with symmetric encryption KMS keys. On operations with symmetric encryption KMS keys, an encryption context is optional, but it is strongly recommended.

For more information, 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.

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

Specifies the symmetric encryption KMS key that encrypts the data key. You cannot specify an asymmetric KMS key or a KMS key in a custom key store. To get the type and origin of your KMS key, use the DescribeKey operation.

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with “alias/”. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias 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

  • Alias name: alias/ExampleAlias

  • Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

KeyId is a required field

KeySpec *string `type:"string" enum:"DataKeySpec"`

Specifies the length of the data key. Use AES_128 to generate a 128-bit symmetric key, or AES_256 to generate a 256-bit symmetric key.

You must specify either the KeySpec or the NumberOfBytes parameter (but not both) in every GenerateDataKey request.

NumberOfBytes *int64 `min:"1" type:"integer"`

Specifies the length of the data key in bytes. For example, use the value 64 to generate a 512-bit data key (64 bytes is 512 bits). For 128-bit (16-byte) and 256-bit (32-byte) data keys, use the KeySpec parameter.

You must specify either the KeySpec or the NumberOfBytes parameter (but not both) in every GenerateDataKey request.

_ struct{} `type:"structure"`

Method Details

func (s GenerateDataKeyInput) 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”.



11509
11510
11511
// File 'service/kms/api.go', line 11509

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

func (s *GenerateDataKeyInput) SetEncryptionContext(v map[string]*string) *GenerateDataKeyInput

SetEncryptionContext sets the EncryptionContext field's value.



11533
11534
11535
11536
// File 'service/kms/api.go', line 11533

func (s *GenerateDataKeyInput) SetEncryptionContext(v map[string]*string) *GenerateDataKeyInput { s.EncryptionContext = v return s }

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

SetGrantTokens sets the GrantTokens field's value.



11539
11540
11541
11542
// File 'service/kms/api.go', line 11539

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

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

SetKeyId sets the KeyId field's value.



11545
11546
11547
11548
// File 'service/kms/api.go', line 11545

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

func (s *GenerateDataKeyInput) SetKeySpec(v string) *GenerateDataKeyInput

SetKeySpec sets the KeySpec field's value.



11551
11552
11553
11554
// File 'service/kms/api.go', line 11551

func (s *GenerateDataKeyInput) SetKeySpec(v string) *GenerateDataKeyInput { s.KeySpec = &v return s }

func (s *GenerateDataKeyInput) SetNumberOfBytes(v int64) *GenerateDataKeyInput

SetNumberOfBytes sets the NumberOfBytes field's value.



11557
11558
11559
11560
// File 'service/kms/api.go', line 11557

func (s *GenerateDataKeyInput) SetNumberOfBytes(v int64) *GenerateDataKeyInput { s.NumberOfBytes = &v return s }

func (s GenerateDataKeyInput) 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”.



11500
11501
11502
// File 'service/kms/api.go', line 11500

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

func (s *GenerateDataKeyInput) Validate() error

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



11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
// File 'service/kms/api.go', line 11514

func (s *GenerateDataKeyInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "GenerateDataKeyInput"} 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.NumberOfBytes != nil && *s.NumberOfBytes < 1 { invalidParams.Add(request.NewErrParamMinValue("NumberOfBytes", 1)) } if invalidParams.Len() > 0 { return invalidParams } return nil }