updateLoadBalancerAttribute method

Future<UpdateLoadBalancerAttributeResult> updateLoadBalancerAttribute({
  1. required LoadBalancerAttributeName attributeName,
  2. required String attributeValue,
  3. required String loadBalancerName,
})

Updates the specified attribute for a load balancer. You can only update one attribute at a time.

The update load balancer attribute operation supports tag-based access control via resource tags applied to the resource identified by load balancer name. For more information, see the Lightsail Dev Guide.

May throw ServiceException. May throw InvalidInputException. May throw NotFoundException. May throw OperationFailureException. May throw AccessDeniedException. May throw AccountSetupInProgressException. May throw UnauthenticatedException.

Parameter attributeName : The name of the attribute you want to update. Valid values are below.

Parameter attributeValue : The value that you want to specify for the attribute name.

Parameter loadBalancerName : The name of the load balancer that you want to modify (e.g., my-load-balancer.

Implementation

Future<UpdateLoadBalancerAttributeResult> updateLoadBalancerAttribute({
  required LoadBalancerAttributeName attributeName,
  required String attributeValue,
  required String loadBalancerName,
}) async {
  ArgumentError.checkNotNull(attributeName, 'attributeName');
  ArgumentError.checkNotNull(attributeValue, 'attributeValue');
  _s.validateStringLength(
    'attributeValue',
    attributeValue,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(loadBalancerName, 'loadBalancerName');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Lightsail_20161128.UpdateLoadBalancerAttribute'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'attributeName': attributeName.toValue(),
      'attributeValue': attributeValue,
      'loadBalancerName': loadBalancerName,
    },
  );

  return UpdateLoadBalancerAttributeResult.fromJson(jsonResponse.body);
}