amazonka-kms-2.0: Amazon Key Management Service SDK.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Amazonka.KMS.ListGrants

Description

Gets a list of all grants for the specified KMS key.

You must specify the KMS key in all requests. You can filter the grant list by grant ID or grantee principal.

For detailed information about grants, including grant terminology, see Grants in KMS in the /Key Management Service Developer Guide/ . For examples of working with grants in several programming languages, see Programming grants.

The GranteePrincipal field in the ListGrants response usually contains the user or role designated as the grantee principal in the grant. However, when the grantee principal in the grant is an Amazon Web Services service, the GranteePrincipal field contains the service principal, which might represent several different grantee principals.

Cross-account use: Yes. To perform this operation on a KMS key in a different Amazon Web Services account, specify the key ARN in the value of the KeyId parameter.

Required permissions: kms:ListGrants (key policy)

Related operations:

  • CreateGrant
  • ListRetirableGrants
  • RetireGrant
  • RevokeGrant

This operation returns paginated results.

Synopsis

Creating a Request

data ListGrants Source #

See: newListGrants smart constructor.

Constructors

ListGrants' 

Fields

  • grantId :: Maybe Text

    Returns only the grant with the specified grant ID. The grant ID uniquely identifies the grant.

  • granteePrincipal :: Maybe Text

    Returns only grants where the specified principal is the grantee principal for the grant.

  • limit :: Maybe Natural

    Use this parameter to specify the maximum number of items to return. When this value is present, KMS does not return more than the specified number of items, but it might return fewer.

    This value is optional. If you include a value, it must be between 1 and 100, inclusive. If you do not include a value, it defaults to 50.

  • marker :: Maybe Text

    Use this parameter in a subsequent request after you receive a response with truncated results. Set it to the value of NextMarker from the truncated response you just received.

  • keyId :: Text

    Returns only grants for the specified KMS key. This parameter is required.

    Specify the key ID or key ARN of the KMS key. To specify a KMS key in a different Amazon Web Services 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 KMS key, use ListKeys or DescribeKey.

Instances

Instances details
ToJSON ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

ToHeaders ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

Methods

toHeaders :: ListGrants -> [Header] #

ToPath ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

ToQuery ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

AWSPager ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

AWSRequest ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

Associated Types

type AWSResponse ListGrants #

Generic ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

Associated Types

type Rep ListGrants :: Type -> Type #

Read ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

Show ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

NFData ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

Methods

rnf :: ListGrants -> () #

Eq ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

Hashable ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

type AWSResponse ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

type Rep ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

newListGrants Source #

Arguments

:: Text

ListGrants

-> ListGrants 

Create a value of ListGrants with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

ListGrants, listGrants_grantId - Returns only the grant with the specified grant ID. The grant ID uniquely identifies the grant.

ListGrants, listGrants_granteePrincipal - Returns only grants where the specified principal is the grantee principal for the grant.

$sel:limit:ListGrants', listGrants_limit - Use this parameter to specify the maximum number of items to return. When this value is present, KMS does not return more than the specified number of items, but it might return fewer.

This value is optional. If you include a value, it must be between 1 and 100, inclusive. If you do not include a value, it defaults to 50.

$sel:marker:ListGrants', listGrants_marker - Use this parameter in a subsequent request after you receive a response with truncated results. Set it to the value of NextMarker from the truncated response you just received.

ListGrants, listGrants_keyId - Returns only grants for the specified KMS key. This parameter is required.

Specify the key ID or key ARN of the KMS key. To specify a KMS key in a different Amazon Web Services 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 KMS key, use ListKeys or DescribeKey.

Request Lenses

listGrants_grantId :: Lens' ListGrants (Maybe Text) Source #

Returns only the grant with the specified grant ID. The grant ID uniquely identifies the grant.

listGrants_granteePrincipal :: Lens' ListGrants (Maybe Text) Source #

Returns only grants where the specified principal is the grantee principal for the grant.

listGrants_limit :: Lens' ListGrants (Maybe Natural) Source #

