kms

package
v0.6.5-0...-b2d953f Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2015 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package kms provides a client for AWS Key Management Service.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliasListEntry

type AliasListEntry struct {
	// String that contains the key ARN.
	AliasARN *string `locationName:"AliasArn" type:"string"`

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

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

Contains information about an alias.

func (AliasListEntry) GoString

func (s AliasListEntry) GoString() string

GoString returns the string representation

func (AliasListEntry) String

func (s AliasListEntry) 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 *string `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 *string `locationName:"TargetKeyId" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (CreateAliasInput) GoString

func (s CreateAliasInput) GoString() string

GoString returns the string representation

func (CreateAliasInput) String

func (s CreateAliasInput) String() string

String returns the string representation

type CreateAliasOutput

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

func (CreateAliasOutput) GoString

func (s CreateAliasOutput) GoString() string

GoString returns the string representation

func (CreateAliasOutput) String

func (s CreateAliasOutput) String() string

String returns the string representation

type CreateGrantInput

type CreateGrantInput struct {
	// Specifies the conditions under which the actions specified by the Operations
	// parameter are allowed.
	Constraints *GrantConstraints `type:"structure"`

	// For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token).
	GrantTokens []*string `type:"list"`

	// Principal given permission by the grant to use the key identified by the
	// keyId parameter.
	GranteePrincipal *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 *string `locationName:"KeyId" type:"string" required:"true"`

	// List of operations permitted by the grant. This can be any combination of
	// one or more of the following values:  Decrypt Encrypt GenerateDataKey GenerateDataKeyWithoutPlaintext
	// ReEncryptFrom ReEncryptTo CreateGrant RetireGrant
	Operations []*string `type:"list"`

	// Principal given permission to retire the grant. For more information, see
	// RetireGrant.
	RetiringPrincipal *string `type:"string"`
	// contains filtered or unexported fields
}

func (CreateGrantInput) GoString

func (s CreateGrantInput) GoString() string

GoString returns the string representation

func (CreateGrantInput) String

func (s CreateGrantInput) String() string

String returns the string representation

type CreateGrantOutput

type CreateGrantOutput struct {
	// Unique grant identifier. You can use the GrantId value to revoke a grant.
	GrantID *string `locationName:"GrantId" type:"string"`

	// For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token).
	GrantToken *string `type:"string"`
	// contains filtered or unexported fields
}

func (CreateGrantOutput) GoString

func (s CreateGrantOutput) GoString() string

GoString returns the string representation

func (CreateGrantOutput) String

func (s CreateGrantOutput) String() string

String returns the string representation

type CreateKeyInput

type CreateKeyInput struct {
	// Description of the key. We recommend that you choose a description that helps
	// your customer decide whether the key is appropriate for a task.
	Description *string `type:"string"`

	// Specifies the intended use of the key. Currently this defaults to ENCRYPT/DECRYPT,
	// and only symmetric encryption and decryption are supported.
	KeyUsage *string `type:"string"`

	// Policy to be attached to the key. This is required and delegates back to
	// the account. The key is the root of trust.
	Policy *string `type:"string"`
	// contains filtered or unexported fields
}

func (CreateKeyInput) GoString

func (s CreateKeyInput) GoString() string

GoString returns the string representation

func (CreateKeyInput) String

func (s CreateKeyInput) String() string

String returns the string representation

type CreateKeyOutput

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

func (CreateKeyOutput) GoString

func (s CreateKeyOutput) GoString() string

GoString returns the string representation

func (CreateKeyOutput) String

func (s CreateKeyOutput) String() string

String returns the string representation

type DecryptInput

type DecryptInput struct {
	// Ciphertext to be decrypted. The blob includes metadata.
	CiphertextBlob []byte `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/encrypt-context.html).
	EncryptionContext map[string]*string `type:"map"`

	// For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token).
	GrantTokens []*string `type:"list"`
	// contains filtered or unexported fields
}

func (DecryptInput) GoString

func (s DecryptInput) GoString() string

GoString returns the string representation

func (DecryptInput) String

func (s DecryptInput) String() string

String returns the string representation

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 `locationName:"KeyId" 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 []byte `type:"blob"`
	// contains filtered or unexported fields
}

func (DecryptOutput) GoString

func (s DecryptOutput) GoString() string

GoString returns the string representation

func (DecryptOutput) String

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 *string `type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (DeleteAliasInput) GoString

func (s DeleteAliasInput) GoString() string

GoString returns the string representation

func (DeleteAliasInput) String

func (s DeleteAliasInput) String() string

String returns the string representation

type DeleteAliasOutput

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

func (DeleteAliasOutput) GoString

func (s DeleteAliasOutput) GoString() string

GoString returns the string representation

func (DeleteAliasOutput) String

func (s DeleteAliasOutput) String() string

String returns the string representation

type DescribeKeyInput

type DescribeKeyInput 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 *string `locationName:"KeyId" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (DescribeKeyInput) GoString

func (s DescribeKeyInput) GoString() string

GoString returns the string representation

func (DescribeKeyInput) String

func (s DescribeKeyInput) String() string

String returns the string representation

type DescribeKeyOutput

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

func (DescribeKeyOutput) GoString

func (s DescribeKeyOutput) GoString() string

GoString returns the string representation

func (DescribeKeyOutput) String

func (s DescribeKeyOutput) String() string

String returns the string representation

type DisableKeyInput

type DisableKeyInput 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 *string `locationName:"KeyId" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (DisableKeyInput) GoString

func (s DisableKeyInput) GoString() string

GoString returns the string representation

func (DisableKeyInput) String

func (s DisableKeyInput) String() string

String returns the string representation

type DisableKeyOutput

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

func (DisableKeyOutput) GoString

func (s DisableKeyOutput) GoString() string

GoString returns the string representation

func (DisableKeyOutput) String

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 *string `locationName:"KeyId" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (DisableKeyRotationInput) GoString

func (s DisableKeyRotationInput) GoString() string

GoString returns the string representation

func (DisableKeyRotationInput) String

func (s DisableKeyRotationInput) String() string

String returns the string representation

type DisableKeyRotationOutput

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

func (DisableKeyRotationOutput) GoString

func (s DisableKeyRotationOutput) GoString() string

GoString returns the string representation

func (DisableKeyRotationOutput) String

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 *string `locationName:"KeyId" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (EnableKeyInput) GoString

func (s EnableKeyInput) GoString() string

GoString returns the string representation

func (EnableKeyInput) String

func (s EnableKeyInput) String() string

String returns the string representation

type EnableKeyOutput

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

func (EnableKeyOutput) GoString

func (s EnableKeyOutput) GoString() string

GoString returns the string representation

func (EnableKeyOutput) String

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 *string `locationName:"KeyId" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (EnableKeyRotationInput) GoString

func (s EnableKeyRotationInput) GoString() string

GoString returns the string representation

func (EnableKeyRotationInput) String

func (s EnableKeyRotationInput) String() string

String returns the string representation

type EnableKeyRotationOutput

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

func (EnableKeyRotationOutput) GoString

func (s EnableKeyRotationOutput) GoString() string

GoString returns the string representation

func (EnableKeyRotationOutput) String

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/encrypt-context.html).
	EncryptionContext map[string]*string `type:"map"`

	// For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token).
	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 *string `locationName:"KeyId" type:"string" required:"true"`

	// Data to be encrypted.
	Plaintext []byte `type:"blob" required:"true"`
	// contains filtered or unexported fields
}

