putPublicAccessBlock method

Future<void> putPublicAccessBlock({
  1. required String accountId,
  2. required PublicAccessBlockConfiguration publicAccessBlockConfiguration,
})

Creates or modifies the PublicAccessBlock configuration for an AWS account. For more information, see Using Amazon S3 block public access.

Related actions include:

Parameter accountId : The account ID for the AWS account whose PublicAccessBlock configuration you want to set.

Parameter publicAccessBlockConfiguration : The PublicAccessBlock configuration that you want to apply to the specified AWS account.

Implementation

Future<void> putPublicAccessBlock({
  required String accountId,
  required PublicAccessBlockConfiguration publicAccessBlockConfiguration,
}) async {
  ArgumentError.checkNotNull(accountId, 'accountId');
  _s.validateStringLength(
    'accountId',
    accountId,
    0,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(
      publicAccessBlockConfiguration, 'publicAccessBlockConfiguration');
  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'),
    exceptionFnMap: _exceptionFns,
  );
}