kms

package
v1.4.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package kms provides a client for AWS Key Management Service.

Index

Examples

Constants

View Source
const (
	// AlgorithmSpecRsaesPkcs1V15 is a AlgorithmSpec enum value
	AlgorithmSpecRsaesPkcs1V15 = "RSAES_PKCS1_V1_5"

	// AlgorithmSpecRsaesOaepSha1 is a AlgorithmSpec enum value
	AlgorithmSpecRsaesOaepSha1 = "RSAES_OAEP_SHA_1"

	// AlgorithmSpecRsaesOaepSha256 is a AlgorithmSpec enum value
	AlgorithmSpecRsaesOaepSha256 = "RSAES_OAEP_SHA_256"
)
View Source
const (
	// DataKeySpecAes256 is a DataKeySpec enum value
	DataKeySpecAes256 = "AES_256"

	// DataKeySpecAes128 is a DataKeySpec enum value
	DataKeySpecAes128 = "AES_128"
)
View Source
const (
	// ExpirationModelTypeKeyMaterialExpires is a ExpirationModelType enum value
	ExpirationModelTypeKeyMaterialExpires = "KEY_MATERIAL_EXPIRES"

	// ExpirationModelTypeKeyMaterialDoesNotExpire is a ExpirationModelType enum value
	ExpirationModelTypeKeyMaterialDoesNotExpire = "KEY_MATERIAL_DOES_NOT_EXPIRE"
)
View Source
const (
	// GrantOperationDecrypt is a GrantOperation enum value
	GrantOperationDecrypt = "Decrypt"

	// GrantOperationEncrypt is a GrantOperation enum value
	GrantOperationEncrypt = "Encrypt"

	// GrantOperationGenerateDataKey is a GrantOperation enum value
	GrantOperationGenerateDataKey = "GenerateDataKey"

	// GrantOperationGenerateDataKeyWithoutPlaintext is a GrantOperation enum value
	GrantOperationGenerateDataKeyWithoutPlaintext = "GenerateDataKeyWithoutPlaintext"

	// GrantOperationReEncryptFrom is a GrantOperation enum value
	GrantOperationReEncryptFrom = "ReEncryptFrom"

	// GrantOperationReEncryptTo is a GrantOperation enum value
	GrantOperationReEncryptTo = "ReEncryptTo"

	// GrantOperationCreateGrant is a GrantOperation enum value
	GrantOperationCreateGrant = "CreateGrant"

	// GrantOperationRetireGrant is a GrantOperation enum value
	GrantOperationRetireGrant = "RetireGrant"

	// GrantOperationDescribeKey is a GrantOperation enum value
	GrantOperationDescribeKey = "DescribeKey"
)
View Source
const (
	// KeyStateEnabled is a KeyState enum value
	KeyStateEnabled = "Enabled"

	// KeyStateDisabled is a KeyState enum value
	KeyStateDisabled = "Disabled"

	// KeyStatePendingDeletion is a KeyState enum value
	KeyStatePendingDeletion = "PendingDeletion"

	// KeyStatePendingImport is a KeyState enum value
	KeyStatePendingImport = "PendingImport"
)
View Source
const (
	// OriginTypeAwsKms is a OriginType enum value
	OriginTypeAwsKms = "AWS_KMS"

	// OriginTypeExternal is a OriginType enum value
	OriginTypeExternal = "EXTERNAL"
)
View Source
const (
	// KeyUsageTypeEncryptDecrypt is a KeyUsageType enum value
	KeyUsageTypeEncryptDecrypt = "ENCRYPT_DECRYPT"
)
View Source
const ServiceName = "kms"

A ServiceName is the name of the service the client will make API calls to.