func (EncryptInput) GoString

func (s EncryptInput) GoString() string

GoString returns the string representation

func (EncryptInput) String

func (s EncryptInput) String() string

String returns the string representation

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 []byte `type:"blob"`

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

func (EncryptOutput) GoString

func (s EncryptOutput) GoString() string

GoString returns the string representation

func (EncryptOutput) String

func (s EncryptOutput) String() string

String returns the string representation

type GenerateDataKeyInput

type GenerateDataKeyInput struct {
	// Name/value pair that contains additional data to be authenticated during
	// the encryption and decryption processes that use the key. This value is logged
	// by AWS CloudTrail to provide context around the data encrypted by the key.
	EncryptionContext map[string]*string `type:"map"`

	// For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token).
	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 *string `locationName:"KeyId" type:"string" required:"true"`

	// Value that identifies the encryption algorithm and key size to generate a
	// data key for. Currently this can be AES_128 or AES_256.
	KeySpec *string `type:"string"`

	// Integer that contains the number of bytes to generate. Common values are
	// 128, 256, 512, and 1024. 1024 is the current limit. We recommend that you
	// use the KeySpec parameter instead.
	NumberOfBytes *int64 `type:"integer"`
	// contains filtered or unexported fields
}

func (GenerateDataKeyInput) GoString

func (s GenerateDataKeyInput) GoString() string

GoString returns the string representation

func (GenerateDataKeyInput) String

func (s GenerateDataKeyInput) String() string

String returns the string representation

type GenerateDataKeyOutput

