createGuardrailVersion method

Future<CreateGuardrailVersionResponse> createGuardrailVersion({
  1. required String guardrailIdentifier,
  2. String? clientRequestToken,
  3. String? description,
})

Creates a version of the guardrail. Use this API to create a snapshot of the guardrail when you are satisfied with a configuration, or to compare the configuration with another version.

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

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

Parameter clientRequestToken : A unique, case-sensitive identifier to ensure that the API request completes no more than once. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see Ensuring idempotency in the Amazon S3 User Guide.

Parameter description : A description of the guardrail version.

Implementation

Future<CreateGuardrailVersionResponse> createGuardrailVersion({
  required String guardrailIdentifier,
  String? clientRequestToken,
  String? description,
}) async {
  final $payload = <String, dynamic>{
    'clientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/guardrails/${Uri.encodeComponent(guardrailIdentifier)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreateGuardrailVersionResponse.fromJson(response);
}