putPublicAccessBlock method
Future<void>
putPublicAccessBlock({
- required String accountId,
- required PublicAccessBlockConfiguration publicAccessBlockConfiguration,
Creates or modifies the
PublicAccessBlock configuration for
an Amazon Web Services account. This operation may be restricted when the
account is managed by organization-level Block Public Access policies. You
might get an Access Denied (403) error when the account is managed by
organization-level Block Public Access policies. Organization-level
policies override account-level settings, preventing direct account-level
modifications. For this operation, users must have the
s3:PutAccountPublicAccessBlock permission. For more
information, see
Using Amazon S3 block public access.
Related actions include:
Parameter accountId :
The account ID for the Amazon Web Services account whose
PublicAccessBlock configuration you want to set.
Parameter publicAccessBlockConfiguration :
The PublicAccessBlock configuration that you want to apply to
the specified Amazon Web Services account.
Implementation
Future<void> putPublicAccessBlock({
required String accountId,
required PublicAccessBlockConfiguration publicAccessBlockConfiguration,
}) async {
final headers = <String, String>{
'x-amz-account-id': accountId.toString(),
};
await _protocol.send(
method: 'PUT',
requestUri: '/v20180820/configuration/publicAccessBlock',
headers: headers,
payload: publicAccessBlockConfiguration
.toXml('PublicAccessBlockConfiguration'),
endpoint: _resolveEndpoint(
requiresAccountId: true,
accountId: accountId,
),
hostPrefix: '{AccountId}.',
exceptionFnMap: _exceptionFns,
);
}