aws-sdk-kms 1.0.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b550ddbb43764a42cccda6f4cc81bbd731970cfc
4
+ data.tar.gz: 988e4adcf959f4ec893ffce5261488fc47310271
5
+ SHA512:
6
+ metadata.gz: 8f305e6cd783332f432ab9e7e38a6a3166ddd9c598879f365c711433e8e8b571d9b94e96d12ba2819793d69ab8c685406a6a01aee6b5c36959978e95b9ce08f4
7
+ data.tar.gz: c59213a82532eb4790a60a7f4955861ad1d16f01e65e2b07ec5d98c17a72ccf5e7ecfda8605566cdc7d22150f9571fa4497eb6f3a93a4ea13b4303c0e0e8edce
@@ -0,0 +1,47 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing for info on making contributions:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
8
+ require 'aws-sdk-core'
9
+ require 'aws-sigv4'
10
+
11
+ require_relative 'aws-sdk-kms/types'
12
+ require_relative 'aws-sdk-kms/client_api'
13
+ require_relative 'aws-sdk-kms/client'
14
+ require_relative 'aws-sdk-kms/errors'
15
+ require_relative 'aws-sdk-kms/resource'
16
+ require_relative 'aws-sdk-kms/customizations'
17
+
18
+ # This module provides support for AWS Key Management Service. This module is available in the
19
+ # `aws-sdk-kms` gem.
20
+ #
21
+ # # Client
22
+ #
23
+ # The {Client} class provides one method for each API operation. Operation
24
+ # methods each accept a hash of request parameters and return a response
25
+ # structure.
26
+ #
27
+ # See {Client} for more information.
28
+ #
29
+ # # Errors
30
+ #
31
+ # Errors returned from AWS Key Management Service all
32
+ # extend {Errors::ServiceError}.
33
+ #
34
+ # begin
35
+ # # do stuff
36
+ # rescue Aws::KMS::Errors::ServiceError
37
+ # # rescues all service API errors
38
+ # end
39
+ #
40
+ # See {Errors} for more information.
41
+ #
42
+ # @service
43
+ module Aws::KMS
44
+
45
+ GEM_VERSION = '1.0.0.rc1'
46
+
47
+ end
@@ -0,0 +1,1959 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing for info on making contributions:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
8
+ require 'seahorse/client/plugins/content_length.rb'
9
+ require 'aws-sdk-core/plugins/credentials_configuration.rb'
10
+ require 'aws-sdk-core/plugins/logging.rb'
11
+ require 'aws-sdk-core/plugins/param_converter.rb'
12
+ require 'aws-sdk-core/plugins/param_validator.rb'
13
+ require 'aws-sdk-core/plugins/user_agent.rb'
14
+ require 'aws-sdk-core/plugins/helpful_socket_errors.rb'
15
+ require 'aws-sdk-core/plugins/retry_errors.rb'
16
+ require 'aws-sdk-core/plugins/global_configuration.rb'
17
+ require 'aws-sdk-core/plugins/regional_endpoint.rb'
18
+ require 'aws-sdk-core/plugins/response_paging.rb'
19
+ require 'aws-sdk-core/plugins/stub_responses.rb'
20
+ require 'aws-sdk-core/plugins/idempotency_token.rb'
21
+ require 'aws-sdk-core/plugins/signature_v4.rb'
22
+ require 'aws-sdk-core/plugins/protocols/json_rpc.rb'
23
+
24
+ Aws::Plugins::GlobalConfiguration.add_identifier(:kms)
25
+
26
+ module Aws
27
+ module KMS
28
+ class Client < Seahorse::Client::Base
29
+
30
+ include Aws::ClientStubs
31
+
32
+ @identifier = :kms
33
+
34
+ set_api(ClientApi::API)
35
+
36
+ add_plugin(Seahorse::Client::Plugins::ContentLength)
37
+ add_plugin(Aws::Plugins::CredentialsConfiguration)
38
+ add_plugin(Aws::Plugins::Logging)
39
+ add_plugin(Aws::Plugins::ParamConverter)
40
+ add_plugin(Aws::Plugins::ParamValidator)
41
+ add_plugin(Aws::Plugins::UserAgent)
42
+ add_plugin(Aws::Plugins::HelpfulSocketErrors)
43
+ add_plugin(Aws::Plugins::RetryErrors)
44
+ add_plugin(Aws::Plugins::GlobalConfiguration)
45
+ add_plugin(Aws::Plugins::RegionalEndpoint)
46
+ add_plugin(Aws::Plugins::ResponsePaging)
47
+ add_plugin(Aws::Plugins::StubResponses)
48
+ add_plugin(Aws::Plugins::IdempotencyToken)
49
+ add_plugin(Aws::Plugins::SignatureV4)
50
+ add_plugin(Aws::Plugins::Protocols::JsonRpc)
51
+
52
+ # @option options [required, Aws::CredentialProvider] :credentials
53
+ # Your AWS credentials. This can be an instance of any one of the
54
+ # following classes:
55
+ #
56
+ # * `Aws::Credentials` - Used for configuring static, non-refreshing
57
+ # credentials.
58
+ #
59
+ # * `Aws::InstanceProfileCredentials` - Used for loading credentials
60
+ # from an EC2 IMDS on an EC2 instance.
61
+ #
62
+ # * `Aws::SharedCredentials` - Used for loading credentials from a
63
+ # shared file, such as `~/.aws/config`.
64
+ #
65
+ # * `Aws::AssumeRoleCredentials` - Used when you need to assume a role.
66
+ #
67
+ # When `:credentials` are not configured directly, the following
68
+ # locations will be searched for credentials:
69
+ #
70
+ # * `Aws.config[:credentials]`
71
+ # * The `:access_key_id`, `:secret_access_key`, and `:session_token` options.
72
+ # * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
73
+ # * `~/.aws/credentials`
74
+ # * `~/.aws/config`
75
+ # * EC2 IMDS instance profile - When used by default, the timeouts are
76
+ # very aggressive. Construct and pass an instance of
77
+ # `Aws::InstanceProfileCredentails` to enable retries and extended
78
+ # timeouts.
79
+ # @option options [required, String] :region
80
+ # The AWS region to connect to. The configured `:region` is
81
+ # used to determine the service `:endpoint`. When not passed,
82
+ # a default `:region` is search for in the following locations:
83
+ #
84
+ # * `Aws.config[:region]`
85
+ # * `ENV['AWS_REGION']`
86
+ # * `ENV['AMAZON_REGION']`
87
+ # * `ENV['AWS_DEFAULT_REGION']`
88
+ # * `~/.aws/credentials`
89
+ # * `~/.aws/config`
90
+ # @option options [String] :access_key_id
91
+ # @option options [Boolean] :convert_params (true)
92
+ # When `true`, an attempt is made to coerce request parameters into
93
+ # the required types.
94
+ # @option options [String] :endpoint
95
+ # The client endpoint is normally constructed from the `:region`
96
+ # option. You should only configure an `:endpoint` when connecting
97
+ # to test endpoints. This should be avalid HTTP(S) URI.
98
+ # @option options [Aws::Log::Formatter] :log_formatter (Aws::Log::Formatter.default)
99
+ # The log formatter.
100
+ # @option options [Symbol] :log_level (:info)
101
+ # The log level to send messages to the `:logger` at.
102
+ # @option options [Logger] :logger
103
+ # The Logger instance to send log messages to. If this option
104
+ # is not set, logging will be disabled.
105
+ # @option options [String] :profile ("default")
106
+ # Used when loading credentials from the shared credentials file
107
+ # at HOME/.aws/credentials. When not specified, 'default' is used.
108
+ # @option options [Integer] :retry_limit (3)
109
+ # The maximum number of times to retry failed requests. Only
110
+ # ~ 500 level server errors and certain ~ 400 level client errors
111
+ # are retried. Generally, these are throttling errors, data
112
+ # checksum errors, networking errors, timeout errors and auth
113
+ # errors from expired credentials.
114
+ # @option options [String] :secret_access_key
115
+ # @option options [String] :session_token
116
+ # @option options [Boolean] :simple_json (false)
117
+ # Disables request parameter conversion, validation, and formatting.
118
+ # Also disable response data type conversions. This option is useful
119
+ # when you want to ensure the highest level of performance by
120
+ # avoiding overhead of walking request parameters and response data
121
+ # structures.
122
+ #
123
+ # When `:simple_json` is enabled, the request parameters hash must
124
+ # be formatted exactly as the DynamoDB API expects.
125
+ # @option options [Boolean] :stub_responses (false)
126
+ # Causes the client to return stubbed responses. By default
127
+ # fake responses are generated and returned. You can specify
128
+ # the response data to return or errors to raise by calling
129
+ # {ClientStubs#stub_responses}. See {ClientStubs} for more information.
130
+ #
131
+ # ** Please note ** When response stubbing is enabled, no HTTP
132
+ # requests are made, and retries are disabled.
133
+ # @option options [Boolean] :validate_params (true)
134
+ # When `true`, request parameters are validated before
135
+ # sending the request.
136
+ def initialize(*args)
137
+ super
138
+ end
139
+
140
+ # @!group API Operations
141
+
142
+ # Cancels the deletion of a customer master key (CMK). When this
143
+ # operation is successful, the CMK is set to the `Disabled` state. To
144
+ # enable a CMK, use EnableKey.
145
+ #
146
+ # For more information about scheduling and canceling deletion of a CMK,
147
+ # see [Deleting Customer Master Keys][1] in the *AWS Key Management
148
+ # Service Developer Guide*.
149
+ #
150
+ #
151
+ #
152
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/deleting-keys.html
153
+ # @option params [required, String] :key_id
154
+ # The unique identifier for the customer master key (CMK) for which to
155
+ # cancel deletion.
156
+ #
157
+ # To specify this value, use the unique key ID or the Amazon Resource
158
+ # Name (ARN) of the CMK. Examples:
159
+ #
160
+ # * Unique key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
161
+ #
162
+ # * Key ARN:
163
+ # arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
164
+ #
165
+ # To obtain the unique key ID and key ARN for a given CMK, use ListKeys
166
+ # or DescribeKey.
167
+ # @return [Types::CancelKeyDeletionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
168
+ #
169
+ # * {Types::CancelKeyDeletionResponse#key_id #KeyId} => String
170
+ #
171
+ # @example Request syntax with placeholder values
172
+ # resp = client.cancel_key_deletion({
173
+ # key_id: "KeyIdType", # required
174
+ # })
175
+ #
176
+ # @example Response structure
177
+ # resp.key_id #=> String
178
+ # @overload cancel_key_deletion(params = {})
179
+ # @param [Hash] params ({})
180
+ def cancel_key_deletion(params = {}, options = {})
181
+ req = build_request(:cancel_key_deletion, params)
182
+ req.send_request(options)
183
+ end
184
+
185
+ # Creates a display name for a customer master key. An alias can be used
186
+ # to identify a key and should be unique. The console enforces a
187
+ # one-to-one mapping between the alias and a key. An alias name can
188
+ # contain only alphanumeric characters, forward slashes (/), underscores
189
+ # (\_), and dashes (-). An alias must start with the word "alias"
190
+ # followed by a forward slash (alias/). An alias that begins with
191
+ # "aws" after the forward slash (alias/aws...) is reserved by Amazon
192
+ # Web Services (AWS).
193
+ #
194
+ # The alias and the key it is mapped to must be in the same AWS account
195
+ # and the same region.
196
+ #
197
+ # To map an alias to a different key, call UpdateAlias.
198
+ # @option params [required, String] :alias_name
199
+ # String that contains the display name. The name must start with the
200
+ # word "alias" followed by a forward slash (alias/). Aliases that
201
+ # begin with "alias/AWS" are reserved.
202
+ # @option params [required, String] :target_key_id
203
+ # An identifier of the key for which you are creating the alias. This
204
+ # value cannot be another alias but can be a globally unique identifier
205
+ # or a fully specified ARN to a key.
206
+ #
207
+ # * Key ARN Example -
208
+ # arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
209
+ #
210
+ # * Globally Unique Key ID Example -
211
+ # 12345678-1234-1234-1234-123456789012
212
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
213
+ #
214
+ # @example Request syntax with placeholder values
215
+ # resp = client.create_alias({
216
+ # alias_name: "AliasNameType", # required
217
+ # target_key_id: "KeyIdType", # required
218
+ # })
219
+ # @overload create_alias(params = {})
220
+ # @param [Hash] params ({})
221
+ def create_alias(params = {}, options = {})
222
+ req = build_request(:create_alias, params)
223
+ req.send_request(options)
224
+ end
225
+
226
+ # Adds a grant to a key to specify who can use the key and under what
227
+ # conditions. Grants are alternate permission mechanisms to key
228
+ # policies.
229
+ #
230
+ # For more information about grants, see [Grants][1] in the *AWS Key
231
+ # Management Service Developer Guide*.
232
+ #
233
+ #
234
+ #
235
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/grants.html
236
+ # @option params [required, String] :key_id
237
+ # The unique identifier for the customer master key (CMK) that the grant
238
+ # applies to.
239
+ #
240
+ # To specify this value, use the globally unique key ID or the Amazon
241
+ # Resource Name (ARN) of the key. Examples:
242
+ #
243
+ # * Globally unique key ID: 12345678-1234-1234-1234-123456789012
244
+ #
245
+ # * Key ARN:
246
+ # arn:aws:kms:us-west-2:123456789012:key/12345678-1234-1234-1234-123456789012
247
+ # @option params [required, String] :grantee_principal
248
+ # The principal that is given permission to perform the operations that
249
+ # the grant permits.
250
+ #
251
+ # To specify the principal, use the [Amazon Resource Name (ARN)][1] of
252
+ # an AWS principal. Valid AWS principals include AWS accounts (root),
253
+ # IAM users, federated users, and assumed role users. For examples of
254
+ # the ARN syntax to use for specifying a principal, see [AWS Identity
255
+ # and Access Management (IAM)][2] in the Example ARNs section of the
256
+ # *AWS General Reference*.
257
+ #
258
+ #
259
+ #
260
+ # [1]: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
261
+ # [2]: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-iam
262
+ # @option params [String] :retiring_principal
263
+ # The principal that is given permission to retire the grant by using
264
+ # RetireGrant operation.
265
+ #
266
+ # To specify the principal, use the [Amazon Resource Name (ARN)][1] of
267
+ # an AWS principal. Valid AWS principals include AWS accounts (root),
268
+ # IAM users, federated users, and assumed role users. For examples of
269
+ # the ARN syntax to use for specifying a principal, see [AWS Identity
270
+ # and Access Management (IAM)][2] in the Example ARNs section of the
271
+ # *AWS General Reference*.
272
+ #
273
+ #
274
+ #
275
+ # [1]: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
276
+ # [2]: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-iam
277
+ # @option params [Array<String>] :operations
278
+ # A list of operations that the grant permits. The list can contain any
279
+ # combination of one or more of the following values:
280
+ #
281
+ # * Decrypt
282
+ #
283
+ # * Encrypt
284
+ #
285
+ # * GenerateDataKey
286
+ #
287
+ # * GenerateDataKeyWithoutPlaintext
288
+ #
289
+ # * [ReEncryptFrom][1]
290
+ #
291
+ # * [ReEncryptTo][1]
292
+ #
293
+ # * CreateGrant
294
+ #
295
+ # * RetireGrant
296
+ #
297
+ # * DescribeKey
298
+ #
299
+ #
300
+ #
301
+ # [1]: http://docs.aws.amazon.com/kms/latest/APIReference/API_ReEncrypt.html
302
+ # @option params [Types::GrantConstraints] :constraints
303
+ # The conditions under which the operations permitted by the grant are
304
+ # allowed.
305
+ #
306
+ # You can use this value to allow the operations permitted by the grant
307
+ # only when a specified encryption context is present. For more
308
+ # information, see [Encryption Context][1] in the *AWS Key Management
309
+ # Service Developer Guide*.
310
+ #
311
+ #
312
+ #
313
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html
314
+ # @option params [Array<String>] :grant_tokens
315
+ # A list of grant tokens.
316
+ #
317
+ # For more information, see [Grant Tokens][1] in the *AWS Key Management
318
+ # Service Developer Guide*.
319
+ #
320
+ #
321
+ #
322
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token
323
+ # @option params [String] :name
324
+ # A friendly name for identifying the grant. Use this value to prevent
325
+ # unintended creation of duplicate grants when retrying this request.
326
+ #
327
+ # When this value is absent, all `CreateGrant` requests result in a new
328
+ # grant with a unique `GrantId` even if all the supplied parameters are
329
+ # identical. This can result in unintended duplicates when you retry the
330
+ # `CreateGrant` request.
331
+ #
332
+ # When this value is present, you can retry a `CreateGrant` request with
333
+ # identical parameters; if the grant already exists, the original
334
+ # `GrantId` is returned without creating a new grant. Note that the
335
+ # returned grant token is unique with every `CreateGrant` request, even
336
+ # when a duplicate `GrantId` is returned. All grant tokens obtained in
337
+ # this way can be used interchangeably.
338
+ # @return [Types::CreateGrantResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
339
+ #
340
+ # * {Types::CreateGrantResponse#grant_token #GrantToken} => String
341
+ # * {Types::CreateGrantResponse#grant_id #GrantId} => String
342
+ #
343
+ # @example Request syntax with placeholder values
344
+ # resp = client.create_grant({
345
+ # key_id: "KeyIdType", # required
346
+ # grantee_principal: "PrincipalIdType", # required
347
+ # retiring_principal: "PrincipalIdType",
348
+ # operations: ["Decrypt"], # accepts Decrypt, Encrypt, GenerateDataKey, GenerateDataKeyWithoutPlaintext, ReEncryptFrom, ReEncryptTo, CreateGrant, RetireGrant, DescribeKey
349
+ # constraints: {
350
+ # encryption_context_subset: {
351
+ # "EncryptionContextKey" => "EncryptionContextValue",
352
+ # },
353
+ # encryption_context_equals: {
354
+ # "EncryptionContextKey" => "EncryptionContextValue",
355
+ # },
356
+ # },
357
+ # grant_tokens: ["GrantTokenType"],
358
+ # name: "GrantNameType",
359
+ # })
360
+ #
361
+ # @example Response structure
362
+ # resp.grant_token #=> String
363
+ # resp.grant_id #=> String
364
+ # @overload create_grant(params = {})
365
+ # @param [Hash] params ({})
366
+ def create_grant(params = {}, options = {})
367
+ req = build_request(:create_grant, params)
368
+ req.send_request(options)
369
+ end
370
+
371
+ # Creates a customer master key (CMK).
372
+ #
373
+ # You can use a CMK to encrypt small amounts of data (4 KiB or less)
374
+ # directly, but CMKs are more commonly used to encrypt data encryption
375
+ # keys (DEKs), which are used to encrypt raw data. For more information
376
+ # about DEKs and the difference between CMKs and DEKs, see the
377
+ # following:
378
+ #
379
+ # * The GenerateDataKey operation
380
+ #
381
+ # * [AWS Key Management Service Concepts][1] in the *AWS Key Management
382
+ # Service Developer Guide*
383
+ #
384
+ #
385
+ #
386
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html
387
+ # @option params [String] :policy
388
+ # The key policy to attach to the CMK.
389
+ #
390
+ # If you specify a policy and do not set
391
+ # `BypassPolicyLockoutSafetyCheck` to true, the policy must meet the
392
+ # following criteria:
393
+ #
394
+ # * It must allow the principal making the `CreateKey` request to make a
395
+ # subsequent PutKeyPolicy request on the CMK. This reduces the
396
+ # likelihood that the CMK becomes unmanageable. For more information,
397
+ # refer to the scenario in the [Default Key Policy][1] section in the
398
+ # *AWS Key Management Service Developer Guide*.
399
+ #
400
+ # * The principal(s) specified in the key policy must exist and be
401
+ # visible to AWS KMS. When you create a new AWS principal (for
402
+ # example, an IAM user or role), you might need to enforce a delay
403
+ # before specifying the new principal in a key policy because the new
404
+ # principal might not immediately be visible to AWS KMS. For more
405
+ # information, see [Changes that I make are not always immediately
406
+ # visible][2] in the *IAM User Guide*.
407
+ #
408
+ # If you do not specify a policy, AWS KMS attaches a default key policy
409
+ # to the CMK. For more information, see [Default Key Policy][3] in the
410
+ # *AWS Key Management Service Developer Guide*.
411
+ #
412
+ # The policy size limit is 32 KiB (32768 bytes).
413
+ #
414
+ #
415
+ #
416
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam
417
+ # [2]: http://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency
418
+ # [3]: http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default
419
+ # @option params [String] :description
420
+ # A description of the CMK.
421
+ #
422
+ # Use a description that helps you decide whether the CMK is appropriate
423
+ # for a task.
424
+ # @option params [String] :key_usage
425
+ # The intended use of the CMK.
426
+ #
427
+ # You can use CMKs only for symmetric encryption and decryption.
428
+ # @option params [String] :origin
429
+ # The source of the CMK's key material.
430
+ #
431
+ # The default is `AWS_KMS`, which means AWS KMS creates the key
432
+ # material. When this parameter is set to `EXTERNAL`, the request
433
+ # creates a CMK without key material so that you can import key material
434
+ # from your existing key management infrastructure. For more information
435
+ # about importing key material into AWS KMS, see [Importing Key
436
+ # Material][1] in the *AWS Key Management Service Developer Guide*.
437
+ #
438
+ # The CMK's `Origin` is immutable and is set when the CMK is created.
439
+ #
440
+ #
441
+ #
442
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html
443
+ # @option params [Boolean] :bypass_policy_lockout_safety_check
444
+ # A flag to indicate whether to bypass the key policy lockout safety
445
+ # check.
446
+ #
447
+ # Setting this value to true increases the likelihood that the CMK
448
+ # becomes unmanageable. Do not set this value to true indiscriminately.
449
+ #
450
+ # For more information, refer to the scenario in the [Default Key
451
+ # Policy][1] section in the *AWS Key Management Service Developer
452
+ # Guide*.
453
+ #
454
+ # Use this parameter only when you include a policy in the request and
455
+ # you intend to prevent the principal making the request from making a
456
+ # subsequent PutKeyPolicy request on the CMK.
457
+ #
458
+ # The default value is false.
459
+ #
460
+ #
461
+ #
462
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam
463
+ # @return [Types::CreateKeyResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
464
+ #
465
+ # * {Types::CreateKeyResponse#key_metadata #KeyMetadata} => Types::KeyMetadata
466
+ #
467
+ # @example Request syntax with placeholder values
468
+ # resp = client.create_key({
469
+ # policy: "PolicyType",
470
+ # description: "DescriptionType",
471
+ # key_usage: "ENCRYPT_DECRYPT", # accepts ENCRYPT_DECRYPT
472
+ # origin: "AWS_KMS", # accepts AWS_KMS, EXTERNAL
473
+ # bypass_policy_lockout_safety_check: false,
474
+ # })
475
+ #
476
+ # @example Response structure
477
+ # resp.key_metadata.aws_account_id #=> String
478
+ # resp.key_metadata.key_id #=> String
479
+ # resp.key_metadata.arn #=> String
480
+ # resp.key_metadata.creation_date #=> Time
481
+ # resp.key_metadata.enabled #=> Boolean
482
+ # resp.key_metadata.description #=> String
483
+ # resp.key_metadata.key_usage #=> String, one of "ENCRYPT_DECRYPT"
484
+ # resp.key_metadata.key_state #=> String, one of "Enabled", "Disabled", "PendingDeletion", "PendingImport"
485
+ # resp.key_metadata.deletion_date #=> Time
486
+ # resp.key_metadata.valid_to #=> Time
487
+ # resp.key_metadata.origin #=> String, one of "AWS_KMS", "EXTERNAL"
488
+ # resp.key_metadata.expiration_model #=> String, one of "KEY_MATERIAL_EXPIRES", "KEY_MATERIAL_DOES_NOT_EXPIRE"
489
+ # @overload create_key(params = {})
490
+ # @param [Hash] params ({})
491
+ def create_key(params = {}, options = {})
492
+ req = build_request(:create_key, params)
493
+ req.send_request(options)
494
+ end
495
+
496
+ # Decrypts ciphertext. Ciphertext is plaintext that has been previously
497
+ # encrypted by using any of the following functions:
498
+ #
499
+ # * GenerateDataKey
500
+ #
501
+ # * GenerateDataKeyWithoutPlaintext
502
+ #
503
+ # * Encrypt
504
+ #
505
+ # Note that if a caller has been granted access permissions to all keys
506
+ # (through, for example, IAM user policies that grant `Decrypt`
507
+ # permission on all resources), then ciphertext encrypted by using keys
508
+ # in other accounts where the key grants access to the caller can be
509
+ # decrypted. To remedy this, we recommend that you do not grant
510
+ # `Decrypt` access in an IAM user policy. Instead grant `Decrypt` access
511
+ # only in key policies. If you must grant `Decrypt` access in an IAM
512
+ # user policy, you should scope the resource to specific keys or to
513
+ # specific trusted accounts.
514
+ # @option params [required, String, IO] :ciphertext_blob
515
+ # Ciphertext to be decrypted. The blob includes metadata.
516
+ # @option params [Hash<String,String>] :encryption_context
517
+ # The encryption context. If this was specified in the Encrypt function,
518
+ # it must be specified here or the decryption operation will fail. For
519
+ # more information, see [Encryption Context][1].
520
+ #
521
+ #
522
+ #
523
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html
524
+ # @option params [Array<String>] :grant_tokens
525
+ # A list of grant tokens.
526
+ #
527
+ # For more information, see [Grant Tokens][1] in the *AWS Key Management
528
+ # Service Developer Guide*.
529
+ #
530
+ #
531
+ #
532
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token
533
+ # @return [Types::DecryptResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
534
+ #
535
+ # * {Types::DecryptResponse#key_id #KeyId} => String
536
+ # * {Types::DecryptResponse#plaintext #Plaintext} => String
537
+ #
538
+ # @example Request syntax with placeholder values
539
+ # resp = client.decrypt({
540
+ # ciphertext_blob: "data", # required
541
+ # encryption_context: {
542
+ # "EncryptionContextKey" => "EncryptionContextValue",
543
+ # },
544
+ # grant_tokens: ["GrantTokenType"],
545
+ # })
546
+ #
547
+ # @example Response structure
548
+ # resp.key_id #=> String
549
+ # resp.plaintext #=> String
550
+ # @overload decrypt(params = {})
551
+ # @param [Hash] params ({})
552
+ def decrypt(params = {}, options = {})
553
+ req = build_request(:decrypt, params)
554
+ req.send_request(options)
555
+ end
556
+
557
+ # Deletes the specified alias. To map an alias to a different key, call
558
+ # UpdateAlias.
559
+ # @option params [required, String] :alias_name
560
+ # The alias to be deleted. The name must start with the word "alias"
561
+ # followed by a forward slash (alias/). Aliases that begin with
562
+ # "alias/AWS" are reserved.
563
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
564
+ #
565
+ # @example Request syntax with placeholder values
566
+ # resp = client.delete_alias({
567
+ # alias_name: "AliasNameType", # required
568
+ # })
569
+ # @overload delete_alias(params = {})
570
+ # @param [Hash] params ({})
571
+ def delete_alias(params = {}, options = {})
572
+ req = build_request(:delete_alias, params)
573
+ req.send_request(options)
574
+ end
575
+
576
+ # Deletes key material that you previously imported and makes the
577
+ # specified customer master key (CMK) unusable. For more information
578
+ # about importing key material into AWS KMS, see [Importing Key
579
+ # Material][1] in the *AWS Key Management Service Developer Guide*.
580
+ #
581
+ # When the specified CMK is in the `PendingDeletion` state, this
582
+ # operation does not change the CMK's state. Otherwise, it changes the
583
+ # CMK's state to `PendingImport`.
584
+ #
585
+ # After you delete key material, you can use ImportKeyMaterial to
586
+ # reimport the same key material into the CMK.
587
+ #
588
+ #
589
+ #
590
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html
591
+ # @option params [required, String] :key_id
592
+ # The identifier of the CMK whose key material to delete. The CMK's
593
+ # `Origin` must be `EXTERNAL`.
594
+ #
595
+ # A valid identifier is the unique key ID or the Amazon Resource Name
596
+ # (ARN) of the CMK. Examples:
597
+ #
598
+ # * Unique key ID: `1234abcd-12ab-34cd-56ef-1234567890ab`
599
+ #
600
+ # * Key ARN:
601
+ # `arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab`
602
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
603
+ #
604
+ # @example Request syntax with placeholder values
605
+ # resp = client.delete_imported_key_material({
606
+ # key_id: "KeyIdType", # required
607
+ # })
608
+ # @overload delete_imported_key_material(params = {})
609
+ # @param [Hash] params ({})
610
+ def delete_imported_key_material(params = {}, options = {})
611
+ req = build_request(:delete_imported_key_material, params)
612
+ req.send_request(options)
613
+ end
614
+
615
+ # Provides detailed information about the specified customer master key.
616
+ # @option params [required, String] :key_id
617
+ # A unique identifier for the customer master key. This value can be a
618
+ # globally unique identifier, a fully specified ARN to either an alias
619
+ # or a key, or an alias name prefixed by "alias/".
620
+ #
621
+ # * Key ARN Example -
622
+ # arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
623
+ #
624
+ # * Alias ARN Example -
625
+ # arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
626
+ #
627
+ # * Globally Unique Key ID Example -
628
+ # 12345678-1234-1234-1234-123456789012
629
+ #
630
+ # * Alias Name Example - alias/MyAliasName
631
+ # @option params [Array<String>] :grant_tokens
632
+ # A list of grant tokens.
633
+ #
634
+ # For more information, see [Grant Tokens][1] in the *AWS Key Management
635
+ # Service Developer Guide*.
636
+ #
637
+ #
638
+ #
639
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token
640
+ # @return [Types::DescribeKeyResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
641
+ #
642
+ # * {Types::DescribeKeyResponse#key_metadata #KeyMetadata} => Types::KeyMetadata
643
+ #
644
+ # @example Request syntax with placeholder values
645
+ # resp = client.describe_key({
646
+ # key_id: "KeyIdType", # required
647
+ # grant_tokens: ["GrantTokenType"],
648
+ # })
649
+ #
650
+ # @example Response structure
651
+ # resp.key_metadata.aws_account_id #=> String
652
+ # resp.key_metadata.key_id #=> String
653
+ # resp.key_metadata.arn #=> String
654
+ # resp.key_metadata.creation_date #=> Time
655
+ # resp.key_metadata.enabled #=> Boolean
656
+ # resp.key_metadata.description #=> String
657
+ # resp.key_metadata.key_usage #=> String, one of "ENCRYPT_DECRYPT"
658
+ # resp.key_metadata.key_state #=> String, one of "Enabled", "Disabled", "PendingDeletion", "PendingImport"
659
+ # resp.key_metadata.deletion_date #=> Time
660
+ # resp.key_metadata.valid_to #=> Time
661
+ # resp.key_metadata.origin #=> String, one of "AWS_KMS", "EXTERNAL"
662
+ # resp.key_metadata.expiration_model #=> String, one of "KEY_MATERIAL_EXPIRES", "KEY_MATERIAL_DOES_NOT_EXPIRE"
663
+ # @overload describe_key(params = {})
664
+ # @param [Hash] params ({})
665
+ def describe_key(params = {}, options = {})
666
+ req = build_request(:describe_key, params)
667
+ req.send_request(options)
668
+ end
669
+
670
+ # Sets the state of a customer master key (CMK) to disabled, thereby
671
+ # preventing its use for cryptographic operations. For more information
672
+ # about how key state affects the use of a CMK, see [How Key State
673
+ # Affects the Use of a Customer Master Key][1] in the *AWS Key
674
+ # Management Service Developer Guide*.
675
+ #
676
+ #
677
+ #
678
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
679
+ # @option params [required, String] :key_id
680
+ # A unique identifier for the CMK.
681
+ #
682
+ # Use the CMK's unique identifier or its Amazon Resource Name (ARN).
683
+ # For example:
684
+ #
685
+ # * Unique ID: 1234abcd-12ab-34cd-56ef-1234567890ab
686
+ #
687
+ # * ARN:
688
+ # arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
689
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
690
+ #
691
+ # @example Request syntax with placeholder values
692
+ # resp = client.disable_key({
693
+ # key_id: "KeyIdType", # required
694
+ # })
695
+ # @overload disable_key(params = {})
696
+ # @param [Hash] params ({})
697
+ def disable_key(params = {}, options = {})
698
+ req = build_request(:disable_key, params)
699
+ req.send_request(options)
700
+ end
701
+
702
+ # Disables rotation of the specified key.
703
+ # @option params [required, String] :key_id
704
+ # A unique identifier for the customer master key. This value can be a
705
+ # globally unique identifier or the fully specified ARN to a key.
706
+ #
707
+ # * Key ARN Example -
708
+ # arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
709
+ #
710
+ # * Globally Unique Key ID Example -
711
+ # 12345678-1234-1234-1234-123456789012
712
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
713
+ #
714
+ # @example Request syntax with placeholder values
715
+ # resp = client.disable_key_rotation({
716
+ # key_id: "KeyIdType", # required
717
+ # })
718
+ # @overload disable_key_rotation(params = {})
719
+ # @param [Hash] params ({})
720
+ def disable_key_rotation(params = {}, options = {})
721
+ req = build_request(:disable_key_rotation, params)
722
+ req.send_request(options)
723
+ end
724
+
725
+ # Marks a key as enabled, thereby permitting its use.
726
+ # @option params [required, String] :key_id
727
+ # A unique identifier for the customer master key. This value can be a
728
+ # globally unique identifier or the fully specified ARN to a key.
729
+ #
730
+ # * Key ARN Example -
731
+ # arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
732
+ #
733
+ # * Globally Unique Key ID Example -
734
+ # 12345678-1234-1234-1234-123456789012
735
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
736
+ #
737
+ # @example Request syntax with placeholder values
738
+ # resp = client.enable_key({
739
+ # key_id: "KeyIdType", # required
740
+ # })
741
+ # @overload enable_key(params = {})
742
+ # @param [Hash] params ({})
743
+ def enable_key(params = {}, options = {})
744
+ req = build_request(:enable_key, params)
745
+ req.send_request(options)
746
+ end
747
+
748
+ # Enables rotation of the specified customer master key.
749
+ # @option params [required, String] :key_id
750
+ # A unique identifier for the customer master key. This value can be a
751
+ # globally unique identifier or the fully specified ARN to a key.
752
+ #
753
+ # * Key ARN Example -
754
+ # arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
755
+ #
756
+ # * Globally Unique Key ID Example -
757
+ # 12345678-1234-1234-1234-123456789012
758
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
759
+ #
760
+ # @example Request syntax with placeholder values
761
+ # resp = client.enable_key_rotation({
762
+ # key_id: "KeyIdType", # required
763
+ # })
764
+ # @overload enable_key_rotation(params = {})
765
+ # @param [Hash] params ({})
766
+ def enable_key_rotation(params = {}, options = {})
767
+ req = build_request(:enable_key_rotation, params)
768
+ req.send_request(options)
769
+ end
770
+
771
+ # Encrypts plaintext into ciphertext by using a customer master key. The
772
+ # `Encrypt` function has two primary use cases:
773
+ #
774
+ # * You can encrypt up to 4 KB of arbitrary data such as an RSA key, a
775
+ # database password, or other sensitive customer information.
776
+ #
777
+ # * If you are moving encrypted data from one region to another, you can
778
+ # use this API to encrypt in the new region the plaintext data key
779
+ # that was used to encrypt the data in the original region. This
780
+ # provides you with an encrypted copy of the data key that can be
781
+ # decrypted in the new region and used there to decrypt the encrypted
782
+ # data.
783
+ #
784
+ # Unless you are moving encrypted data from one region to another, you
785
+ # don't use this function to encrypt a generated data key within a
786
+ # region. You retrieve data keys already encrypted by calling the
787
+ # GenerateDataKey or GenerateDataKeyWithoutPlaintext function. Data keys
788
+ # don't need to be encrypted again by calling `Encrypt`.
789
+ #
790
+ # If you want to encrypt data locally in your application, you can use
791
+ # the `GenerateDataKey` function to return a plaintext data encryption
792
+ # key and a copy of the key encrypted under the customer master key
793
+ # (CMK) of your choosing.
794
+ # @option params [required, String] :key_id
795
+ # A unique identifier for the customer master key. This value can be a
796
+ # globally unique identifier, a fully specified ARN to either an alias
797
+ # or a key, or an alias name prefixed by "alias/".
798
+ #
799
+ # * Key ARN Example -
800
+ # arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
801
+ #
802
+ # * Alias ARN Example -
803
+ # arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
804
+ #
805
+ # * Globally Unique Key ID Example -
806
+ # 12345678-1234-1234-1234-123456789012
807
+ #
808
+ # * Alias Name Example - alias/MyAliasName
809
+ # @option params [required, String, IO] :plaintext
810
+ # Data to be encrypted.
811
+ # @option params [Hash<String,String>] :encryption_context
812
+ # Name-value pair that specifies the encryption context to be used for
813
+ # authenticated encryption. If used here, the same value must be
814
+ # supplied to the `Decrypt` API or decryption will fail. For more
815
+ # information, see [Encryption Context][1].
816
+ #
817
+ #
818
+ #
819
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html
820
+ # @option params [Array<String>] :grant_tokens
821
+ # A list of grant tokens.
822
+ #
823
+ # For more information, see [Grant Tokens][1] in the *AWS Key Management
824
+ # Service Developer Guide*.
825
+ #
826
+ #
827
+ #
828
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token
829
+ # @return [Types::EncryptResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
830
+ #
831
+ # * {Types::EncryptResponse#ciphertext_blob #CiphertextBlob} => String
832
+ # * {Types::EncryptResponse#key_id #KeyId} => String
833
+ #
834
+ # @example Request syntax with placeholder values
835
+ # resp = client.encrypt({
836
+ # key_id: "KeyIdType", # required
837
+ # plaintext: "data", # required
838
+ # encryption_context: {
839
+ # "EncryptionContextKey" => "EncryptionContextValue",
840
+ # },
841
+ # grant_tokens: ["GrantTokenType"],
842
+ # })
843
+ #
844
+ # @example Response structure
845
+ # resp.ciphertext_blob #=> String
846
+ # resp.key_id #=> String
847
+ # @overload encrypt(params = {})
848
+ # @param [Hash] params ({})
849
+ def encrypt(params = {}, options = {})
850
+ req = build_request(:encrypt, params)
851
+ req.send_request(options)
852
+ end
853
+
854
+ # Returns a data encryption key that you can use in your application to
855
+ # encrypt data locally.
856
+ #
857
+ # You must specify the customer master key (CMK) under which to generate
858
+ # the data key. You must also specify the length of the data key using
859
+ # either the `KeySpec` or `NumberOfBytes` field. You must specify one
860
+ # field or the other, but not both. For common key lengths (128-bit and
861
+ # 256-bit symmetric keys), we recommend that you use `KeySpec`.
862
+ #
863
+ # This operation returns a plaintext copy of the data key in the
864
+ # `Plaintext` field of the response, and an encrypted copy of the data
865
+ # key in the `CiphertextBlob` field. The data key is encrypted under the
866
+ # CMK specified in the `KeyId` field of the request.
867
+ #
868
+ # We recommend that you use the following pattern to encrypt data
869
+ # locally in your application:
870
+ #
871
+ # 1. Use this operation (`GenerateDataKey`) to retrieve a data
872
+ # encryption key.
873
+ #
874
+ # 2. Use the plaintext data encryption key (returned in the `Plaintext`
875
+ # field of the response) to encrypt data locally, then erase the
876
+ # plaintext data key from memory.
877
+ #
878
+ # 3. Store the encrypted data key (returned in the `CiphertextBlob`
879
+ # field of the response) alongside the locally encrypted data.
880
+ #
881
+ # To decrypt data locally:
882
+ #
883
+ # 1. Use the Decrypt operation to decrypt the encrypted data key into a
884
+ # plaintext copy of the data key.
885
+ #
886
+ # 2. Use the plaintext data key to decrypt data locally, then erase the
887
+ # plaintext data key from memory.
888
+ #
889
+ # To return only an encrypted copy of the data key, use
890
+ # GenerateDataKeyWithoutPlaintext. To return an arbitrary unpredictable
891
+ # byte string, use GenerateRandom.
892
+ #
893
+ # If you use the optional `EncryptionContext` field, you must store at
894
+ # least enough information to be able to reconstruct the full encryption
895
+ # context when you later send the ciphertext to the Decrypt operation.
896
+ # It is a good practice to choose an encryption context that you can
897
+ # reconstruct on the fly to better secure the ciphertext. For more
898
+ # information, see [Encryption Context][1] in the *AWS Key Management
899
+ # Service Developer Guide*.
900
+ #
901
+ #
902
+ #
903
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html
904
+ # @option params [required, String] :key_id
905
+ # The identifier of the CMK under which to generate and encrypt the data
906
+ # encryption key.
907
+ #
908
+ # A valid identifier is the unique key ID or the Amazon Resource Name
909
+ # (ARN) of the CMK, or the alias name or ARN of an alias that points to
910
+ # the CMK. Examples:
911
+ #
912
+ # * Unique key ID: `1234abcd-12ab-34cd-56ef-1234567890ab`
913
+ #
914
+ # * CMK ARN:
915
+ # `arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab`
916
+ #
917
+ # * Alias name: `alias/ExampleAlias`
918
+ #
919
+ # * Alias ARN: `arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias`
920
+ # @option params [Hash<String,String>] :encryption_context
921
+ # A set of key-value pairs that represents additional authenticated
922
+ # data.
923
+ #
924
+ # For more information, see [Encryption Context][1] in the *AWS Key
925
+ # Management Service Developer Guide*.
926
+ #
927
+ #
928
+ #
929
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html
930
+ # @option params [Integer] :number_of_bytes
931
+ # The length of the data encryption key in bytes. For example, use the
932
+ # value 64 to generate a 512-bit data key (64 bytes is 512 bits). For
933
+ # common key lengths (128-bit and 256-bit symmetric keys), we recommend
934
+ # that you use the `KeySpec` field instead of this one.
935
+ # @option params [String] :key_spec
936
+ # The length of the data encryption key. Use `AES_128` to generate a
937
+ # 128-bit symmetric key, or `AES_256` to generate a 256-bit symmetric
938
+ # key.
939
+ # @option params [Array<String>] :grant_tokens
940
+ # A list of grant tokens.
941
+ #
942
+ # For more information, see [Grant Tokens][1] in the *AWS Key Management
943
+ # Service Developer Guide*.
944
+ #
945
+ #
946
+ #
947
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token
948
+ # @return [Types::GenerateDataKeyResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
949
+ #
950
+ # * {Types::GenerateDataKeyResponse#ciphertext_blob #CiphertextBlob} => String
951
+ # * {Types::GenerateDataKeyResponse#plaintext #Plaintext} => String
952
+ # * {Types::GenerateDataKeyResponse#key_id #KeyId} => String
953
+ #
954
+ # @example Request syntax with placeholder values
955
+ # resp = client.generate_data_key({
956
+ # key_id: "KeyIdType", # required
957
+ # encryption_context: {
958
+ # "EncryptionContextKey" => "EncryptionContextValue",
959
+ # },
960
+ # number_of_bytes: 1,
961
+ # key_spec: "AES_256", # accepts AES_256, AES_128
962
+ # grant_tokens: ["GrantTokenType"],
963
+ # })
964
+ #
965
+ # @example Response structure
966
+ # resp.ciphertext_blob #=> String
967
+ # resp.plaintext #=> String
968
+ # resp.key_id #=> String
969
+ # @overload generate_data_key(params = {})
970
+ # @param [Hash] params ({})
971
+ def generate_data_key(params = {}, options = {})
972
+ req = build_request(:generate_data_key, params)
973
+ req.send_request(options)
974
+ end
975
+
976
+ # Returns a data encryption key encrypted under a customer master key
977
+ # (CMK). This operation is identical to GenerateDataKey but returns only
978
+ # the encrypted copy of the data key.
979
+ #
980
+ # This operation is useful in a system that has multiple components with
981
+ # different degrees of trust. For example, consider a system that stores
982
+ # encrypted data in containers. Each container stores the encrypted data
983
+ # and an encrypted copy of the data key. One component of the system,
984
+ # called the *control plane*, creates new containers. When it creates a
985
+ # new container, it uses this operation
986
+ # (`GenerateDataKeyWithoutPlaintext`) to get an encrypted data key and
987
+ # then stores it in the container. Later, a different component of the
988
+ # system, called the *data plane*, puts encrypted data into the
989
+ # containers. To do this, it passes the encrypted data key to the
990
+ # Decrypt operation, then uses the returned plaintext data key to
991
+ # encrypt data, and finally stores the encrypted data in the container.
992
+ # In this system, the control plane never sees the plaintext data key.
993
+ # @option params [required, String] :key_id
994
+ # The identifier of the CMK under which to generate and encrypt the data
995
+ # encryption key.
996
+ #
997
+ # A valid identifier is the unique key ID or the Amazon Resource Name
998
+ # (ARN) of the CMK, or the alias name or ARN of an alias that points to
999
+ # the CMK. Examples:
1000
+ #
1001
+ # * Unique key ID: `1234abcd-12ab-34cd-56ef-1234567890ab`
1002
+ #
1003
+ # * CMK ARN:
1004
+ # `arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab`
1005
+ #
1006
+ # * Alias name: `alias/ExampleAlias`
1007
+ #
1008
+ # * Alias ARN: `arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias`
1009
+ # @option params [Hash<String,String>] :encryption_context
1010
+ # A set of key-value pairs that represents additional authenticated
1011
+ # data.
1012
+ #
1013
+ # For more information, see [Encryption Context][1] in the *AWS Key
1014
+ # Management Service Developer Guide*.
1015
+ #
1016
+ #
1017
+ #
1018
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html
1019
+ # @option params [String] :key_spec
1020
+ # The length of the data encryption key. Use `AES_128` to generate a
1021
+ # 128-bit symmetric key, or `AES_256` to generate a 256-bit symmetric
1022
+ # key.
1023
+ # @option params [Integer] :number_of_bytes
1024
+ # The length of the data encryption key in bytes. For example, use the
1025
+ # value 64 to generate a 512-bit data key (64 bytes is 512 bits). For
1026
+ # common key lengths (128-bit and 256-bit symmetric keys), we recommend
1027
+ # that you use the `KeySpec` field instead of this one.
1028
+ # @option params [Array<String>] :grant_tokens
1029
+ # A list of grant tokens.
1030
+ #
1031
+ # For more information, see [Grant Tokens][1] in the *AWS Key Management
1032
+ # Service Developer Guide*.
1033
+ #
1034
+ #
1035
+ #
1036
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token
1037
+ # @return [Types::GenerateDataKeyWithoutPlaintextResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
1038
+ #
1039
+ # * {Types::GenerateDataKeyWithoutPlaintextResponse#ciphertext_blob #CiphertextBlob} => String
1040
+ # * {Types::GenerateDataKeyWithoutPlaintextResponse#key_id #KeyId} => String
1041
+ #
1042
+ # @example Request syntax with placeholder values
1043
+ # resp = client.generate_data_key_without_plaintext({
1044
+ # key_id: "KeyIdType", # required
1045
+ # encryption_context: {
1046
+ # "EncryptionContextKey" => "EncryptionContextValue",
1047
+ # },
1048
+ # key_spec: "AES_256", # accepts AES_256, AES_128
1049
+ # number_of_bytes: 1,
1050
+ # grant_tokens: ["GrantTokenType"],
1051
+ # })
1052
+ #
1053
+ # @example Response structure
1054
+ # resp.ciphertext_blob #=> String
1055
+ # resp.key_id #=> String
1056
+ # @overload generate_data_key_without_plaintext(params = {})
1057
+ # @param [Hash] params ({})
1058
+ def generate_data_key_without_plaintext(params = {}, options = {})
1059
+ req = build_request(:generate_data_key_without_plaintext, params)
1060
+ req.send_request(options)
1061
+ end
1062
+
1063
+ # Generates an unpredictable byte string.
1064
+ # @option params [Integer] :number_of_bytes
1065
+ # The length of the byte string.
1066
+ # @return [Types::GenerateRandomResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
1067
+ #
1068
+ # * {Types::GenerateRandomResponse#plaintext #Plaintext} => String
1069
+ #
1070
+ # @example Request syntax with placeholder values
1071
+ # resp = client.generate_random({
1072
+ # number_of_bytes: 1,
1073
+ # })
1074
+ #
1075
+ # @example Response structure
1076
+ # resp.plaintext #=> String
1077
+ # @overload generate_random(params = {})
1078
+ # @param [Hash] params ({})
1079
+ def generate_random(params = {}, options = {})
1080
+ req = build_request(:generate_random, params)
1081
+ req.send_request(options)
1082
+ end
1083
+
1084
+ # Retrieves a policy attached to the specified key.
1085
+ # @option params [required, String] :key_id
1086
+ # A unique identifier for the customer master key. This value can be a
1087
+ # globally unique identifier or the fully specified ARN to a key.
1088
+ #
1089
+ # * Key ARN Example -
1090
+ # arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
1091
+ #
1092
+ # * Globally Unique Key ID Example -
1093
+ # 12345678-1234-1234-1234-123456789012
1094
+ # @option params [required, String] :policy_name
1095
+ # String that contains the name of the policy. Currently, this must be
1096
+ # "default". Policy names can be discovered by calling
1097
+ # ListKeyPolicies.
1098
+ # @return [Types::GetKeyPolicyResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
1099
+ #
1100
+ # * {Types::GetKeyPolicyResponse#policy #Policy} => String
1101
+ #
1102
+ # @example Request syntax with placeholder values
1103
+ # resp = client.get_key_policy({
1104
+ # key_id: "KeyIdType", # required
1105
+ # policy_name: "PolicyNameType", # required
1106
+ # })
1107
+ #
1108
+ # @example Response structure
1109
+ # resp.policy #=> String
1110
+ # @overload get_key_policy(params = {})
1111
+ # @param [Hash] params ({})
1112
+ def get_key_policy(params = {}, options = {})
1113
+ req = build_request(:get_key_policy, params)
1114
+ req.send_request(options)
1115
+ end
1116
+
1117
+ # Retrieves a Boolean value that indicates whether key rotation is
1118
+ # enabled for the specified key.
1119
+ # @option params [required, String] :key_id
1120
+ # A unique identifier for the customer master key. This value can be a
1121
+ # globally unique identifier or the fully specified ARN to a key.
1122
+ #
1123
+ # * Key ARN Example -
1124
+ # arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
1125
+ #
1126
+ # * Globally Unique Key ID Example -
1127
+ # 12345678-1234-1234-1234-123456789012
1128
+ # @return [Types::GetKeyRotationStatusResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
1129
+ #
1130
+ # * {Types::GetKeyRotationStatusResponse#key_rotation_enabled #KeyRotationEnabled} => Boolean
1131
+ #
1132
+ # @example Request syntax with placeholder values
1133
+ # resp = client.get_key_rotation_status({
1134
+ # key_id: "KeyIdType", # required
1135
+ # })
1136
+ #
1137
+ # @example Response structure
1138
+ # resp.key_rotation_enabled #=> Boolean
1139
+ # @overload get_key_rotation_status(params = {})
1140
+ # @param [Hash] params ({})
1141
+ def get_key_rotation_status(params = {}, options = {})
1142
+ req = build_request(:get_key_rotation_status, params)
1143
+ req.send_request(options)
1144
+ end
1145
+
1146
+ # Returns the items you need in order to import key material into AWS
1147
+ # KMS from your existing key management infrastructure. For more
1148
+ # information about importing key material into AWS KMS, see [Importing
1149
+ # Key Material][1] in the *AWS Key Management Service Developer Guide*.
1150
+ #
1151
+ # You must specify the key ID of the customer master key (CMK) into
1152
+ # which you will import key material. This CMK's `Origin` must be
1153
+ # `EXTERNAL`. You must also specify the wrapping algorithm and type of
1154
+ # wrapping key (public key) that you will use to encrypt the key
1155
+ # material.
1156
+ #
1157
+ # This operation returns a public key and an import token. Use the
1158
+ # public key to encrypt the key material. Store the import token to send
1159
+ # with a subsequent ImportKeyMaterial request. The public key and import
1160
+ # token from the same response must be used together. These items are
1161
+ # valid for 24 hours, after which they cannot be used for a subsequent
1162
+ # ImportKeyMaterial request. To retrieve new ones, send another
1163
+ # `GetParametersForImport` request.
1164
+ #
1165
+ #
1166
+ #
1167
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html
1168
+ # @option params [required, String] :key_id
1169
+ # The identifier of the CMK into which you will import key material. The
1170
+ # CMK's `Origin` must be `EXTERNAL`.
1171
+ #
1172
+ # A valid identifier is the unique key ID or the Amazon Resource Name
1173
+ # (ARN) of the CMK. Examples:
1174
+ #
1175
+ # * Unique key ID: `1234abcd-12ab-34cd-56ef-1234567890ab`
1176
+ #
1177
+ # * Key ARN:
1178
+ # `arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab`
1179
+ # @option params [required, String] :wrapping_algorithm
1180
+ # The algorithm you will use to encrypt the key material before
1181
+ # importing it with ImportKeyMaterial. For more information, see
1182
+ # [Encrypt the Key Material][1] in the *AWS Key Management Service
1183
+ # Developer Guide*.
1184
+ #
1185
+ #
1186
+ #
1187
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-encrypt-key-material.html
1188
+ # @option params [required, String] :wrapping_key_spec
1189
+ # The type of wrapping key (public key) to return in the response. Only
1190
+ # 2048-bit RSA public keys are supported.
1191
+ # @return [Types::GetParametersForImportResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
1192
+ #
1193
+ # * {Types::GetParametersForImportResponse#key_id #KeyId} => String
1194
+ # * {Types::GetParametersForImportResponse#import_token #ImportToken} => String
1195
+ # * {Types::GetParametersForImportResponse#public_key #PublicKey} => String
1196
+ # * {Types::GetParametersForImportResponse#parameters_valid_to #ParametersValidTo} => Time
1197
+ #
1198
+ # @example Request syntax with placeholder values
1199
+ # resp = client.get_parameters_for_import({
1200
+ # key_id: "KeyIdType", # required
1201
+ # wrapping_algorithm: "RSAES_PKCS1_V1_5", # required, accepts RSAES_PKCS1_V1_5, RSAES_OAEP_SHA_1, RSAES_OAEP_SHA_256
1202
+ # wrapping_key_spec: "RSA_2048", # required, accepts RSA_2048
1203
+ # })
1204
+ #
1205
+ # @example Response structure
1206
+ # resp.key_id #=> String
1207
+ # resp.import_token #=> String
1208
+ # resp.public_key #=> String
1209
+ # resp.parameters_valid_to #=> Time
1210
+ # @overload get_parameters_for_import(params = {})
1211
+ # @param [Hash] params ({})
1212
+ def get_parameters_for_import(params = {}, options = {})
1213
+ req = build_request(:get_parameters_for_import, params)
1214
+ req.send_request(options)
1215
+ end
1216
+
1217
+ # Imports key material into an AWS KMS customer master key (CMK) from
1218
+ # your existing key management infrastructure. For more information
1219
+ # about importing key material into AWS KMS, see [Importing Key
1220
+ # Material][1] in the *AWS Key Management Service Developer Guide*.
1221
+ #
1222
+ # You must specify the key ID of the CMK to import the key material
1223
+ # into. This CMK's `Origin` must be `EXTERNAL`. You must also send an
1224
+ # import token and the encrypted key material. Send the import token
1225
+ # that you received in the same GetParametersForImport response that
1226
+ # contained the public key that you used to encrypt the key material.
1227
+ # You must also specify whether the key material expires and if so,
1228
+ # when. When the key material expires, AWS KMS deletes the key material
1229
+ # and the CMK becomes unusable. To use the CMK again, you can reimport
1230
+ # the same key material. If you set an expiration date, you can change
1231
+ # it only by reimporting the same key material and specifying a new
1232
+ # expiration date.
1233
+ #
1234
+ # When this operation is successful, the specified CMK's key state
1235
+ # changes to `Enabled`, and you can use the CMK.
1236
+ #
1237
+ # After you successfully import key material into a CMK, you can
1238
+ # reimport the same key material into that CMK, but you cannot import
1239
+ # different key material.
1240
+ #
1241
+ #
1242
+ #
1243
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html
1244
+ # @option params [required, String] :key_id
1245
+ # The identifier of the CMK to import the key material into. The CMK's
1246
+ # `Origin` must be `EXTERNAL`.
1247
+ #
1248
+ # A valid identifier is the unique key ID or the Amazon Resource Name
1249
+ # (ARN) of the CMK. Examples:
1250
+ #
1251
+ # * Unique key ID: `1234abcd-12ab-34cd-56ef-1234567890ab`
1252
+ #
1253
+ # * Key ARN:
1254
+ # `arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab`
1255
+ # @option params [required, String, IO] :import_token
1256
+ # The import token that you received in the response to a previous
1257
+ # GetParametersForImport request. It must be from the same response that
1258
+ # contained the public key that you used to encrypt the key material.
1259
+ # @option params [required, String, IO] :encrypted_key_material
1260
+ # The encrypted key material to import. It must be encrypted with the
1261
+ # public key that you received in the response to a previous
1262
+ # GetParametersForImport request, using the wrapping algorithm that you
1263
+ # specified in that request.
1264
+ # @option params [Time,DateTime,Date,Integer,String] :valid_to
1265
+ # The time at which the imported key material expires. When the key
1266
+ # material expires, AWS KMS deletes the key material and the CMK becomes
1267
+ # unusable. You must omit this parameter when the `ExpirationModel`
1268
+ # parameter is set to `KEY_MATERIAL_DOES_NOT_EXPIRE`. Otherwise it is
1269
+ # required.
1270
+ # @option params [String] :expiration_model
1271
+ # Specifies whether the key material expires. The default is
1272
+ # `KEY_MATERIAL_EXPIRES`, in which case you must include the `ValidTo`
1273
+ # parameter. When this parameter is set to
1274
+ # `KEY_MATERIAL_DOES_NOT_EXPIRE`, you must omit the `ValidTo` parameter.
1275
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
1276
+ #
1277
+ # @example Request syntax with placeholder values
1278
+ # resp = client.import_key_material({
1279
+ # key_id: "KeyIdType", # required
1280
+ # import_token: "data", # required
1281
+ # encrypted_key_material: "data", # required
1282
+ # valid_to: Time.now,
1283
+ # expiration_model: "KEY_MATERIAL_EXPIRES", # accepts KEY_MATERIAL_EXPIRES, KEY_MATERIAL_DOES_NOT_EXPIRE
1284
+ # })
1285
+ # @overload import_key_material(params = {})
1286
+ # @param [Hash] params ({})
1287
+ def import_key_material(params = {}, options = {})
1288
+ req = build_request(:import_key_material, params)
1289
+ req.send_request(options)
1290
+ end
1291
+
1292
+ # Lists all of the key aliases in the account.
1293
+ # @option params [Integer] :limit
1294
+ # When paginating results, specify the maximum number of items to return
1295
+ # in the response. If additional items exist beyond the number you
1296
+ # specify, the `Truncated` element in the response is set to true.
1297
+ #
1298
+ # This value is optional. If you include a value, it must be between 1
1299
+ # and 100, inclusive. If you do not include a value, it defaults to 50.
1300
+ # @option params [String] :marker
1301
+ # Use this parameter only when paginating results and only in a
1302
+ # subsequent request after you receive a response with truncated
1303
+ # results. Set it to the value of `NextMarker` from the response you
1304
+ # just received.
1305
+ # @return [Types::ListAliasesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
1306
+ #
1307
+ # * {Types::ListAliasesResponse#aliases #Aliases} => Array&lt;Types::AliasListEntry&gt;
1308
+ # * {Types::ListAliasesResponse#next_marker #NextMarker} => String
1309
+ # * {Types::ListAliasesResponse#truncated #Truncated} => Boolean
1310
+ #
1311
+ # @example Request syntax with placeholder values
1312
+ # resp = client.list_aliases({
1313
+ # limit: 1,
1314
+ # marker: "MarkerType",
1315
+ # })
1316
+ #
1317
+ # @example Response structure
1318
+ # resp.aliases #=> Array
1319
+ # resp.aliases[0].alias_name #=> String
1320
+ # resp.aliases[0].alias_arn #=> String
1321
+ # resp.aliases[0].target_key_id #=> String
1322
+ # resp.next_marker #=> String
1323
+ # resp.truncated #=> Boolean
1324
+ # @overload list_aliases(params = {})
1325
+ # @param [Hash] params ({})
1326
+ def list_aliases(params = {}, options = {})
1327
+ req = build_request(:list_aliases, params)
1328
+ req.send_request(options)
1329
+ end
1330
+
1331
+ # List the grants for a specified key.
1332
+ # @option params [Integer] :limit
1333
+ # When paginating results, specify the maximum number of items to return
1334
+ # in the response. If additional items exist beyond the number you
1335
+ # specify, the `Truncated` element in the response is set to true.
1336
+ #
1337
+ # This value is optional. If you include a value, it must be between 1
1338
+ # and 100, inclusive. If you do not include a value, it defaults to 50.
1339
+ # @option params [String] :marker
1340
+ # Use this parameter only when paginating results and only in a
1341
+ # subsequent request after you receive a response with truncated
1342
+ # results. Set it to the value of `NextMarker` from the response you
1343
+ # just received.
1344
+ # @option params [required, String] :key_id
1345
+ # A unique identifier for the customer master key. This value can be a
1346
+ # globally unique identifier or the fully specified ARN to a key.
1347
+ #
1348
+ # * Key ARN Example -
1349
+ # arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
1350
+ #
1351
+ # * Globally Unique Key ID Example -
1352
+ # 12345678-1234-1234-1234-123456789012
1353
+ # @return [Types::ListGrantsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
1354
+ #
1355
+ # * {Types::ListGrantsResponse#grants #Grants} => Array&lt;Types::GrantListEntry&gt;
1356
+ # * {Types::ListGrantsResponse#next_marker #NextMarker} => String
1357
+ # * {Types::ListGrantsResponse#truncated #Truncated} => Boolean
1358
+ #
1359
+ # @example Request syntax with placeholder values
1360
+ # resp = client.list_grants({
1361
+ # limit: 1,
1362
+ # marker: "MarkerType",
1363
+ # key_id: "KeyIdType", # required
1364
+ # })
1365
+ #
1366
+ # @example Response structure
1367
+ # resp.grants #=> Array
1368
+ # resp.grants[0].key_id #=> String
1369
+ # resp.grants[0].grant_id #=> String
1370
+ # resp.grants[0].name #=> String
1371
+ # resp.grants[0].creation_date #=> Time
1372
+ # resp.grants[0].grantee_principal #=> String
1373
+ # resp.grants[0].retiring_principal #=> String
1374
+ # resp.grants[0].issuing_account #=> String
1375
+ # resp.grants[0].operations #=> Array
1376
+ # resp.grants[0].operations[0] #=> String, one of "Decrypt", "Encrypt", "GenerateDataKey", "GenerateDataKeyWithoutPlaintext", "ReEncryptFrom", "ReEncryptTo", "CreateGrant", "RetireGrant", "DescribeKey"
1377
+ # resp.grants[0].constraints.encryption_context_subset #=> Hash
1378
+ # resp.grants[0].constraints.encryption_context_subset["EncryptionContextKey"] #=> String
1379
+ # resp.grants[0].constraints.encryption_context_equals #=> Hash
1380
+ # resp.grants[0].constraints.encryption_context_equals["EncryptionContextKey"] #=> String
1381
+ # resp.next_marker #=> String
1382
+ # resp.truncated #=> Boolean
1383
+ # @overload list_grants(params = {})
1384
+ # @param [Hash] params ({})
1385
+ def list_grants(params = {}, options = {})
1386
+ req = build_request(:list_grants, params)
1387
+ req.send_request(options)
1388
+ end
1389
+
1390
+ # Retrieves a list of policies attached to a key.
1391
+ # @option params [required, String] :key_id
1392
+ # A unique identifier for the customer master key. This value can be a
1393
+ # globally unique identifier, a fully specified ARN to either an alias
1394
+ # or a key, or an alias name prefixed by "alias/".
1395
+ #
1396
+ # * Key ARN Example -
1397
+ # arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
1398
+ #
1399
+ # * Alias ARN Example -
1400
+ # arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
1401
+ #
1402
+ # * Globally Unique Key ID Example -
1403
+ # 12345678-1234-1234-1234-123456789012
1404
+ #
1405
+ # * Alias Name Example - alias/MyAliasName
1406
+ # @option params [Integer] :limit
1407
+ # When paginating results, specify the maximum number of items to return
1408
+ # in the response. If additional items exist beyond the number you
1409
+ # specify, the `Truncated` element in the response is set to true.
1410
+ #
1411
+ # This value is optional. If you include a value, it must be between 1
1412
+ # and 1000, inclusive. If you do not include a value, it defaults to
1413
+ # 100.
1414
+ #
1415
+ # Currently only 1 policy can be attached to a key.
1416
+ # @option params [String] :marker
1417
+ # Use this parameter only when paginating results and only in a
1418
+ # subsequent request after you receive a response with truncated
1419
+ # results. Set it to the value of `NextMarker` from the response you
1420
+ # just received.
1421
+ # @return [Types::ListKeyPoliciesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
1422
+ #
1423
+ # * {Types::ListKeyPoliciesResponse#policy_names #PolicyNames} => Array&lt;String&gt;
1424
+ # * {Types::ListKeyPoliciesResponse#next_marker #NextMarker} => String
1425
+ # * {Types::ListKeyPoliciesResponse#truncated #Truncated} => Boolean
1426
+ #
1427
+ # @example Request syntax with placeholder values
1428
+ # resp = client.list_key_policies({
1429
+ # key_id: "KeyIdType", # required
1430
+ # limit: 1,
1431
+ # marker: "MarkerType",
1432
+ # })
1433
+ #
1434
+ # @example Response structure
1435
+ # resp.policy_names #=> Array
1436
+ # resp.policy_names[0] #=> String
1437
+ # resp.next_marker #=> String
1438
+ # resp.truncated #=> Boolean
1439
+ # @overload list_key_policies(params = {})
1440
+ # @param [Hash] params ({})
1441
+ def list_key_policies(params = {}, options = {})
1442
+ req = build_request(:list_key_policies, params)
1443
+ req.send_request(options)
1444
+ end
1445
+
1446
+ # Lists the customer master keys.
1447
+ # @option params [Integer] :limit
1448
+ # When paginating results, specify the maximum number of items to return
1449
+ # in the response. If additional items exist beyond the number you
1450
+ # specify, the `Truncated` element in the response is set to true.
1451
+ #
1452
+ # This value is optional. If you include a value, it must be between 1
1453
+ # and 1000, inclusive. If you do not include a value, it defaults to
1454
+ # 100.
1455
+ # @option params [String] :marker
1456
+ # Use this parameter only when paginating results and only in a
1457
+ # subsequent request after you receive a response with truncated
1458
+ # results. Set it to the value of `NextMarker` from the response you
1459
+ # just received.
1460
+ # @return [Types::ListKeysResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
1461
+ #
1462
+ # * {Types::ListKeysResponse#keys #Keys} => Array&lt;Types::KeyListEntry&gt;
1463
+ # * {Types::ListKeysResponse#next_marker #NextMarker} => String
1464
+ # * {Types::ListKeysResponse#truncated #Truncated} => Boolean
1465
+ #
1466
+ # @example Request syntax with placeholder values
1467
+ # resp = client.list_keys({
1468
+ # limit: 1,
1469
+ # marker: "MarkerType",
1470
+ # })
1471
+ #
1472
+ # @example Response structure
1473
+ # resp.keys #=> Array
1474
+ # resp.keys[0].key_id #=> String
1475
+ # resp.keys[0].key_arn #=> String
1476
+ # resp.next_marker #=> String
1477
+ # resp.truncated #=> Boolean
1478
+ # @overload list_keys(params = {})
1479
+ # @param [Hash] params ({})
1480
+ def list_keys(params = {}, options = {})
1481
+ req = build_request(:list_keys, params)
1482
+ req.send_request(options)
1483
+ end
1484
+
1485
+ # Returns a list of all grants for which the grant's
1486
+ # `RetiringPrincipal` matches the one specified.
1487
+ #
1488
+ # A typical use is to list all grants that you are able to retire. To
1489
+ # retire a grant, use RetireGrant.
1490
+ # @option params [Integer] :limit
1491
+ # When paginating results, specify the maximum number of items to return
1492
+ # in the response. If additional items exist beyond the number you
1493
+ # specify, the `Truncated` element in the response is set to true.
1494
+ #
1495
+ # This value is optional. If you include a value, it must be between 1
1496
+ # and 100, inclusive. If you do not include a value, it defaults to 50.
1497
+ # @option params [String] :marker
1498
+ # Use this parameter only when paginating results and only in a
1499
+ # subsequent request after you receive a response with truncated
1500
+ # results. Set it to the value of `NextMarker` from the response you
1501
+ # just received.
1502
+ # @option params [required, String] :retiring_principal
1503
+ # The retiring principal for which to list grants.
1504
+ #
1505
+ # To specify the retiring principal, use the [Amazon Resource Name
1506
+ # (ARN)][1] of an AWS principal. Valid AWS principals include AWS
1507
+ # accounts (root), IAM users, federated users, and assumed role users.
1508
+ # For examples of the ARN syntax for specifying a principal, see [AWS
1509
+ # Identity and Access Management (IAM)][2] in the Example ARNs section
1510
+ # of the *Amazon Web Services General Reference*.
1511
+ #
1512
+ #
1513
+ #
1514
+ # [1]: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
1515
+ # [2]: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-iam
1516
+ # @return [Types::ListGrantsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
1517
+ #
1518
+ # * {Types::ListGrantsResponse#grants #Grants} => Array&lt;Types::GrantListEntry&gt;
1519
+ # * {Types::ListGrantsResponse#next_marker #NextMarker} => String
1520
+ # * {Types::ListGrantsResponse#truncated #Truncated} => Boolean
1521
+ #
1522
+ # @example Request syntax with placeholder values
1523
+ # resp = client.list_retirable_grants({
1524
+ # limit: 1,
1525
+ # marker: "MarkerType",
1526
+ # retiring_principal: "PrincipalIdType", # required
1527
+ # })
1528
+ #
1529
+ # @example Response structure
1530
+ # resp.grants #=> Array
1531
+ # resp.grants[0].key_id #=> String
1532
+ # resp.grants[0].grant_id #=> String
1533
+ # resp.grants[0].name #=> String
1534
+ # resp.grants[0].creation_date #=> Time
1535
+ # resp.grants[0].grantee_principal #=> String
1536
+ # resp.grants[0].retiring_principal #=> String
1537
+ # resp.grants[0].issuing_account #=> String
1538
+ # resp.grants[0].operations #=> Array
1539
+ # resp.grants[0].operations[0] #=> String, one of "Decrypt", "Encrypt", "GenerateDataKey", "GenerateDataKeyWithoutPlaintext", "ReEncryptFrom", "ReEncryptTo", "CreateGrant", "RetireGrant", "DescribeKey"
1540
+ # resp.grants[0].constraints.encryption_context_subset #=> Hash
1541
+ # resp.grants[0].constraints.encryption_context_subset["EncryptionContextKey"] #=> String
1542
+ # resp.grants[0].constraints.encryption_context_equals #=> Hash
1543
+ # resp.grants[0].constraints.encryption_context_equals["EncryptionContextKey"] #=> String
1544
+ # resp.next_marker #=> String
1545
+ # resp.truncated #=> Boolean
1546
+ # @overload list_retirable_grants(params = {})
1547
+ # @param [Hash] params ({})
1548
+ def list_retirable_grants(params = {}, options = {})
1549
+ req = build_request(:list_retirable_grants, params)
1550
+ req.send_request(options)
1551
+ end
1552
+
1553
+ # Attaches a key policy to the specified customer master key (CMK).
1554
+ #
1555
+ # For more information about key policies, see [Key Policies][1] in the
1556
+ # *AWS Key Management Service Developer Guide*.
1557
+ #
1558
+ #
1559
+ #
1560
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html
1561
+ # @option params [required, String] :key_id
1562
+ # A unique identifier for the CMK.
1563
+ #
1564
+ # Use the CMK's unique identifier or its Amazon Resource Name (ARN).
1565
+ # For example:
1566
+ #
1567
+ # * Unique ID: 1234abcd-12ab-34cd-56ef-1234567890ab
1568
+ #
1569
+ # * ARN:
1570
+ # arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
1571
+ # @option params [required, String] :policy_name
1572
+ # The name of the key policy.
1573
+ #
1574
+ # This value must be `default`.
1575
+ # @option params [required, String] :policy
1576
+ # The key policy to attach to the CMK.
1577
+ #
1578
+ # If you do not set `BypassPolicyLockoutSafetyCheck` to true, the policy
1579
+ # must meet the following criteria:
1580
+ #
1581
+ # * It must allow the principal making the `PutKeyPolicy` request to
1582
+ # make a subsequent `PutKeyPolicy` request on the CMK. This reduces
1583
+ # the likelihood that the CMK becomes unmanageable. For more
1584
+ # information, refer to the scenario in the [Default Key Policy][1]
1585
+ # section in the *AWS Key Management Service Developer Guide*.
1586
+ #
1587
+ # * The principal(s) specified in the key policy must exist and be
1588
+ # visible to AWS KMS. When you create a new AWS principal (for
1589
+ # example, an IAM user or role), you might need to enforce a delay
1590
+ # before specifying the new principal in a key policy because the new
1591
+ # principal might not immediately be visible to AWS KMS. For more
1592
+ # information, see [Changes that I make are not always immediately
1593
+ # visible][2] in the *IAM User Guide*.
1594
+ #
1595
+ # The policy size limit is 32 KiB (32768 bytes).
1596
+ #
1597
+ #
1598
+ #
1599
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam
1600
+ # [2]: http://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency
1601
+ # @option params [Boolean] :bypass_policy_lockout_safety_check
1602
+ # A flag to indicate whether to bypass the key policy lockout safety
1603
+ # check.
1604
+ #
1605
+ # Setting this value to true increases the likelihood that the CMK
1606
+ # becomes unmanageable. Do not set this value to true indiscriminately.
1607
+ #
1608
+ # For more information, refer to the scenario in the [Default Key
1609
+ # Policy][1] section in the *AWS Key Management Service Developer
1610
+ # Guide*.
1611
+ #
1612
+ # Use this parameter only when you intend to prevent the principal
1613
+ # making the request from making a subsequent `PutKeyPolicy` request on
1614
+ # the CMK.
1615
+ #
1616
+ # The default value is false.
1617
+ #
1618
+ #
1619
+ #
1620
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam
1621
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
1622
+ #
1623
+ # @example Request syntax with placeholder values
1624
+ # resp = client.put_key_policy({
1625
+ # key_id: "KeyIdType", # required
1626
+ # policy_name: "PolicyNameType", # required
1627
+ # policy: "PolicyType", # required
1628
+ # bypass_policy_lockout_safety_check: false,
1629
+ # })
1630
+ # @overload put_key_policy(params = {})
1631
+ # @param [Hash] params ({})
1632
+ def put_key_policy(params = {}, options = {})
1633
+ req = build_request(:put_key_policy, params)
1634
+ req.send_request(options)
1635
+ end
1636
+
1637
+ # Encrypts data on the server side with a new customer master key
1638
+ # without exposing the plaintext of the data on the client side. The
1639
+ # data is first decrypted and then encrypted. This operation can also be
1640
+ # used to change the encryption context of a ciphertext.
1641
+ #
1642
+ # Unlike other actions, `ReEncrypt` is authorized twice - once as
1643
+ # `ReEncryptFrom` on the source key and once as `ReEncryptTo` on the
1644
+ # destination key. We therefore recommend that you include the
1645
+ # `"action":"kms:ReEncrypt*"` statement in your key policies to permit
1646
+ # re-encryption from or to the key. The statement is included
1647
+ # automatically when you authorize use of the key through the console
1648
+ # but must be included manually when you set a policy by using the
1649
+ # PutKeyPolicy function.
1650
+ # @option params [required, String, IO] :ciphertext_blob
1651
+ # Ciphertext of the data to re-encrypt.
1652
+ # @option params [Hash<String,String>] :source_encryption_context
1653
+ # Encryption context used to encrypt and decrypt the data specified in
1654
+ # the `CiphertextBlob` parameter.
1655
+ # @option params [required, String] :destination_key_id
1656
+ # A unique identifier for the customer master key used to re-encrypt the
1657
+ # data. This value can be a globally unique identifier, a fully
1658
+ # specified ARN to either an alias or a key, or an alias name prefixed
1659
+ # by "alias/".
1660
+ #
1661
+ # * Key ARN Example -
1662
+ # arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
1663
+ #
1664
+ # * Alias ARN Example -
1665
+ # arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
1666
+ #
1667
+ # * Globally Unique Key ID Example -
1668
+ # 12345678-1234-1234-1234-123456789012
1669
+ #
1670
+ # * Alias Name Example - alias/MyAliasName
1671
+ # @option params [Hash<String,String>] :destination_encryption_context
1672
+ # Encryption context to be used when the data is re-encrypted.
1673
+ # @option params [Array<String>] :grant_tokens
1674
+ # A list of grant tokens.
1675
+ #
1676
+ # For more information, see [Grant Tokens][1] in the *AWS Key Management
1677
+ # Service Developer Guide*.
1678
+ #
1679
+ #
1680
+ #
1681
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token
1682
+ # @return [Types::ReEncryptResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
1683
+ #
1684
+ # * {Types::ReEncryptResponse#ciphertext_blob #CiphertextBlob} => String
1685
+ # * {Types::ReEncryptResponse#source_key_id #SourceKeyId} => String
1686
+ # * {Types::ReEncryptResponse#key_id #KeyId} => String
1687
+ #
1688
+ # @example Request syntax with placeholder values
1689
+ # resp = client.re_encrypt({
1690
+ # ciphertext_blob: "data", # required
1691
+ # source_encryption_context: {
1692
+ # "EncryptionContextKey" => "EncryptionContextValue",
1693
+ # },
1694
+ # destination_key_id: "KeyIdType", # required
1695
+ # destination_encryption_context: {
1696
+ # "EncryptionContextKey" => "EncryptionContextValue",
1697
+ # },
1698
+ # grant_tokens: ["GrantTokenType"],
1699
+ # })
1700
+ #
1701
+ # @example Response structure
1702
+ # resp.ciphertext_blob #=> String
1703
+ # resp.source_key_id #=> String
1704
+ # resp.key_id #=> String
1705
+ # @overload re_encrypt(params = {})
1706
+ # @param [Hash] params ({})
1707
+ def re_encrypt(params = {}, options = {})
1708
+ req = build_request(:re_encrypt, params)
1709
+ req.send_request(options)
1710
+ end
1711
+
1712
+ # Retires a grant. You can retire a grant when you're done using it to
1713
+ # clean up. You should revoke a grant when you intend to actively deny
1714
+ # operations that depend on it. The following are permitted to call this
1715
+ # API:
1716
+ #
1717
+ # * The account that created the grant
1718
+ #
1719
+ # * The `RetiringPrincipal`, if present
1720
+ #
1721
+ # * The `GranteePrincipal`, if `RetireGrant` is a grantee operation
1722
+ #
1723
+ # The grant to retire must be identified by its grant token or by a
1724
+ # combination of the key ARN and the grant ID. A grant token is a unique
1725
+ # variable-length base64-encoded string. A grant ID is a 64 character
1726
+ # unique identifier of a grant. Both are returned by the `CreateGrant`
1727
+ # function.
1728
+ # @option params [String] :grant_token
1729
+ # Token that identifies the grant to be retired.
1730
+ # @option params [String] :key_id
1731
+ # A unique identifier for the customer master key associated with the
1732
+ # grant. This value can be a globally unique identifier or a fully
1733
+ # specified ARN of the key.
1734
+ #
1735
+ # * Key ARN Example -
1736
+ # arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
1737
+ #
1738
+ # * Globally Unique Key ID Example -
1739
+ # 12345678-1234-1234-1234-123456789012
1740
+ # @option params [String] :grant_id
1741
+ # Unique identifier of the grant to be retired. The grant ID is returned
1742
+ # by the `CreateGrant` function.
1743
+ #
1744
+ # * Grant ID Example -
1745
+ # 0123456789012345678901234567890123456789012345678901234567890123
1746
+ #
1747
+ # ^
1748
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
1749
+ #
1750
+ # @example Request syntax with placeholder values
1751
+ # resp = client.retire_grant({
1752
+ # grant_token: "GrantTokenType",
1753
+ # key_id: "KeyIdType",
1754
+ # grant_id: "GrantIdType",
1755
+ # })
1756
+ # @overload retire_grant(params = {})
1757
+ # @param [Hash] params ({})
1758
+ def retire_grant(params = {}, options = {})
1759
+ req = build_request(:retire_grant, params)
1760
+ req.send_request(options)
1761
+ end
1762
+
1763
+ # Revokes a grant. You can revoke a grant to actively deny operations
1764
+ # that depend on it.
1765
+ # @option params [required, String] :key_id
1766
+ # A unique identifier for the customer master key associated with the
1767
+ # grant. This value can be a globally unique identifier or the fully
1768
+ # specified ARN to a key.
1769
+ #
1770
+ # * Key ARN Example -
1771
+ # arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
1772
+ #
1773
+ # * Globally Unique Key ID Example -
1774
+ # 12345678-1234-1234-1234-123456789012
1775
+ # @option params [required, String] :grant_id
1776
+ # Identifier of the grant to be revoked.
1777
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
1778
+ #
1779
+ # @example Request syntax with placeholder values
1780
+ # resp = client.revoke_grant({
1781
+ # key_id: "KeyIdType", # required
1782
+ # grant_id: "GrantIdType", # required
1783
+ # })
1784
+ # @overload revoke_grant(params = {})
1785
+ # @param [Hash] params ({})
1786
+ def revoke_grant(params = {}, options = {})
1787
+ req = build_request(:revoke_grant, params)
1788
+ req.send_request(options)
1789
+ end
1790
+
1791
+ # Schedules the deletion of a customer master key (CMK). You may provide
1792
+ # a waiting period, specified in days, before deletion occurs. If you do
1793
+ # not provide a waiting period, the default period of 30 days is used.
1794
+ # When this operation is successful, the state of the CMK changes to
1795
+ # `PendingDeletion`. Before the waiting period ends, you can use
1796
+ # CancelKeyDeletion to cancel the deletion of the CMK. After the waiting
1797
+ # period ends, AWS KMS deletes the CMK and all AWS KMS data associated
1798
+ # with it, including all aliases that point to it.
1799
+ #
1800
+ # Deleting a CMK is a destructive and potentially dangerous operation.
1801
+ # When a CMK is deleted, all data that was encrypted under the CMK is
1802
+ # rendered unrecoverable. To restrict the use of a CMK without deleting
1803
+ # it, use DisableKey.
1804
+ #
1805
+ # For more information about scheduling a CMK for deletion, see
1806
+ # [Deleting Customer Master Keys][1] in the *AWS Key Management Service
1807
+ # Developer Guide*.
1808
+ #
1809
+ #
1810
+ #
1811
+ # [1]: http://docs.aws.amazon.com/kms/latest/developerguide/deleting-keys.html
1812
+ # @option params [required, String] :key_id
1813
+ # The unique identifier for the customer master key (CMK) to delete.
1814
+ #
1815
+ # To specify this value, use the unique key ID or the Amazon Resource
1816
+ # Name (ARN) of the CMK. Examples:
1817
+ #
1818
+ # * Unique key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
1819
+ #
1820
+ # * Key ARN:
1821
+ # arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
1822
+ #
1823
+ # To obtain the unique key ID and key ARN for a given CMK, use ListKeys
1824
+ # or DescribeKey.
1825
+ # @option params [Integer] :pending_window_in_days
1826
+ # The waiting period, specified in number of days. After the waiting
1827
+ # period ends, AWS KMS deletes the customer master key (CMK).
1828
+ #
1829
+ # This value is optional. If you include a value, it must be between 7
1830
+ # and 30, inclusive. If you do not include a value, it defaults to 30.
1831
+ # @return [Types::ScheduleKeyDeletionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
1832
+ #
1833
+ # * {Types::ScheduleKeyDeletionResponse#key_id #KeyId} => String
1834
+ # * {Types::ScheduleKeyDeletionResponse#deletion_date #DeletionDate} => Time
1835
+ #
1836
+ # @example Request syntax with placeholder values
1837
+ # resp = client.schedule_key_deletion({
1838
+ # key_id: "KeyIdType", # required
1839
+ # pending_window_in_days: 1,
1840
+ # })
1841
+ #
1842
+ # @example Response structure
1843
+ # resp.key_id #=> String
1844
+ # resp.deletion_date #=> Time
1845
+ # @overload schedule_key_deletion(params = {})
1846
+ # @param [Hash] params ({})
1847
+ def schedule_key_deletion(params = {}, options = {})
1848
+ req = build_request(:schedule_key_deletion, params)
1849
+ req.send_request(options)
1850
+ end
1851
+
1852
+ # Updates an alias to map it to a different key.
1853
+ #
1854
+ # An alias is not a property of a key. Therefore, an alias can be mapped
1855
+ # to and unmapped from an existing key without changing the properties
1856
+ # of the key.
1857
+ #
1858
+ # An alias name can contain only alphanumeric characters, forward
1859
+ # slashes (/), underscores (\_), and dashes (-). An alias must start
1860
+ # with the word "alias" followed by a forward slash (alias/). An alias
1861
+ # that begins with "aws" after the forward slash (alias/aws...) is
1862
+ # reserved by Amazon Web Services (AWS).
1863
+ #
1864
+ # The alias and the key it is mapped to must be in the same AWS account
1865
+ # and the same region.
1866
+ # @option params [required, String] :alias_name
1867
+ # String that contains the name of the alias to be modified. The name
1868
+ # must start with the word "alias" followed by a forward slash
1869
+ # (alias/). Aliases that begin with "alias/aws" are reserved.
1870
+ # @option params [required, String] :target_key_id
1871
+ # Unique identifier of the customer master key to be mapped to the
1872
+ # alias. This value can be a globally unique identifier or the fully
1873
+ # specified ARN of a key.
1874
+ #
1875
+ # * Key ARN Example -
1876
+ # arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
1877
+ #
1878
+ # * Globally Unique Key ID Example -
1879
+ # 12345678-1234-1234-1234-123456789012
1880
+ #
1881
+ # You can call ListAliases to verify that the alias is mapped to the
1882
+ # correct `TargetKeyId`.
1883
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
1884
+ #
1885
+ # @example Request syntax with placeholder values
1886
+ # resp = client.update_alias({
1887
+ # alias_name: "AliasNameType", # required
1888
+ # target_key_id: "KeyIdType", # required
1889
+ # })
1890
+ # @overload update_alias(params = {})
1891
+ # @param [Hash] params ({})
1892
+ def update_alias(params = {}, options = {})
1893
+ req = build_request(:update_alias, params)
1894
+ req.send_request(options)
1895
+ end
1896
+
1897
+ # Updates the description of a key.
1898
+ # @option params [required, String] :key_id
1899
+ # A unique identifier for the customer master key. This value can be a
1900
+ # globally unique identifier or the fully specified ARN to a key.
1901
+ #
1902
+ # * Key ARN Example -
1903
+ # arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
1904
+ #
1905
+ # * Globally Unique Key ID Example -
1906
+ # 12345678-1234-1234-1234-123456789012
1907
+ # @option params [required, String] :description
1908
+ # New description for the key.
1909
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
1910
+ #
1911
+ # @example Request syntax with placeholder values
1912
+ # resp = client.update_key_description({
1913
+ # key_id: "KeyIdType", # required
1914
+ # description: "DescriptionType", # required
1915
+ # })
1916
+ # @overload update_key_description(params = {})
1917
+ # @param [Hash] params ({})
1918
+ def update_key_description(params = {}, options = {})
1919
+ req = build_request(:update_key_description, params)
1920
+ req.send_request(options)
1921
+ end
1922
+
1923
+ # @!endgroup
1924
+
1925
+ # @param params ({})
1926
+ # @api private
1927
+ def build_request(operation_name, params = {})
1928
+ handlers = @handlers.for(operation_name)
1929
+ context = Seahorse::Client::RequestContext.new(
1930
+ operation_name: operation_name,
1931
+ operation: config.api.operation(operation_name),
1932
+ client: self,
1933
+ params: params,
1934
+ config: config)
1935
+ context[:gem_name] = 'aws-sdk-kms'
1936
+ context[:gem_version] = '1.0.0.rc1'
1937
+ Seahorse::Client::Request.new(handlers, context)
1938
+ end
1939
+
1940
+ # @api private
1941
+ # @deprecated
1942
+ def waiter_names
1943
+ []
1944
+ end
1945
+
1946
+ class << self
1947
+
1948
+ # @api private
1949
+ attr_reader :identifier
1950
+
1951
+ # @api private
1952
+ def errors_module
1953
+ Errors
1954
+ end
1955
+
1956
+ end
1957
+ end
1958
+ end
1959
+ end