updateAccessGrantsLocation method

Future<UpdateAccessGrantsLocationResult> updateAccessGrantsLocation({
  1. required String accessGrantsLocationId,
  2. required String accountId,
  3. required String iAMRoleArn,
})

Updates the IAM role of a registered location in your S3 Access Grants instance.

Permissions
You must have the s3:UpdateAccessGrantsLocation permission to use this operation.
Additional Permissions
You must also have the following permission: iam:PassRole

Parameter accessGrantsLocationId : The ID of the registered location that you are updating. S3 Access Grants assigns this ID when you register the location. S3 Access Grants assigns the ID default to the default location s3:// and assigns an auto-generated ID to other locations that you register.

The ID of the registered location to which you are granting access. S3 Access Grants assigned this ID when you registered the location. S3 Access Grants assigns the ID default to the default location s3:// and assigns an auto-generated ID to other locations that you register.

If you are passing the default location, you cannot create an access grant for the entire default location. You must also specify a bucket or a bucket and prefix in the Subprefix field.

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

Parameter iAMRoleArn : The Amazon Resource Name (ARN) of the IAM role for the registered location. S3 Access Grants assumes this role to manage access to the registered location.

Implementation

Future<UpdateAccessGrantsLocationResult> updateAccessGrantsLocation({
  required String accessGrantsLocationId,
  required String accountId,
  required String iAMRoleArn,
}) async {
  final headers = <String, String>{
    'x-amz-account-id': accountId.toString(),
  };
  final $result = await _protocol.send(
    method: 'PUT',
    requestUri:
        '/v20180820/accessgrantsinstance/location/${Uri.encodeComponent(accessGrantsLocationId)}',
    headers: headers,
    payload: UpdateAccessGrantsLocationRequest(
            accessGrantsLocationId: accessGrantsLocationId,
            accountId: accountId,
            iAMRoleArn: iAMRoleArn)
        .toXml('UpdateAccessGrantsLocationRequest'),
    endpoint: _resolveEndpoint(
      requiresAccountId: true,
      accountId: accountId,
    ),
    hostPrefix: '{AccountId}.',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateAccessGrantsLocationResult.fromXml($result.body);
}