updateAccelerator method

Future<UpdateAcceleratorResponse> updateAccelerator({
  1. required String acceleratorArn,
  2. bool? enabled,
  3. IpAddressType? ipAddressType,
  4. String? name,
})

Update an accelerator.

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

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

Parameter enabled : Indicates whether an accelerator is enabled. The value is true or false. The default value is true.

If the value is set to true, the accelerator cannot be deleted. If set to false, the accelerator can be deleted.

Parameter ipAddressType : The IP address type, which must be IPv4.

Parameter name : The name of the accelerator. The name can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens (-), and must not begin or end with a hyphen.

Implementation

Future<UpdateAcceleratorResponse> updateAccelerator({
  required String acceleratorArn,
  bool? enabled,
  IpAddressType? ipAddressType,
  String? name,
}) async {
  ArgumentError.checkNotNull(acceleratorArn, 'acceleratorArn');
  _s.validateStringLength(
    'acceleratorArn',
    acceleratorArn,
    0,
    255,
    isRequired: true,
  );
  _s.validateStringLength(
    'name',
    name,
    0,
    255,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'GlobalAccelerator_V20180706.UpdateAccelerator'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AcceleratorArn': acceleratorArn,
      if (enabled != null) 'Enabled': enabled,
      if (ipAddressType != null) 'IpAddressType': ipAddressType.toValue(),
      if (name != null) 'Name': name,
    },
  );

  return UpdateAcceleratorResponse.fromJson(jsonResponse.body);
}