Copyright | (c) 2013-2017 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay <brendan.g.hay+amazonka@gmail.com> |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
Adds a grant to a customer master key (CMK). The grant specifies who can use the CMK and under what conditions. When setting permissions, grants are an alternative to key policies.
To perform this operation on a CMK in a different AWS account, specify the key ARN in the value of the KeyId parameter. For more information about grants, see Grants in the AWS Key Management Service Developer Guide .
- createGrant :: Text -> Text -> CreateGrant
- data CreateGrant
- cgRetiringPrincipal :: Lens' CreateGrant (Maybe Text)
- cgGrantTokens :: Lens' CreateGrant [Text]
- cgConstraints :: Lens' CreateGrant (Maybe GrantConstraints)
- cgName :: Lens' CreateGrant (Maybe Text)
- cgKeyId :: Lens' CreateGrant Text
- cgGranteePrincipal :: Lens' CreateGrant Text
- cgOperations :: Lens' CreateGrant [GrantOperation]
- createGrantResponse :: Int -> CreateGrantResponse
- data CreateGrantResponse
- cgrsGrantId :: Lens' CreateGrantResponse (Maybe Text)
- cgrsGrantToken :: Lens' CreateGrantResponse (Maybe Text)
- cgrsResponseStatus :: Lens' CreateGrantResponse Int
Creating a Request
Creates a value of CreateGrant
with the minimum fields required to make a request.
Use one of the following lenses to modify other fields as desired:
cgRetiringPrincipal
- The principal that is given permission to retire the grant by usingRetireGrant
operation. To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS principals include AWS accounts (root), IAM users, federated users, and assumed role users. For examples of the ARN syntax to use for specifying a principal, see AWS Identity and Access Management (IAM) in the Example ARNs section of the AWS General Reference .cgGrantTokens
- A list of grant tokens. For more information, see Grant Tokens in the AWS Key Management Service Developer Guide .cgConstraints
- A structure that you can use to allow certain operations in the grant only when the desired encryption context is present. For more information about encryption context, see Encryption Context in the AWS Key Management Service Developer Guide .cgName
- A friendly name for identifying the grant. Use this value to prevent unintended creation of duplicate grants when retrying this request. When this value is absent, allCreateGrant
requests result in a new grant with a uniqueGrantId
even if all the supplied parameters are identical. This can result in unintended duplicates when you retry theCreateGrant
request. When this value is present, you can retry aCreateGrant
request with identical parameters; if the grant already exists, the originalGrantId
is returned without creating a new grant. Note that the returned grant token is unique with everyCreateGrant
request, even when a duplicateGrantId
is returned. All grant tokens obtained in this way can be used interchangeably.cgKeyId
- The unique identifier for the customer master key (CMK) that the grant applies to. Specify the key ID or the Amazon Resource Name (ARN) of the CMK. To specify a CMK in a different AWS account, you must use the key ARN. For example: * Key ID:1234abcd-12ab-34cd-56ef-1234567890ab
* Key ARN:arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
To get the key ID and key ARN for a CMK, useListKeys
orDescribeKey
.cgGranteePrincipal
- The principal that is given permission to perform the operations that the grant permits. To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS principals include AWS accounts (root), IAM users, IAM roles, federated users, and assumed role users. For examples of the ARN syntax to use for specifying a principal, see AWS Identity and Access Management (IAM) in the Example ARNs section of the AWS General Reference .cgOperations
- A list of operations that the grant permits.
data CreateGrant Source #
See: createGrant
smart constructor.
Request Lenses
cgRetiringPrincipal :: Lens' CreateGrant (Maybe Text) Source #
The principal that is given permission to retire the grant by using RetireGrant
operation. To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS principals include AWS accounts (root), IAM users, federated users, and assumed role users. For examples of the ARN syntax to use for specifying a principal, see AWS Identity and Access Management (IAM) in the Example ARNs section of the AWS General Reference .
cgGrantTokens :: Lens' CreateGrant [Text] Source #
A list of grant tokens. For more information, see Grant Tokens in the AWS Key Management Service Developer Guide .
cgConstraints :: Lens' CreateGrant (Maybe GrantConstraints) Source #
A structure that you can use to allow certain operations in the grant only when the desired encryption context is present. For more information about encryption context, see Encryption Context in the AWS Key Management Service Developer Guide .
cgName :: Lens' CreateGrant (Maybe Text) Source #
A friendly name for identifying the grant. Use this value to prevent unintended creation of duplicate grants when retrying this request. When this value is absent, all CreateGrant
requests result in a new grant with a unique GrantId
even if all the supplied parameters are identical. This can result in unintended duplicates when you retry the CreateGrant
request. When this value is present, you can retry a CreateGrant
request with identical parameters; if the grant already exists, the original GrantId
is returned without creating a new grant. Note that the returned grant token is unique with every CreateGrant
request, even when a duplicate GrantId
is returned. All grant tokens obtained in this way can be used interchangeably.
cgKeyId :: Lens' CreateGrant Text Source #
The unique identifier for the customer master key (CMK) that the grant applies to. Specify the key ID or the Amazon Resource Name (ARN) of the CMK. To specify a CMK in a different AWS account, you must use the key ARN. For example: * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
* Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
To get the key ID and key ARN for a CMK, use ListKeys
or DescribeKey
.
cgGranteePrincipal :: Lens' CreateGrant Text Source #
The principal that is given permission to perform the operations that the grant permits. To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS principals include AWS accounts (root), IAM users, IAM roles, federated users, and assumed role users. For examples of the ARN syntax to use for specifying a principal, see AWS Identity and Access Management (IAM) in the Example ARNs section of the AWS General Reference .
cgOperations :: Lens' CreateGrant [GrantOperation] Source #
A list of operations that the grant permits.
Destructuring the Response
Creates a value of CreateGrantResponse
with the minimum fields required to make a request.
Use one of the following lenses to modify other fields as desired:
cgrsGrantId
- The unique identifier for the grant. You can use theGrantId
in a subsequentRetireGrant
orRevokeGrant
operation.cgrsGrantToken
- The grant token. For more information, see Grant Tokens in the AWS Key Management Service Developer Guide .cgrsResponseStatus
- -- | The response status code.
data CreateGrantResponse Source #
See: createGrantResponse
smart constructor.
Response Lenses
cgrsGrantId :: Lens' CreateGrantResponse (Maybe Text) Source #
The unique identifier for the grant. You can use the GrantId
in a subsequent RetireGrant
or RevokeGrant
operation.
cgrsGrantToken :: Lens' CreateGrantResponse (Maybe Text) Source #
The grant token. For more information, see Grant Tokens in the AWS Key Management Service Developer Guide .
cgrsResponseStatus :: Lens' CreateGrantResponse Int Source #
- - | The response status code.