amazonka-kms-1.6.0: Amazon Key Management Service SDK.

Copyright(c) 2013-2018 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Network.AWS.KMS.CreateGrant

Contents

Description

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 .

Synopsis

Creating a Request

createGrant Source #

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

Instances

Eq CreateGrant Source # 
Data CreateGrant Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CreateGrant -> c CreateGrant #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CreateGrant #

toConstr :: CreateGrant -> Constr #

dataTypeOf :: CreateGrant -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c CreateGrant) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CreateGrant) #

gmapT :: (forall b. Data b => b -> b) -> CreateGrant -> CreateGrant #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CreateGrant -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CreateGrant -> r #

gmapQ :: (forall d. Data d => d -> u) -> CreateGrant -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CreateGrant -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CreateGrant -> m CreateGrant #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CreateGrant -> m CreateGrant #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CreateGrant -> m CreateGrant #

Read CreateGrant Source # 
Show CreateGrant Source # 
Generic CreateGrant Source # 

Associated Types

type Rep CreateGrant :: * -> * #

Hashable CreateGrant Source # 
ToJSON CreateGrant Source # 
NFData CreateGrant Source # 

Methods

rnf :: CreateGrant -> () #

AWSRequest CreateGrant Source # 
ToHeaders CreateGrant Source # 

Methods

toHeaders :: CreateGrant -> [Header] #

ToPath CreateGrant Source # 
ToQuery CreateGrant Source # 
type Rep CreateGrant Source # 
type Rs CreateGrant Source # 

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

createGrantResponse Source #

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:

data CreateGrantResponse Source #

See: createGrantResponse smart constructor.

Instances

Eq CreateGrantResponse Source # 
Data CreateGrantResponse Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CreateGrantResponse -> c CreateGrantResponse #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CreateGrantResponse #

toConstr :: CreateGrantResponse -> Constr #

dataTypeOf :: CreateGrantResponse -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c CreateGrantResponse) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CreateGrantResponse) #

gmapT :: (forall b. Data b => b -> b) -> CreateGrantResponse -> CreateGrantResponse #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CreateGrantResponse -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CreateGrantResponse -> r #

gmapQ :: (forall d. Data d => d -> u) -> CreateGrantResponse -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CreateGrantResponse -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CreateGrantResponse -> m CreateGrantResponse #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CreateGrantResponse -> m CreateGrantResponse #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CreateGrantResponse -> m CreateGrantResponse #

Read CreateGrantResponse Source # 
Show CreateGrantResponse Source # 
Generic CreateGrantResponse Source # 
NFData CreateGrantResponse Source # 

Methods

rnf :: CreateGrantResponse -> () #

type Rep CreateGrantResponse Source # 
type Rep CreateGrantResponse = D1 * (MetaData "CreateGrantResponse" "Network.AWS.KMS.CreateGrant" "amazonka-kms-1.6.0-6a1SDMHmleyARI8mxMgB7S" False) (C1 * (MetaCons "CreateGrantResponse'" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "_cgrsGrantId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * (Maybe Text))) ((:*:) * (S1 * (MetaSel (Just Symbol "_cgrsGrantToken") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * (Maybe Text))) (S1 * (MetaSel (Just Symbol "_cgrsResponseStatus") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * Int)))))

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.