| 1 | |||
| 2 | package Paws::KMS::GenerateDataKey; | ||
| 3 | use Moose; | ||
| 4 | has EncryptionContext => (is => 'ro', isa => 'Paws::KMS::EncryptionContextType'); | ||
| 5 | has GrantTokens => (is => 'ro', isa => 'ArrayRef[Str|Undef]'); | ||
| 6 | has KeyId => (is => 'ro', isa => 'Str', required => 1); | ||
| 7 | has KeySpec => (is => 'ro', isa => 'Str'); | ||
| 8 | has NumberOfBytes => (is => 'ro', isa => 'Int'); | ||
| 9 | |||
| 10 | use MooseX::ClassAttribute; | ||
| 11 | |||
| 12 | class_has _api_call => (isa => 'Str', is => 'ro', default => 'GenerateDataKey'); | ||
| 13 | class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::KMS::GenerateDataKeyResponse'); | ||
| 14 | class_has _result_key => (isa => 'Str', is => 'ro'); | ||
| 15 | 1; | ||
| 16 | |||
| 17 | ### main pod documentation begin ### | ||
| 18 | |||
| 19 | =head1 NAME | ||
| 20 | |||
| 21 | Paws::KMS::GenerateDataKey - Arguments for method GenerateDataKey on L<Paws::KMS> | ||
| 22 | |||
| 23 | =head1 DESCRIPTION | ||
| 24 | |||
| 25 | This class represents the parameters used for calling the method GenerateDataKey on the | ||
| 26 | L<AWS Key Management Service|Paws::KMS> service. Use the attributes of this class | ||
| 27 | as arguments to method GenerateDataKey. | ||
| 28 | |||
| 29 | You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to GenerateDataKey. | ||
| 30 | |||
| 31 | =head1 SYNOPSIS | ||
| 32 | |||
| 33 | my $kms = Paws->service('KMS'); | ||
| 34 | # To generate a data key | ||
| 35 | # The following example generates a 256-bit symmetric data encryption key (data | ||
| 36 | # key) in two formats. One is the unencrypted (plainext) data key, and the other | ||
| 37 | # is the data key encrypted with the specified customer master key (CMK). | ||
| 38 | my $GenerateDataKeyResponse = $kms->GenerateDataKey( | ||
| 39 | 'KeyId' => 'alias/ExampleAlias', | ||
| 40 | 'KeySpec' => 'AES_256' | ||
| 41 | ); | ||
| 42 | |||
| 43 | # Results: | ||
| 44 | my $CiphertextBlob = $GenerateDataKeyResponse->CiphertextBlob; | ||
| 45 | my $KeyId = $GenerateDataKeyResponse->KeyId; | ||
| 46 | my $Plaintext = $GenerateDataKeyResponse->Plaintext; | ||
| 47 | |||
| 48 | # Returns a L<Paws::KMS::GenerateDataKeyResponse> object. | ||
| 49 | |||
| 50 | Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object. | ||
| 51 | For the AWS API documentation, see L<https://docs.aws.amazon.com/goto/WebAPI/kms/GenerateDataKey> | ||
| 52 | |||
| 53 | =head1 ATTRIBUTES | ||
| 54 | |||
| 55 | |||
| 56 | =head2 EncryptionContext => L<Paws::KMS::EncryptionContextType> | ||
| 57 | |||
| 58 | Specifies the encryption context that will be used when encrypting the | ||
| 59 | data key. | ||
| 60 | |||
| 61 | An I<encryption context> is a collection of non-secret key-value pairs | ||
| 62 | that represents additional authenticated data. When you use an | ||
| 63 | encryption context to encrypt data, you must specify the same (an exact | ||
| 64 | case-sensitive match) encryption context to decrypt the data. An | ||
| 65 | encryption context is optional when encrypting with a symmetric CMK, | ||
| 66 | but it is highly recommended. | ||
| 67 | |||
| 68 | For more information, see Encryption Context | ||
| 69 | (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) | ||
| 70 | in the I<AWS Key Management Service Developer Guide>. | ||
| 71 | |||
| 72 | |||
| 73 | |||
| 74 | =head2 GrantTokens => ArrayRef[Str|Undef] | ||
| 75 | |||
| 76 | A list of grant tokens. | ||
| 77 | |||
| 78 | Use a grant token when your permission to call this operation comes | ||
| 79 | from a new grant that has not yet achieved I<eventual consistency>. For | ||
| 80 | more information, see Grant token | ||
| 81 | (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token) | ||
| 82 | in the I<AWS Key Management Service Developer Guide>. | ||
| 83 | |||
| 84 | |||
| 85 | |||
| 86 | =head2 B<REQUIRED> KeyId => Str | ||
| 87 | |||
| 88 | Identifies the symmetric CMK that encrypts the data key. | ||
| 89 | |||
| 90 | To specify a CMK, use its key ID, key ARN, alias name, or alias ARN. | ||
| 91 | When using an alias name, prefix it with C<"alias/">. To specify a CMK | ||
| 92 | in a different AWS account, you must use the key ARN or alias ARN. | ||
| 93 | |||
| 94 | For example: | ||
| 95 | |||
| 96 | =over | ||
| 97 | |||
| 98 | =item * | ||
| 99 | |||
| 100 | Key ID: C<1234abcd-12ab-34cd-56ef-1234567890ab> | ||
| 101 | |||
| 102 | =item * | ||
| 103 | |||
| 104 | Key ARN: | ||
| 105 | C<arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab> | ||
| 106 | |||
| 107 | =item * | ||
| 108 | |||
| 109 | Alias name: C<alias/ExampleAlias> | ||
| 110 | |||
| 111 | =item * | ||
| 112 | |||
| 113 | Alias ARN: C<arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias> | ||
| 114 | |||
| 115 | =back | ||
| 116 | |||
| 117 | To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey. | ||
| 118 | To get the alias name and alias ARN, use ListAliases. | ||
| 119 | |||
| 120 | |||
| 121 | |||
| 122 | =head2 KeySpec => Str | ||
| 123 | |||
| 124 | Specifies the length of the data key. Use C<AES_128> to generate a | ||
| 125 | 128-bit symmetric key, or C<AES_256> to generate a 256-bit symmetric | ||
| 126 | key. | ||
| 127 | |||
| 128 | You must specify either the C<KeySpec> or the C<NumberOfBytes> | ||
| 129 | parameter (but not both) in every C<GenerateDataKey> request. | ||
| 130 | |||
| 131 | Valid values are: C<"AES_256">, C<"AES_128"> | ||
| 132 | |||
| 133 | =head2 NumberOfBytes => Int | ||
| 134 | |||
| 135 | Specifies the length of the data key in bytes. For example, use the | ||
| 136 | value 64 to generate a 512-bit data key (64 bytes is 512 bits). For | ||
| 137 | 128-bit (16-byte) and 256-bit (32-byte) data keys, use the C<KeySpec> | ||
| 138 | parameter. | ||
| 139 | |||
| 140 | You must specify either the C<KeySpec> or the C<NumberOfBytes> | ||
| 141 | parameter (but not both) in every C<GenerateDataKey> request. | ||
| 142 | |||
| 143 | |||
| 144 | |||
| 145 | |||
| 146 | =head1 SEE ALSO | ||
| 147 | |||
| 148 | This class forms part of L<Paws>, documenting arguments for method GenerateDataKey in L<Paws::KMS> | ||
| 149 | |||
| 150 | =head1 BUGS and CONTRIBUTIONS | ||
| 151 | |||
| 152 | The source code is located here: L<https://github.com/pplu/aws-sdk-perl> | ||
| 153 | |||
| 154 | Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues> | ||
| 155 | |||
| 156 | =cut | ||
| 157 |