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

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 Using grants 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.

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

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

  • 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
Eq ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

Read ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

Show ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

Generic ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

Associated Types

type Rep ListGrants :: Type -> Type #

NFData ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

Methods

rnf :: ListGrants -> () #

Hashable ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

ToJSON 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 #

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

type Rep ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

type Rep ListGrants = D1 ('MetaData "ListGrants" "Amazonka.KMS.ListGrants" "libZSservicesZSamazonka-kmsZSamazonka-kms" 'False) (C1 ('MetaCons "ListGrants'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "grantId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "granteePrincipal") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text))) :*: (S1 ('MetaSel ('Just "marker") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "limit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Natural)) :*: S1 ('MetaSel ('Just "keyId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)))))
type AWSResponse ListGrants Source # 
Instance details

Defined in Amazonka.KMS.ListGrants

newListGrants Source #

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:

$sel:grantId:ListGrants', listGrants_grantId - Returns only the grant with the specified grant ID. The grant ID uniquely identifies the grant.

$sel:granteePrincipal:ListGrants', listGrants_granteePrincipal - Returns only grants where the specified principal is the grantee principal for the grant.

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

$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:keyId: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_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_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_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

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

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

Instances

Instances details
Eq ListGrantsResponse Source # 
Instance details

Defined in Amazonka.KMS.Types.ListGrantsResponse

Read ListGrantsResponse Source # 
Instance details

Defined in Amazonka.KMS.Types.ListGrantsResponse

Show 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 #

NFData ListGrantsResponse Source # 
Instance details

Defined in Amazonka.KMS.Types.ListGrantsResponse

Methods

rnf :: ListGrantsResponse -> () #

Hashable ListGrantsResponse Source # 
Instance details

Defined in Amazonka.KMS.Types.ListGrantsResponse

FromJSON 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" "libZSservicesZSamazonka-kmsZSamazonka-kms" 'False) (C1 ('MetaCons "ListGrantsResponse'" 'PrefixI 'True) (S1 ('MetaSel ('Just "truncated") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Bool)) :*: (S1 ('MetaSel ('Just "grants") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [GrantListEntry])) :*: S1 ('MetaSel ('Just "nextMarker") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)))))

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

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

Response Lenses

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.

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.