createCertificate method
Creates an SSL/TLS certificate for an Amazon Lightsail content delivery network (CDN) distribution and a container service.
After the certificate is valid, use the
AttachCertificateToDistribution action to use the certificate
and its domains with your distribution. Or use the
UpdateContainerService action to use the certificate and its
domains with your container service.
May throw AccessDeniedException.
May throw InvalidInputException.
May throw NotFoundException.
May throw RegionSetupInProgressException.
May throw ServiceException.
May throw UnauthenticatedException.
Parameter certificateName :
The name for the certificate.
Parameter domainName :
The domain name (example.com) for the certificate.
Parameter subjectAlternativeNames :
An array of strings that specify the alternate domains
(example2.com) and subdomains (blog.example.com)
for the certificate.
You can specify a maximum of nine alternate domains (in addition to the primary domain name).
Wildcard domain entries (*.example.com) are not supported.
Parameter tags :
The tag keys and optional values to add to the certificate during create.
Use the TagResource action to tag a resource after it's
created.
Implementation
Future<CreateCertificateResult> createCertificate({
required String certificateName,
required String domainName,
List<String>? subjectAlternativeNames,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Lightsail_20161128.CreateCertificate'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'certificateName': certificateName,
'domainName': domainName,
if (subjectAlternativeNames != null)
'subjectAlternativeNames': subjectAlternativeNames,
if (tags != null) 'tags': tags,
},
);
return CreateCertificateResult.fromJson(jsonResponse.body);
}