Copyright | (c) 2013-2021 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 |
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
- data ListGrants = ListGrants' {}
- newListGrants :: Text -> ListGrants
- listGrants_grantId :: Lens' ListGrants (Maybe Text)
- listGrants_granteePrincipal :: Lens' ListGrants (Maybe Text)
- listGrants_marker :: Lens' ListGrants (Maybe Text)
- listGrants_limit :: Lens' ListGrants (Maybe Natural)
- listGrants_keyId :: Lens' ListGrants Text
- data ListGrantsResponse = ListGrantsResponse' {
- truncated :: Maybe Bool
- grants :: Maybe [GrantListEntry]
- nextMarker :: Maybe Text
- newListGrantsResponse :: ListGrantsResponse
- listGrantsResponse_truncated :: Lens' ListGrantsResponse (Maybe Bool)
- listGrantsResponse_grants :: Lens' ListGrantsResponse (Maybe [GrantListEntry])
- listGrantsResponse_nextMarker :: Lens' ListGrantsResponse (Maybe Text)
Creating a Request
data ListGrants Source #
See: newListGrants
smart constructor.
ListGrants' | |
|
Instances
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.
ListGrantsResponse' | |
|
Instances
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_grants :: Lens' ListGrantsResponse (Maybe [GrantListEntry]) Source #
A list of grants.
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.