searchCertificates method

Future<SearchCertificatesResponse> searchCertificates({
  1. CertificateFilterStatement? filterStatement,
  2. int? maxResults,
  3. String? nextToken,
  4. SearchCertificatesSortBy? sortBy,
  5. SearchCertificatesSortOrder? sortOrder,
})

Retrieves a list of certificates matching search criteria. You can filter certificates by X.509 attributes and ACM specific properties like certificate status, type and renewal eligibility. This operation provides more flexible filtering than ListCertificates by supporting complex filter statements.

May throw AccessDeniedException. May throw ThrottlingException. May throw ValidationException.

Parameter filterStatement : A filter statement that defines the search criteria. You can combine multiple filters using AND, OR, and NOT logical operators to create complex queries.

Parameter maxResults : The maximum number of results to return in the response. Default is 100.

Parameter nextToken : Use this parameter only when paginating results and only in a subsequent request after you receive a response with truncated results. Set it to the value of NextToken from the response you just received.

Parameter sortBy : Specifies the field to sort results by. Valid values are CREATED_AT, NOT_AFTER, STATUS, RENEWAL_STATUS, EXPORTED, IN_USE, NOT_BEFORE, KEY_ALGORITHM, TYPE, CERTIFICATE_ARN, COMMON_NAME, REVOKED_AT, RENEWAL_ELIGIBILITY, ISSUED_AT, MANAGED_BY, EXPORT_OPTION, VALIDATION_METHOD, and IMPORTED_AT.

Parameter sortOrder : Specifies the order of sorted results. Valid values are ASCENDING or DESCENDING.

Implementation

Future<SearchCertificatesResponse> searchCertificates({
  CertificateFilterStatement? filterStatement,
  int? maxResults,
  String? nextToken,
  SearchCertificatesSortBy? sortBy,
  SearchCertificatesSortOrder? sortOrder,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    500,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CertificateManager.SearchCertificates'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (filterStatement != null) 'FilterStatement': filterStatement,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (sortBy != null) 'SortBy': sortBy.value,
      if (sortOrder != null) 'SortOrder': sortOrder.value,
    },
  );

  return SearchCertificatesResponse.fromJson(jsonResponse.body);
}