listGuardrails method

Future<ListGuardrailsResponse> listGuardrails({
  1. String? guardrailIdentifier,
  2. int? maxResults,
  3. String? nextToken,
})

Lists details about all the guardrails in an account. To list the DRAFT version of all your guardrails, don't specify the guardrailIdentifier field. To list all versions of a guardrail, specify the ARN of the guardrail in the guardrailIdentifier field.

You can set the maximum number of results to return in a response in the maxResults field. If there are more results than the number you set, the response returns a nextToken that you can send in another ListGuardrails request to see the next batch of results.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter guardrailIdentifier : The unique identifier of the guardrail. This can be an ID or the ARN.

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

Parameter nextToken : If there are more results than were returned in the response, the response returns a nextToken that you can send in another ListGuardrails request to see the next batch of results.

Implementation

Future<ListGuardrailsResponse> listGuardrails({
  String? guardrailIdentifier,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  final $query = <String, List<String>>{
    if (guardrailIdentifier != null)
      'guardrailIdentifier': [guardrailIdentifier],
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/guardrails',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListGuardrailsResponse.fromJson(response);
}