type GenerateDataKeyOutput struct {
	// Ciphertext that contains the encrypted data key. You must store the blob
	// and enough information to reconstruct the encryption context so that the
	// data encrypted by using the key can later be decrypted. You must provide
	// both the ciphertext blob and the encryption context to the Decrypt API to
	// recover the plaintext data key and decrypt the object.
	//
	// If you are using the CLI, the value is Base64 encoded. Otherwise, it is
	// not encoded.
	CiphertextBlob []byte `type:"blob"`

	// System generated unique identifier of the key to be used to decrypt the encrypted
	// copy of the data key.
	KeyID *string `locationName:"KeyId" type:"string"`

	// Plaintext that contains the data key. Use this for encryption and decryption
	// and then remove it from memory as soon as possible.
	Plaintext []byte `type:"blob"`
	// contains filtered or unexported fields
}

func (GenerateDataKeyOutput) GoString

func (s GenerateDataKeyOutput) GoString() string

GoString returns the string representation

func (GenerateDataKeyOutput) String

func (s GenerateDataKeyOutput) String() string

String returns the string representation

type GenerateDataKeyWithoutPlaintextInput

type GenerateDataKeyWithoutPlaintextInput struct {
	// Name:value pair that contains additional data to be authenticated during
	// the encryption and decryption processes.
	EncryptionContext map[string]*string `type:"map"`

	// For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token).
	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 *string `locationName:"KeyId" type:"string" required:"true"`

	// Value that identifies the encryption algorithm and key size. Currently this
	// can be AES_128 or AES_256.
	KeySpec *string `type:"string"`

	// Integer that contains the number of bytes to generate. Common values are
	// 128, 256, 512, 1024 and so on. We recommend that you use the KeySpec parameter
	// instead.
	NumberOfBytes *int64 `type:"integer"`
	// contains filtered or unexported fields
}

func (GenerateDataKeyWithoutPlaintextInput) GoString

GoString returns the string representation

func (GenerateDataKeyWithoutPlaintextInput) String

String returns the string representation

type GenerateDataKeyWithoutPlaintextOutput

type GenerateDataKeyWithoutPlaintextOutput struct {
	// Ciphertext that contains the wrapped data key. You must store the blob and
	// encryption context so that the key can be used in a future decrypt operation.
	//
	// If you are using the CLI, the value is Base64 encoded. Otherwise, it is
	// not encoded.
	CiphertextBlob []byte `type:"blob"`

	// System generated unique identifier of the key to be used to decrypt the encrypted
	// copy of the data key.
	KeyID *string `locationName:"KeyId" type:"string"`
	// contains filtered or unexported fields
}

func (GenerateDataKeyWithoutPlaintextOutput) GoString

GoString returns the string representation

func (GenerateDataKeyWithoutPlaintextOutput) String

String returns the string representation

type GenerateRandomInput

type GenerateRandomInput struct {
	// Integer that contains the number of bytes to generate. Common values are
	// 128, 256, 512, 1024 and so on. The current limit is 1024 bytes.
	NumberOfBytes *int64 `type:"integer"`
	// contains filtered or unexported fields
}

func (GenerateRandomInput) GoString

func (s GenerateRandomInput) GoString() string

GoString returns the string representation

func (GenerateRandomInput) String

func (s GenerateRandomInput) String() string

String returns the string representation

type GenerateRandomOutput

type GenerateRandomOutput struct {
	// Plaintext that contains the unpredictable byte string.
	Plaintext []byte `type:"blob"`
	// contains filtered or unexported fields
}

func (GenerateRandomOutput) GoString

func (s GenerateRandomOutput) GoString() string

GoString returns the string representation

func (GenerateRandomOutput) String

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 *string `locationName:"KeyId" 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 *string `type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (GetKeyPolicyInput) GoString

func (s GetKeyPolicyInput) GoString() string

GoString returns the string representation

func (GetKeyPolicyInput) String

func (s GetKeyPolicyInput) String() string

String returns the string representation

type GetKeyPolicyOutput

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

func (GetKeyPolicyOutput) GoString

func (s GetKeyPolicyOutput) GoString() string

GoString returns the string representation

