createFlow method
Creates a prompt flow that you can use to send an input through various steps to yield an output. Configure nodes, each of which corresponds to a step of the flow, and create connections between the nodes to create paths to different outputs. For more information, see How it works and Create a flow in Amazon Bedrock in the Amazon Bedrock User Guide.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter executionRoleArn :
The Amazon Resource Name (ARN) of the service role with permissions to
create and manage a flow. For more information, see Create
a service role for flows in Amazon Bedrock in the Amazon Bedrock User
Guide.
Parameter name :
A name for the flow.
Parameter clientToken :
A unique, case-sensitive identifier to ensure that the API request
completes no more than one time. If this token matches a previous request,
Amazon Bedrock ignores the request, but does not return an error. For more
information, see Ensuring
idempotency.
Parameter customerEncryptionKeyArn :
The Amazon Resource Name (ARN) of the KMS key to encrypt the flow.
Parameter definition :
A definition of the nodes and connections between nodes in the flow.
Parameter description :
A description for the flow.
Parameter tags :
Any tags that you want to attach to the flow. For more information, see Tagging
resources in Amazon Bedrock.
Implementation
Future<CreateFlowResponse> createFlow({
required String executionRoleArn,
required String name,
String? clientToken,
String? customerEncryptionKeyArn,
FlowDefinition? definition,
String? description,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'executionRoleArn': executionRoleArn,
'name': name,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (customerEncryptionKeyArn != null)
'customerEncryptionKeyArn': customerEncryptionKeyArn,
if (definition != null) 'definition': definition,
if (description != null) 'description': description,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/flows/',
exceptionFnMap: _exceptionFns,
);
return CreateFlowResponse.fromJson(response);
}