getCertificates method

Future<GetCertificatesResult> getCertificates({
  1. String? certificateName,
  2. List<CertificateStatus>? certificateStatuses,
  3. bool? includeCertificateDetails,
})

Returns information about one or more Amazon Lightsail SSL/TLS certificates.

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

Parameter certificateName : The name for the certificate for which to return information.

When omitted, the response includes all of your certificates in the AWS Region where the request is made.

Parameter certificateStatuses : The status of the certificates for which to return information.

For example, specify ISSUED to return only certificates with an ISSUED status.

When omitted, the response includes all of your certificates in the AWS Region where the request is made, regardless of their current status.

Parameter includeCertificateDetails : Indicates whether to include detailed information about the certificates in the response.

When omitted, the response includes only the certificate names, Amazon Resource Names (ARNs), domain names, and tags.

Implementation

Future<GetCertificatesResult> getCertificates({
  String? certificateName,
  List<CertificateStatus>? certificateStatuses,
  bool? includeCertificateDetails,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Lightsail_20161128.GetCertificates'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (certificateName != null) 'certificateName': certificateName,
      if (certificateStatuses != null)
        'certificateStatuses':
            certificateStatuses.map((e) => e.toValue()).toList(),
      if (includeCertificateDetails != null)
        'includeCertificateDetails': includeCertificateDetails,
    },
  );

  return GetCertificatesResult.fromJson(jsonResponse.body);
}