Use this parameter to specify the maximum number of items to return. When this value is present, KMS does not return more than the specified number of items, but it might return fewer.

This value is optional. If you include a value, it must be between 1 and 100, inclusive. If you do not include a value, it defaults to 50.

listGrants_marker :: Lens' ListGrants (Maybe Text) Source #

Use this parameter in a subsequent request after you receive a response with truncated results. Set it to the value of NextMarker from the truncated response you just received.

listGrants_keyId :: Lens' ListGrants Text Source #

Returns only grants for the specified KMS key. This parameter is required.

Specify the key ID or key ARN of the KMS key. To specify a KMS key in a different Amazon Web Services 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 KMS key, use ListKeys or DescribeKey.

Destructuring the Response

data ListGrantsResponse Source #

See: newListGrantsResponse smart constructor.

Constructors

ListGrantsResponse' 

Fields

  • grants :: Maybe [GrantListEntry]

    A list of grants.

  • nextMarker :: Maybe Text

    When Truncated is true, this element is present and contains the value to use for the Marker parameter in a subsequent request.

  • truncated :: Maybe Bool

    A flag that indicates whether there are more items in the list. When this value is true, the list in this response is truncated. To get more items, pass the value of the NextMarker element in thisresponse to the Marker parameter in a subsequent request.

Instances

Instances details
FromJSON ListGrantsResponse Source # 
Instance details

Defined in Amazonka.KMS.Types.ListGrantsResponse

Generic ListGrantsResponse Source # 
Instance details

Defined in Amazonka.KMS.Types.ListGrantsResponse

Associated Types

type Rep ListGrantsResponse :: Type -> Type #

Read ListGrantsResponse Source # 
Instance details

Defined in Amazonka.KMS.Types.ListGrantsResponse

Show ListGrantsResponse Source # 
Instance details

Defined in Amazonka.KMS.Types.ListGrantsResponse

NFData ListGrantsResponse Source # 
Instance details

Defined in Amazonka.KMS.Types.ListGrantsResponse

Methods

rnf :: ListGrantsResponse -> () #

Eq ListGrantsResponse Source # 
Instance details

Defined in Amazonka.KMS.Types.ListGrantsResponse

Hashable ListGrantsResponse Source # 
Instance details

Defined in Amazonka.KMS.Types.ListGrantsResponse

type Rep ListGrantsResponse Source # 
Instance details

Defined in Amazonka.KMS.Types.ListGrantsResponse

type Rep ListGrantsResponse = D1 ('MetaData "ListGrantsResponse" "Amazonka.KMS.Types.ListGrantsResponse" "amazonka-kms-2.0-6YhT3Ymbf9Z5PoaGoz7tbG" 'False) (C1 ('MetaCons "ListGrantsResponse'" 'PrefixI 'True) (S1 ('MetaSel ('Just "grants") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [GrantListEntry])) :*: (S1 ('MetaSel ('Just "nextMarker") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "truncated") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Bool)))))

newListGrantsResponse :: ListGrantsResponse Source #

Create a value of ListGrantsResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:grants:ListGrantsResponse', listGrantsResponse_grants - A list of grants.

$sel:nextMarker:ListGrantsResponse', listGrantsResponse_nextMarker - When Truncated is true, this element is present and contains the value to use for the Marker parameter in a subsequent request.

$sel:truncated:ListGrantsResponse', listGrantsResponse_truncated - A flag that indicates whether there are more items in the list. When this value is true, the list in this response is truncated. To get more items, pass the value of the NextMarker element in thisresponse to the Marker parameter in a subsequent request.

Response Lenses

listGrantsResponse_nextMarker :: Lens' ListGrantsResponse (Maybe Text) Source #

When Truncated is true, this element is present and contains the value to use for the Marker parameter in a subsequent request.

listGrantsResponse_truncated :: Lens' ListGrantsResponse (Maybe Bool) Source #

A flag that indicates whether there are more items in the list. When this value is true, the list in this response is truncated. To get more items, pass the value of the NextMarker element in thisresponse to the Marker parameter in a subsequent request.