func (GetKeyPolicyOutput) String

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 *string `locationName:"KeyId" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (GetKeyRotationStatusInput) GoString

func (s GetKeyRotationStatusInput) GoString() string

GoString returns the string representation

func (GetKeyRotationStatusInput) String

func (s GetKeyRotationStatusInput) String() string

String returns the string representation

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

func (s GetKeyRotationStatusOutput) GoString() string

GoString returns the string representation

func (GetKeyRotationStatusOutput) String

String returns the string representation

type GrantConstraints

type GrantConstraints struct {
	// The constraint contains additional key/value pairs that serve to further
	// limit the grant.
	EncryptionContextEquals map[string]*string `type:"map"`

	// The constraint equals the full encryption context.
	EncryptionContextSubset map[string]*string `type:"map"`
	// contains filtered or unexported fields
}

Contains constraints on the grant.

func (GrantConstraints) GoString

func (s GrantConstraints) GoString() string

GoString returns the string representation

func (GrantConstraints) String

func (s GrantConstraints) String() string

String returns the string representation

type GrantListEntry

type GrantListEntry struct {
	// Specifies the conditions under which the actions specified by the Operations
	// parameter are allowed.
	Constraints *GrantConstraints `type:"structure"`

	// Unique grant identifier.
	GrantID *string `locationName:"GrantId" type:"string"`

	// The principal that receives the grant permission.
	GranteePrincipal *string `type:"string"`

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

	// List of operations permitted by the grant. This can be any combination of
	// one or more of the following values:  Decrypt Encrypt GenerateDataKey GenerateDataKeyWithoutPlaintext
	// ReEncryptFrom ReEncryptTo CreateGrant
	Operations []*string `type:"list"`

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

Contains information about each entry in the grant list.

func (GrantListEntry) GoString

func (s GrantListEntry) GoString() string

GoString returns the string representation

func (GrantListEntry) String

func (s GrantListEntry) String() string

String returns the string representation

type KMS

type KMS struct {
	*aws.Service
}

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

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 KMS and AWS. 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 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 access key ID and secret key for everyday work with 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 KMS operations require Signature Version 4 (http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html).

Recording API Requests

KMS supports AWS CloudTrail, a service that records 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 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/whatiscloudtrail.html)

Additional Resources

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

AWS Security Credentials (http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html).

This topic provides general information about the types of credentials used for accessing AWS. AWS Security Token Service (http://docs.aws.amazon.com/STS/latest/UsingSTS/). This guide describes how to create and use temporary security credentials.

Signing AWS API Requests (http://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html).

This set of topics walks you through the process of signing a request using an access key ID and a secret access key. 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

func New

func New(config *aws.Config) *KMS

New returns a new KMS client.

func (*KMS) CreateAlias

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

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).

To associate an alias with a different key, call UpdateAlias.

Note that you cannot create or update an alias that represents a key in another account.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

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

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) CreateAliasRequest

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

CreateAliasRequest generates a request for the CreateAlias operation.

func (*KMS) CreateGrant

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

Adds a grant to a key to specify who can access 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 developer guide. If a grant is absent, access to the key is evaluated based on IAM policies attached to the user. ListGrants RetireGrant RevokeGrant

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

	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...
		},
		Operations: []*string{
			aws.String("GrantOperation"), // Required
			// More values...
		},
		RetiringPrincipal: aws.String("PrincipalIdType"),
	}
	resp, err := svc.CreateGrant(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) CreateGrantRequest

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

CreateGrantRequest generates a request for the CreateGrant operation.

func (*KMS) CreateKey

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

Creates a customer master key. Customer master keys can be used to encrypt small amounts of data (less than 4K) directly, but they are most commonly used to encrypt or envelope data keys that are then used to encrypt customer data. For more information about data keys, see GenerateDataKey and GenerateDataKeyWithoutPlaintext.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

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

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) CreateKeyRequest

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

CreateKeyRequest generates a request for the CreateKey operation.

func (*KMS) Decrypt

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

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.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

	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 {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) DecryptRequest

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

DecryptRequest generates a request for the Decrypt operation.

func (*KMS) DeleteAlias

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

Deletes the specified alias. To associate an alias with a different key, call UpdateAlias.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

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

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) DeleteAliasRequest

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

DeleteAliasRequest generates a request for the DeleteAlias operation.

func (*KMS) DescribeKey

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

Provides detailed information about the specified customer master key.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

	params := &kms.DescribeKeyInput{
		KeyID: aws.String("KeyIdType"), // Required
	}
	resp, err := svc.DescribeKey(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) DescribeKeyRequest

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

DescribeKeyRequest generates a request for the DescribeKey operation.

func (*KMS) DisableKey

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

Marks a key as disabled, thereby preventing its use.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

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

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) DisableKeyRequest

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

DisableKeyRequest generates a request for the DisableKey operation.

func (*KMS) DisableKeyRotation

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

Disables rotation of the specified key.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

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

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) DisableKeyRotationRequest

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

DisableKeyRotationRequest generates a request for the DisableKeyRotation operation.

func (*KMS) EnableKey

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

Marks a key as enabled, thereby permitting its use. You can have up to 25 enabled keys at one time.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

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

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) EnableKeyRequest

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

EnableKeyRequest generates a request for the EnableKey operation.

func (*KMS) EnableKeyRotation

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

Enables rotation of the specified customer master key.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

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

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) EnableKeyRotationRequest

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

EnableKeyRotationRequest generates a request for the EnableKeyRotation operation.

func (*KMS) Encrypt

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

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.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

	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 {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) EncryptRequest

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

EncryptRequest generates a request for the Encrypt operation.

func (*KMS) GenerateDataKey

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

Generates a data key that you can use in your application to locally encrypt data. This call returns a plaintext version of the key in the Plaintext field of the response object and an encrypted copy of the key in the CiphertextBlob field. The key is encrypted by using the master key specified by the KeyId field. To decrypt the encrypted key, pass it to the Decrypt API.

We recommend that you use the following pattern to locally encrypt data: call the GenerateDataKey API, use the key returned in the Plaintext response field to locally encrypt data, and then erase the plaintext data key from memory. Store the encrypted data key (contained in the CiphertextBlob field) alongside of the locally encrypted data.

You should not call the Encrypt function to re-encrypt your data keys within a region. GenerateDataKey always returns the data key encrypted and tied to the customer master key that will be used to decrypt it. There is no need to decrypt it twice. If you decide to use the optional EncryptionContext parameter, you must also store the context in full or at least store enough information along with the encrypted data to be able to reconstruct the context when submitting the ciphertext to the Decrypt API. It is a good practice to choose a context that you can reconstruct on the fly to better secure the ciphertext. For more information about how this parameter is used, see Encryption Context (http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html).

To decrypt data, pass the encrypted data key to the Decrypt API. Decrypt uses the associated master key to decrypt the encrypted data key and returns it as plaintext. Use the plaintext data key to locally decrypt your data and then erase the key from memory. You must specify the encryption context, if any, that you specified when you generated the key. The encryption context is logged by CloudTrail, and you can use this log to help track the use of particular data.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

	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.Long(1),
	}
	resp, err := svc.GenerateDataKey(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) GenerateDataKeyRequest

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

GenerateDataKeyRequest generates a request for the GenerateDataKey operation.

func (*KMS) GenerateDataKeyWithoutPlaintext

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

Returns a data key encrypted by a customer master key without the plaintext copy of that key. Otherwise, this API functions exactly like GenerateDataKey. You can use this API to, for example, satisfy an audit requirement that an encrypted key be made available without exposing the plaintext copy of that key.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

	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.Long(1),
	}
	resp, err := svc.GenerateDataKeyWithoutPlaintext(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) GenerateDataKeyWithoutPlaintextRequest

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

GenerateDataKeyWithoutPlaintextRequest generates a request for the GenerateDataKeyWithoutPlaintext operation.

func (*KMS) GenerateRandom

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

Generates an unpredictable byte string.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

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

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) GenerateRandomRequest

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

GenerateRandomRequest generates a request for the GenerateRandom operation.

func (*KMS) GetKeyPolicy

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

Retrieves a policy attached to the specified key.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

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

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) GetKeyPolicyRequest

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

GetKeyPolicyRequest generates a request for the GetKeyPolicy operation.

func (*KMS) GetKeyRotationStatus

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

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

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

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

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) GetKeyRotationStatusRequest

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

GetKeyRotationStatusRequest generates a request for the GetKeyRotationStatus operation.

func (*KMS) ListAliases

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

Lists all of the key aliases in the account.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

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

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) ListAliasesPages

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

func (*KMS) ListAliasesRequest

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

ListAliasesRequest generates a request for the ListAliases operation.

func (*KMS) ListGrants

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

List the grants for a specified key.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

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

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) ListGrantsPages

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

func (*KMS) ListGrantsRequest

func (c *KMS) ListGrantsRequest(input *ListGrantsInput) (req *aws.Request, output *ListGrantsOutput)

ListGrantsRequest generates a request for the ListGrants operation.

func (*KMS) ListKeyPolicies

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

Retrieves a list of policies attached to a key.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

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

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) ListKeyPoliciesPages

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

func (*KMS) ListKeyPoliciesRequest

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

ListKeyPoliciesRequest generates a request for the ListKeyPolicies operation.

func (*KMS) ListKeys

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

Lists the customer master keys.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

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

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) ListKeysPages

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

func (*KMS) ListKeysRequest

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

ListKeysRequest generates a request for the ListKeys operation.

func (*KMS) PutKeyPolicy

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

Attaches a policy to the specified key.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

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

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) PutKeyPolicyRequest

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

PutKeyPolicyRequest generates a request for the PutKeyPolicy operation.

func (*KMS) ReEncrypt

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

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.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

	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 {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) ReEncryptRequest

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

ReEncryptRequest generates a request for the ReEncrypt operation.

func (*KMS) RetireGrant

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

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.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

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

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) RetireGrantRequest

func (c *KMS) RetireGrantRequest(input *RetireGrantInput) (req *aws.Request, output *RetireGrantOutput)

RetireGrantRequest generates a request for the RetireGrant operation.

func (*KMS) RevokeGrant

func (c *KMS) RevokeGrant(input *RevokeGrantInput) (*RevokeGrantOutput, error)

Revokes a grant. You can revoke a grant to actively deny operations that depend on it.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

	params := &kms.RevokeGrantInput{
		GrantID: aws.String("GrantIdType"), // Required
		KeyID:   aws.String("KeyIdType"),   // Required
	}
	resp, err := svc.RevokeGrant(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) RevokeGrantRequest

func (c *KMS) RevokeGrantRequest(input *RevokeGrantInput) (req *aws.Request, output *RevokeGrantOutput)

RevokeGrantRequest generates a request for the RevokeGrant operation.

func (*KMS) UpdateAlias

func (c *KMS) UpdateAlias(input *UpdateAliasInput) (*UpdateAliasOutput, error)

Updates an alias to associate it with a different 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).

An alias is not a property of a key. Therefore, an alias can be associated with and disassociated from an existing key without changing the properties of the key.

Note that you cannot create or update an alias that represents a key in another account.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

	params := &kms.UpdateAliasInput{
		AliasName:   aws.String("AliasNameType"), // Required
		TargetKeyID: aws.String("KeyIdType"),     // Required
	}
	resp, err := svc.UpdateAlias(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) UpdateAliasRequest

func (c *KMS) UpdateAliasRequest(input *UpdateAliasInput) (req *aws.Request, output *UpdateAliasOutput)

UpdateAliasRequest generates a request for the UpdateAlias operation.

func (*KMS) UpdateKeyDescription

func (c *KMS) UpdateKeyDescription(input *UpdateKeyDescriptionInput) (*UpdateKeyDescriptionOutput, error)

Updates the description of a key.

Example
package main

import (
	"fmt"

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

func main() {
	svc := kms.New(nil)

	params := &kms.UpdateKeyDescriptionInput{
		Description: aws.String("DescriptionType"), // Required
		KeyID:       aws.String("KeyIdType"),       // Required
	}
	resp, err := svc.UpdateKeyDescription(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

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

func (*KMS) UpdateKeyDescriptionRequest

func (c *KMS) UpdateKeyDescriptionRequest(input *UpdateKeyDescriptionInput) (req *aws.Request, output *UpdateKeyDescriptionOutput)

UpdateKeyDescriptionRequest generates a request for the UpdateKeyDescription operation.

type KeyListEntry

type KeyListEntry struct {
	// ARN of the key.
	KeyARN *string `locationName:"KeyArn" type:"string"`

	// Unique identifier of the key.
	KeyID *string `locationName:"KeyId" type:"string"`
	// contains filtered or unexported fields
}

Contains information about each entry in the key list.

func (KeyListEntry) GoString

func (s KeyListEntry) GoString() string

GoString returns the string representation

func (KeyListEntry) String

func (s KeyListEntry) String() string

String returns the string representation

type KeyMetadata

type KeyMetadata struct {
	// Key ARN (Amazon Resource Name).
	ARN *string `locationName:"Arn" type:"string"`

	// Account ID number.
	AWSAccountID *string `locationName:"AWSAccountId" type:"string"`

	// Date the key was created.
	CreationDate *time.Time `type:"timestamp" timestampFormat:"unix"`

	// The description of the key.
	Description *string `type:"string"`

	// Value that specifies whether the key is enabled.
	Enabled *bool `type:"boolean"`

	// Unique identifier for the key.
	KeyID *string `locationName:"KeyId" type:"string" required:"true"`

	// A value that specifies what operation(s) the key can perform.
	KeyUsage *string `type:"string"`
	// contains filtered or unexported fields
}

Contains metadata associated with a specific key.

func (KeyMetadata) GoString

func (s KeyMetadata) GoString() string

GoString returns the string representation

func (KeyMetadata) String

func (s KeyMetadata) String() string

String returns the string representation

type ListAliasesInput

type ListAliasesInput struct {
	// Specify this parameter when paginating results to indicate the maximum number
	// of aliases you want in each response. If there are additional aliases beyond
	// the maximum you specify, the Truncated response element will be set to true.
	Limit *int64 `type:"integer"`

	// Use this parameter when paginating results, and only in a subsequent request
	// after you've received a response where the results are truncated. Set it
	// to the value of the NextMarker element in the response you just received.
	Marker *string `type:"string"`
	// contains filtered or unexported fields
}

func (ListAliasesInput) GoString

func (s ListAliasesInput) GoString() string

GoString returns the string representation

func (ListAliasesInput) String

func (s ListAliasesInput) String() string

String returns the string representation

type ListAliasesOutput

type ListAliasesOutput struct {
	// A list of key aliases in the user's account.
	Aliases []*AliasListEntry `type:"list"`

	// If Truncated is true, this value is present and contains the value to use
	// for the Marker request parameter in a subsequent pagination request.
	NextMarker *string `type:"string"`

	// A flag that indicates whether there are more items in the list. If your results
	// were truncated, you can make a subsequent pagination request using the Marker
	// request parameter to retrieve more aliases in the list.
	Truncated *bool `type:"boolean"`
	// contains filtered or unexported fields
}

func (ListAliasesOutput) GoString

func (s ListAliasesOutput) GoString() string

GoString returns the string representation

func (ListAliasesOutput) String

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 *string `locationName:"KeyId" type:"string" required:"true"`

	// Specify this parameter only when paginating results to indicate the maximum
	// number of grants you want listed in the response. If there are additional
	// grants beyond the maximum you specify, the Truncated response element will
	// be set to true.
	Limit *int64 `type:"integer"`

	// Use this parameter only when paginating results, and only in a subsequent
	// request after you've received a response where the results are truncated.
	// Set it to the value of the NextMarker in the response you just received.
	Marker *string `type:"string"`
	// contains filtered or unexported fields
}

func (ListGrantsInput) GoString

func (s ListGrantsInput) GoString() string

GoString returns the string representation

func (ListGrantsInput) String

func (s ListGrantsInput) String() string

String returns the string representation

type ListGrantsOutput

type ListGrantsOutput struct {
	// A list of grants.
	Grants []*GrantListEntry `type:"list"`

	// If Truncated is true, this value is present and contains the value to use
	// for the Marker request parameter in a subsequent pagination request.
	NextMarker *string `type:"string"`

	// A flag that indicates whether there are more items in the list. If your results
	// were truncated, you can make a subsequent pagination request using the Marker
	// request parameter to retrieve more grants in the list.
	Truncated *bool `type:"boolean"`
	// contains filtered or unexported fields
}

func (ListGrantsOutput) GoString

func (s ListGrantsOutput) GoString() string

GoString returns the string representation

func (ListGrantsOutput) String

func (s ListGrantsOutput) 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 *string `locationName:"KeyId" type:"string" required:"true"`

	// Specify this parameter only when paginating results to indicate the maximum
	// number of policies you want listed in the response. If there are additional
	// policies beyond the maximum you specify, the Truncated response element will
	// be set to true.
	Limit *int64 `type:"integer"`

	// Use this parameter only when paginating results, and only in a subsequent
	// request after you've received a response where the results are truncated.
	// Set it to the value of the NextMarker in the response you just received.
	Marker *string `type:"string"`
	// contains filtered or unexported fields
}

func (ListKeyPoliciesInput) GoString

func (s ListKeyPoliciesInput) GoString() string

GoString returns the string representation

func (ListKeyPoliciesInput) String

func (s ListKeyPoliciesInput) String() string

String returns the string representation

type ListKeyPoliciesOutput

type ListKeyPoliciesOutput struct {
	// If Truncated is true, this value is present and contains the value to use
	// for the Marker request parameter in a subsequent pagination request.
	NextMarker *string `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 make a subsequent pagination request using the Marker
	// request parameter to retrieve more policies in the list.
	Truncated *bool `type:"boolean"`
	// contains filtered or unexported fields
}

