updateAcceleratorAttributes method

Future<UpdateAcceleratorAttributesResponse> updateAcceleratorAttributes({
  1. required String acceleratorArn,
  2. bool? flowLogsEnabled,
  3. String? flowLogsS3Bucket,
  4. String? flowLogsS3Prefix,
})

Update the attributes for an accelerator.

May throw AcceleratorNotFoundException. May throw InternalServiceErrorException. May throw InvalidArgumentException. May throw AccessDeniedException.

Parameter acceleratorArn : The Amazon Resource Name (ARN) of the accelerator that you want to update.

Parameter flowLogsEnabled : Update whether flow logs are enabled. The default value is false. If the value is true, FlowLogsS3Bucket and FlowLogsS3Prefix must be specified.

For more information, see Flow Logs in the AWS Global Accelerator Developer Guide.

Parameter flowLogsS3Bucket : The name of the Amazon S3 bucket for the flow logs. Attribute is required if FlowLogsEnabled is true. The bucket must exist and have a bucket policy that grants AWS Global Accelerator permission to write to the bucket.

Parameter flowLogsS3Prefix : Update the prefix for the location in the Amazon S3 bucket for the flow logs. Attribute is required if FlowLogsEnabled is true.

If you don’t specify a prefix, the flow logs are stored in the root of the bucket. If you specify slash (/) for the S3 bucket prefix, the log file bucket folder structure will include a double slash (//), like the following:

s3-bucket_name//AWSLogs/aws_account_id

Implementation

Future<UpdateAcceleratorAttributesResponse> updateAcceleratorAttributes({
  required String acceleratorArn,
  bool? flowLogsEnabled,
  String? flowLogsS3Bucket,
  String? flowLogsS3Prefix,
}) async {
  ArgumentError.checkNotNull(acceleratorArn, 'acceleratorArn');
  _s.validateStringLength(
    'acceleratorArn',
    acceleratorArn,
    0,
    255,
    isRequired: true,
  );
  _s.validateStringLength(
    'flowLogsS3Bucket',
    flowLogsS3Bucket,
    0,
    255,
  );
  _s.validateStringLength(
    'flowLogsS3Prefix',
    flowLogsS3Prefix,
    0,
    255,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'GlobalAccelerator_V20180706.UpdateAcceleratorAttributes'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AcceleratorArn': acceleratorArn,
      if (flowLogsEnabled != null) 'FlowLogsEnabled': flowLogsEnabled,
      if (flowLogsS3Bucket != null) 'FlowLogsS3Bucket': flowLogsS3Bucket,
      if (flowLogsS3Prefix != null) 'FlowLogsS3Prefix': flowLogsS3Prefix,
    },
  );

  return UpdateAcceleratorAttributesResponse.fromJson(jsonResponse.body);
}