View Source
const (
	// WrappingKeySpecRsa2048 is a WrappingKeySpec enum value
	WrappingKeySpecRsa2048 = "RSA_2048"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AliasListEntry

type AliasListEntry struct {

	// String that contains the key ARN.
	AliasArn *string `min:"20" type:"string"`

	// String that contains the alias.
	AliasName *string `min:"1" type:"string"`

	// String that contains the key identifier pointed to by the alias.
	TargetKeyId *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

Contains information about an alias.

func (AliasListEntry) GoString added in v0.6.5

func (s AliasListEntry) GoString() string

GoString returns the string representation

func (AliasListEntry) String added in v0.6.5

func (s AliasListEntry) String() string

String returns the string representation

type CancelKeyDeletionInput added in v0.9.15

type CancelKeyDeletionInput struct {

	// The unique identifier for the customer master key (CMK) for which to cancel
	// deletion.
	//
	// To specify this value, use the unique key ID or the Amazon Resource Name
	// (ARN) of the CMK. Examples:
	//
	//    * Unique key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
	//
	//    * Key ARN: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
	//
	// To obtain the unique key ID and key ARN for a given CMK, use ListKeys or
	// DescribeKey.
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (CancelKeyDeletionInput) GoString added in v0.9.15

func (s CancelKeyDeletionInput) GoString() string

GoString returns the string representation

func (CancelKeyDeletionInput) String added in v0.9.15

func (s CancelKeyDeletionInput) String() string

String returns the string representation

func (*CancelKeyDeletionInput) Validate added in v1.1.21

func (s *CancelKeyDeletionInput) Validate() error

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

type CancelKeyDeletionOutput added in v0.9.15

type CancelKeyDeletionOutput struct {

	// The unique identifier of the master key for which deletion is canceled.
	KeyId *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (CancelKeyDeletionOutput) GoString added in v0.9.15

func (s CancelKeyDeletionOutput) GoString() string

GoString returns the string representation

func (CancelKeyDeletionOutput) String added in v0.9.15

func (s CancelKeyDeletionOutput) String() string

String returns the string representation

type CreateAliasInput

type CreateAliasInput struct {

	// String that contains the display name. The name must start with the word
	// "alias" followed by a forward slash (alias/). Aliases that begin with "alias/AWS"
	// are reserved.
	//
	// AliasName is a required field
	AliasName *string `min:"1" type:"string" required:"true"`

	// An identifier of the key for which you are creating the alias. This value
	// cannot be another alias but can be a globally unique identifier or a fully
	// specified ARN to a key.
	//
	//    * Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
	//
	//    * Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
	//
	// TargetKeyId is a required field
	TargetKeyId *string `min:"1" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (CreateAliasInput) GoString added in v0.6.5

func (s CreateAliasInput) GoString() string

GoString returns the string representation

func (CreateAliasInput) String added in v0.6.5

func (s CreateAliasInput) String() string

String returns the string representation

func (*CreateAliasInput) Validate added in v1.1.21

func (s *CreateAliasInput) Validate() error

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

type CreateAliasOutput

type CreateAliasOutput struct {
	// contains filtered or unexported fields
}

func (CreateAliasOutput) GoString added in v0.6.5

func (s CreateAliasOutput) GoString() string

GoString returns the string representation

func (CreateAliasOutput) String added in v0.6.5

func (s CreateAliasOutput) String() string

String returns the string representation

type CreateGrantInput

type CreateGrantInput struct {

	// The conditions under which the operations permitted by the grant are allowed.
	//
	// You can use this value to allow the operations permitted by the grant only
	// when a specified encryption context is present. For more information, see
	// Encryption Context (http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html)
	// in the AWS Key Management Service Developer Guide.
	Constraints *GrantConstraints `type:"structure"`

	// A list of grant tokens.
	//
	// For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token)
	// in the AWS Key Management Service Developer Guide.
	GrantTokens []*string `type:"list"`

	// The principal that is given permission to perform the operations that the
	// grant permits.
	//
	// To specify the principal, use the Amazon Resource Name (ARN) (http://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) (http://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
	GranteePrincipal *string `min:"1" type:"string" required:"true"`

	// The unique identifier for the customer master key (CMK) that the grant applies
	// to.
	//
	// To specify this value, use the globally unique key ID or the Amazon Resource
	// Name (ARN) of the key. Examples:
	//
	//    * Globally unique key ID: 12345678-1234-1234-1234-123456789012
	//
	//    * Key ARN: arn:aws:kms:us-west-2:123456789012:key/12345678-1234-1234-1234-123456789012
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`

	// 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.
	Name *string `min:"1" type:"string"`

	// A list of operations that the grant permits. The list can contain any combination
	// of one or more of the following values:
	//
	//    * Decrypt
	//
	//    * Encrypt
	//
	//    * GenerateDataKey
	//
	//    * GenerateDataKeyWithoutPlaintext
	//
	//    * ReEncryptFrom (http://docs.aws.amazon.com/kms/latest/APIReference/API_ReEncrypt.html)
	//
	//    * ReEncryptTo (http://docs.aws.amazon.com/kms/latest/APIReference/API_ReEncrypt.html)
	//
	//    * CreateGrant
	//
	//    * RetireGrant
	//
	//    * DescribeKey
	Operations []*string `type:"list"`

	// The principal that is given permission to retire the grant by using RetireGrant
	// operation.
	//
	// To specify the principal, use the Amazon Resource Name (ARN) (http://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) (http://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.
	RetiringPrincipal *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (CreateGrantInput) GoString added in v0.6.5

func (s CreateGrantInput) GoString() string

GoString returns the string representation

func (CreateGrantInput) String added in v0.6.5

func (s CreateGrantInput) String() string

String returns the string representation

func (*CreateGrantInput) Validate added in v1.1.21

func (s *CreateGrantInput) Validate() error

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

type CreateGrantOutput

type CreateGrantOutput struct {

	// The unique identifier for the grant.
	//
	// You can use the GrantId in a subsequent RetireGrant or RevokeGrant operation.
	GrantId *string `min:"1" type:"string"`

	// The grant token.
	//
	// For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token)
	// in the AWS Key Management Service Developer Guide.
	GrantToken *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (CreateGrantOutput) GoString added in v0.6.5

func (s CreateGrantOutput) GoString() string

GoString returns the string representation

func (CreateGrantOutput) String added in v0.6.5

func (s CreateGrantOutput) String() string

String returns the string representation

type CreateKeyInput

type CreateKeyInput struct {

	// A flag to indicate whether to bypass the key policy lockout safety check.
	//
	// Setting this value to true increases the likelihood 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 (http://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 include a policy in the request and you
	// intend to prevent the principal making the request from making a subsequent
	// PutKeyPolicy request on the CMK.
	//
	// The default value is false.
	BypassPolicyLockoutSafetyCheck *bool `type:"boolean"`

	// A description of the CMK.
	//
	// Use a description that helps you decide whether the CMK is appropriate for
	// a task.
	Description *string `type:"string"`

	// The intended use of the CMK.
	//
	// You can use CMKs only for symmetric encryption and decryption.
	KeyUsage *string `type:"string" enum:"KeyUsageType"`

	// The source of the CMK's key material.
	//
	// The default is AWS_KMS, which means AWS KMS creates the key material. When
	// this parameter is set to EXTERNAL, the request creates a CMK without key
	// material so that you can import key material from your existing key management
	// infrastructure. For more information about importing key material into AWS
	// KMS, see Importing Key Material (http://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html)
	// in the AWS Key Management Service Developer Guide.
	//
	// The CMK's Origin is immutable and is set when the CMK is created.
	Origin *string `type:"string" enum:"OriginType"`

	// The key policy to attach to the CMK.
	//
	// If you specify a policy and do not set BypassPolicyLockoutSafetyCheck to
	// true, the policy must meet the following criteria:
	//
	//    * It must allow the principal making the CreateKey request to make a subsequent
	//    PutKeyPolicy request on the CMK. This reduces the likelihood that the
	//    CMK becomes unmanageable. For more information, refer to the scenario
	//    in the Default Key Policy (http://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.
	//
	//    * The principal(s) specified 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 specifying the new
	//    principal in a key policy because the new principal might not immediately
	//    be visible to AWS KMS. For more information, see Changes that I make are
	//    not always immediately visible (http://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency)
	//    in the IAM User Guide.
	//
	// If you do not specify a policy, AWS KMS attaches a default key policy to
	// the CMK. For more information, see Default Key Policy (http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default)
	// in the AWS Key Management Service Developer Guide.
	//
	// The policy size limit is 32 KiB (32768 bytes).
	Policy *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (CreateKeyInput) GoString added in v0.6.5

func (s CreateKeyInput) GoString() string

GoString returns the string representation

func (CreateKeyInput) String added in v0.6.5

func (s CreateKeyInput) String() string

String returns the string representation

func (*CreateKeyInput) Validate added in v1.1.21

func (s *CreateKeyInput) Validate() error

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

type CreateKeyOutput

type CreateKeyOutput struct {

	// Metadata associated with the CMK.
	KeyMetadata *KeyMetadata `type:"structure"`
	// contains filtered or unexported fields
}

func (CreateKeyOutput) GoString added in v0.6.5

func (s CreateKeyOutput) GoString() string

GoString returns the string representation

func (CreateKeyOutput) String added in v0.6.5

func (s CreateKeyOutput) String() string

String returns the string representation

type DecryptInput

type DecryptInput struct {

	// Ciphertext to be decrypted. The blob includes metadata.
	//
	// CiphertextBlob is automatically base64 encoded/decoded by the SDK.
	//
	// CiphertextBlob is a required field
	CiphertextBlob []byte `min:"1" type:"blob" required:"true"`

	// The encryption context. If this was specified in the Encrypt function, it
	// must be specified here or the decryption operation will fail. For more information,
	// see Encryption Context (http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html).
	EncryptionContext map[string]*string `type:"map"`

	// A list of grant tokens.
	//
	// For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token)
	// in the AWS Key Management Service Developer Guide.
	GrantTokens []*string `type:"list"`
	// contains filtered or unexported fields
}

func (DecryptInput) GoString added in v0.6.5

func (s DecryptInput) GoString() string

GoString returns the string representation

func (DecryptInput) String added in v0.6.5

func (s DecryptInput) String() string

String returns the string representation

func (*DecryptInput) Validate added in v1.1.21

func (s *DecryptInput) Validate() error

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

type DecryptOutput

type DecryptOutput struct {

	// ARN of the key used to perform the decryption. This value is returned if
	// no errors are encountered during the operation.
	KeyId *string `min:"1" type:"string"`

	// Decrypted plaintext data. This value may not be returned if the customer
	// master key is not available or if you didn't have permission to use it.
	//
	// Plaintext is automatically base64 encoded/decoded by the SDK.
	Plaintext []byte `min:"1" type:"blob"`
	// contains filtered or unexported fields
}

func (DecryptOutput) GoString added in v0.6.5

func (s DecryptOutput) GoString() string

GoString returns the string representation

func (DecryptOutput) String added in v0.6.5

func (s DecryptOutput) String() string

String returns the string representation

type DeleteAliasInput

type DeleteAliasInput struct {

	// The alias to be deleted. The name must start with the word "alias" followed
	// by a forward slash (alias/). Aliases that begin with "alias/AWS" are reserved.
	//
	// AliasName is a required field
	AliasName *string `min:"1" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (DeleteAliasInput) GoString added in v0.6.5

func (s DeleteAliasInput) GoString() string

GoString returns the string representation

func (DeleteAliasInput) String added in v0.6.5

func (s DeleteAliasInput) String() string

String returns the string representation

func (*DeleteAliasInput) Validate added in v1.1.21

func (s *DeleteAliasInput) Validate() error

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

type DeleteAliasOutput

type DeleteAliasOutput struct {
	// contains filtered or unexported fields
}

func (DeleteAliasOutput) GoString added in v0.6.5

func (s DeleteAliasOutput) GoString() string

GoString returns the string representation

func (DeleteAliasOutput) String added in v0.6.5

func (s DeleteAliasOutput) String() string

String returns the string representation

type DeleteImportedKeyMaterialInput added in v1.4.1

type DeleteImportedKeyMaterialInput struct {

	// The identifier of the CMK whose key material to delete. The CMK's Origin
	// must be EXTERNAL.
	//
	// A valid identifier is the unique key ID or the Amazon Resource Name (ARN)
	// of the CMK. Examples:
	//
	//    * Unique key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
	//
	//    * Key ARN: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (DeleteImportedKeyMaterialInput) GoString added in v1.4.1

GoString returns the string representation

func (DeleteImportedKeyMaterialInput) String added in v1.4.1

String returns the string representation

func (*DeleteImportedKeyMaterialInput) Validate added in v1.4.1

func (s *DeleteImportedKeyMaterialInput) Validate() error

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

type DeleteImportedKeyMaterialOutput added in v1.4.1

type DeleteImportedKeyMaterialOutput struct {
	// contains filtered or unexported fields
}

func (DeleteImportedKeyMaterialOutput) GoString added in v1.4.1

GoString returns the string representation

func (DeleteImportedKeyMaterialOutput) String added in v1.4.1

String returns the string representation

type DescribeKeyInput

type DescribeKeyInput struct {

	// A list of grant tokens.
	//
	// For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token)
	// in the AWS Key Management Service Developer Guide.
	GrantTokens []*string `type:"list"`

	// A unique identifier for the customer master key. This value can be a globally
	// unique identifier, a fully specified ARN to either an alias or a key, or
	// an alias name prefixed by "alias/".
	//
	//    * Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
	//
	//    * Alias ARN Example - arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
	//
	//    * Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
	//
	//    * Alias Name Example - alias/MyAliasName
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (DescribeKeyInput) GoString added in v0.6.5

func (s DescribeKeyInput) GoString() string

GoString returns the string representation

func (DescribeKeyInput) String added in v0.6.5

func (s DescribeKeyInput) String() string

String returns the string representation

func (*DescribeKeyInput) Validate added in v1.1.21

func (s *DescribeKeyInput) Validate() error

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

type DescribeKeyOutput

type DescribeKeyOutput struct {

	// Metadata associated with the key.
	KeyMetadata *KeyMetadata `type:"structure"`
	// contains filtered or unexported fields
}

func (DescribeKeyOutput) GoString added in v0.6.5

func (s DescribeKeyOutput) GoString() string

GoString returns the string representation

func (DescribeKeyOutput) String added in v0.6.5

func (s DescribeKeyOutput) String() string

String returns the string representation

type DisableKeyInput

type DisableKeyInput struct {

	// A unique identifier for the CMK.
	//
	// Use the CMK's unique identifier or its Amazon Resource Name (ARN). For example:
	//
	//    * Unique ID: 1234abcd-12ab-34cd-56ef-1234567890ab
	//
	//    * ARN: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (DisableKeyInput) GoString added in v0.6.5

func (s DisableKeyInput) GoString() string

GoString returns the string representation

func (DisableKeyInput) String added in v0.6.5

func (s DisableKeyInput) String() string

String returns the string representation

func (*DisableKeyInput) Validate added in v1.1.21

func (s *DisableKeyInput) Validate() error

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

type DisableKeyOutput

type DisableKeyOutput struct {
	// contains filtered or unexported fields
}

func (DisableKeyOutput) GoString added in v0.6.5

func (s DisableKeyOutput) GoString() string

GoString returns the string representation

func (DisableKeyOutput) String added in v0.6.5

func (s DisableKeyOutput) String() string

String returns the string representation

type DisableKeyRotationInput

type DisableKeyRotationInput struct {

	// A unique identifier for the customer master key. This value can be a globally
	// unique identifier or the fully specified ARN to a key.
	//
	//    * Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
	//
	//    * Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (DisableKeyRotationInput) GoString added in v0.6.5

func (s DisableKeyRotationInput) GoString() string

GoString returns the string representation

func (DisableKeyRotationInput) String added in v0.6.5

func (s DisableKeyRotationInput) String() string

String returns the string representation

func (*DisableKeyRotationInput) Validate added in v1.1.21

func (s *DisableKeyRotationInput) Validate() error

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

type DisableKeyRotationOutput

type DisableKeyRotationOutput struct {
	// contains filtered or unexported fields
}

func (DisableKeyRotationOutput) GoString added in v0.6.5

func (s DisableKeyRotationOutput) GoString() string

GoString returns the string representation

func (DisableKeyRotationOutput) String added in v0.6.5

func (s DisableKeyRotationOutput) String() string

String returns the string representation

type EnableKeyInput

type EnableKeyInput struct {

	// A unique identifier for the customer master key. This value can be a globally
	// unique identifier or the fully specified ARN to a key.
	//
	//    * Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
	//
	//    * Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (EnableKeyInput) GoString added in v0.6.5

func (s EnableKeyInput) GoString() string

GoString returns the string representation

func (EnableKeyInput) String added in v0.6.5

func (s EnableKeyInput) String() string

String returns the string representation

func (*EnableKeyInput) Validate added in v1.1.21

func (s *EnableKeyInput) Validate() error

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

type EnableKeyOutput

type EnableKeyOutput struct {
	// contains filtered or unexported fields
}

func (EnableKeyOutput) GoString added in v0.6.5

func (s EnableKeyOutput) GoString() string

GoString returns the string representation

func (EnableKeyOutput) String added in v0.6.5

func (s EnableKeyOutput) String() string

String returns the string representation

type EnableKeyRotationInput

type EnableKeyRotationInput struct {

	// A unique identifier for the customer master key. This value can be a globally
	// unique identifier or the fully specified ARN to a key.
	//
	//    * Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
	//
	//    * Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (EnableKeyRotationInput) GoString added in v0.6.5

func (s EnableKeyRotationInput) GoString() string

GoString returns the string representation

func (EnableKeyRotationInput) String added in v0.6.5

func (s EnableKeyRotationInput) String() string

String returns the string representation

func (*EnableKeyRotationInput) Validate added in v1.1.21

func (s *EnableKeyRotationInput) Validate() error

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

type EnableKeyRotationOutput

type EnableKeyRotationOutput struct {
	// contains filtered or unexported fields
}

func (EnableKeyRotationOutput) GoString added in v0.6.5

func (s EnableKeyRotationOutput) GoString() string

GoString returns the string representation

func (EnableKeyRotationOutput) String added in v0.6.5

func (s EnableKeyRotationOutput) String() string

String returns the string representation

type EncryptInput

type EncryptInput struct {

	// Name-value pair that specifies the encryption context to be used for authenticated
	// encryption. If used here, the same value must be supplied to the Decrypt
	// API or decryption will fail. For more information, see Encryption Context
	// (http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html).
	EncryptionContext map[string]*string `type:"map"`

	// A list of grant tokens.
	//
	// For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token)
	// in the AWS Key Management Service Developer Guide.
	GrantTokens []*string `type:"list"`

	// A unique identifier for the customer master key. This value can be a globally
	// unique identifier, a fully specified ARN to either an alias or a key, or
	// an alias name prefixed by "alias/".
	//
	//    * Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
	//
	//    * Alias ARN Example - arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
	//
	//    * Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
	//
	//    * Alias Name Example - alias/MyAliasName
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`

	// Data to be encrypted.
	//
	// Plaintext is automatically base64 encoded/decoded by the SDK.
	//
	// Plaintext is a required field
	Plaintext []byte `min:"1" type:"blob" required:"true"`
	// contains filtered or unexported fields
}

func (EncryptInput) GoString added in v0.6.5

func (s EncryptInput) GoString() string

GoString returns the string representation

func (EncryptInput) String added in v0.6.5

func (s EncryptInput) String() string

String returns the string representation

func (*EncryptInput) Validate added in v1.1.21

func (s *EncryptInput) Validate() error

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

type EncryptOutput

type EncryptOutput struct {

	// The encrypted plaintext. If you are using the CLI, the value is Base64 encoded.
	// Otherwise, it is not encoded.
	//
	// CiphertextBlob is automatically base64 encoded/decoded by the SDK.
	CiphertextBlob []byte `min:"1" type:"blob"`

	// The ID of the key used during encryption.
	KeyId *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (EncryptOutput) GoString added in v0.6.5

func (s EncryptOutput) GoString() string

GoString returns the string representation

func (EncryptOutput) String added in v0.6.5

func (s EncryptOutput) String() string

String returns the string representation

type GenerateDataKeyInput

type GenerateDataKeyInput struct {

	// A set of key-value pairs that represents additional authenticated data.
	//
	// For more information, see Encryption Context (http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html)
	// in the AWS Key Management Service Developer Guide.
	EncryptionContext map[string]*string `type:"map"`

	// A list of grant tokens.
	//
	// For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token)
	// in the AWS Key Management Service Developer Guide.
	GrantTokens []*string `type:"list"`

	// The identifier of the CMK under which to generate and encrypt the data encryption
	// key.
	//
	// A valid identifier is the unique key ID or the Amazon Resource Name (ARN)
	// of the CMK, or the alias name or ARN of an alias that points to the CMK.
	// Examples:
	//
	//    * Unique key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
	//
	//    * CMK ARN: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
	//
	//    * Alias name: alias/ExampleAlias
	//
	//    * Alias ARN: arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`

	// The length of the data encryption key. Use AES_128 to generate a 128-bit
	// symmetric key, or AES_256 to generate a 256-bit symmetric key.
	KeySpec *string `type:"string" enum:"DataKeySpec"`

	// The length of the data encryption key in bytes. For example, use the value
	// 64 to generate a 512-bit data key (64 bytes is 512 bits). For common key
	// lengths (128-bit and 256-bit symmetric keys), we recommend that you use the
	// KeySpec field instead of this one.
	NumberOfBytes *int64 `min:"1" type:"integer"`
	// contains filtered or unexported fields
}

func (GenerateDataKeyInput) GoString added in v0.6.5

func (s GenerateDataKeyInput) GoString() string

GoString returns the string representation

func (GenerateDataKeyInput) String added in v0.6.5

func (s GenerateDataKeyInput) String() string

String returns the string representation

func (*GenerateDataKeyInput) Validate added in v1.1.21

func (s *GenerateDataKeyInput) Validate() error

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

type GenerateDataKeyOutput

type GenerateDataKeyOutput struct {

	// The encrypted data encryption key.
	//
	// CiphertextBlob is automatically base64 encoded/decoded by the SDK.
	CiphertextBlob []byte `min:"1" type:"blob"`

	// The identifier of the CMK under which the data encryption key was generated
	// and encrypted.
	KeyId *string `min:"1" type:"string"`

	// The data encryption key. Use this data key for local encryption and decryption,
	// then remove it from memory as soon as possible.
	//
	// Plaintext is automatically base64 encoded/decoded by the SDK.
	Plaintext []byte `min:"1" type:"blob"`
	// contains filtered or unexported fields
}

func (GenerateDataKeyOutput) GoString added in v0.6.5

func (s GenerateDataKeyOutput) GoString() string

GoString returns the string representation

func (GenerateDataKeyOutput) String added in v0.6.5

func (s GenerateDataKeyOutput) String() string

String returns the string representation

type GenerateDataKeyWithoutPlaintextInput

type GenerateDataKeyWithoutPlaintextInput struct {

	// A set of key-value pairs that represents additional authenticated data.
	//
	// For more information, see Encryption Context (http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html)
	// in the AWS Key Management Service Developer Guide.
	EncryptionContext map[string]*string `type:"map"`

	// A list of grant tokens.
	//
	// For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token)
	// in the AWS Key Management Service Developer Guide.
	GrantTokens []*string `type:"list"`

	// The identifier of the CMK under which to generate and encrypt the data encryption
	// key.
	//
	// A valid identifier is the unique key ID or the Amazon Resource Name (ARN)
	// of the CMK, or the alias name or ARN of an alias that points to the CMK.
	// Examples:
	//
	//    * Unique key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
	//
	//    * CMK ARN: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
	//
	//    * Alias name: alias/ExampleAlias
	//
	//    * Alias ARN: arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`

	// The length of the data encryption key. Use AES_128 to generate a 128-bit
	// symmetric key, or AES_256 to generate a 256-bit symmetric key.
	KeySpec *string `type:"string" enum:"DataKeySpec"`

	// The length of the data encryption key in bytes. For example, use the value
	// 64 to generate a 512-bit data key (64 bytes is 512 bits). For common key
	// lengths (128-bit and 256-bit symmetric keys), we recommend that you use the
	// KeySpec field instead of this one.
	NumberOfBytes *int64 `min:"1" type:"integer"`
	// contains filtered or unexported fields
}

func (GenerateDataKeyWithoutPlaintextInput) GoString added in v0.6.5

GoString returns the string representation

func (GenerateDataKeyWithoutPlaintextInput) String added in v0.6.5

String returns the string representation

func (*GenerateDataKeyWithoutPlaintextInput) Validate added in v1.1.21

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

type GenerateDataKeyWithoutPlaintextOutput

type GenerateDataKeyWithoutPlaintextOutput struct {

	// The encrypted data encryption key.
	//
	// CiphertextBlob is automatically base64 encoded/decoded by the SDK.
	CiphertextBlob []byte `min:"1" type:"blob"`

	// The identifier of the CMK under which the data encryption key was generated
	// and encrypted.
	KeyId *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (GenerateDataKeyWithoutPlaintextOutput) GoString added in v0.6.5

GoString returns the string representation

func (GenerateDataKeyWithoutPlaintextOutput) String added in v0.6.5

String returns the string representation

type GenerateRandomInput

type GenerateRandomInput struct {

	// The length of the byte string.
	NumberOfBytes *int64 `min:"1" type:"integer"`
	// contains filtered or unexported fields
}

func (GenerateRandomInput) GoString added in v0.6.5

func (s GenerateRandomInput) GoString() string

GoString returns the string representation

func (GenerateRandomInput) String added in v0.6.5

func (s GenerateRandomInput) String() string

String returns the string representation

func (*GenerateRandomInput) Validate added in v1.1.21

func (s *GenerateRandomInput) Validate() error

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

type GenerateRandomOutput

type GenerateRandomOutput struct {

	// The unpredictable byte string.
	//
	// Plaintext is automatically base64 encoded/decoded by the SDK.
	Plaintext []byte `min:"1" type:"blob"`
	// contains filtered or unexported fields
}

func (GenerateRandomOutput) GoString added in v0.6.5

func (s GenerateRandomOutput) GoString() string

GoString returns the string representation

func (GenerateRandomOutput) String added in v0.6.5

func (s GenerateRandomOutput) String() string

String returns the string representation

type GetKeyPolicyInput

type GetKeyPolicyInput struct {

	// A unique identifier for the customer master key. This value can be a globally
	// unique identifier or the fully specified ARN to a key.
	//
	//    * Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
	//
	//    * Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`

	// String that contains the name of the policy. Currently, this must be "default".
	// Policy names can be discovered by calling ListKeyPolicies.
	//
	// PolicyName is a required field
	PolicyName *string `min:"1" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (GetKeyPolicyInput) GoString added in v0.6.5

func (s GetKeyPolicyInput) GoString() string

GoString returns the string representation

func (GetKeyPolicyInput) String added in v0.6.5

func (s GetKeyPolicyInput) String() string

String returns the string representation

func (*GetKeyPolicyInput) Validate added in v1.1.21

func (s *GetKeyPolicyInput) Validate() error

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

type GetKeyPolicyOutput

type GetKeyPolicyOutput struct {

	// A policy document in JSON format.
	Policy *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (GetKeyPolicyOutput) GoString added in v0.6.5

func (s GetKeyPolicyOutput) GoString() string

GoString returns the string representation

func (GetKeyPolicyOutput) String added in v0.6.5

func (s GetKeyPolicyOutput) String() string

String returns the string representation

type GetKeyRotationStatusInput

type GetKeyRotationStatusInput struct {

	// A unique identifier for the customer master key. This value can be a globally
	// unique identifier or the fully specified ARN to a key.
	//
	//    * Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
	//
	//    * Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (GetKeyRotationStatusInput) GoString added in v0.6.5

func (s GetKeyRotationStatusInput) GoString() string

GoString returns the string representation

func (GetKeyRotationStatusInput) String added in v0.6.5

func (s GetKeyRotationStatusInput) String() string

String returns the string representation

func (*GetKeyRotationStatusInput) Validate added in v1.1.21

func (s *GetKeyRotationStatusInput) Validate() error

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

type GetKeyRotationStatusOutput

type GetKeyRotationStatusOutput struct {

	// A Boolean value that specifies whether key rotation is enabled.
	KeyRotationEnabled *bool `type:"boolean"`
	// contains filtered or unexported fields
}

func (GetKeyRotationStatusOutput) GoString added in v0.6.5

func (s GetKeyRotationStatusOutput) GoString() string

GoString returns the string representation

func (GetKeyRotationStatusOutput) String added in v0.6.5

String returns the string representation

type GetParametersForImportInput added in v1.4.1

type GetParametersForImportInput struct {

	// The identifier of the CMK into which you will import key material. The CMK's
	// Origin must be EXTERNAL.
	//
	// A valid identifier is the unique key ID or the Amazon Resource Name (ARN)
	// of the CMK. Examples:
	//
	//    * Unique key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
	//
	//    * Key ARN: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`

	// The algorithm you will use to encrypt the key material before importing it
	// with ImportKeyMaterial. For more information, see Encrypt the Key Material
	// (http://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-encrypt-key-material.html)
	// in the AWS Key Management Service Developer Guide.
	//
	// WrappingAlgorithm is a required field
	WrappingAlgorithm *string `type:"string" required:"true" enum:"AlgorithmSpec"`

	// The type of wrapping key (public key) to return in the response. Only 2048-bit
	// RSA public keys are supported.
	//
	// WrappingKeySpec is a required field
	WrappingKeySpec *string `type:"string" required:"true" enum:"WrappingKeySpec"`
	// contains filtered or unexported fields
}

func (GetParametersForImportInput) GoString added in v1.4.1

func (s GetParametersForImportInput) GoString() string

GoString returns the string representation

func (GetParametersForImportInput) String added in v1.4.1

String returns the string representation

func (*GetParametersForImportInput) Validate added in v1.4.1

func (s *GetParametersForImportInput) Validate() error

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

type GetParametersForImportOutput added in v1.4.1

type GetParametersForImportOutput struct {

	// The import token to send in a subsequent ImportKeyMaterial request.
	//
	// ImportToken is automatically base64 encoded/decoded by the SDK.
	ImportToken []byte `min:"1" type:"blob"`

	// The identifier of the CMK to use in a subsequent ImportKeyMaterial request.
	// This is the same CMK specified in the GetParametersForImport request.
	KeyId *string `min:"1" type:"string"`

	// The time at which the import token and public key are no longer valid. After
	// this time, you cannot use them to make an ImportKeyMaterial request and you
	// must send another GetParametersForImport request to retrieve new ones.
	ParametersValidTo *time.Time `type:"timestamp" timestampFormat:"unix"`

	// The public key to use to encrypt the key material before importing it with
	// ImportKeyMaterial.
	//
	// PublicKey is automatically base64 encoded/decoded by the SDK.
	PublicKey []byte `min:"1" type:"blob"`
	// contains filtered or unexported fields
}

func (GetParametersForImportOutput) GoString added in v1.4.1

func (s GetParametersForImportOutput) GoString() string

GoString returns the string representation

func (GetParametersForImportOutput) String added in v1.4.1

String returns the string representation

type GrantConstraints

type GrantConstraints struct {

	// Contains a list of key-value pairs that must be present in the encryption
	// context of a subsequent operation permitted by the grant. When a subsequent
	// operation permitted by the grant includes an encryption context that matches
	// this list, the grant allows the operation. Otherwise, the operation is not
	// allowed.
	EncryptionContextEquals map[string]*string `type:"map"`

	// Contains a list of key-value pairs, a subset of which must be present in
	// the encryption context of a subsequent operation permitted by the grant.
	// When a subsequent operation permitted by the grant includes an encryption
	// context that matches this list or is a subset of this list, the grant allows
	// the operation. Otherwise, the operation is not allowed.
	EncryptionContextSubset map[string]*string `type:"map"`
	// contains filtered or unexported fields
}

A structure for specifying the conditions under which the operations permitted by the grant are allowed.

You can use this structure to allow the operations permitted by the grant only when a specified encryption context is present. For more information about encryption context, see Encryption Context (http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html) in the AWS Key Management Service Developer Guide.

func (GrantConstraints) GoString added in v0.6.5

func (s GrantConstraints) GoString() string

GoString returns the string representation

func (GrantConstraints) String added in v0.6.5

func (s GrantConstraints) String() string

String returns the string representation

type GrantListEntry

type GrantListEntry struct {

	// The conditions under which the grant's operations are allowed.
	Constraints *GrantConstraints `type:"structure"`

	// The date and time when the grant was created.
	CreationDate *time.Time `type:"timestamp" timestampFormat:"unix"`

	// The unique identifier for the grant.
	GrantId *string `min:"1" type:"string"`

	// The principal that receives the grant's permissions.
	GranteePrincipal *string `min:"1" type:"string"`

	// The AWS account under which the grant was issued.
	IssuingAccount *string `min:"1" type:"string"`

	// The unique identifier for the customer master key (CMK) to which the grant
	// applies.
	KeyId *string `min:"1" type:"string"`

	// The friendly name that identifies the grant. If a name was provided in the
	// CreateGrant request, that name is returned. Otherwise this value is null.
	Name *string `min:"1" type:"string"`

	// The list of operations permitted by the grant.
	Operations []*string `type:"list"`

	// The principal that can retire the grant.
	RetiringPrincipal *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

Contains information about an entry in a list of grants.

func (GrantListEntry) GoString added in v0.6.5

func (s GrantListEntry) GoString() string

GoString returns the string representation

func (GrantListEntry) String added in v0.6.5

func (s GrantListEntry) String() string

String returns the string representation

type ImportKeyMaterialInput added in v1.4.1

type ImportKeyMaterialInput struct {

	// The encrypted key material to import. It must be encrypted with the public
	// key that you received in the response to a previous GetParametersForImport
	// request, using the wrapping algorithm that you specified in that request.
	//
	// EncryptedKeyMaterial is automatically base64 encoded/decoded by the SDK.
	//
	// EncryptedKeyMaterial is a required field
	EncryptedKeyMaterial []byte `min:"1" type:"blob" required:"true"`

	// Specifies whether the key material expires. The default is KEY_MATERIAL_EXPIRES,
	// in which case you must include the ValidTo parameter. When this parameter
	// is set to KEY_MATERIAL_DOES_NOT_EXPIRE, you must omit the ValidTo parameter.
	ExpirationModel *string `type:"string" enum:"ExpirationModelType"`

	// The import token that you received in the response to a previous GetParametersForImport
	// request. It must be from the same response that contained the public key
	// that you used to encrypt the key material.
	//
	// ImportToken is automatically base64 encoded/decoded by the SDK.
	//
	// ImportToken is a required field
	ImportToken []byte `min:"1" type:"blob" required:"true"`

	// The identifier of the CMK to import the key material into. The CMK's Origin
	// must be EXTERNAL.
	//
	// A valid identifier is the unique key ID or the Amazon Resource Name (ARN)
	// of the CMK. Examples:
	//
	//    * Unique key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
	//
	//    * Key ARN: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`

	// The time at which the imported key material expires. When the key material
	// expires, AWS KMS deletes the key material and the CMK becomes unusable. You
	// must omit this parameter when the ExpirationModel parameter is set to KEY_MATERIAL_DOES_NOT_EXPIRE.
	// Otherwise it is required.
	ValidTo *time.Time `type:"timestamp" timestampFormat:"unix"`
	// contains filtered or unexported fields
}

func (ImportKeyMaterialInput) GoString added in v1.4.1

func (s ImportKeyMaterialInput) GoString() string

GoString returns the string representation

func (ImportKeyMaterialInput) String added in v1.4.1

func (s ImportKeyMaterialInput) String() string

String returns the string representation

func (*ImportKeyMaterialInput) Validate added in v1.4.1

func (s *ImportKeyMaterialInput) Validate() error

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

type ImportKeyMaterialOutput added in v1.4.1

type ImportKeyMaterialOutput struct {
	// contains filtered or unexported fields
}

func (ImportKeyMaterialOutput) GoString added in v1.4.1

func (s ImportKeyMaterialOutput) GoString() string

GoString returns the string representation

func (ImportKeyMaterialOutput) String added in v1.4.1

func (s ImportKeyMaterialOutput) String() string

String returns the string representation

type KMS

type KMS struct {
	*client.Client
}

AWS Key Management Service (AWS KMS) is an encryption and key management web service. This guide describes the AWS KMS operations that you can call programmatically. For general information about AWS KMS, see the AWS Key Management Service Developer Guide (http://docs.aws.amazon.com/kms/latest/developerguide/).

AWS provides SDKs that consist of libraries and sample code for various programming languages and platforms (Java, Ruby, .Net, iOS, Android, etc.). The SDKs provide a convenient way to create programmatic access to AWS KMS and other AWS services. For example, the SDKs take care of tasks such as signing requests (see below), managing errors, and retrying requests automatically. For more information about the AWS SDKs, including how to download and install them, see Tools for Amazon Web Services (http://aws.amazon.com/tools/).

We recommend that you use the AWS SDKs to make programmatic API calls to AWS KMS.

Clients must support TLS (Transport Layer Security) 1.0. We recommend TLS 1.2. Clients must also support cipher suites with Perfect Forward Secrecy (PFS) such as Ephemeral Diffie-Hellman (DHE) or Elliptic Curve Ephemeral Diffie-Hellman (ECDHE). Most modern systems such as Java 7 and later support these modes.

Signing Requests

Requests must be signed by using an access key ID and a secret access key. We strongly recommend that you do not use your AWS account (root) access key ID and secret key for everyday work with AWS KMS. Instead, use the access key ID and secret access key for an IAM user, or you can use the AWS Security Token Service to generate temporary security credentials that you can use to sign requests.

All AWS KMS operations require Signature Version 4 (http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html).

Logging API Requests

AWS KMS supports AWS CloudTrail, a service that logs AWS API calls and related events for your AWS account and delivers them to an Amazon S3 bucket that you specify. By using the information collected by CloudTrail, you can determine what requests were made to AWS KMS, who made the request, when it was made, and so on. To learn more about CloudTrail, including how to turn it on and find your log files, see the AWS CloudTrail User Guide (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/).

Additional Resources

For more information about credentials and request signing, see the following:

Commonly Used APIs

Of the APIs discussed in this guide, the following will prove the most useful for most applications. You will likely perform actions other than these, such as creating keys and assigning policies, by using the console.

  • Encrypt

  • Decrypt

  • GenerateDataKey

  • GenerateDataKeyWithoutPlaintext

The service client's operations are safe to be used concurrently. It is not safe to mutate any of the client's properties though.

func New

func New(p client.ConfigProvider, cfgs ...*aws.Config) *KMS

New creates a new instance of the KMS client with a session. If additional configuration is needed for the client instance use the optional aws.Config parameter to add your extra config.

Example:

// Create a KMS client from just a session.
svc := kms.New(mySession)

// Create a KMS client with additional configuration
svc := kms.New(mySession, aws.NewConfig().WithRegion("us-west-2"))

func (*KMS) CancelKeyDeletion added in v0.9.15

func (c *KMS) CancelKeyDeletion(input *CancelKeyDeletionInput) (*CancelKeyDeletionOutput, error)

CancelKeyDeletion API operation for AWS Key Management Service.

Cancels the deletion of a customer master key (CMK). When this operation is successful, the CMK is set to the Disabled state. To enable a CMK, use EnableKey.

For more information about scheduling and canceling deletion of a CMK, see Deleting Customer Master Keys (http://docs.aws.amazon.com/kms/latest/developerguide/deleting-keys.html) in the AWS Key Management Service Developer Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation CancelKeyDeletion for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.CancelKeyDeletionInput{
		KeyId: aws.String("KeyIdType"), // Required
	}
	resp, err := svc.CancelKeyDeletion(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) CancelKeyDeletionRequest added in v0.9.15

func (c *KMS) CancelKeyDeletionRequest(input *CancelKeyDeletionInput) (req *request.Request, output *CancelKeyDeletionOutput)

CancelKeyDeletionRequest generates a "aws/request.Request" representing the client's request for the CancelKeyDeletion operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See CancelKeyDeletion for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the CancelKeyDeletion method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the CancelKeyDeletionRequest method.
req, resp := client.CancelKeyDeletionRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) CreateAlias

func (c *KMS) CreateAlias(input *CreateAliasInput) (*CreateAliasOutput, error)

CreateAlias API operation for AWS Key Management Service.

Creates a display name for a customer master key. An alias can be used to identify a key and should be unique. The console enforces a one-to-one mapping between the alias and a key. An alias name can contain only alphanumeric characters, forward slashes (/), underscores (_), and dashes (-). An alias must start with the word "alias" followed by a forward slash (alias/). An alias that begins with "aws" after the forward slash (alias/aws...) is reserved by Amazon Web Services (AWS).

The alias and the key it is mapped to must be in the same AWS account and the same region.

To map an alias to a different key, call UpdateAlias.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation CreateAlias for usage and error information.

Returned Error Codes:

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • AlreadyExistsException The request was rejected because it attempted to create a resource that already exists.

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InvalidAliasNameException The request was rejected because the specified alias name is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • LimitExceededException The request was rejected because a limit was exceeded. For more information, see Limits (http://docs.aws.amazon.com/kms/latest/developerguide/limits.html) in the AWS Key Management Service Developer Guide.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.CreateAliasInput{
		AliasName:   aws.String("AliasNameType"), // Required
		TargetKeyId: aws.String("KeyIdType"),     // Required
	}
	resp, err := svc.CreateAlias(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) CreateAliasRequest

func (c *KMS) CreateAliasRequest(input *CreateAliasInput) (req *request.Request, output *CreateAliasOutput)

CreateAliasRequest generates a "aws/request.Request" representing the client's request for the CreateAlias operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See CreateAlias for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the CreateAlias method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the CreateAliasRequest method.
req, resp := client.CreateAliasRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) CreateGrant

func (c *KMS) CreateGrant(input *CreateGrantInput) (*CreateGrantOutput, error)

CreateGrant API operation for AWS Key Management Service.

Adds a grant to a key to specify who can use the key and under what conditions. Grants are alternate permission mechanisms to key policies.

For more information about grants, see Grants (http://docs.aws.amazon.com/kms/latest/developerguide/grants.html) in the AWS Key Management Service Developer Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation CreateGrant for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified CMK is not enabled.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidGrantTokenException The request was rejected because the specified grant token is not valid.

  • LimitExceededException The request was rejected because a limit was exceeded. For more information, see Limits (http://docs.aws.amazon.com/kms/latest/developerguide/limits.html) in the AWS Key Management Service Developer Guide.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.CreateGrantInput{
		GranteePrincipal: aws.String("PrincipalIdType"), // Required
		KeyId:            aws.String("KeyIdType"),       // Required
		Constraints: &kms.GrantConstraints{
			EncryptionContextEquals: map[string]*string{
				"Key": aws.String("EncryptionContextValue"), // Required
				// More values...
			},
			EncryptionContextSubset: map[string]*string{
				"Key": aws.String("EncryptionContextValue"), // Required
				// More values...
			},
		},
		GrantTokens: []*string{
			aws.String("GrantTokenType"), // Required
			// More values...
		},
		Name: aws.String("GrantNameType"),
		Operations: []*string{
			aws.String("GrantOperation"), // Required
			// More values...
		},
		RetiringPrincipal: aws.String("PrincipalIdType"),
	}
	resp, err := svc.CreateGrant(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) CreateGrantRequest

func (c *KMS) CreateGrantRequest(input *CreateGrantInput) (req *request.Request, output *CreateGrantOutput)

CreateGrantRequest generates a "aws/request.Request" representing the client's request for the CreateGrant operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See CreateGrant for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the CreateGrant method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the CreateGrantRequest method.
req, resp := client.CreateGrantRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) CreateKey

func (c *KMS) CreateKey(input *CreateKeyInput) (*CreateKeyOutput, error)

CreateKey API operation for AWS Key Management Service.

Creates a customer master key (CMK).

You can use a CMK to encrypt small amounts of data (4 KiB or less) directly, but CMKs are more commonly used to encrypt data encryption keys (DEKs), which are used to encrypt raw data. For more information about DEKs and the difference between CMKs and DEKs, see the following:

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation CreateKey for usage and error information.

Returned Error Codes:

  • MalformedPolicyDocumentException The request was rejected because the specified policy is not syntactically or semantically correct.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • UnsupportedOperationException The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • LimitExceededException The request was rejected because a limit was exceeded. For more information, see Limits (http://docs.aws.amazon.com/kms/latest/developerguide/limits.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.CreateKeyInput{
		BypassPolicyLockoutSafetyCheck: aws.Bool(true),
		Description:                    aws.String("DescriptionType"),
		KeyUsage:                       aws.String("KeyUsageType"),
		Origin:                         aws.String("OriginType"),
		Policy:                         aws.String("PolicyType"),
	}
	resp, err := svc.CreateKey(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) CreateKeyRequest

func (c *KMS) CreateKeyRequest(input *CreateKeyInput) (req *request.Request, output *CreateKeyOutput)

CreateKeyRequest generates a "aws/request.Request" representing the client's request for the CreateKey operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See CreateKey for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the CreateKey method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the CreateKeyRequest method.
req, resp := client.CreateKeyRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) Decrypt

func (c *KMS) Decrypt(input *DecryptInput) (*DecryptOutput, error)

Decrypt API operation for AWS Key Management Service.

Decrypts ciphertext. Ciphertext is plaintext that has been previously encrypted by using any of the following functions:

  • GenerateDataKey

  • GenerateDataKeyWithoutPlaintext

  • Encrypt

Note that if a caller has been granted access permissions to all keys (through, for example, IAM user policies that grant Decrypt permission on all resources), then ciphertext encrypted by using keys in other accounts where the key grants access to the caller can be decrypted. To remedy this, we recommend that you do not grant Decrypt access in an IAM user policy. Instead grant Decrypt access only in key policies. If you must grant Decrypt access in an IAM user policy, you should scope the resource to specific keys or to specific trusted accounts.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation Decrypt for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified CMK is not enabled.

  • InvalidCiphertextException The request was rejected because the specified ciphertext has been corrupted or is otherwise invalid.

  • KeyUnavailableException The request was rejected because the specified CMK was not available. The request can be retried.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InvalidGrantTokenException The request was rejected because the specified grant token is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.DecryptInput{
		CiphertextBlob: []byte("PAYLOAD"), // Required
		EncryptionContext: map[string]*string{
			"Key": aws.String("EncryptionContextValue"), // Required
			// More values...
		},
		GrantTokens: []*string{
			aws.String("GrantTokenType"), // Required
			// More values...
		},
	}
	resp, err := svc.Decrypt(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) DecryptRequest

func (c *KMS) DecryptRequest(input *DecryptInput) (req *request.Request, output *DecryptOutput)

DecryptRequest generates a "aws/request.Request" representing the client's request for the Decrypt operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See Decrypt for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the Decrypt method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the DecryptRequest method.
req, resp := client.DecryptRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) DeleteAlias

func (c *KMS) DeleteAlias(input *DeleteAliasInput) (*DeleteAliasOutput, error)

DeleteAlias API operation for AWS Key Management Service.

Deletes the specified alias. To map an alias to a different key, call UpdateAlias.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation DeleteAlias for usage and error information.

Returned Error Codes:

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.DeleteAliasInput{
		AliasName: aws.String("AliasNameType"), // Required
	}
	resp, err := svc.DeleteAlias(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) DeleteAliasRequest

func (c *KMS) DeleteAliasRequest(input *DeleteAliasInput) (req *request.Request, output *DeleteAliasOutput)

DeleteAliasRequest generates a "aws/request.Request" representing the client's request for the DeleteAlias operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See DeleteAlias for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the DeleteAlias method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the DeleteAliasRequest method.
req, resp := client.DeleteAliasRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) DeleteImportedKeyMaterial added in v1.4.1

func (c *KMS) DeleteImportedKeyMaterial(input *DeleteImportedKeyMaterialInput) (*DeleteImportedKeyMaterialOutput, error)

DeleteImportedKeyMaterial API operation for AWS Key Management Service.

Deletes key material that you previously imported and makes the specified customer master key (CMK) unusable. For more information about importing key material into AWS KMS, see Importing Key Material (http://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html) in the AWS Key Management Service Developer Guide.

When the specified CMK is in the PendingDeletion state, this operation does not change the CMK's state. Otherwise, it changes the CMK's state to PendingImport.

After you delete key material, you can use ImportKeyMaterial to reimport the same key material into the CMK.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation DeleteImportedKeyMaterial for usage and error information.

Returned Error Codes:

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • UnsupportedOperationException The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.DeleteImportedKeyMaterialInput{
		KeyId: aws.String("KeyIdType"), // Required
	}
	resp, err := svc.DeleteImportedKeyMaterial(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) DeleteImportedKeyMaterialRequest added in v1.4.1

func (c *KMS) DeleteImportedKeyMaterialRequest(input *DeleteImportedKeyMaterialInput) (req *request.Request, output *DeleteImportedKeyMaterialOutput)

DeleteImportedKeyMaterialRequest generates a "aws/request.Request" representing the client's request for the DeleteImportedKeyMaterial operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See DeleteImportedKeyMaterial for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the DeleteImportedKeyMaterial method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the DeleteImportedKeyMaterialRequest method.
req, resp := client.DeleteImportedKeyMaterialRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) DescribeKey

func (c *KMS) DescribeKey(input *DescribeKeyInput) (*DescribeKeyOutput, error)

DescribeKey API operation for AWS Key Management Service.

Provides detailed information about the specified customer master key.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation DescribeKey for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.DescribeKeyInput{
		KeyId: aws.String("KeyIdType"), // Required
		GrantTokens: []*string{
			aws.String("GrantTokenType"), // Required
			// More values...
		},
	}
	resp, err := svc.DescribeKey(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) DescribeKeyRequest

func (c *KMS) DescribeKeyRequest(input *DescribeKeyInput) (req *request.Request, output *DescribeKeyOutput)

DescribeKeyRequest generates a "aws/request.Request" representing the client's request for the DescribeKey operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See DescribeKey for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the DescribeKey method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the DescribeKeyRequest method.
req, resp := client.DescribeKeyRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) DisableKey

func (c *KMS) DisableKey(input *DisableKeyInput) (*DisableKeyOutput, error)

DisableKey API operation for AWS Key Management Service.

Sets the state of a customer master key (CMK) to disabled, thereby preventing its use for cryptographic operations. For more information about how key state affects the use of a CMK, see How Key State Affects the Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation DisableKey for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.DisableKeyInput{
		KeyId: aws.String("KeyIdType"), // Required
	}
	resp, err := svc.DisableKey(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) DisableKeyRequest

func (c *KMS) DisableKeyRequest(input *DisableKeyInput) (req *request.Request, output *DisableKeyOutput)

DisableKeyRequest generates a "aws/request.Request" representing the client's request for the DisableKey operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See DisableKey for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the DisableKey method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the DisableKeyRequest method.
req, resp := client.DisableKeyRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) DisableKeyRotation

func (c *KMS) DisableKeyRotation(input *DisableKeyRotationInput) (*DisableKeyRotationOutput, error)

DisableKeyRotation API operation for AWS Key Management Service.

Disables rotation of the specified key.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation DisableKeyRotation for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified CMK is not enabled.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

  • UnsupportedOperationException The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.DisableKeyRotationInput{
		KeyId: aws.String("KeyIdType"), // Required
	}
	resp, err := svc.DisableKeyRotation(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) DisableKeyRotationRequest

func (c *KMS) DisableKeyRotationRequest(input *DisableKeyRotationInput) (req *request.Request, output *DisableKeyRotationOutput)

DisableKeyRotationRequest generates a "aws/request.Request" representing the client's request for the DisableKeyRotation operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See DisableKeyRotation for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the DisableKeyRotation method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the DisableKeyRotationRequest method.
req, resp := client.DisableKeyRotationRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) EnableKey

func (c *KMS) EnableKey(input *EnableKeyInput) (*EnableKeyOutput, error)

EnableKey API operation for AWS Key Management Service.

Marks a key as enabled, thereby permitting its use.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation EnableKey for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • LimitExceededException The request was rejected because a limit was exceeded. For more information, see Limits (http://docs.aws.amazon.com/kms/latest/developerguide/limits.html) in the AWS Key Management Service Developer Guide.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.EnableKeyInput{
		KeyId: aws.String("KeyIdType"), // Required
	}
	resp, err := svc.EnableKey(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) EnableKeyRequest

func (c *KMS) EnableKeyRequest(input *EnableKeyInput) (req *request.Request, output *EnableKeyOutput)

EnableKeyRequest generates a "aws/request.Request" representing the client's request for the EnableKey operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See EnableKey for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the EnableKey method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the EnableKeyRequest method.
req, resp := client.EnableKeyRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) EnableKeyRotation

func (c *KMS) EnableKeyRotation(input *EnableKeyRotationInput) (*EnableKeyRotationOutput, error)

EnableKeyRotation API operation for AWS Key Management Service.

Enables rotation of the specified customer master key.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation EnableKeyRotation for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified CMK is not enabled.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

  • UnsupportedOperationException The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.EnableKeyRotationInput{
		KeyId: aws.String("KeyIdType"), // Required
	}
	resp, err := svc.EnableKeyRotation(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) EnableKeyRotationRequest

func (c *KMS) EnableKeyRotationRequest(input *EnableKeyRotationInput) (req *request.Request, output *EnableKeyRotationOutput)

EnableKeyRotationRequest generates a "aws/request.Request" representing the client's request for the EnableKeyRotation operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See EnableKeyRotation for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the EnableKeyRotation method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the EnableKeyRotationRequest method.
req, resp := client.EnableKeyRotationRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) Encrypt

func (c *KMS) Encrypt(input *EncryptInput) (*EncryptOutput, error)

Encrypt API operation for AWS Key Management Service.

Encrypts plaintext into ciphertext by using a customer master key. The Encrypt function has two primary use cases:

  • You can encrypt up to 4 KB of arbitrary data such as an RSA key, a database password, or other sensitive customer information.

  • If you are moving encrypted data from one region to another, you can use this API to encrypt in the new region the plaintext data key that was used to encrypt the data in the original region. This provides you with an encrypted copy of the data key that can be decrypted in the new region and used there to decrypt the encrypted data.

Unless you are moving encrypted data from one region to another, you don't use this function to encrypt a generated data key within a region. You retrieve data keys already encrypted by calling the GenerateDataKey or GenerateDataKeyWithoutPlaintext function. Data keys don't need to be encrypted again by calling Encrypt.

If you want to encrypt data locally in your application, you can use the GenerateDataKey function to return a plaintext data encryption key and a copy of the key encrypted under the customer master key (CMK) of your choosing.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation Encrypt for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified CMK is not enabled.

  • KeyUnavailableException The request was rejected because the specified CMK was not available. The request can be retried.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InvalidKeyUsageException The request was rejected because the specified KeySpec value is not valid.

  • InvalidGrantTokenException The request was rejected because the specified grant token is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.EncryptInput{
		KeyId:     aws.String("KeyIdType"), // Required
		Plaintext: []byte("PAYLOAD"),       // Required
		EncryptionContext: map[string]*string{
			"Key": aws.String("EncryptionContextValue"), // Required
			// More values...
		},
		GrantTokens: []*string{
			aws.String("GrantTokenType"), // Required
			// More values...
		},
	}
	resp, err := svc.Encrypt(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) EncryptRequest

func (c *KMS) EncryptRequest(input *EncryptInput) (req *request.Request, output *EncryptOutput)

EncryptRequest generates a "aws/request.Request" representing the client's request for the Encrypt operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See Encrypt for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the Encrypt method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the EncryptRequest method.
req, resp := client.EncryptRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) GenerateDataKey

func (c *KMS) GenerateDataKey(input *GenerateDataKeyInput) (*GenerateDataKeyOutput, error)

GenerateDataKey API operation for AWS Key Management Service.

Returns a data encryption key that you can use in your application to encrypt data locally.

You must specify the customer master key (CMK) under which to generate the data key. You must also specify the length of the data key using either the KeySpec or NumberOfBytes field. You must specify one field or the other, but not both. For common key lengths (128-bit and 256-bit symmetric keys), we recommend that you use KeySpec.

This operation returns a plaintext copy of the data key in the Plaintext field of the response, and an encrypted copy of the data key in the CiphertextBlob field. The data key is encrypted under the CMK specified in the KeyId field of the request.

We recommend that you use the following pattern to encrypt data locally in your application:

Use this operation (GenerateDataKey) to retrieve a data encryption key.

Use the plaintext data encryption key (returned in the Plaintext field of the response) to encrypt data locally, then erase the plaintext data key from memory.

Store the encrypted data key (returned in the CiphertextBlob field of the response) alongside the locally encrypted data.

To decrypt data locally:

Use the Decrypt operation to decrypt the encrypted data key into a plaintext copy of the data key.

Use the plaintext data key to decrypt data locally, then erase the plaintext data key from memory.

To return only an encrypted copy of the data key, use GenerateDataKeyWithoutPlaintext. To return an arbitrary unpredictable byte string, use GenerateRandom.

If you use the optional EncryptionContext field, you must store at least enough information to be able to reconstruct the full encryption context when you later send the ciphertext to the Decrypt operation. It is a good practice to choose an encryption context that you can reconstruct on the fly to better secure the ciphertext. For more information, see Encryption Context (http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html) in the AWS Key Management Service Developer Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation GenerateDataKey for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified CMK is not enabled.

  • KeyUnavailableException The request was rejected because the specified CMK was not available. The request can be retried.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InvalidKeyUsageException The request was rejected because the specified KeySpec value is not valid.

  • InvalidGrantTokenException The request was rejected because the specified grant token is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.GenerateDataKeyInput{
		KeyId: aws.String("KeyIdType"), // Required
		EncryptionContext: map[string]*string{
			"Key": aws.String("EncryptionContextValue"), // Required
			// More values...
		},
		GrantTokens: []*string{
			aws.String("GrantTokenType"), // Required
			// More values...
		},
		KeySpec:       aws.String("DataKeySpec"),
		NumberOfBytes: aws.Int64(1),
	}
	resp, err := svc.GenerateDataKey(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) GenerateDataKeyRequest

func (c *KMS) GenerateDataKeyRequest(input *GenerateDataKeyInput) (req *request.Request, output *GenerateDataKeyOutput)

GenerateDataKeyRequest generates a "aws/request.Request" representing the client's request for the GenerateDataKey operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See GenerateDataKey for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the GenerateDataKey method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the GenerateDataKeyRequest method.
req, resp := client.GenerateDataKeyRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) GenerateDataKeyWithoutPlaintext

