listAccessGrants method

Future<ListAccessGrantsResult> listAccessGrants({
  1. required String accountId,
  2. String? applicationArn,
  3. String? grantScope,
  4. String? granteeIdentifier,
  5. GranteeType? granteeType,
  6. int? maxResults,
  7. String? nextToken,
  8. Permission? permission,
})

Returns the list of access grants in your S3 Access Grants instance.

Permissions
You must have the s3:ListAccessGrants permission to use this operation.

Parameter accountId : The Amazon Web Services account ID of the S3 Access Grants instance.

Parameter applicationArn : The Amazon Resource Name (ARN) of an Amazon Web Services IAM Identity Center application associated with your Identity Center instance. If the grant includes an application ARN, the grantee can only access the S3 data through this application.

Parameter grantScope : The S3 path of the data to which you are granting access. It is the result of appending the Subprefix to the location scope.

Parameter granteeIdentifier : The unique identifer of the Grantee. If the grantee type is IAM, the identifier is the IAM Amazon Resource Name (ARN) of the user or role. If the grantee type is a directory user or group, the identifier is 128-bit universally unique identifier (UUID) in the format a1b2c3d4-5678-90ab-cdef-EXAMPLE11111. You can obtain this UUID from your Amazon Web Services IAM Identity Center instance.

Parameter granteeType : The type of the grantee to which access has been granted. It can be one of the following values:

  • IAM - An IAM user or role.
  • DIRECTORY_USER - Your corporate directory user. You can use this option if you have added your corporate identity directory to IAM Identity Center and associated the IAM Identity Center instance with your S3 Access Grants instance.
  • DIRECTORY_GROUP - Your corporate directory group. You can use this option if you have added your corporate identity directory to IAM Identity Center and associated the IAM Identity Center instance with your S3 Access Grants instance.

Parameter maxResults : The maximum number of access grants that you would like returned in the List 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 Access Grants request in order to retrieve the next page of results.

Parameter permission : The type of permission granted to your S3 data, which can be set to one of the following values:

  • READ – Grant read-only access to the S3 data.
  • WRITE – Grant write-only access to the S3 data.
  • READWRITE – Grant both read and write access to the S3 data.

Implementation

Future<ListAccessGrantsResult> listAccessGrants({
  required String accountId,
  String? applicationArn,
  String? grantScope,
  String? granteeIdentifier,
  GranteeType? granteeType,
  int? maxResults,
  String? nextToken,
  Permission? permission,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    0,
    1000,
  );
  final headers = <String, String>{
    'x-amz-account-id': accountId.toString(),
  };
  final $query = <String, List<String>>{
    if (applicationArn != null) 'application_arn': [applicationArn],
    if (grantScope != null) 'grantscope': [grantScope],
    if (granteeIdentifier != null) 'granteeidentifier': [granteeIdentifier],
    if (granteeType != null) 'granteetype': [granteeType.value],
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
    if (permission != null) 'permission': [permission.value],
  };
  final $result = await _protocol.send(
    method: 'GET',
    requestUri: '/v20180820/accessgrantsinstance/grants',
    queryParams: $query,
    headers: headers,
    endpoint: _resolveEndpoint(
      requiresAccountId: true,
      accountId: accountId,
    ),
    hostPrefix: '{AccountId}.',
    exceptionFnMap: _exceptionFns,
  );
  return ListAccessGrantsResult.fromXml($result.body);
}