func (ListKeyPoliciesOutput) GoString

func (s ListKeyPoliciesOutput) GoString() string

GoString returns the string representation

func (ListKeyPoliciesOutput) String

func (s ListKeyPoliciesOutput) String() string

String returns the string representation

type ListKeysInput

type ListKeysInput struct {
	// Specify this parameter only when paginating results to indicate the maximum
	// number of keys you want listed in the response. If there are additional keys
	// beyond the maximum you specify, the Truncated response element will be set
	// to true.
	Limit *int64 `type:"integer"`

	// Use this parameter only when paginating results, and only in a subsequent
	// request after you've received a response where the results are truncated.
	// Set it to the value of the NextMarker in the response you just received.
	Marker *string `type:"string"`
	// contains filtered or unexported fields
}

func (ListKeysInput) GoString

func (s ListKeysInput) GoString() string

GoString returns the string representation

func (ListKeysInput) String

func (s ListKeysInput) String() string

String returns the string representation

type ListKeysOutput

type ListKeysOutput struct {
	// A list of keys.
	Keys []*KeyListEntry `type:"list"`

	// If Truncated is true, this value is present and contains the value to use
	// for the Marker request parameter in a subsequent pagination request.
	NextMarker *string `type:"string"`

	// A flag that indicates whether there are more items in the list. If your results
	// were truncated, you can make a subsequent pagination request using the Marker
	// request parameter to retrieve more keys in the list.
	Truncated *bool `type:"boolean"`
	// contains filtered or unexported fields
}