func (c *KMS) GenerateDataKeyWithoutPlaintext(input *GenerateDataKeyWithoutPlaintextInput) (*GenerateDataKeyWithoutPlaintextOutput, error)

GenerateDataKeyWithoutPlaintext API operation for AWS Key Management Service.

Returns a data encryption key encrypted under a customer master key (CMK). This operation is identical to GenerateDataKey but returns only the encrypted copy of the data key.

This operation is useful in a system that has multiple components with different degrees of trust. For example, consider a system that stores encrypted data in containers. Each container stores the encrypted data and an encrypted copy of the data key. One component of the system, called the control plane, creates new containers. When it creates a new container, it uses this operation (GenerateDataKeyWithoutPlaintext) to get an encrypted data key and then stores it in the container. Later, a different component of the system, called the data plane, puts encrypted data into the containers. To do this, it passes the encrypted data key to the Decrypt operation, then uses the returned plaintext data key to encrypt data, and finally stores the encrypted data in the container. In this system, the control plane never sees the plaintext data key.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation GenerateDataKeyWithoutPlaintext for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified CMK is not enabled.

  • KeyUnavailableException The request was rejected because the specified CMK was not available. The request can be retried.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InvalidKeyUsageException The request was rejected because the specified KeySpec value is not valid.

  • InvalidGrantTokenException The request was rejected because the specified grant token is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.GenerateDataKeyWithoutPlaintextInput{
		KeyId: aws.String("KeyIdType"), // Required
		EncryptionContext: map[string]*string{
			"Key": aws.String("EncryptionContextValue"), // Required
			// More values...
		},
		GrantTokens: []*string{
			aws.String("GrantTokenType"), // Required
			// More values...
		},
		KeySpec:       aws.String("DataKeySpec"),
		NumberOfBytes: aws.Int64(1),
	}
	resp, err := svc.GenerateDataKeyWithoutPlaintext(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) GenerateDataKeyWithoutPlaintextRequest

