createLoadBalancerTlsCertificate method
Creates a Lightsail load balancer TLS certificate.
TLS is just an updated, more secure version of Secure Socket Layer (SSL).
The CreateLoadBalancerTlsCertificate
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 certificateDomainName
:
The domain name (e.g., example.com
) for your SSL/TLS
certificate.
Parameter certificateName
:
The SSL/TLS certificate name.
You can have up to 10 certificates in your account at one time. Each Lightsail load balancer can have up to 2 certificates associated with it at one time. There is also an overall limit to the number of certificates that can be issue in a 365-day period. For more information, see Limits.
Parameter loadBalancerName
:
The load balancer name where you want to create the SSL/TLS certificate.
Parameter certificateAlternativeNames
:
An array of strings listing alternative domains and subdomains for your
SSL/TLS certificate. Lightsail will de-dupe the names for you. You can
have a maximum of 9 alternative names (in addition to the 1 primary
domain). We do not support wildcards (e.g., *.example.com
).
Parameter tags
:
The tag keys and optional values to add to the resource during create.
Use the TagResource
action to tag a resource after it's
created.
Implementation
Future<CreateLoadBalancerTlsCertificateResult>
createLoadBalancerTlsCertificate({
required String certificateDomainName,
required String certificateName,
required String loadBalancerName,
List<String>? certificateAlternativeNames,
List<Tag>? tags,
}) async {
ArgumentError.checkNotNull(certificateDomainName, 'certificateDomainName');
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.CreateLoadBalancerTlsCertificate'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'certificateDomainName': certificateDomainName,
'certificateName': certificateName,
'loadBalancerName': loadBalancerName,
if (certificateAlternativeNames != null)
'certificateAlternativeNames': certificateAlternativeNames,
if (tags != null) 'tags': tags,
},
);
return CreateLoadBalancerTlsCertificateResult.fromJson(jsonResponse.body);
}