Class CfnFlow
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.bedrock.CfnFlow
- All Implemented Interfaces:
IInspectable
,ITaggableV2
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.109.0 (build c221850)",
date="2025-03-13T18:54:58.561Z")
@Stability(Stable)
public class CfnFlow
extends CfnResource
implements IInspectable, ITaggableV2
Creates a prompt flow that you can use to send an input through various steps to yield an output.
You define a flow by configuring nodes, each of which corresponds to a step of the flow, and creating connections between the nodes to create paths to different outputs. You can define the flow in one of the following ways:
- Define a FlowDefinition in the
Definition
property. - Provide the definition in the
DefinitionString
property as a JSON-formatted string matching the FlowDefinition property. - Provide an Amazon S3 location in the
DefinitionS3Location
property that matches the FlowDefinition .
If you use the DefinitionString
or DefinitionS3Location
property, you can use the DefinitionSubstitutions
property to define key-value pairs to replace at runtime.
For more information, see How it works and Create a prompt flow in Amazon Bedrock in the Amazon Bedrock User Guide.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.bedrock.*; Object collector; Object input; Object iterator; Object output; CfnFlow cfnFlow = CfnFlow.Builder.create(this, "MyCfnFlow") .executionRoleArn("executionRoleArn") .name("name") // the properties below are optional .customerEncryptionKeyArn("customerEncryptionKeyArn") .definition(FlowDefinitionProperty.builder() .connections(List.of(FlowConnectionProperty.builder() .name("name") .source("source") .target("target") .type("type") // the properties below are optional .configuration(FlowConnectionConfigurationProperty.builder() .conditional(FlowConditionalConnectionConfigurationProperty.builder() .condition("condition") .build()) .data(FlowDataConnectionConfigurationProperty.builder() .sourceOutput("sourceOutput") .targetInput("targetInput") .build()) .build()) .build())) .nodes(List.of(FlowNodeProperty.builder() .name("name") .type("type") // the properties below are optional .configuration(FlowNodeConfigurationProperty.builder() .agent(AgentFlowNodeConfigurationProperty.builder() .agentAliasArn("agentAliasArn") .build()) .collector(collector) .condition(ConditionFlowNodeConfigurationProperty.builder() .conditions(List.of(FlowConditionProperty.builder() .name("name") // the properties below are optional .expression("expression") .build())) .build()) .input(input) .iterator(iterator) .knowledgeBase(KnowledgeBaseFlowNodeConfigurationProperty.builder() .knowledgeBaseId("knowledgeBaseId") // the properties below are optional .guardrailConfiguration(GuardrailConfigurationProperty.builder() .guardrailIdentifier("guardrailIdentifier") .guardrailVersion("guardrailVersion") .build()) .modelId("modelId") .build()) .lambdaFunction(LambdaFunctionFlowNodeConfigurationProperty.builder() .lambdaArn("lambdaArn") .build()) .lex(LexFlowNodeConfigurationProperty.builder() .botAliasArn("botAliasArn") .localeId("localeId") .build()) .output(output) .prompt(PromptFlowNodeConfigurationProperty.builder() .sourceConfiguration(PromptFlowNodeSourceConfigurationProperty.builder() .inline(PromptFlowNodeInlineConfigurationProperty.builder() .modelId("modelId") .templateConfiguration(PromptTemplateConfigurationProperty.builder() .text(TextPromptTemplateConfigurationProperty.builder() .text("text") // the properties below are optional .inputVariables(List.of(PromptInputVariableProperty.builder() .name("name") .build())) .build()) .build()) .templateType("templateType") // the properties below are optional .inferenceConfiguration(PromptInferenceConfigurationProperty.builder() .text(PromptModelInferenceConfigurationProperty.builder() .maxTokens(123) .stopSequences(List.of("stopSequences")) .temperature(123) .topP(123) .build()) .build()) .build()) .resource(PromptFlowNodeResourceConfigurationProperty.builder() .promptArn("promptArn") .build()) .build()) // the properties below are optional .guardrailConfiguration(GuardrailConfigurationProperty.builder() .guardrailIdentifier("guardrailIdentifier") .guardrailVersion("guardrailVersion") .build()) .build()) .retrieval(RetrievalFlowNodeConfigurationProperty.builder() .serviceConfiguration(RetrievalFlowNodeServiceConfigurationProperty.builder() .s3(RetrievalFlowNodeS3ConfigurationProperty.builder() .bucketName("bucketName") .build()) .build()) .build()) .storage(StorageFlowNodeConfigurationProperty.builder() .serviceConfiguration(StorageFlowNodeServiceConfigurationProperty.builder() .s3(StorageFlowNodeS3ConfigurationProperty.builder() .bucketName("bucketName") .build()) .build()) .build()) .build()) .inputs(List.of(FlowNodeInputProperty.builder() .expression("expression") .name("name") .type("type") .build())) .outputs(List.of(FlowNodeOutputProperty.builder() .name("name") .type("type") .build())) .build())) .build()) .definitionS3Location(S3LocationProperty.builder() .bucket("bucket") .key("key") // the properties below are optional .version("version") .build()) .definitionString("definitionString") .definitionSubstitutions(Map.of( "definitionSubstitutionsKey", "definitionSubstitutions")) .description("description") .tags(Map.of( "tagsKey", "tags")) .testAliasTags(Map.of( "testAliasTagsKey", "testAliasTags")) .build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Defines an agent node in your flow.static final class
A fluent builder forCfnFlow
.static interface
Defines a condition node in your flow.static interface
The configuration of a connection between a condition node and another node.static interface
Defines a condition in the condition node.static interface
The configuration of the connection.static interface
Contains information about a connection between two nodes in the flow.static interface
The configuration of a connection originating from a node that isn't a Condition node.static interface
The definition of the nodes and connections between nodes in the flow.static interface
Contains configurations for a node in your flow.static interface
Contains configurations for an input to a node.static interface
Contains configurations for an output from a node.static interface
Contains configurations about a node in the flow.static interface
Contains information about validation of the flow.static interface
Configuration information for a guardrail that you use with the Converse operation.static interface
Contains configurations for a knowledge base node in a flow.static interface
Contains configurations for a Lambda function node in the flow.static interface
Contains configurations for a Lex node in the flow.static interface
Contains configurations for a prompt node in the flow.static interface
Contains configurations for a prompt defined inline in the node.static interface
Contains configurations for a prompt from Prompt management to use in a node.static interface
Contains configurations for a prompt and whether it is from Prompt management or defined inline.static interface
Contains inference configurations for the prompt.static interface
Contains information about a variable in the prompt.static interface
Contains inference configurations related to model inference for a prompt.static interface
Contains the message for a prompt.static interface
Contains configurations for a Retrieval node in a flow.static interface
Contains configurations for the Amazon S3 location from which to retrieve data to return as the output from the node.static interface
Contains configurations for the service to use for retrieving data to return as the output from the node.static interface
The S3 location of the flow definition.static interface
Contains configurations for a Storage node in a flow.static interface
Contains configurations for the Amazon S3 location in which to store the input into the node.static interface
Contains configurations for the service to use for storing the input into the node.static interface
Contains configurations for a text prompt template.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.ITaggableV2
ITaggableV2.Jsii$Default, ITaggableV2.Jsii$Proxy
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CfnFlow
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnFlow
(software.amazon.jsii.JsiiObjectRef objRef) CfnFlow
(software.constructs.Construct scope, String id, CfnFlowProps props) -
Method Summary
Modifier and TypeMethodDescriptionThe Amazon Resource Name (ARN) of the flow.The time at which the flow was created.The unique identifier of the flow.The status of the flow.The time at which the flow was last updated.List of flow validations.The latest version of the flow.Tag Manager which manages the tags for this resource.The Amazon Resource Name (ARN) of the KMS key that the flow is encrypted with.The definition of the nodes and connections between the nodes in the flow.The Amazon S3 location of the flow definition.The definition of the flow as a JSON-formatted string.A map that specifies the mappings for placeholder variables in the prompt flow definition.A description of the flow.The Amazon Resource Name (ARN) of the service role with permissions to create a flow.getName()
The name of the flow.getTags()
Metadata that you can assign to a resource as key-value pairs.A map of tag keys and values.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
The Amazon Resource Name (ARN) of the KMS key that the flow is encrypted with.void
setDefinition
(IResolvable value) The definition of the nodes and connections between the nodes in the flow.void
The definition of the nodes and connections between the nodes in the flow.void
The Amazon S3 location of the flow definition.void
The Amazon S3 location of the flow definition.void
setDefinitionString
(String value) The definition of the flow as a JSON-formatted string.void
setDefinitionSubstitutions
(Map<String, Object> value) A map that specifies the mappings for placeholder variables in the prompt flow definition.void
A map that specifies the mappings for placeholder variables in the prompt flow definition.void
setDescription
(String value) A description of the flow.void
setExecutionRoleArn
(String value) The Amazon Resource Name (ARN) of the service role with permissions to create a flow.void
The name of the flow.void
Metadata that you can assign to a resource as key-value pairs.void
setTestAliasTags
(Map<String, String> value) A map of tag keys and values.void
setTestAliasTags
(IResolvable value) A map of tag keys and values.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.constructs.Construct
getNode, isConstruct
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnFlow
protected CfnFlow(software.amazon.jsii.JsiiObjectRef objRef) -
CfnFlow
protected CfnFlow(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnFlow
@Stability(Stable) public CfnFlow(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnFlowProps props) - Parameters:
scope
- Scope in which this resource is defined. This parameter is required.id
- Construct identifier for this resource (unique in its scope). This parameter is required.props
- Resource properties. This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrArn
The Amazon Resource Name (ARN) of the flow. -
getAttrCreatedAt
The time at which the flow was created. -
getAttrId
The unique identifier of the flow. -
getAttrStatus
The status of the flow. The following statuses are possible:.- NotPrepared – The flow has been created or updated, but hasn't been prepared. If you just created the flow, you can't test it. If you updated the flow, the
DRAFT
version won't contain the latest changes for testing. Send a PrepareFlow request to package the latest changes into theDRAFT
version. - Preparing – The flow is being prepared so that the
DRAFT
version contains the latest changes for testing. - Prepared – The flow is prepared and the
DRAFT
version contains the latest changes for testing. - Failed – The last API operation that you invoked on the flow failed. Send a GetFlow request and check the error message in the
validations
field.
- NotPrepared – The flow has been created or updated, but hasn't been prepared. If you just created the flow, you can't test it. If you updated the flow, the
-
getAttrUpdatedAt
The time at which the flow was last updated. -
getAttrValidations
List of flow validations. -
getAttrVersion
The latest version of the flow. -
getCdkTagManager
Tag Manager which manages the tags for this resource.- Specified by:
getCdkTagManager
in interfaceITaggableV2
-
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getExecutionRoleArn
The Amazon Resource Name (ARN) of the service role with permissions to create a flow. -
setExecutionRoleArn
The Amazon Resource Name (ARN) of the service role with permissions to create a flow. -
getName
The name of the flow. -
setName
The name of the flow. -
getCustomerEncryptionKeyArn
The Amazon Resource Name (ARN) of the KMS key that the flow is encrypted with. -
setCustomerEncryptionKeyArn
The Amazon Resource Name (ARN) of the KMS key that the flow is encrypted with. -
getDefinition
The definition of the nodes and connections between the nodes in the flow. -
setDefinition
The definition of the nodes and connections between the nodes in the flow. -
setDefinition
The definition of the nodes and connections between the nodes in the flow. -
getDefinitionS3Location
The Amazon S3 location of the flow definition. -
setDefinitionS3Location
The Amazon S3 location of the flow definition. -
setDefinitionS3Location
The Amazon S3 location of the flow definition. -
getDefinitionString
The definition of the flow as a JSON-formatted string. -
setDefinitionString
The definition of the flow as a JSON-formatted string. -
getDefinitionSubstitutions
A map that specifies the mappings for placeholder variables in the prompt flow definition. -
setDefinitionSubstitutions
A map that specifies the mappings for placeholder variables in the prompt flow definition. -
setDefinitionSubstitutions
A map that specifies the mappings for placeholder variables in the prompt flow definition. -
getDescription
A description of the flow. -
setDescription
A description of the flow. -
getTags
Metadata that you can assign to a resource as key-value pairs.For more information, see the following resources:.
-
setTags
Metadata that you can assign to a resource as key-value pairs.For more information, see the following resources:.
-
getTestAliasTags
A map of tag keys and values. -
setTestAliasTags
A map of tag keys and values. -
setTestAliasTags
A map of tag keys and values.
-