deleteLoadBalancerTlsCertificate method

Future<DeleteLoadBalancerTlsCertificateResult> deleteLoadBalancerTlsCertificate({
  1. required String certificateName,
  2. required String loadBalancerName,
  3. bool? force,
})

Deletes an SSL/TLS certificate associated with a Lightsail load balancer.

The DeleteLoadBalancerTlsCertificate 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 certificateName : The SSL/TLS certificate name.

Parameter loadBalancerName : The load balancer name.

Parameter force : When true, forces the deletion of an SSL/TLS certificate.

There can be two certificates associated with a Lightsail load balancer: the primary and the backup. The force parameter is required when the primary SSL/TLS certificate is in use by an instance attached to the load balancer.

Implementation

Future<DeleteLoadBalancerTlsCertificateResult>
    deleteLoadBalancerTlsCertificate({
  required String certificateName,
  required String loadBalancerName,
  bool? force,
}) async {
  ArgumentError.checkNotNull(certificateName, 'certificateName');
  ArgumentError.checkNotNull(loadBalancerName, 'loadBalancerName');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Lightsail_20161128.DeleteLoadBalancerTlsCertificate'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'certificateName': certificateName,
      'loadBalancerName': loadBalancerName,
      if (force != null) 'force': force,
    },
  );

  return DeleteLoadBalancerTlsCertificateResult.fromJson(jsonResponse.body);
}