Class WorkflowsClient

java.lang.Object
com.google.cloud.workflows.v1.WorkflowsClient
All Implemented Interfaces:
BackgroundResource, AutoCloseable

@Generated("by gapic-generator-java") public class WorkflowsClient extends Object implements BackgroundResource
Service Description: Workflows is used to deploy and execute workflow programs. Workflows makes sure the program executes reliably, despite hardware and networking interruptions.

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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
   WorkflowName name = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
   Workflow response = workflowsClient.getWorkflow(name);
 }
 

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

Methods
Method Description Method Variants

ListWorkflows

Lists workflows in a given project and location. The default order is not specified.

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

  • listWorkflows(ListWorkflowsRequest request)

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

  • listWorkflows(LocationName parent)

  • listWorkflows(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.

  • listWorkflowsPagedCallable()

  • listWorkflowsCallable()

GetWorkflow

Gets details of a single workflow.

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

  • getWorkflow(GetWorkflowRequest request)

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

  • getWorkflow(WorkflowName name)

  • getWorkflow(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.

  • getWorkflowCallable()

CreateWorkflow

Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.

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

  • createWorkflowAsync(CreateWorkflowRequest request)

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

  • createWorkflowAsync(LocationName parent, Workflow workflow, String workflowId)

  • createWorkflowAsync(String parent, Workflow workflow, String workflowId)

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

  • createWorkflowOperationCallable()

  • createWorkflowCallable()

DeleteWorkflow

Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.

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

  • deleteWorkflowAsync(DeleteWorkflowRequest request)

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

  • deleteWorkflowAsync(WorkflowName name)

  • deleteWorkflowAsync(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.

  • deleteWorkflowOperationCallable()

  • deleteWorkflowCallable()

UpdateWorkflow

Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow might be created as a result of a successful update operation. In that case, the new revision is used in new workflow executions.

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

  • updateWorkflowAsync(UpdateWorkflowRequest request)

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

  • updateWorkflowAsync(Workflow workflow, 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.

  • updateWorkflowOperationCallable()

  • updateWorkflowCallable()

ListWorkflowRevisions

Lists revisions for a given workflow.

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

  • listWorkflowRevisions(ListWorkflowRevisionsRequest request)

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

  • listWorkflowRevisionsPagedCallable()

  • listWorkflowRevisionsCallable()

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 WorkflowsSettings 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
 WorkflowsSettings workflowsSettings =
     WorkflowsSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 WorkflowsClient workflowsClient = WorkflowsClient.create(workflowsSettings);
 

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
 WorkflowsSettings workflowsSettings =
     WorkflowsSettings.newBuilder().setEndpoint(myEndpoint).build();
 WorkflowsClient workflowsClient = WorkflowsClient.create(workflowsSettings);
 

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
 WorkflowsSettings workflowsSettings = WorkflowsSettings.newHttpJsonBuilder().build();
 WorkflowsClient workflowsClient = WorkflowsClient.create(workflowsSettings);
 

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

  • Constructor Details

    • WorkflowsClient

      protected WorkflowsClient(WorkflowsSettings settings) throws IOException
      Constructs an instance of WorkflowsClient, 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.
      Throws:
      IOException
    • WorkflowsClient

      protected WorkflowsClient(WorkflowsStub stub)
  • Method Details

    • create

      public static final WorkflowsClient create() throws IOException
      Constructs an instance of WorkflowsClient with default settings.
      Throws:
      IOException
    • create

      public static final WorkflowsClient create(WorkflowsSettings settings) throws IOException
      Constructs an instance of WorkflowsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
      Throws:
      IOException
    • create

      public static final WorkflowsClient create(WorkflowsStub stub)
      Constructs an instance of WorkflowsClient, using the given stub for making calls. This is for advanced usage - prefer using create(WorkflowsSettings).
    • getSettings

      public final WorkflowsSettings getSettings()
    • getStub

      public WorkflowsStub getStub()
    • 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.
    • getHttpJsonOperationsClient

      @BetaApi 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.
    • listWorkflows

      public final WorkflowsClient.ListWorkflowsPagedResponse listWorkflows(LocationName parent)
      Lists workflows in a given project and location. The default order is not specified.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
         for (Workflow element : workflowsClient.listWorkflows(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. Project and location from which the workflows should be listed. Format: projects/{project}/locations/{location}
      Throws:
      ApiException - if the remote call fails
    • listWorkflows

      public final WorkflowsClient.ListWorkflowsPagedResponse listWorkflows(String parent)
      Lists workflows in a given project and location. The default order is not specified.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
         for (Workflow element : workflowsClient.listWorkflows(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. Project and location from which the workflows should be listed. Format: projects/{project}/locations/{location}
      Throws:
      ApiException - if the remote call fails
    • listWorkflows

      Lists workflows in a given project and location. The default order is not specified.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         ListWorkflowsRequest request =
             ListWorkflowsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .setOrderBy("orderBy-1207110587")
                 .build();
         for (Workflow element : workflowsClient.listWorkflows(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listWorkflowsPagedCallable

      Lists workflows in a given project and location. The default order is not specified.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         ListWorkflowsRequest request =
             ListWorkflowsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .setOrderBy("orderBy-1207110587")
                 .build();
         ApiFuture<Workflow> future = workflowsClient.listWorkflowsPagedCallable().futureCall(request);
         // Do something.
         for (Workflow element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listWorkflowsCallable

      public final UnaryCallable<ListWorkflowsRequest,ListWorkflowsResponse> listWorkflowsCallable()
      Lists workflows in a given project and location. The default order is not specified.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         ListWorkflowsRequest request =
             ListWorkflowsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .setOrderBy("orderBy-1207110587")
                 .build();
         while (true) {
           ListWorkflowsResponse response = workflowsClient.listWorkflowsCallable().call(request);
           for (Workflow element : response.getWorkflowsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getWorkflow

      public final Workflow getWorkflow(WorkflowName name)
      Gets details of a single workflow.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         WorkflowName name = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
         Workflow response = workflowsClient.getWorkflow(name);
       }
       
      Parameters:
      name - Required. Name of the workflow for which information should be retrieved. Format: projects/{project}/locations/{location}/workflows/{workflow}
      Throws:
      ApiException - if the remote call fails
    • getWorkflow

      public final Workflow getWorkflow(String name)
      Gets details of a single workflow.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         String name = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString();
         Workflow response = workflowsClient.getWorkflow(name);
       }
       
      Parameters:
      name - Required. Name of the workflow for which information should be retrieved. Format: projects/{project}/locations/{location}/workflows/{workflow}
      Throws:
      ApiException - if the remote call fails
    • getWorkflow

      public final Workflow getWorkflow(GetWorkflowRequest request)
      Gets details of a single workflow.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         GetWorkflowRequest request =
             GetWorkflowRequest.newBuilder()
                 .setName(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
                 .setRevisionId("revisionId-1507445162")
                 .build();
         Workflow response = workflowsClient.getWorkflow(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getWorkflowCallable

      public final UnaryCallable<GetWorkflowRequest,Workflow> getWorkflowCallable()
      Gets details of a single workflow.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         GetWorkflowRequest request =
             GetWorkflowRequest.newBuilder()
                 .setName(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
                 .setRevisionId("revisionId-1507445162")
                 .build();
         ApiFuture<Workflow> future = workflowsClient.getWorkflowCallable().futureCall(request);
         // Do something.
         Workflow response = future.get();
       }
       
    • createWorkflowAsync

      public final OperationFuture<Workflow,OperationMetadata> createWorkflowAsync(LocationName parent, Workflow workflow, String workflowId)
      Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
         Workflow workflow = Workflow.newBuilder().build();
         String workflowId = "workflowId-360387270";
         Workflow response = workflowsClient.createWorkflowAsync(parent, workflow, workflowId).get();
       }
       
      Parameters:
      parent - Required. Project and location in which the workflow should be created. Format: projects/{project}/locations/{location}
      workflow - Required. Workflow to be created.
      workflowId - Required. The ID of the workflow to be created. It has to fulfill the following requirements:
      • Must contain only letters, numbers, underscores and hyphens.
      • Must start with a letter.
      • Must be between 1-64 characters.
      • Must end with a number or a letter.
      • Must be unique within the customer project and location.
      Throws:
      ApiException - if the remote call fails
    • createWorkflowAsync

      public final OperationFuture<Workflow,OperationMetadata> createWorkflowAsync(String parent, Workflow workflow, String workflowId)
      Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
         Workflow workflow = Workflow.newBuilder().build();
         String workflowId = "workflowId-360387270";
         Workflow response = workflowsClient.createWorkflowAsync(parent, workflow, workflowId).get();
       }
       
      Parameters:
      parent - Required. Project and location in which the workflow should be created. Format: projects/{project}/locations/{location}
      workflow - Required. Workflow to be created.
      workflowId - Required. The ID of the workflow to be created. It has to fulfill the following requirements:
      • Must contain only letters, numbers, underscores and hyphens.
      • Must start with a letter.
      • Must be between 1-64 characters.
      • Must end with a number or a letter.
      • Must be unique within the customer project and location.
      Throws:
      ApiException - if the remote call fails
    • createWorkflowAsync

      public final OperationFuture<Workflow,OperationMetadata> createWorkflowAsync(CreateWorkflowRequest request)
      Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         CreateWorkflowRequest request =
             CreateWorkflowRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setWorkflow(Workflow.newBuilder().build())
                 .setWorkflowId("workflowId-360387270")
                 .build();
         Workflow response = workflowsClient.createWorkflowAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createWorkflowOperationCallable

      public final OperationCallable<CreateWorkflowRequest,Workflow,OperationMetadata> createWorkflowOperationCallable()
      Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         CreateWorkflowRequest request =
             CreateWorkflowRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setWorkflow(Workflow.newBuilder().build())
                 .setWorkflowId("workflowId-360387270")
                 .build();
         OperationFuture<Workflow, OperationMetadata> future =
             workflowsClient.createWorkflowOperationCallable().futureCall(request);
         // Do something.
         Workflow response = future.get();
       }
       
    • createWorkflowCallable

      public final UnaryCallable<CreateWorkflowRequest,Operation> createWorkflowCallable()
      Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         CreateWorkflowRequest request =
             CreateWorkflowRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setWorkflow(Workflow.newBuilder().build())
                 .setWorkflowId("workflowId-360387270")
                 .build();
         ApiFuture<Operation> future = workflowsClient.createWorkflowCallable().futureCall(request);
         // Do something.
         Operation response = future.get();
       }
       
    • deleteWorkflowAsync

      public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteWorkflowAsync(WorkflowName name)
      Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         WorkflowName name = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
         workflowsClient.deleteWorkflowAsync(name).get();
       }
       
      Parameters:
      name - Required. Name of the workflow to be deleted. Format: projects/{project}/locations/{location}/workflows/{workflow}
      Throws:
      ApiException - if the remote call fails
    • deleteWorkflowAsync

      public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteWorkflowAsync(String name)
      Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         String name = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString();
         workflowsClient.deleteWorkflowAsync(name).get();
       }
       
      Parameters:
      name - Required. Name of the workflow to be deleted. Format: projects/{project}/locations/{location}/workflows/{workflow}
      Throws:
      ApiException - if the remote call fails
    • deleteWorkflowAsync

      public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteWorkflowAsync(DeleteWorkflowRequest request)
      Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         DeleteWorkflowRequest request =
             DeleteWorkflowRequest.newBuilder()
                 .setName(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
                 .build();
         workflowsClient.deleteWorkflowAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteWorkflowOperationCallable

      public final OperationCallable<DeleteWorkflowRequest,com.google.protobuf.Empty,OperationMetadata> deleteWorkflowOperationCallable()
      Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         DeleteWorkflowRequest request =
             DeleteWorkflowRequest.newBuilder()
                 .setName(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
                 .build();
         OperationFuture<Empty, OperationMetadata> future =
             workflowsClient.deleteWorkflowOperationCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • deleteWorkflowCallable

      public final UnaryCallable<DeleteWorkflowRequest,Operation> deleteWorkflowCallable()
      Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         DeleteWorkflowRequest request =
             DeleteWorkflowRequest.newBuilder()
                 .setName(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
                 .build();
         ApiFuture<Operation> future = workflowsClient.deleteWorkflowCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • updateWorkflowAsync

      public final OperationFuture<Workflow,OperationMetadata> updateWorkflowAsync(Workflow workflow, com.google.protobuf.FieldMask updateMask)
      Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow might be created as a result of a successful update operation. In that case, the new revision is used in new workflow executions.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         Workflow workflow = Workflow.newBuilder().build();
         FieldMask updateMask = FieldMask.newBuilder().build();
         Workflow response = workflowsClient.updateWorkflowAsync(workflow, updateMask).get();
       }
       
      Parameters:
      workflow - Required. Workflow to be updated.
      updateMask - List of fields to be updated. If not present, the entire workflow will be updated.
      Throws:
      ApiException - if the remote call fails
    • updateWorkflowAsync

      public final OperationFuture<Workflow,OperationMetadata> updateWorkflowAsync(UpdateWorkflowRequest request)
      Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow might be created as a result of a successful update operation. In that case, the new revision is used in new workflow executions.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         UpdateWorkflowRequest request =
             UpdateWorkflowRequest.newBuilder()
                 .setWorkflow(Workflow.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         Workflow response = workflowsClient.updateWorkflowAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • updateWorkflowOperationCallable

      public final OperationCallable<UpdateWorkflowRequest,Workflow,OperationMetadata> updateWorkflowOperationCallable()
      Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow might be created as a result of a successful update operation. In that case, the new revision is used in new workflow executions.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         UpdateWorkflowRequest request =
             UpdateWorkflowRequest.newBuilder()
                 .setWorkflow(Workflow.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         OperationFuture<Workflow, OperationMetadata> future =
             workflowsClient.updateWorkflowOperationCallable().futureCall(request);
         // Do something.
         Workflow response = future.get();
       }
       
    • updateWorkflowCallable

      public final UnaryCallable<UpdateWorkflowRequest,Operation> updateWorkflowCallable()
      Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow might be created as a result of a successful update operation. In that case, the new revision is used in new workflow executions.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         UpdateWorkflowRequest request =
             UpdateWorkflowRequest.newBuilder()
                 .setWorkflow(Workflow.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         ApiFuture<Operation> future = workflowsClient.updateWorkflowCallable().futureCall(request);
         // Do something.
         Operation response = future.get();
       }
       
    • listWorkflowRevisions

      Lists revisions for a given workflow.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         ListWorkflowRevisionsRequest request =
             ListWorkflowRevisionsRequest.newBuilder()
                 .setName(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (Workflow element : workflowsClient.listWorkflowRevisions(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listWorkflowRevisionsPagedCallable

      Lists revisions for a given workflow.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         ListWorkflowRevisionsRequest request =
             ListWorkflowRevisionsRequest.newBuilder()
                 .setName(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<Workflow> future =
             workflowsClient.listWorkflowRevisionsPagedCallable().futureCall(request);
         // Do something.
         for (Workflow element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listWorkflowRevisionsCallable

      public final UnaryCallable<ListWorkflowRevisionsRequest,ListWorkflowRevisionsResponse> listWorkflowRevisionsCallable()
      Lists revisions for a given workflow.

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         ListWorkflowRevisionsRequest request =
             ListWorkflowRevisionsRequest.newBuilder()
                 .setName(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListWorkflowRevisionsResponse response =
               workflowsClient.listWorkflowRevisionsCallable().call(request);
           for (Workflow element : response.getWorkflowsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • listLocations

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (Location element : workflowsClient.listLocations(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • 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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<Location> future = workflowsClient.listLocationsPagedCallable().futureCall(request);
         // Do something.
         for (Location element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • 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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListLocationsResponse response = workflowsClient.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;
           }
         }
       }
       
    • getLocation

      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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
         Location response = workflowsClient.getLocation(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • 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 (WorkflowsClient workflowsClient = WorkflowsClient.create()) {
         GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
         ApiFuture<Location> future = workflowsClient.getLocationCallable().futureCall(request);
         // Do something.
         Location response = future.get();
       }
       
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface BackgroundResource
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface BackgroundResource
    • isTerminated

      public boolean isTerminated()
      Specified by:
      isTerminated in interface BackgroundResource
    • shutdownNow

      public void shutdownNow()
      Specified by:
      shutdownNow in interface BackgroundResource
    • awaitTermination

      public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
      Specified by:
      awaitTermination in interface BackgroundResource
      Throws:
      InterruptedException