getCertificates method

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

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

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 for which to return information.

When omitted, the response includes all of your certificates in the Amazon Web Services 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 Amazon Web Services 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.

Parameter pageToken : The token to advance to the next page of results from your request.

To get a page token, perform an initial GetCertificates request. If your results are paginated, the response will return a next page token that you can specify as the page token in a subsequent request.

Implementation

Future<GetCertificatesResult> getCertificates({
  String? certificateName,
  List<CertificateStatus>? certificateStatuses,
  bool? includeCertificateDetails,
  String? pageToken,
}) 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.value).toList(),
      if (includeCertificateDetails != null)
        'includeCertificateDetails': includeCertificateDetails,
      if (pageToken != null) 'pageToken': pageToken,
    },
  );

  return GetCertificatesResult.fromJson(jsonResponse.body);
}