func (ListKeysOutput) GoString

func (s ListKeysOutput) GoString() string

GoString returns the string representation

func (ListKeysOutput) String

func (s ListKeysOutput) String() string

String returns the string representation

type PutKeyPolicyInput

type PutKeyPolicyInput 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 *string `locationName:"KeyId" type:"string" required:"true"`

	// The policy, in JSON format, to be attached to the key.
	Policy *string `type:"string" required:"true"`

	// Name of the policy to be attached. Currently, the only supported name is
	// "default".
	PolicyName *string `type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (PutKeyPolicyInput) GoString

func (s PutKeyPolicyInput) GoString() string

GoString returns the string representation

func (PutKeyPolicyInput) String

func (s PutKeyPolicyInput) String() string

String returns the string representation

type PutKeyPolicyOutput

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

func (PutKeyPolicyOutput) GoString

func (s PutKeyPolicyOutput) GoString() string

GoString returns the string representation

func (PutKeyPolicyOutput) String

func (s PutKeyPolicyOutput) String() string

String returns the string representation

type ReEncryptInput

type ReEncryptInput struct {
	// Ciphertext of the data to re-encrypt.
	CiphertextBlob []byte `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 *string `locationName:"DestinationKeyId" type:"string" required:"true"`

	// For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token).
	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