func (c *KMS) GenerateDataKeyWithoutPlaintextRequest(input *GenerateDataKeyWithoutPlaintextInput) (req *request.Request, output *GenerateDataKeyWithoutPlaintextOutput)

GenerateDataKeyWithoutPlaintextRequest generates a "aws/request.Request" representing the client's request for the GenerateDataKeyWithoutPlaintext operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See GenerateDataKeyWithoutPlaintext for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the GenerateDataKeyWithoutPlaintext method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the GenerateDataKeyWithoutPlaintextRequest method.
req, resp := client.GenerateDataKeyWithoutPlaintextRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) GenerateRandom

func (c *KMS) GenerateRandom(input *GenerateRandomInput) (*GenerateRandomOutput, error)

GenerateRandom API operation for AWS Key Management Service.

Generates an unpredictable byte string.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation GenerateRandom for usage and error information.

Returned Error Codes:

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.GenerateRandomInput{
		NumberOfBytes: aws.Int64(1),
	}
	resp, err := svc.GenerateRandom(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) GenerateRandomRequest

func (c *KMS) GenerateRandomRequest(input *GenerateRandomInput) (req *request.Request, output *GenerateRandomOutput)

GenerateRandomRequest generates a "aws/request.Request" representing the client's request for the GenerateRandom operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See GenerateRandom for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the GenerateRandom method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the GenerateRandomRequest method.
req, resp := client.GenerateRandomRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) GetKeyPolicy

