Class FlowsClient (0.52.0)

GitHub RepositoryProduct ReferenceREST DocumentationRPC Documentation

Service Description: Service for managing Flows.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
   Flow flow = Flow.newBuilder().build();
   Flow response = flowsClient.createFlow(parent, flow);
 }
 

Note: close() needs to be called on the FlowsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
MethodDescriptionMethod Variants

CreateFlow

Creates a flow in the specified agent.

Note: You should always train a flow prior to sending it queries. See the training documentation.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createFlow(CreateFlowRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createFlow(AgentName parent, Flow flow)

  • createFlow(String parent, Flow flow)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createFlowCallable()

DeleteFlow

Deletes a specified flow.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteFlow(DeleteFlowRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteFlow(FlowName name)

  • deleteFlow(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteFlowCallable()

ListFlows

Returns the list of all flows in the specified agent.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listFlows(ListFlowsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listFlows(AgentName parent)

  • listFlows(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listFlowsPagedCallable()

  • listFlowsCallable()

GetFlow

Retrieves the specified flow.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getFlow(GetFlowRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getFlow(FlowName name)

  • getFlow(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getFlowCallable()

UpdateFlow

Updates the specified flow.

Note: You should always train a flow prior to sending it queries. See the training documentation.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateFlow(UpdateFlowRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateFlow(Flow flow, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateFlowCallable()

TrainFlow

Trains the specified flow. Note that only the flow in 'draft' environment is trained.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message - response: An Empty message

Note: You should always train a flow prior to sending it queries. See the training documentation.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • trainFlowAsync(TrainFlowRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • trainFlowAsync(FlowName name)

  • trainFlowAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • trainFlowOperationCallable()

  • trainFlowCallable()

ValidateFlow

Validates the specified flow and creates or updates validation results. Please call this API after the training is completed to get the complete validation results.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • validateFlow(ValidateFlowRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • validateFlowCallable()

GetFlowValidationResult

Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getFlowValidationResult(GetFlowValidationResultRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getFlowValidationResult(FlowValidationResultName name)

  • getFlowValidationResult(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getFlowValidationResultCallable()

ImportFlow

Imports the specified flow to the specified agent from a binary file.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message - response: ImportFlowResponse

Note: You should always train a flow prior to sending it queries. See the training documentation.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • importFlowAsync(ImportFlowRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • importFlowOperationCallable()

  • importFlowCallable()

ExportFlow

Exports the specified flow to a binary file.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message - response: ExportFlowResponse

Note that resources (e.g. intents, entities, webhooks) that the flow references will also be exported.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • exportFlowAsync(ExportFlowRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • exportFlowOperationCallable()

  • exportFlowCallable()

ListLocations

Lists information about the supported locations for this service.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listLocations(ListLocationsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getLocation(GetLocationRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getLocationCallable()

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of FlowsSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 FlowsSettings flowsSettings =
     FlowsSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 FlowsClient flowsClient = FlowsClient.create(flowsSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 FlowsSettings flowsSettings = FlowsSettings.newBuilder().setEndpoint(myEndpoint).build();
 FlowsClient flowsClient = FlowsClient.create(flowsSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 FlowsSettings flowsSettings = FlowsSettings.newHttpJsonBuilder().build();
 FlowsClient flowsClient = FlowsClient.create(flowsSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > FlowsClient

Static Methods

create()

public static final FlowsClient create()

Constructs an instance of FlowsClient with default settings.

Returns
TypeDescription
FlowsClient
Exceptions
TypeDescription
IOException

create(FlowsSettings settings)

public static final FlowsClient create(FlowsSettings settings)

Constructs an instance of FlowsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsFlowsSettings
Returns
TypeDescription
FlowsClient
Exceptions
TypeDescription
IOException

create(FlowsStub stub)

public static final FlowsClient create(FlowsStub stub)

Constructs an instance of FlowsClient, using the given stub for making calls. This is for advanced usage - prefer using create(FlowsSettings).

Parameter
NameDescription
stubFlowsStub
Returns
TypeDescription
FlowsClient

Constructors

FlowsClient(FlowsSettings settings)

protected FlowsClient(FlowsSettings settings)

Constructs an instance of FlowsClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
NameDescription
settingsFlowsSettings

FlowsClient(FlowsStub stub)

protected FlowsClient(FlowsStub stub)
Parameter
NameDescription
stubFlowsStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

createFlow(AgentName parent, Flow flow)

public final Flow createFlow(AgentName parent, Flow flow)

Creates a flow in the specified agent.

Note: You should always train a flow prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
   Flow flow = Flow.newBuilder().build();
   Flow response = flowsClient.createFlow(parent, flow);
 }
 
Parameters
NameDescription
parentAgentName

Required. The agent to create a flow for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

flowFlow

Required. The flow to create.

Returns
TypeDescription
Flow

createFlow(CreateFlowRequest request)

public final Flow createFlow(CreateFlowRequest request)

Creates a flow in the specified agent.

Note: You should always train a flow prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   CreateFlowRequest request =
       CreateFlowRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setFlow(Flow.newBuilder().build())
           .setLanguageCode("languageCode-2092349083")
           .build();
   Flow response = flowsClient.createFlow(request);
 }
 
Parameter
NameDescription
requestCreateFlowRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Flow

createFlow(String parent, Flow flow)

public final Flow createFlow(String parent, Flow flow)

Creates a flow in the specified agent.

Note: You should always train a flow prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
   Flow flow = Flow.newBuilder().build();
   Flow response = flowsClient.createFlow(parent, flow);
 }
 
Parameters
NameDescription
parentString

Required. The agent to create a flow for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

flowFlow

Required. The flow to create.

Returns
TypeDescription
Flow

createFlowCallable()

public final UnaryCallable<CreateFlowRequest,Flow> createFlowCallable()

Creates a flow in the specified agent.

Note: You should always train a flow prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   CreateFlowRequest request =
       CreateFlowRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setFlow(Flow.newBuilder().build())
           .setLanguageCode("languageCode-2092349083")
           .build();
   ApiFuture<Flow> future = flowsClient.createFlowCallable().futureCall(request);
   // Do something.
   Flow response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateFlowRequest,Flow>

deleteFlow(DeleteFlowRequest request)

public final void deleteFlow(DeleteFlowRequest request)

Deletes a specified flow.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   DeleteFlowRequest request =
       DeleteFlowRequest.newBuilder()
           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
           .setForce(true)
           .build();
   flowsClient.deleteFlow(request);
 }
 
Parameter
NameDescription
requestDeleteFlowRequest

The request object containing all of the parameters for the API call.

deleteFlow(FlowName name)

public final void deleteFlow(FlowName name)

Deletes a specified flow.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
   flowsClient.deleteFlow(name);
 }
 
Parameter
NameDescription
nameFlowName

Required. The name of the flow to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>.

deleteFlow(String name)

public final void deleteFlow(String name)

Deletes a specified flow.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   String name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
   flowsClient.deleteFlow(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the flow to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>.

deleteFlowCallable()

public final UnaryCallable<DeleteFlowRequest,Empty> deleteFlowCallable()

Deletes a specified flow.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   DeleteFlowRequest request =
       DeleteFlowRequest.newBuilder()
           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
           .setForce(true)
           .build();
   ApiFuture<Empty> future = flowsClient.deleteFlowCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteFlowRequest,Empty>

exportFlowAsync(ExportFlowRequest request)

public final OperationFuture<ExportFlowResponse,Struct> exportFlowAsync(ExportFlowRequest request)

Exports the specified flow to a binary file.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: ExportFlowResponse

    Note that resources (e.g. intents, entities, webhooks) that the flow references will also be exported.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (FlowsClient flowsClient = FlowsClient.create()) {
    ExportFlowRequest request =
        ExportFlowRequest.newBuilder()
            .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
            .setFlowUri("flowUri-765815458")
            .setIncludeReferencedFlows(true)
            .build();
    ExportFlowResponse response = flowsClient.exportFlowAsync(request).get();
    }
    
Parameter
NameDescription
requestExportFlowRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<ExportFlowResponse,Struct>

exportFlowCallable()

public final UnaryCallable<ExportFlowRequest,Operation> exportFlowCallable()

Exports the specified flow to a binary file.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: ExportFlowResponse

    Note that resources (e.g. intents, entities, webhooks) that the flow references will also be exported.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (FlowsClient flowsClient = FlowsClient.create()) {
    ExportFlowRequest request =
        ExportFlowRequest.newBuilder()
            .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
            .setFlowUri("flowUri-765815458")
            .setIncludeReferencedFlows(true)
            .build();
    ApiFuture<Operation> future = flowsClient.exportFlowCallable().futureCall(request);
    // Do something.
    Operation response = future.get();
    }
    
Returns
TypeDescription
UnaryCallable<ExportFlowRequest,Operation>

exportFlowOperationCallable()

public final OperationCallable<ExportFlowRequest,ExportFlowResponse,Struct> exportFlowOperationCallable()

Exports the specified flow to a binary file.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: ExportFlowResponse

    Note that resources (e.g. intents, entities, webhooks) that the flow references will also be exported.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (FlowsClient flowsClient = FlowsClient.create()) {
    ExportFlowRequest request =
        ExportFlowRequest.newBuilder()
            .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
            .setFlowUri("flowUri-765815458")
            .setIncludeReferencedFlows(true)
            .build();
    OperationFuture<ExportFlowResponse, Struct> future =
        flowsClient.exportFlowOperationCallable().futureCall(request);
    // Do something.
    ExportFlowResponse response = future.get();
    }
    
Returns
TypeDescription
OperationCallable<ExportFlowRequest,ExportFlowResponse,Struct>

getFlow(FlowName name)

public final Flow getFlow(FlowName name)

Retrieves the specified flow.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
   Flow response = flowsClient.getFlow(name);
 }
 
Parameter
NameDescription
nameFlowName

Required. The name of the flow to get. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>.

Returns
TypeDescription
Flow

getFlow(GetFlowRequest request)

public final Flow getFlow(GetFlowRequest request)

Retrieves the specified flow.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   GetFlowRequest request =
       GetFlowRequest.newBuilder()
           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
           .setLanguageCode("languageCode-2092349083")
           .build();
   Flow response = flowsClient.getFlow(request);
 }
 
Parameter
NameDescription
requestGetFlowRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Flow

getFlow(String name)

public final Flow getFlow(String name)

Retrieves the specified flow.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   String name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
   Flow response = flowsClient.getFlow(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the flow to get. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>.

Returns
TypeDescription
Flow

getFlowCallable()

public final UnaryCallable<GetFlowRequest,Flow> getFlowCallable()

Retrieves the specified flow.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   GetFlowRequest request =
       GetFlowRequest.newBuilder()
           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
           .setLanguageCode("languageCode-2092349083")
           .build();
   ApiFuture<Flow> future = flowsClient.getFlowCallable().futureCall(request);
   // Do something.
   Flow response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetFlowRequest,Flow>

getFlowValidationResult(FlowValidationResultName name)

public final FlowValidationResult getFlowValidationResult(FlowValidationResultName name)

Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   FlowValidationResultName name =
       FlowValidationResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
   FlowValidationResult response = flowsClient.getFlowValidationResult(name);
 }
 
Parameter
NameDescription
nameFlowValidationResultName

Required. The flow name. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/validationResult.

Returns
TypeDescription
FlowValidationResult

getFlowValidationResult(GetFlowValidationResultRequest request)

public final FlowValidationResult getFlowValidationResult(GetFlowValidationResultRequest request)

Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   GetFlowValidationResultRequest request =
       GetFlowValidationResultRequest.newBuilder()
           .setName(
               FlowValidationResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]")
                   .toString())
           .setLanguageCode("languageCode-2092349083")
           .build();
   FlowValidationResult response = flowsClient.getFlowValidationResult(request);
 }
 
Parameter
NameDescription
requestGetFlowValidationResultRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
FlowValidationResult

getFlowValidationResult(String name)

public final FlowValidationResult getFlowValidationResult(String name)

Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   String name =
       FlowValidationResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
   FlowValidationResult response = flowsClient.getFlowValidationResult(name);
 }
 
Parameter
NameDescription
nameString

Required. The flow name. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/validationResult.

Returns
TypeDescription
FlowValidationResult

getFlowValidationResultCallable()

public final UnaryCallable<GetFlowValidationResultRequest,FlowValidationResult> getFlowValidationResultCallable()

Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   GetFlowValidationResultRequest request =
       GetFlowValidationResultRequest.newBuilder()
           .setName(
               FlowValidationResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]")
                   .toString())
           .setLanguageCode("languageCode-2092349083")
           .build();
   ApiFuture<FlowValidationResult> future =
       flowsClient.getFlowValidationResultCallable().futureCall(request);
   // Do something.
   FlowValidationResult response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetFlowValidationResultRequest,FlowValidationResult>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
TypeDescription
OperationsClient

getLocation(GetLocationRequest request)

public final Location getLocation(GetLocationRequest request)

Gets information about a location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   Location response = flowsClient.getLocation(request);
 }
 
Parameter
NameDescription
requestcom.google.cloud.location.GetLocationRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
com.google.cloud.location.Location

getLocationCallable()

public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()

Gets information about a location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Location> future = flowsClient.getLocationCallable().futureCall(request);
   // Do something.
   Location response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
TypeDescription
OperationsClient

getSettings()

public final FlowsSettings getSettings()
Returns
TypeDescription
FlowsSettings

getStub()

public FlowsStub getStub()
Returns
TypeDescription
FlowsStub

importFlowAsync(ImportFlowRequest request)

public final OperationFuture<ImportFlowResponse,Struct> importFlowAsync(ImportFlowRequest request)

Imports the specified flow to the specified agent from a binary file.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: ImportFlowResponse

    Note: You should always train a flow prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (FlowsClient flowsClient = FlowsClient.create()) {
    ImportFlowRequest request =
        ImportFlowRequest.newBuilder()
            .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
            .setFlowImportStrategy(FlowImportStrategy.newBuilder().build())
            .build();
    ImportFlowResponse response = flowsClient.importFlowAsync(request).get();
    }
    
Parameter
NameDescription
requestImportFlowRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<ImportFlowResponse,Struct>

importFlowCallable()

public final UnaryCallable<ImportFlowRequest,Operation> importFlowCallable()

Imports the specified flow to the specified agent from a binary file.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: ImportFlowResponse

    Note: You should always train a flow prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (FlowsClient flowsClient = FlowsClient.create()) {
    ImportFlowRequest request =
        ImportFlowRequest.newBuilder()
            .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
            .setFlowImportStrategy(FlowImportStrategy.newBuilder().build())
            .build();
    ApiFuture<Operation> future = flowsClient.importFlowCallable().futureCall(request);
    // Do something.
    Operation response = future.get();
    }
    
Returns
TypeDescription
UnaryCallable<ImportFlowRequest,Operation>

importFlowOperationCallable()

public final OperationCallable<ImportFlowRequest,ImportFlowResponse,Struct> importFlowOperationCallable()

Imports the specified flow to the specified agent from a binary file.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: ImportFlowResponse

    Note: You should always train a flow prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (FlowsClient flowsClient = FlowsClient.create()) {
    ImportFlowRequest request =
        ImportFlowRequest.newBuilder()
            .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
            .setFlowImportStrategy(FlowImportStrategy.newBuilder().build())
            .build();
    OperationFuture<ImportFlowResponse, Struct> future =
        flowsClient.importFlowOperationCallable().futureCall(request);
    // Do something.
    ImportFlowResponse response = future.get();
    }
    
Returns
TypeDescription
OperationCallable<ImportFlowRequest,ImportFlowResponse,Struct>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listFlows(AgentName parent)

public final FlowsClient.ListFlowsPagedResponse listFlows(AgentName parent)

Returns the list of all flows in the specified agent.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
   for (Flow element : flowsClient.listFlows(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentAgentName

Required. The agent containing the flows. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

Returns
TypeDescription
FlowsClient.ListFlowsPagedResponse

listFlows(ListFlowsRequest request)

public final FlowsClient.ListFlowsPagedResponse listFlows(ListFlowsRequest request)

Returns the list of all flows in the specified agent.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   ListFlowsRequest request =
       ListFlowsRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setLanguageCode("languageCode-2092349083")
           .build();
   for (Flow element : flowsClient.listFlows(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListFlowsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
FlowsClient.ListFlowsPagedResponse

listFlows(String parent)

public final FlowsClient.ListFlowsPagedResponse listFlows(String parent)

Returns the list of all flows in the specified agent.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
   for (Flow element : flowsClient.listFlows(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The agent containing the flows. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

Returns
TypeDescription
FlowsClient.ListFlowsPagedResponse

listFlowsCallable()

public final UnaryCallable<ListFlowsRequest,ListFlowsResponse> listFlowsCallable()

Returns the list of all flows in the specified agent.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   ListFlowsRequest request =
       ListFlowsRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setLanguageCode("languageCode-2092349083")
           .build();
   while (true) {
     ListFlowsResponse response = flowsClient.listFlowsCallable().call(request);
     for (Flow element : response.getFlowsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListFlowsRequest,ListFlowsResponse>

listFlowsPagedCallable()

public final UnaryCallable<ListFlowsRequest,FlowsClient.ListFlowsPagedResponse> listFlowsPagedCallable()

Returns the list of all flows in the specified agent.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   ListFlowsRequest request =
       ListFlowsRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setLanguageCode("languageCode-2092349083")
           .build();
   ApiFuture<Flow> future = flowsClient.listFlowsPagedCallable().futureCall(request);
   // Do something.
   for (Flow element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListFlowsRequest,ListFlowsPagedResponse>

listLocations(ListLocationsRequest request)

public final FlowsClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)

Lists information about the supported locations for this service.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Location element : flowsClient.listLocations(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestcom.google.cloud.location.ListLocationsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
FlowsClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()

Lists information about the supported locations for this service.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListLocationsResponse response = flowsClient.listLocationsCallable().call(request);
     for (Location element : response.getLocationsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable<ListLocationsRequest,FlowsClient.ListLocationsPagedResponse> listLocationsPagedCallable()

Lists information about the supported locations for this service.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Location> future = flowsClient.listLocationsPagedCallable().futureCall(request);
   // Do something.
   for (Location element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

trainFlowAsync(FlowName name)

public final OperationFuture<Empty,Struct> trainFlowAsync(FlowName name)

Trains the specified flow. Note that only the flow in 'draft' environment is trained.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: An Empty message

    Note: You should always train a flow prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (FlowsClient flowsClient = FlowsClient.create()) {
    FlowName name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
    flowsClient.trainFlowAsync(name).get();
    }
    
Parameter
NameDescription
nameFlowName

Required. The flow to train. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>.

Returns
TypeDescription
OperationFuture<Empty,Struct>

trainFlowAsync(TrainFlowRequest request)

public final OperationFuture<Empty,Struct> trainFlowAsync(TrainFlowRequest request)

Trains the specified flow. Note that only the flow in 'draft' environment is trained.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: An Empty message

    Note: You should always train a flow prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (FlowsClient flowsClient = FlowsClient.create()) {
    TrainFlowRequest request =
        TrainFlowRequest.newBuilder()
            .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
            .build();
    flowsClient.trainFlowAsync(request).get();
    }
    
Parameter
NameDescription
requestTrainFlowRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Empty,Struct>

trainFlowAsync(String name)

public final OperationFuture<Empty,Struct> trainFlowAsync(String name)

Trains the specified flow. Note that only the flow in 'draft' environment is trained.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: An Empty message

    Note: You should always train a flow prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (FlowsClient flowsClient = FlowsClient.create()) {
    String name = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
    flowsClient.trainFlowAsync(name).get();
    }
    
Parameter
NameDescription
nameString

Required. The flow to train. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>.

Returns
TypeDescription
OperationFuture<Empty,Struct>

trainFlowCallable()

public final UnaryCallable<TrainFlowRequest,Operation> trainFlowCallable()

Trains the specified flow. Note that only the flow in 'draft' environment is trained.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: An Empty message

    Note: You should always train a flow prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (FlowsClient flowsClient = FlowsClient.create()) {
    TrainFlowRequest request =
        TrainFlowRequest.newBuilder()
            .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
            .build();
    ApiFuture<Operation> future = flowsClient.trainFlowCallable().futureCall(request);
    // Do something.
    future.get();
    }
    
Returns
TypeDescription
UnaryCallable<TrainFlowRequest,Operation>

trainFlowOperationCallable()

public final OperationCallable<TrainFlowRequest,Empty,Struct> trainFlowOperationCallable()

Trains the specified flow. Note that only the flow in 'draft' environment is trained.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: An Empty message

    Note: You should always train a flow prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (FlowsClient flowsClient = FlowsClient.create()) {
    TrainFlowRequest request =
        TrainFlowRequest.newBuilder()
            .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
            .build();
    OperationFuture<Empty, Struct> future =
        flowsClient.trainFlowOperationCallable().futureCall(request);
    // Do something.
    future.get();
    }
    
Returns
TypeDescription
OperationCallable<TrainFlowRequest,Empty,Struct>

updateFlow(Flow flow, FieldMask updateMask)

public final Flow updateFlow(Flow flow, FieldMask updateMask)

Updates the specified flow.

Note: You should always train a flow prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   Flow flow = Flow.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Flow response = flowsClient.updateFlow(flow, updateMask);
 }
 
Parameters
NameDescription
flowFlow

Required. The flow to update.

updateMaskFieldMask

The mask to control which fields get updated. If the mask is not present, all fields will be updated.

Returns
TypeDescription
Flow

updateFlow(UpdateFlowRequest request)

public final Flow updateFlow(UpdateFlowRequest request)

Updates the specified flow.

Note: You should always train a flow prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   UpdateFlowRequest request =
       UpdateFlowRequest.newBuilder()
           .setFlow(Flow.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setLanguageCode("languageCode-2092349083")
           .build();
   Flow response = flowsClient.updateFlow(request);
 }
 
Parameter
NameDescription
requestUpdateFlowRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Flow

updateFlowCallable()

public final UnaryCallable<UpdateFlowRequest,Flow> updateFlowCallable()

Updates the specified flow.

Note: You should always train a flow prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   UpdateFlowRequest request =
       UpdateFlowRequest.newBuilder()
           .setFlow(Flow.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setLanguageCode("languageCode-2092349083")
           .build();
   ApiFuture<Flow> future = flowsClient.updateFlowCallable().futureCall(request);
   // Do something.
   Flow response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateFlowRequest,Flow>

validateFlow(ValidateFlowRequest request)

public final FlowValidationResult validateFlow(ValidateFlowRequest request)

Validates the specified flow and creates or updates validation results. Please call this API after the training is completed to get the complete validation results.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   ValidateFlowRequest request =
       ValidateFlowRequest.newBuilder()
           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
           .setLanguageCode("languageCode-2092349083")
           .build();
   FlowValidationResult response = flowsClient.validateFlow(request);
 }
 
Parameter
NameDescription
requestValidateFlowRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
FlowValidationResult

validateFlowCallable()

public final UnaryCallable<ValidateFlowRequest,FlowValidationResult> validateFlowCallable()

Validates the specified flow and creates or updates validation results. Please call this API after the training is completed to get the complete validation results.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FlowsClient flowsClient = FlowsClient.create()) {
   ValidateFlowRequest request =
       ValidateFlowRequest.newBuilder()
           .setName(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
           .setLanguageCode("languageCode-2092349083")
           .build();
   ApiFuture<FlowValidationResult> future =
       flowsClient.validateFlowCallable().futureCall(request);
   // Do something.
   FlowValidationResult response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<ValidateFlowRequest,FlowValidationResult>