attachLoadBalancerTlsCertificate method
Attaches a Transport Layer Security (TLS) certificate to your load balancer. TLS is just an updated, more secure version of Secure Socket Layer (SSL).
Once you create and validate your certificate, you can attach it to your
load balancer. You can also use this API to rotate the certificates on
your account. Use the AttachLoadBalancerTlsCertificate
action
with the non-attached certificate, and it will replace the existing one
and become the attached certificate.
The AttachLoadBalancerTlsCertificate
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 name of your SSL/TLS certificate.
Parameter loadBalancerName
:
The name of the load balancer to which you want to associate the SSL/TLS
certificate.
Implementation
Future<AttachLoadBalancerTlsCertificateResult>
attachLoadBalancerTlsCertificate({
required String certificateName,
required String loadBalancerName,
}) 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.AttachLoadBalancerTlsCertificate'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'certificateName': certificateName,
'loadBalancerName': loadBalancerName,
},
);
return AttachLoadBalancerTlsCertificateResult.fromJson(jsonResponse.body);
}