func (c *KMS) GetKeyPolicy(input *GetKeyPolicyInput) (*GetKeyPolicyOutput, error)

GetKeyPolicy API operation for AWS Key Management Service.

Retrieves a policy attached to the specified key.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation GetKeyPolicy for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.GetKeyPolicyInput{
		KeyId:      aws.String("KeyIdType"),      // Required
		PolicyName: aws.String("PolicyNameType"), // Required
	}
	resp, err := svc.GetKeyPolicy(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) GetKeyPolicyRequest

func (c *KMS) GetKeyPolicyRequest(input *GetKeyPolicyInput) (req *request.Request, output *GetKeyPolicyOutput)

GetKeyPolicyRequest generates a "aws/request.Request" representing the client's request for the GetKeyPolicy operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See GetKeyPolicy for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the GetKeyPolicy method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the GetKeyPolicyRequest method.
req, resp := client.GetKeyPolicyRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) GetKeyRotationStatus

func (c *KMS) GetKeyRotationStatus(input *GetKeyRotationStatusInput) (*GetKeyRotationStatusOutput, error)

GetKeyRotationStatus API operation for AWS Key Management Service.

Retrieves a Boolean value that indicates whether key rotation is enabled for the specified key.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation GetKeyRotationStatus for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

  • UnsupportedOperationException The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.GetKeyRotationStatusInput{
		KeyId: aws.String("KeyIdType"), // Required
	}
	resp, err := svc.GetKeyRotationStatus(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) GetKeyRotationStatusRequest

func (c *KMS) GetKeyRotationStatusRequest(input *GetKeyRotationStatusInput) (req *request.Request, output *GetKeyRotationStatusOutput)

GetKeyRotationStatusRequest generates a "aws/request.Request" representing the client's request for the GetKeyRotationStatus operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See GetKeyRotationStatus for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the GetKeyRotationStatus method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the GetKeyRotationStatusRequest method.
req, resp := client.GetKeyRotationStatusRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) GetParametersForImport added in v1.4.1

func (c *KMS) GetParametersForImport(input *GetParametersForImportInput) (*GetParametersForImportOutput, error)

GetParametersForImport API operation for AWS Key Management Service.

Returns the items you need in order to import key material into AWS KMS from your existing key management infrastructure. For more information about importing key material into AWS KMS, see Importing Key Material (http://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html) in the AWS Key Management Service Developer Guide.

You must specify the key ID of the customer master key (CMK) into which you will import key material. This CMK's Origin must be EXTERNAL. You must also specify the wrapping algorithm and type of wrapping key (public key) that you will use to encrypt the key material.

This operation returns a public key and an import token. Use the public key to encrypt the key material. Store the import token to send with a subsequent ImportKeyMaterial request. The public key and import token from the same response must be used together. These items are valid for 24 hours, after which they cannot be used for a subsequent ImportKeyMaterial request. To retrieve new ones, send another GetParametersForImport request.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation GetParametersForImport for usage and error information.

Returned Error Codes:

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • UnsupportedOperationException The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.GetParametersForImportInput{
		KeyId:             aws.String("KeyIdType"),       // Required
		WrappingAlgorithm: aws.String("AlgorithmSpec"),   // Required
		WrappingKeySpec:   aws.String("WrappingKeySpec"), // Required
	}
	resp, err := svc.GetParametersForImport(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) GetParametersForImportRequest added in v1.4.1

func (c *KMS) GetParametersForImportRequest(input *GetParametersForImportInput) (req *request.Request, output *GetParametersForImportOutput)

GetParametersForImportRequest generates a "aws/request.Request" representing the client's request for the GetParametersForImport operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See GetParametersForImport for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the GetParametersForImport method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the GetParametersForImportRequest method.
req, resp := client.GetParametersForImportRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) ImportKeyMaterial added in v1.4.1

func (c *KMS) ImportKeyMaterial(input *ImportKeyMaterialInput) (*ImportKeyMaterialOutput, error)

ImportKeyMaterial API operation for AWS Key Management Service.

Imports key material into an AWS KMS customer master key (CMK) from your existing key management infrastructure. For more information about importing key material into AWS KMS, see Importing Key Material (http://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html) in the AWS Key Management Service Developer Guide.

You must specify the key ID of the CMK to import the key material into. This CMK's Origin must be EXTERNAL. You must also send an import token and the encrypted key material. Send the import token that you received in the same GetParametersForImport response that contained the public key that you used to encrypt the key material. You must also specify whether the key material expires and if so, when. When the key material expires, AWS KMS deletes the key material and the CMK becomes unusable. To use the CMK again, you can reimport the same key material. If you set an expiration date, you can change it only by reimporting the same key material and specifying a new expiration date.

When this operation is successful, the specified CMK's key state changes to Enabled, and you can use the CMK.

After you successfully import key material into a CMK, you can reimport the same key material into that CMK, but you cannot import different key material.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation ImportKeyMaterial for usage and error information.

Returned Error Codes:

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • UnsupportedOperationException The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

  • InvalidCiphertextException The request was rejected because the specified ciphertext has been corrupted or is otherwise invalid.

  • IncorrectKeyMaterialException The request was rejected because the provided key material is invalid or is not the same key material that was previously imported into this customer master key (CMK).

  • ExpiredImportTokenException The request was rejected because the provided import token is expired. Use GetParametersForImport to retrieve a new import token and public key, use the new public key to encrypt the key material, and then try the request again.

  • InvalidImportTokenException The request was rejected because the provided import token is invalid or is associated with a different customer master key (CMK).

Example
package main

import (
	"fmt"
	"time"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.ImportKeyMaterialInput{
		EncryptedKeyMaterial: []byte("PAYLOAD"),       // Required
		ImportToken:          []byte("PAYLOAD"),       // Required
		KeyId:                aws.String("KeyIdType"), // Required
		ExpirationModel:      aws.String("ExpirationModelType"),
		ValidTo:              aws.Time(time.Now()),
	}
	resp, err := svc.ImportKeyMaterial(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) ImportKeyMaterialRequest added in v1.4.1

func (c *KMS) ImportKeyMaterialRequest(input *ImportKeyMaterialInput) (req *request.Request, output *ImportKeyMaterialOutput)

ImportKeyMaterialRequest generates a "aws/request.Request" representing the client's request for the ImportKeyMaterial operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See ImportKeyMaterial for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the ImportKeyMaterial method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the ImportKeyMaterialRequest method.
req, resp := client.ImportKeyMaterialRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) ListAliases

func (c *KMS) ListAliases(input *ListAliasesInput) (*ListAliasesOutput, error)

ListAliases API operation for AWS Key Management Service.

Lists all of the key aliases in the account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation ListAliases for usage and error information.

Returned Error Codes:

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InvalidMarkerException The request was rejected because the marker that specifies where pagination should next begin is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.ListAliasesInput{
		Limit:  aws.Int64(1),
		Marker: aws.String("MarkerType"),
	}
	resp, err := svc.ListAliases(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) ListAliasesPages added in v0.6.5

func (c *KMS) ListAliasesPages(input *ListAliasesInput, fn func(p *ListAliasesOutput, lastPage bool) (shouldContinue bool)) error

ListAliasesPages iterates over the pages of a ListAliases operation, calling the "fn" function with the response data for each page. To stop iterating, return false from the fn function.

See ListAliases method for more information on how to use this operation.

Note: This operation can generate multiple requests to a service.

// Example iterating over at most 3 pages of a ListAliases operation.
pageNum := 0
err := client.ListAliasesPages(params,
    func(page *ListAliasesOutput, lastPage bool) bool {
        pageNum++
        fmt.Println(page)
        return pageNum <= 3
    })

func (*KMS) ListAliasesRequest

func (c *KMS) ListAliasesRequest(input *ListAliasesInput) (req *request.Request, output *ListAliasesOutput)

ListAliasesRequest generates a "aws/request.Request" representing the client's request for the ListAliases operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See ListAliases for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the ListAliases method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the ListAliasesRequest method.
req, resp := client.ListAliasesRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) ListGrants

func (c *KMS) ListGrants(input *ListGrantsInput) (*ListGrantsResponse, error)

ListGrants API operation for AWS Key Management Service.

List the grants for a specified key.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation ListGrants for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InvalidMarkerException The request was rejected because the marker that specifies where pagination should next begin is not valid.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.ListGrantsInput{
		KeyId:  aws.String("KeyIdType"), // Required
		Limit:  aws.Int64(1),
		Marker: aws.String("MarkerType"),
	}
	resp, err := svc.ListGrants(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) ListGrantsPages added in v0.6.5

func (c *KMS) ListGrantsPages(input *ListGrantsInput, fn func(p *ListGrantsResponse, lastPage bool) (shouldContinue bool)) error

ListGrantsPages iterates over the pages of a ListGrants operation, calling the "fn" function with the response data for each page. To stop iterating, return false from the fn function.

See ListGrants method for more information on how to use this operation.

Note: This operation can generate multiple requests to a service.

// Example iterating over at most 3 pages of a ListGrants operation.
pageNum := 0
err := client.ListGrantsPages(params,
    func(page *ListGrantsResponse, lastPage bool) bool {
        pageNum++
        fmt.Println(page)
        return pageNum <= 3
    })

func (*KMS) ListGrantsRequest

func (c *KMS) ListGrantsRequest(input *ListGrantsInput) (req *request.Request, output *ListGrantsResponse)

ListGrantsRequest generates a "aws/request.Request" representing the client's request for the ListGrants operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See ListGrants for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the ListGrants method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the ListGrantsRequest method.
req, resp := client.ListGrantsRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) ListKeyPolicies

func (c *KMS) ListKeyPolicies(input *ListKeyPoliciesInput) (*ListKeyPoliciesOutput, error)

ListKeyPolicies API operation for AWS Key Management Service.

Retrieves a list of policies attached to a key.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation ListKeyPolicies for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.ListKeyPoliciesInput{
		KeyId:  aws.String("KeyIdType"), // Required
		Limit:  aws.Int64(1),
		Marker: aws.String("MarkerType"),
	}
	resp, err := svc.ListKeyPolicies(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) ListKeyPoliciesPages added in v0.6.5

func (c *KMS) ListKeyPoliciesPages(input *ListKeyPoliciesInput, fn func(p *ListKeyPoliciesOutput, lastPage bool) (shouldContinue bool)) error

ListKeyPoliciesPages iterates over the pages of a ListKeyPolicies operation, calling the "fn" function with the response data for each page. To stop iterating, return false from the fn function.

See ListKeyPolicies method for more information on how to use this operation.

Note: This operation can generate multiple requests to a service.

// Example iterating over at most 3 pages of a ListKeyPolicies operation.
pageNum := 0
err := client.ListKeyPoliciesPages(params,
    func(page *ListKeyPoliciesOutput, lastPage bool) bool {
        pageNum++
        fmt.Println(page)
        return pageNum <= 3
    })

func (*KMS) ListKeyPoliciesRequest

func (c *KMS) ListKeyPoliciesRequest(input *ListKeyPoliciesInput) (req *request.Request, output *ListKeyPoliciesOutput)

ListKeyPoliciesRequest generates a "aws/request.Request" representing the client's request for the ListKeyPolicies operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See ListKeyPolicies for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the ListKeyPolicies method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the ListKeyPoliciesRequest method.
req, resp := client.ListKeyPoliciesRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) ListKeys

func (c *KMS) ListKeys(input *ListKeysInput) (*ListKeysOutput, error)

ListKeys API operation for AWS Key Management Service.

Lists the customer master keys.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation ListKeys for usage and error information.

Returned Error Codes:

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidMarkerException The request was rejected because the marker that specifies where pagination should next begin is not valid.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.ListKeysInput{
		Limit:  aws.Int64(1),
		Marker: aws.String("MarkerType"),
	}
	resp, err := svc.ListKeys(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) ListKeysPages added in v0.6.5

func (c *KMS) ListKeysPages(input *ListKeysInput, fn func(p *ListKeysOutput, lastPage bool) (shouldContinue bool)) error

ListKeysPages iterates over the pages of a ListKeys operation, calling the "fn" function with the response data for each page. To stop iterating, return false from the fn function.

See ListKeys method for more information on how to use this operation.

Note: This operation can generate multiple requests to a service.

// Example iterating over at most 3 pages of a ListKeys operation.
pageNum := 0
err := client.ListKeysPages(params,
    func(page *ListKeysOutput, lastPage bool) bool {
        pageNum++
        fmt.Println(page)
        return pageNum <= 3
    })

func (*KMS) ListKeysRequest

func (c *KMS) ListKeysRequest(input *ListKeysInput) (req *request.Request, output *ListKeysOutput)

ListKeysRequest generates a "aws/request.Request" representing the client's request for the ListKeys operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See ListKeys for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the ListKeys method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the ListKeysRequest method.
req, resp := client.ListKeysRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) ListRetirableGrants added in v0.9.15

func (c *KMS) ListRetirableGrants(input *ListRetirableGrantsInput) (*ListGrantsResponse, error)

ListRetirableGrants API operation for AWS Key Management Service.

Returns a list of all grants for which the grant's RetiringPrincipal matches the one specified.

A typical use is to list all grants that you are able to retire. To retire a grant, use RetireGrant.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation ListRetirableGrants for usage and error information.

Returned Error Codes:

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InvalidMarkerException The request was rejected because the marker that specifies where pagination should next begin is not valid.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.ListRetirableGrantsInput{
		RetiringPrincipal: aws.String("PrincipalIdType"), // Required
		Limit:             aws.Int64(1),
		Marker:            aws.String("MarkerType"),
	}
	resp, err := svc.ListRetirableGrants(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) ListRetirableGrantsRequest added in v0.9.15

func (c *KMS) ListRetirableGrantsRequest(input *ListRetirableGrantsInput) (req *request.Request, output *ListGrantsResponse)

ListRetirableGrantsRequest generates a "aws/request.Request" representing the client's request for the ListRetirableGrants operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See ListRetirableGrants for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the ListRetirableGrants method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the ListRetirableGrantsRequest method.
req, resp := client.ListRetirableGrantsRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) PutKeyPolicy

func (c *KMS) PutKeyPolicy(input *PutKeyPolicyInput) (*PutKeyPolicyOutput, error)

PutKeyPolicy API operation for AWS Key Management Service.

Attaches a key policy to the specified customer master key (CMK).

For more information about key policies, see Key Policies (http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html) in the AWS Key Management Service Developer Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation PutKeyPolicy for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • MalformedPolicyDocumentException The request was rejected because the specified policy is not syntactically or semantically correct.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • UnsupportedOperationException The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • LimitExceededException The request was rejected because a limit was exceeded. For more information, see Limits (http://docs.aws.amazon.com/kms/latest/developerguide/limits.html) in the AWS Key Management Service Developer Guide.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.PutKeyPolicyInput{
		KeyId:                          aws.String("KeyIdType"),      // Required
		Policy:                         aws.String("PolicyType"),     // Required
		PolicyName:                     aws.String("PolicyNameType"), // Required
		BypassPolicyLockoutSafetyCheck: aws.Bool(true),
	}
	resp, err := svc.PutKeyPolicy(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) PutKeyPolicyRequest

func (c *KMS) PutKeyPolicyRequest(input *PutKeyPolicyInput) (req *request.Request, output *PutKeyPolicyOutput)

PutKeyPolicyRequest generates a "aws/request.Request" representing the client's request for the PutKeyPolicy operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See PutKeyPolicy for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the PutKeyPolicy method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the PutKeyPolicyRequest method.
req, resp := client.PutKeyPolicyRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) ReEncrypt

func (c *KMS) ReEncrypt(input *ReEncryptInput) (*ReEncryptOutput, error)

ReEncrypt API operation for AWS Key Management Service.

Encrypts data on the server side with a new customer master key without exposing the plaintext of the data on the client side. The data is first decrypted and then encrypted. This operation can also be used to change the encryption context of a ciphertext.

Unlike other actions, ReEncrypt is authorized twice - once as ReEncryptFrom on the source key and once as ReEncryptTo on the destination key. We therefore recommend that you include the "action":"kms:ReEncrypt*" statement in your key policies to permit re-encryption from or to the key. The statement is included automatically when you authorize use of the key through the console but must be included manually when you set a policy by using the PutKeyPolicy function.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation ReEncrypt for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified CMK is not enabled.

  • InvalidCiphertextException The request was rejected because the specified ciphertext has been corrupted or is otherwise invalid.

  • KeyUnavailableException The request was rejected because the specified CMK was not available. The request can be retried.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InvalidKeyUsageException The request was rejected because the specified KeySpec value is not valid.

  • InvalidGrantTokenException The request was rejected because the specified grant token is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.ReEncryptInput{
		CiphertextBlob:   []byte("PAYLOAD"),       // Required
		DestinationKeyId: aws.String("KeyIdType"), // Required
		DestinationEncryptionContext: map[string]*string{
			"Key": aws.String("EncryptionContextValue"), // Required
			// More values...
		},
		GrantTokens: []*string{
			aws.String("GrantTokenType"), // Required
			// More values...
		},
		SourceEncryptionContext: map[string]*string{
			"Key": aws.String("EncryptionContextValue"), // Required
			// More values...
		},
	}
	resp, err := svc.ReEncrypt(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) ReEncryptRequest

func (c *KMS) ReEncryptRequest(input *ReEncryptInput) (req *request.Request, output *ReEncryptOutput)

ReEncryptRequest generates a "aws/request.Request" representing the client's request for the ReEncrypt operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See ReEncrypt for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the ReEncrypt method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the ReEncryptRequest method.
req, resp := client.ReEncryptRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) RetireGrant

func (c *KMS) RetireGrant(input *RetireGrantInput) (*RetireGrantOutput, error)

RetireGrant API operation for AWS Key Management Service.

Retires a grant. You can retire a grant when you're done using it to clean up. You should revoke a grant when you intend to actively deny operations that depend on it. The following are permitted to call this API:

  • The account that created the grant

  • The RetiringPrincipal, if present

  • The GranteePrincipal, if RetireGrant is a grantee operation

The grant to retire must be identified by its grant token or by a combination of the key ARN and the grant ID. A grant token is a unique variable-length base64-encoded string. A grant ID is a 64 character unique identifier of a grant. Both are returned by the CreateGrant function.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation RetireGrant for usage and error information.

Returned Error Codes:

  • InvalidGrantTokenException The request was rejected because the specified grant token is not valid.

  • InvalidGrantIdException The request was rejected because the specified GrantId is not valid.

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.RetireGrantInput{
		GrantId:    aws.String("GrantIdType"),
		GrantToken: aws.String("GrantTokenType"),
		KeyId:      aws.String("KeyIdType"),
	}
	resp, err := svc.RetireGrant(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) RetireGrantRequest

func (c *KMS) RetireGrantRequest(input *RetireGrantInput) (req *request.Request, output *RetireGrantOutput)

RetireGrantRequest generates a "aws/request.Request" representing the client's request for the RetireGrant operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See RetireGrant for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the RetireGrant method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the RetireGrantRequest method.
req, resp := client.RetireGrantRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) RevokeGrant

func (c *KMS) RevokeGrant(input *RevokeGrantInput) (*RevokeGrantOutput, error)

RevokeGrant API operation for AWS Key Management Service.

Revokes a grant. You can revoke a grant to actively deny operations that depend on it.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation RevokeGrant for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • InvalidGrantIdException The request was rejected because the specified GrantId is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.RevokeGrantInput{
		GrantId: aws.String("GrantIdType"), // Required
		KeyId:   aws.String("KeyIdType"),   // Required
	}
	resp, err := svc.RevokeGrant(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) RevokeGrantRequest

func (c *KMS) RevokeGrantRequest(input *RevokeGrantInput) (req *request.Request, output *RevokeGrantOutput)

RevokeGrantRequest generates a "aws/request.Request" representing the client's request for the RevokeGrant operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See RevokeGrant for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the RevokeGrant method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the RevokeGrantRequest method.
req, resp := client.RevokeGrantRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) ScheduleKeyDeletion added in v0.9.15

func (c *KMS) ScheduleKeyDeletion(input *ScheduleKeyDeletionInput) (*ScheduleKeyDeletionOutput, error)

ScheduleKeyDeletion API operation for AWS Key Management Service.

Schedules the deletion of a customer master key (CMK). You may provide a waiting period, specified in days, before deletion occurs. If you do not provide a waiting period, the default period of 30 days is used. When this operation is successful, the state of the CMK changes to PendingDeletion. Before the waiting period ends, you can use CancelKeyDeletion to cancel the deletion of the CMK. After the waiting period ends, AWS KMS deletes the CMK and all AWS KMS data associated with it, including all aliases that point to it.

Deleting a CMK is a destructive and potentially dangerous operation. When a CMK is deleted, all data that was encrypted under the CMK is rendered unrecoverable. To restrict the use of a CMK without deleting it, use DisableKey.

For more information about scheduling a CMK for deletion, see Deleting Customer Master Keys (http://docs.aws.amazon.com/kms/latest/developerguide/deleting-keys.html) in the AWS Key Management Service Developer Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation ScheduleKeyDeletion for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.ScheduleKeyDeletionInput{
		KeyId:               aws.String("KeyIdType"), // Required
		PendingWindowInDays: aws.Int64(1),
	}
	resp, err := svc.ScheduleKeyDeletion(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) ScheduleKeyDeletionRequest added in v0.9.15

func (c *KMS) ScheduleKeyDeletionRequest(input *ScheduleKeyDeletionInput) (req *request.Request, output *ScheduleKeyDeletionOutput)

ScheduleKeyDeletionRequest generates a "aws/request.Request" representing the client's request for the ScheduleKeyDeletion operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See ScheduleKeyDeletion for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the ScheduleKeyDeletion method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the ScheduleKeyDeletionRequest method.
req, resp := client.ScheduleKeyDeletionRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) UpdateAlias

func (c *KMS) UpdateAlias(input *UpdateAliasInput) (*UpdateAliasOutput, error)

UpdateAlias API operation for AWS Key Management Service.

Updates an alias to map it to a different key.

An alias is not a property of a key. Therefore, an alias can be mapped to and unmapped from an existing key without changing the properties of the key.

An alias name can contain only alphanumeric characters, forward slashes (/), underscores (_), and dashes (-). An alias must start with the word "alias" followed by a forward slash (alias/). An alias that begins with "aws" after the forward slash (alias/aws...) is reserved by Amazon Web Services (AWS).

The alias and the key it is mapped to must be in the same AWS account and the same region.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation UpdateAlias for usage and error information.

Returned Error Codes:

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.UpdateAliasInput{
		AliasName:   aws.String("AliasNameType"), // Required
		TargetKeyId: aws.String("KeyIdType"),     // Required
	}
	resp, err := svc.UpdateAlias(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) UpdateAliasRequest

func (c *KMS) UpdateAliasRequest(input *UpdateAliasInput) (req *request.Request, output *UpdateAliasOutput)

UpdateAliasRequest generates a "aws/request.Request" representing the client's request for the UpdateAlias operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See UpdateAlias for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the UpdateAlias method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the UpdateAliasRequest method.
req, resp := client.UpdateAliasRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*KMS) UpdateKeyDescription

func (c *KMS) UpdateKeyDescription(input *UpdateKeyDescriptionInput) (*UpdateKeyDescriptionOutput, error)

UpdateKeyDescription API operation for AWS Key Management Service.

Updates the description of a key.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation UpdateKeyDescription for usage and error information.

Returned Error Codes:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InvalidArnException The request was rejected because a specified ARN was not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. The request can be retried.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    For more information about how key state affects the use of a CMK, see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the AWS Key Management Service Developer Guide.

Example
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
)

func main() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := kms.New(sess)

	params := &kms.UpdateKeyDescriptionInput{
		Description: aws.String("DescriptionType"), // Required
		KeyId:       aws.String("KeyIdType"),       // Required
	}
	resp, err := svc.UpdateKeyDescription(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
Output:

func (*KMS) UpdateKeyDescriptionRequest

func (c *KMS) UpdateKeyDescriptionRequest(input *UpdateKeyDescriptionInput) (req *request.Request, output *UpdateKeyDescriptionOutput)

UpdateKeyDescriptionRequest generates a "aws/request.Request" representing the client's request for the UpdateKeyDescription operation. The "output" return value can be used to capture response data after the request's "Send" method is called.

See UpdateKeyDescription for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the UpdateKeyDescription method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// Example sending a request using the UpdateKeyDescriptionRequest method.
req, resp := client.UpdateKeyDescriptionRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

type KeyListEntry

type KeyListEntry struct {

	// ARN of the key.
	KeyArn *string `min:"20" type:"string"`

	// Unique identifier of the key.
	KeyId *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

Contains information about each entry in the key list.

func (KeyListEntry) GoString added in v0.6.5

func (s KeyListEntry) GoString() string

GoString returns the string representation

func (KeyListEntry) String added in v0.6.5

func (s KeyListEntry) String() string

String returns the string representation

type KeyMetadata

type KeyMetadata struct {

	// The twelve-digit account ID of the AWS account that owns the CMK.
	AWSAccountId *string `type:"string"`

	// The Amazon Resource Name (ARN) of the CMK. For examples, see AWS Key Management
	// Service (AWS KMS) (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-kms)
	// in the Example ARNs section of the AWS General Reference.
	Arn *string `min:"20" type:"string"`

	// The date and time when the CMK was created.
	CreationDate *time.Time `type:"timestamp" timestampFormat:"unix"`

	// The date and time after which AWS KMS deletes the CMK. This value is present
	// only when KeyState is PendingDeletion, otherwise this value is omitted.
	DeletionDate *time.Time `type:"timestamp" timestampFormat:"unix"`

	// The description of the CMK.
	Description *string `type:"string"`

	// Specifies whether the CMK is enabled. When KeyState is Enabled this value
	// is true, otherwise it is false.
	Enabled *bool `type:"boolean"`

	// Specifies whether the CMK's key material expires. This value is present only
	// when Origin is EXTERNAL, otherwise this value is omitted.
	ExpirationModel *string `type:"string" enum:"ExpirationModelType"`

	// The globally unique identifier for the CMK.
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`

	// The state of the CMK.
	//
	// For more information about how key state affects the use of a CMK, see How
	// Key State Affects the Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
	// in the AWS Key Management Service Developer Guide.
	KeyState *string `type:"string" enum:"KeyState"`

	// The cryptographic operations for which you can use the CMK. Currently the
	// only allowed value is ENCRYPT_DECRYPT, which means you can use the CMK for
	// the Encrypt and Decrypt operations.
	KeyUsage *string `type:"string" enum:"KeyUsageType"`

	// The source of the CMK's key material. When this value is AWS_KMS, AWS KMS
	// created the key material. When this value is EXTERNAL, the key material was
	// imported from your existing key management infrastructure or the CMK lacks
	// key material.
	Origin *string `type:"string" enum:"OriginType"`

	// The time at which the imported key material expires. When the key material
	// expires, AWS KMS deletes the key material and the CMK becomes unusable. This
	// value is present only for CMKs whose Origin is EXTERNAL and whose ExpirationModel
	// is KEY_MATERIAL_EXPIRES, otherwise this value is omitted.
	ValidTo *time.Time `type:"timestamp" timestampFormat:"unix"`
	// contains filtered or unexported fields
}

Contains metadata about a customer master key (CMK).

This data type is used as a response element for the CreateKey and DescribeKey operations.

func (KeyMetadata) GoString added in v0.6.5

func (s KeyMetadata) GoString() string

GoString returns the string representation

func (KeyMetadata) String added in v0.6.5

func (s KeyMetadata) String() string

String returns the string representation

type ListAliasesInput

type ListAliasesInput struct {

	// When paginating results, specify the maximum number of items to return in
	// the response. If additional items exist beyond the number you specify, the
	// Truncated element in the response is set to true.
	//
	// This value is optional. If you include a value, it must be between 1 and
	// 100, inclusive. If you do not include a value, it defaults to 50.
	Limit *int64 `min:"1" type:"integer"`

	// Use this parameter only when paginating results and only in a subsequent
	// request after you receive a response with truncated results. Set it to the
	// value of NextMarker from the response you just received.
	Marker *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (ListAliasesInput) GoString added in v0.6.5

func (s ListAliasesInput) GoString() string

GoString returns the string representation

func (ListAliasesInput) String added in v0.6.5

func (s ListAliasesInput) String() string

String returns the string representation

func (*ListAliasesInput) Validate added in v1.1.21

func (s *ListAliasesInput) Validate() error

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

type ListAliasesOutput

type ListAliasesOutput struct {

	// A list of key aliases in the user's account.
	Aliases []*AliasListEntry `type:"list"`

	// When Truncated is true, this value is present and contains the value to use
	// for the Marker parameter in a subsequent pagination request.
	NextMarker *string `min:"1" type:"string"`

	// A flag that indicates whether there are more items in the list. If your results
	// were truncated, you can use the Marker parameter to make a subsequent pagination
	// request to retrieve more items in the list.
	Truncated *bool `type:"boolean"`
	// contains filtered or unexported fields
}

func (ListAliasesOutput) GoString added in v0.6.5

func (s ListAliasesOutput) GoString() string

GoString returns the string representation

func (ListAliasesOutput) String added in v0.6.5

func (s ListAliasesOutput) String() string

String returns the string representation

type ListGrantsInput

type ListGrantsInput struct {

	// A unique identifier for the customer master key. This value can be a globally
	// unique identifier or the fully specified ARN to a key.
	//
	//    * Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
	//
	//    * Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`

	// When paginating results, specify the maximum number of items to return in
	// the response. If additional items exist beyond the number you specify, the
	// Truncated element in the response is set to true.
	//
	// This value is optional. If you include a value, it must be between 1 and
	// 100, inclusive. If you do not include a value, it defaults to 50.
	Limit *int64 `min:"1" type:"integer"`

	// Use this parameter only when paginating results and only in a subsequent
	// request after you receive a response with truncated results. Set it to the
	// value of NextMarker from the response you just received.
	Marker *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (ListGrantsInput) GoString added in v0.6.5

func (s ListGrantsInput) GoString() string

GoString returns the string representation

func (ListGrantsInput) String added in v0.6.5

func (s ListGrantsInput) String() string

String returns the string representation

func (*ListGrantsInput) Validate added in v1.1.21

func (s *ListGrantsInput) Validate() error

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

type ListGrantsResponse added in v0.9.15

type ListGrantsResponse struct {

	// A list of grants.
	Grants []*GrantListEntry `type:"list"`

	// When Truncated is true, this value is present and contains the value to use
	// for the Marker parameter in a subsequent pagination request.
	NextMarker *string `min:"1" type:"string"`

	// A flag that indicates whether there are more items in the list. If your results
	// were truncated, you can use the Marker parameter to make a subsequent pagination
	// request to retrieve more items in the list.
	Truncated *bool `type:"boolean"`
	// contains filtered or unexported fields
}

func (ListGrantsResponse) GoString added in v0.9.15

func (s ListGrantsResponse) GoString() string

GoString returns the string representation

func (ListGrantsResponse) String added in v0.9.15

func (s ListGrantsResponse) String() string

String returns the string representation

type ListKeyPoliciesInput

type ListKeyPoliciesInput struct {

	// A unique identifier for the customer master key. This value can be a globally
	// unique identifier, a fully specified ARN to either an alias or a key, or
	// an alias name prefixed by "alias/".
	//
	//    * Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
	//
	//    * Alias ARN Example - arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
	//
	//    * Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
	//
	//    * Alias Name Example - alias/MyAliasName
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`

	// When paginating results, specify the maximum number of items to return in
	// the response. If additional items exist beyond the number you specify, the
	// Truncated element in the response is set to true.
	//
	// This value is optional. If you include a value, it must be between 1 and
	// 1000, inclusive. If you do not include a value, it defaults to 100.
	//
	// Currently only 1 policy can be attached to a key.
	Limit *int64 `min:"1" type:"integer"`

	// Use this parameter only when paginating results and only in a subsequent
	// request after you receive a response with truncated results. Set it to the
	// value of NextMarker from the response you just received.
	Marker *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (ListKeyPoliciesInput) GoString added in v0.6.5

func (s ListKeyPoliciesInput) GoString() string

GoString returns the string representation

func (ListKeyPoliciesInput) String added in v0.6.5

func (s ListKeyPoliciesInput) String() string

String returns the string representation

func (*ListKeyPoliciesInput) Validate added in v1.1.21

func (s *ListKeyPoliciesInput) Validate() error

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

type ListKeyPoliciesOutput

type ListKeyPoliciesOutput struct {

	// When Truncated is true, this value is present and contains the value to use
	// for the Marker parameter in a subsequent pagination request.
	NextMarker *string `min:"1" type:"string"`

	// A list of policy names. Currently, there is only one policy and it is named
	// "Default".
	PolicyNames []*string `type:"list"`

	// A flag that indicates whether there are more items in the list. If your results
	// were truncated, you can use the Marker parameter to make a subsequent pagination
	// request to retrieve more items in the list.
	Truncated *bool `type:"boolean"`
	// contains filtered or unexported fields
}

func (ListKeyPoliciesOutput) GoString added in v0.6.5

func (s ListKeyPoliciesOutput) GoString() string

GoString returns the string representation

func (ListKeyPoliciesOutput) String added in v0.6.5

func (s ListKeyPoliciesOutput) String() string

String returns the string representation

type ListKeysInput

type ListKeysInput struct {

	// When paginating results, specify the maximum number of items to return in
	// the response. If additional items exist beyond the number you specify, the
	// Truncated element in the response is set to true.
	//
	// This value is optional. If you include a value, it must be between 1 and
	// 1000, inclusive. If you do not include a value, it defaults to 100.
	Limit *int64 `min:"1" type:"integer"`

	// Use this parameter only when paginating results and only in a subsequent
	// request after you receive a response with truncated results. Set it to the
	// value of NextMarker from the response you just received.
	Marker *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (ListKeysInput) GoString added in v0.6.5

func (s ListKeysInput) GoString() string

GoString returns the string representation

func (ListKeysInput) String added in v0.6.5

func (s ListKeysInput) String() string

String returns the string representation

func (*ListKeysInput) Validate added in v1.1.21

func (s *ListKeysInput) Validate() error

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

type ListKeysOutput

type ListKeysOutput struct {

	// A list of keys.
	Keys []*KeyListEntry `type:"list"`

	// When Truncated is true, this value is present and contains the value to use
	// for the Marker parameter in a subsequent pagination request.
	NextMarker *string `min:"1" type:"string"`

	// A flag that indicates whether there are more items in the list. If your results
	// were truncated, you can use the Marker parameter to make a subsequent pagination
	// request to retrieve more items in the list.
	Truncated *bool `type:"boolean"`
	// contains filtered or unexported fields
}

func (ListKeysOutput) GoString added in v0.6.5

func (s ListKeysOutput) GoString() string

GoString returns the string representation

func (ListKeysOutput) String added in v0.6.5

func (s ListKeysOutput) String() string

String returns the string representation

type ListRetirableGrantsInput added in v0.9.15

type ListRetirableGrantsInput struct {

	// When paginating results, specify the maximum number of items to return in
	// the response. If additional items exist beyond the number you specify, the
	// Truncated element in the response is set to true.
	//
	// This value is optional. If you include a value, it must be between 1 and
	// 100, inclusive. If you do not include a value, it defaults to 50.
	Limit *int64 `min:"1" type:"integer"`

	// Use this parameter only when paginating results and only in a subsequent
	// request after you receive a response with truncated results. Set it to the
	// value of NextMarker from the response you just received.
	Marker *string `min:"1" type:"string"`

	// The retiring principal for which to list grants.
	//
	// To specify the retiring principal, use the Amazon Resource Name (ARN) (http://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
	// for specifying a principal, see AWS Identity and Access Management (IAM)
	// (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-iam)
	// in the Example ARNs section of the Amazon Web Services General Reference.
	//
	// RetiringPrincipal is a required field
	RetiringPrincipal *string `min:"1" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (ListRetirableGrantsInput) GoString added in v0.9.15

func (s ListRetirableGrantsInput) GoString() string

GoString returns the string representation

func (ListRetirableGrantsInput) String added in v0.9.15

func (s ListRetirableGrantsInput) String() string

String returns the string representation

func (*ListRetirableGrantsInput) Validate added in v1.1.21

func (s *ListRetirableGrantsInput) Validate() error

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

type PutKeyPolicyInput

type PutKeyPolicyInput struct {

	// A flag to indicate whether to bypass the key policy lockout safety check.
	//
	// Setting this value to true increases the likelihood 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 (http://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 making the
	// request from making a subsequent PutKeyPolicy request on the CMK.
	//
	// The default value is false.
	BypassPolicyLockoutSafetyCheck *bool `type:"boolean"`

	// A unique identifier for the CMK.
	//
	// Use the CMK's unique identifier or its Amazon Resource Name (ARN). For example:
	//
	//    * Unique ID: 1234abcd-12ab-34cd-56ef-1234567890ab
	//
	//    * ARN: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`

	// The key policy to attach to the CMK.
	//
	// If you do not set BypassPolicyLockoutSafetyCheck to true, the policy must
	// meet the following criteria:
	//
	//    * It must allow the principal making the PutKeyPolicy request to make
	//    a subsequent PutKeyPolicy request on the CMK. This reduces the likelihood
	//    that the CMK becomes unmanageable. For more information, refer to the
	//    scenario in the Default Key Policy (http://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.
	//
	//    * The principal(s) specified 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 specifying the new
	//    principal in a key policy because the new principal might not immediately
	//    be visible to AWS KMS. For more information, see Changes that I make are
	//    not always immediately visible (http://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency)
	//    in the IAM User Guide.
	//
	// The policy size limit is 32 KiB (32768 bytes).
	//
	// Policy is a required field
	Policy *string `min:"1" type:"string" required:"true"`

	// The name of the key policy.
	//
	// This value must be default.
	//
	// PolicyName is a required field
	PolicyName *string `min:"1" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (PutKeyPolicyInput) GoString added in v0.6.5

func (s PutKeyPolicyInput) GoString() string

GoString returns the string representation

func (PutKeyPolicyInput) String added in v0.6.5

func (s PutKeyPolicyInput) String() string

String returns the string representation

func (*PutKeyPolicyInput) Validate added in v1.1.21

func (s *PutKeyPolicyInput) Validate() error

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

type PutKeyPolicyOutput

type PutKeyPolicyOutput struct {
	// contains filtered or unexported fields
}

func (PutKeyPolicyOutput) GoString added in v0.6.5

func (s PutKeyPolicyOutput) GoString() string

GoString returns the string representation

func (PutKeyPolicyOutput) String added in v0.6.5

func (s PutKeyPolicyOutput) String() string

String returns the string representation

type ReEncryptInput

type ReEncryptInput struct {

	// Ciphertext of the data to re-encrypt.
	//
	// CiphertextBlob is automatically base64 encoded/decoded by the SDK.
	//
	// CiphertextBlob is a required field
	CiphertextBlob []byte `min:"1" type:"blob" required:"true"`

	// Encryption context to be used when the data is re-encrypted.
	DestinationEncryptionContext map[string]*string `type:"map"`

	// A unique identifier for the customer master key used to re-encrypt the data.
	// This value can be a globally unique identifier, a fully specified ARN to
	// either an alias or a key, or an alias name prefixed by "alias/".
	//
	//    * Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
	//
	//    * Alias ARN Example - arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
	//
	//    * Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
	//
	//    * Alias Name Example - alias/MyAliasName
	//
	// DestinationKeyId is a required field
	DestinationKeyId *string `min:"1" type:"string" required:"true"`

	// A list of grant tokens.
	//
	// For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token)
	// in the AWS Key Management Service Developer Guide.
	GrantTokens []*string `type:"list"`

	// Encryption context used to encrypt and decrypt the data specified in the
	// CiphertextBlob parameter.
	SourceEncryptionContext map[string]*string `type:"map"`
	// contains filtered or unexported fields
}

func (ReEncryptInput) GoString added in v0.6.5

func (s ReEncryptInput) GoString() string

GoString returns the string representation

func (ReEncryptInput) String added in v0.6.5

func (s ReEncryptInput) String() string

String returns the string representation

func (*ReEncryptInput) Validate added in v1.1.21

func (s *ReEncryptInput) Validate() error

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

type ReEncryptOutput

type ReEncryptOutput struct {

	// The re-encrypted data. If you are using the CLI, the value is Base64 encoded.
	// Otherwise, it is not encoded.
	//
	// CiphertextBlob is automatically base64 encoded/decoded by the SDK.
	CiphertextBlob []byte `min:"1" type:"blob"`

	// Unique identifier of the key used to re-encrypt the data.
	KeyId *string `min:"1" type:"string"`

	// Unique identifier of the key used to originally encrypt the data.
	SourceKeyId *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (ReEncryptOutput) GoString added in v0.6.5

func (s ReEncryptOutput) GoString() string

GoString returns the string representation

func (ReEncryptOutput) String added in v0.6.5

func (s ReEncryptOutput) String() string

String returns the string representation

type RetireGrantInput

type RetireGrantInput struct {

	// Unique identifier of the grant to be retired. The grant ID is returned by
	// the CreateGrant function.
	//
	//    * Grant ID Example - 0123456789012345678901234567890123456789012345678901234567890123
	GrantId *string `min:"1" type:"string"`

	// Token that identifies the grant to be retired.
	GrantToken *string `min:"1" type:"string"`

	// A unique identifier for the customer master key associated with the grant.
	// This value can be a globally unique identifier or a fully specified ARN of
	// the key.
	//
	//    * Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
	//
	//    * Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
	KeyId *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (RetireGrantInput) GoString added in v0.6.5

func (s RetireGrantInput) GoString() string

GoString returns the string representation

func (RetireGrantInput) String added in v0.6.5

func (s RetireGrantInput) String() string

String returns the string representation

func (*RetireGrantInput) Validate added in v1.1.21

func (s *RetireGrantInput) Validate() error

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

type RetireGrantOutput

type RetireGrantOutput struct {
	// contains filtered or unexported fields
}

func (RetireGrantOutput) GoString added in v0.6.5

func (s RetireGrantOutput) GoString() string

GoString returns the string representation

func (RetireGrantOutput) String added in v0.6.5

func (s RetireGrantOutput) String() string

String returns the string representation

type RevokeGrantInput

type RevokeGrantInput struct {

	// Identifier of the grant to be revoked.
	//
	// GrantId is a required field
	GrantId *string `min:"1" type:"string" required:"true"`

	// A unique identifier for the customer master key associated with the grant.
	// This value can be a globally unique identifier or the fully specified ARN
	// to a key.
	//
	//    * Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
	//
	//    * Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (RevokeGrantInput) GoString added in v0.6.5

func (s RevokeGrantInput) GoString() string

GoString returns the string representation

func (RevokeGrantInput) String added in v0.6.5

func (s RevokeGrantInput) String() string

String returns the string representation

func (*RevokeGrantInput) Validate added in v1.1.21

func (s *RevokeGrantInput) Validate() error

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

type RevokeGrantOutput

type RevokeGrantOutput struct {
	// contains filtered or unexported fields
}

func (RevokeGrantOutput) GoString added in v0.6.5

func (s RevokeGrantOutput) GoString() string

GoString returns the string representation

func (RevokeGrantOutput) String added in v0.6.5

func (s RevokeGrantOutput) String() string

String returns the string representation

type ScheduleKeyDeletionInput added in v0.9.15

type ScheduleKeyDeletionInput struct {

	// The unique identifier for the customer master key (CMK) to delete.
	//
	// To specify this value, use the unique key ID or the Amazon Resource Name
	// (ARN) of the CMK. Examples:
	//
	//    * Unique key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
	//
	//    * Key ARN: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
	//
	// To obtain the unique key ID and key ARN for a given CMK, use ListKeys or
	// DescribeKey.
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`

	// The waiting period, specified in number of days. After the waiting period
	// ends, AWS KMS deletes the customer master key (CMK).
	//
	// This value is optional. If you include a value, it must be between 7 and
	// 30, inclusive. If you do not include a value, it defaults to 30.
	PendingWindowInDays *int64 `min:"1" type:"integer"`
	// contains filtered or unexported fields
}

func (ScheduleKeyDeletionInput) GoString added in v0.9.15

func (s ScheduleKeyDeletionInput) GoString() string

GoString returns the string representation

func (ScheduleKeyDeletionInput) String added in v0.9.15

func (s ScheduleKeyDeletionInput) String() string

String returns the string representation

func (*ScheduleKeyDeletionInput) Validate added in v1.1.21

func (s *ScheduleKeyDeletionInput) Validate() error

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

type ScheduleKeyDeletionOutput added in v0.9.15

type ScheduleKeyDeletionOutput struct {

	// The date and time after which AWS KMS deletes the customer master key (CMK).
	DeletionDate *time.Time `type:"timestamp" timestampFormat:"unix"`

	// The unique identifier of the customer master key (CMK) for which deletion
	// is scheduled.
	KeyId *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (ScheduleKeyDeletionOutput) GoString added in v0.9.15

func (s ScheduleKeyDeletionOutput) GoString() string

GoString returns the string representation

func (ScheduleKeyDeletionOutput) String added in v0.9.15

func (s ScheduleKeyDeletionOutput) String() string

String returns the string representation

type UpdateAliasInput

type UpdateAliasInput struct {

	// String that contains the name of the alias to be modified. The name must
	// start with the word "alias" followed by a forward slash (alias/). Aliases
	// that begin with "alias/aws" are reserved.
	//
	// AliasName is a required field
	AliasName *string `min:"1" type:"string" required:"true"`

	// Unique identifier of the customer master key to be mapped to the alias. This
	// value can be a globally unique identifier or the fully specified ARN of a
	// key.
	//
	//    * Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
	//
	//    * Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
	//
	// You can call ListAliases to verify that the alias is mapped to the correct
	// TargetKeyId.
	//
	// TargetKeyId is a required field
	TargetKeyId *string `min:"1" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (UpdateAliasInput) GoString added in v0.6.5

func (s UpdateAliasInput) GoString() string

GoString returns the string representation

func (UpdateAliasInput) String added in v0.6.5

func (s UpdateAliasInput) String() string

String returns the string representation

func (*UpdateAliasInput) Validate added in v1.1.21

func (s *UpdateAliasInput) Validate() error

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

type UpdateAliasOutput

type UpdateAliasOutput struct {
	// contains filtered or unexported fields
}

func (UpdateAliasOutput) GoString added in v0.6.5

func (s UpdateAliasOutput) GoString() string

GoString returns the string representation

func (UpdateAliasOutput) String added in v0.6.5

func (s UpdateAliasOutput) String() string

String returns the string representation

type UpdateKeyDescriptionInput

type UpdateKeyDescriptionInput struct {

	// New description for the key.
	//
	// Description is a required field
	Description *string `type:"string" required:"true"`

	// A unique identifier for the customer master key. This value can be a globally
	// unique identifier or the fully specified ARN to a key.
	//
	//    * Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
	//
	//    * Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
	//
	// KeyId is a required field
	KeyId *string `min:"1" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (UpdateKeyDescriptionInput) GoString added in v0.6.5

func (s UpdateKeyDescriptionInput) GoString() string

GoString returns the string representation

func (UpdateKeyDescriptionInput) String added in v0.6.5

func (s UpdateKeyDescriptionInput) String() string

String returns the string representation

func (*UpdateKeyDescriptionInput) Validate added in v1.1.21

func (s *UpdateKeyDescriptionInput) Validate() error

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

type UpdateKeyDescriptionOutput

type UpdateKeyDescriptionOutput struct {
	// contains filtered or unexported fields
}

func (UpdateKeyDescriptionOutput) GoString added in v0.6.5

func (s UpdateKeyDescriptionOutput) GoString() string

GoString returns the string representation

func (UpdateKeyDescriptionOutput) String added in v0.6.5

String returns the string representation

Directories

Path Synopsis
Package kmsiface provides an interface to enable mocking the AWS Key Management Service service client for testing your code.
Package kmsiface provides an interface to enable mocking the AWS Key Management Service service client for testing your code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL