listCallerAccessGrants method
Use this API to list the access grants that grant the caller access to
Amazon S3 data through S3 Access Grants. The caller (grantee) can be an
Identity and Access Management (IAM) identity or Amazon Web Services
Identity Center corporate directory identity. You must pass the Amazon Web
Services account of the S3 data owner (grantor) in the request. You can,
optionally, narrow the results by GrantScope, using a
fragment of the data's S3 path, and S3 Access Grants will return only the
grants with a path that contains the path fragment. You can also pass the
AllowedByApplication filter in the request, which returns
only the grants authorized for applications, whether the application is
the caller's Identity Center application or any other application
(ALL). For more information, see List
the caller's access grants in the Amazon S3 User Guide.
- Permissions
-
You must have the
s3:ListCallerAccessGrantspermission to use this operation.
Parameter accountId :
The Amazon Web Services account ID of the S3 Access Grants instance.
Parameter allowedByApplication :
If this optional parameter is passed in the request, a filter is applied
to the results. The results will include only the access grants for the
caller's Identity Center application or for any other applications
(ALL).
Parameter grantScope :
The S3 path of the data that you would like to access. Must start with
s3://. You can optionally pass only the beginning characters
of a path, and S3 Access Grants will search for all applicable grants for
the path fragment.
Parameter maxResults :
The maximum number of access grants that you would like returned in the
List Caller Access Grants response. If the results include
the pagination token NextToken, make another call using the
NextToken to determine if there are more results.
Parameter nextToken :
A pagination token to request the next page of results. Pass this value
into a subsequent List Caller Access Grants request in order
to retrieve the next page of results.
Implementation
Future<ListCallerAccessGrantsResult> listCallerAccessGrants({
required String accountId,
bool? allowedByApplication,
String? grantScope,
int? maxResults,
String? nextToken,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
0,
1000,
);
final headers = <String, String>{
'x-amz-account-id': accountId.toString(),
};
final $query = <String, List<String>>{
if (allowedByApplication != null)
'allowedByApplication': [allowedByApplication.toString()],
if (grantScope != null) 'grantscope': [grantScope],
if (maxResults != null) 'maxResults': [maxResults.toString()],
if (nextToken != null) 'nextToken': [nextToken],
};
final $result = await _protocol.send(
method: 'GET',
requestUri: '/v20180820/accessgrantsinstance/caller/grants',
queryParams: $query,
headers: headers,
exceptionFnMap: _exceptionFns,
);
return ListCallerAccessGrantsResult.fromXml($result.body);
}