func (s ReEncryptInput) GoString() string

GoString returns the string representation

func (ReEncryptInput) String

func (s ReEncryptInput) String() string

String returns the string representation

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 []byte `type:"blob"`

	// Unique identifier of the key used to re-encrypt the data.
	KeyID *string `locationName:"KeyId" type:"string"`

	// Unique identifier of the key used to originally encrypt the data.
	SourceKeyID *string `locationName:"SourceKeyId" type:"string"`
	// contains filtered or unexported fields
}

func (ReEncryptOutput) GoString

func (s ReEncryptOutput) GoString() string

GoString returns the string representation

func (ReEncryptOutput) String

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 `locationName:"GrantId" type:"string"`

	// Token that identifies the grant to be retired.
	GrantToken *string `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 `locationName:"KeyId" type:"string"`
	// contains filtered or unexported fields
}

func (RetireGrantInput) GoString

func (s RetireGrantInput) GoString() string

GoString returns the string representation

func (RetireGrantInput) String

func (s RetireGrantInput) String() string

String returns the string representation

type RetireGrantOutput

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

func (RetireGrantOutput) GoString

func (s RetireGrantOutput) GoString() string

GoString returns the string representation

func (RetireGrantOutput) String

func (s RetireGrantOutput) String() string

String returns the string representation

type RevokeGrantInput

type RevokeGrantInput struct {
	// Identifier of the grant to be revoked.
	GrantID *string `locationName:"GrantId" 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 *string `locationName:"KeyId" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (RevokeGrantInput) GoString

func (s RevokeGrantInput) GoString() string

GoString returns the string representation

func (RevokeGrantInput) String

func (s RevokeGrantInput) String() string

String returns the string representation

type RevokeGrantOutput

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

func (RevokeGrantOutput) GoString

func (s RevokeGrantOutput) GoString() string

GoString returns the string representation

func (RevokeGrantOutput) String

func (s RevokeGrantOutput) String() string

String returns the string representation

type UpdateAliasInput

type UpdateAliasInput struct {
	// String that contains the name of the alias to be modifed. The name must start
	// with the word "alias" followed by a forward slash (alias/). Aliases that
	// begin with "alias/AWS" are reserved.
	AliasName *string `type:"string" required:"true"`

	// Unique identifier of the customer master key to be associated with 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
	TargetKeyID *string `locationName:"TargetKeyId" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (UpdateAliasInput) GoString

func (s UpdateAliasInput) GoString() string

GoString returns the string representation

func (UpdateAliasInput) String

func (s UpdateAliasInput) String() string

String returns the string representation

type UpdateAliasOutput

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

func (UpdateAliasOutput) GoString

func (s UpdateAliasOutput) GoString() string

GoString returns the string representation

func (UpdateAliasOutput) String

func (s UpdateAliasOutput) String() string

String returns the string representation

type UpdateKeyDescriptionInput

type UpdateKeyDescriptionInput struct {
	// New description for the key.
	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 *string `locationName:"KeyId" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (UpdateKeyDescriptionInput) GoString

func (s UpdateKeyDescriptionInput) GoString() string

GoString returns the string representation

func (UpdateKeyDescriptionInput) String

func (s UpdateKeyDescriptionInput) String() string

String returns the string representation

type UpdateKeyDescriptionOutput

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

func (UpdateKeyDescriptionOutput) GoString

func (s UpdateKeyDescriptionOutput) GoString() string

GoString returns the string representation

func (UpdateKeyDescriptionOutput) String

String returns the string representation

Directories

Path Synopsis
Package kmsiface provides an interface for the AWS Key Management Service.
Package kmsiface provides an interface for the AWS Key Management Service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL