- 2.53.0 (latest)
- 2.52.0
- 2.51.0
- 2.49.0
- 2.48.0
- 2.47.0
- 2.46.0
- 2.45.0
- 2.44.0
- 2.43.0
- 2.42.0
- 2.41.0
- 2.40.0
- 2.39.0
- 2.37.0
- 2.36.0
- 2.35.0
- 2.34.0
- 2.33.0
- 2.32.0
- 2.31.0
- 2.30.0
- 2.29.0
- 2.28.0
- 2.27.0
- 2.24.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.0
- 2.11.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.0
- 2.3.6
- 2.2.1
- 2.1.10
GitHub Repository | Product Reference | REST Documentation |
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().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
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.
Static Methods
create()
public static final WorkflowsClient create()
Constructs an instance of WorkflowsClient with default settings.
Returns | |
---|---|
Type | Description |
WorkflowsClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(WorkflowsSettings settings)
public static final WorkflowsClient create(WorkflowsSettings settings)
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.
Parameter | |
---|---|
Name | Description |
settings | WorkflowsSettings |
Returns | |
---|---|
Type | Description |
WorkflowsClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(WorkflowsStub stub)
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).
Parameter | |
---|---|
Name | Description |
stub | WorkflowsStub |
Returns | |
---|---|
Type | Description |
WorkflowsClient |
Constructors
WorkflowsClient(WorkflowsSettings settings)
protected WorkflowsClient(WorkflowsSettings settings)
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.
Parameter | |
---|---|
Name | Description |
settings | WorkflowsSettings |
WorkflowsClient(WorkflowsStub stub)
protected WorkflowsClient(WorkflowsStub stub)
Parameter | |
---|---|
Name | Description |
stub | WorkflowsStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Parameters | |
---|---|
Name | Description |
duration | long |
unit | TimeUnit |
Returns | |
---|---|
Type | Description |
boolean |
Exceptions | |
---|---|
Type | Description |
InterruptedException |
close()
public final void close()
createWorkflowAsync(CreateWorkflowRequest request)
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 will return 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();
}
Parameter | |
---|---|
Name | Description |
request | CreateWorkflowRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Workflow,OperationMetadata> |
createWorkflowAsync(LocationName parent, Workflow workflow, String workflowId)
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 will return 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 | |
---|---|
Name | Description |
parent | LocationName Required. Project and location in which the workflow should be created. Format: projects/{project}/locations/{location} |
workflow | Workflow Required. Workflow to be created. |
workflowId | String Required. The ID of the workflow to be created. It has to fulfill the following requirements:
|
Returns | |
---|---|
Type | Description |
OperationFuture<Workflow,OperationMetadata> |
createWorkflowAsync(String parent, Workflow workflow, String workflowId)
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 will return 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 | |
---|---|
Name | Description |
parent | String Required. Project and location in which the workflow should be created. Format: projects/{project}/locations/{location} |
workflow | Workflow Required. Workflow to be created. |
workflowId | String Required. The ID of the workflow to be created. It has to fulfill the following requirements:
|
Returns | |
---|---|
Type | Description |
OperationFuture<Workflow,OperationMetadata> |
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 will return 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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateWorkflowRequest,Operation> |
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 will return 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();
}
Returns | |
---|---|
Type | Description |
OperationCallable<CreateWorkflowRequest,Workflow,OperationMetadata> |
deleteWorkflowAsync(DeleteWorkflowRequest request)
public final OperationFuture<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();
}
Parameter | |
---|---|
Name | Description |
request | DeleteWorkflowRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,OperationMetadata> |
deleteWorkflowAsync(WorkflowName name)
public final OperationFuture<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();
}
Parameter | |
---|---|
Name | Description |
name | WorkflowName Required. Name of the workflow to be deleted. Format: projects/{project}/locations/{location}/workflows/{workflow} |
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,OperationMetadata> |
deleteWorkflowAsync(String name)
public final OperationFuture<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();
}
Parameter | |
---|---|
Name | Description |
name | String Required. Name of the workflow to be deleted. Format: projects/{project}/locations/{location}/workflows/{workflow} |
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,OperationMetadata> |
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteWorkflowRequest,Operation> |
deleteWorkflowOperationCallable()
public final OperationCallable<DeleteWorkflowRequest,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();
}
Returns | |
---|---|
Type | Description |
OperationCallable<DeleteWorkflowRequest,Empty,OperationMetadata> |
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 | |
---|---|
Type | Description |
OperationsClient |
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 | |
---|---|
Type | Description |
OperationsClient |
getSettings()
public final WorkflowsSettings getSettings()
Returns | |
---|---|
Type | Description |
WorkflowsSettings |
getStub()
public WorkflowsStub getStub()
Returns | |
---|---|
Type | Description |
WorkflowsStub |
getWorkflow(GetWorkflowRequest request)
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())
.build();
Workflow response = workflowsClient.getWorkflow(request);
}
Parameter | |
---|---|
Name | Description |
request | GetWorkflowRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Workflow |
getWorkflow(WorkflowName name)
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);
}
Parameter | |
---|---|
Name | Description |
name | WorkflowName Required. Name of the workflow which information should be retrieved. Format: projects/{project}/locations/{location}/workflows/{workflow} |
Returns | |
---|---|
Type | Description |
Workflow |
getWorkflow(String name)
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);
}
Parameter | |
---|---|
Name | Description |
name | String Required. Name of the workflow which information should be retrieved. Format: projects/{project}/locations/{location}/workflows/{workflow} |
Returns | |
---|---|
Type | Description |
Workflow |
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())
.build();
ApiFuture<Workflow> future = workflowsClient.getWorkflowCallable().futureCall(request);
// Do something.
Workflow response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetWorkflowRequest,Workflow> |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
listWorkflows(ListWorkflowsRequest request)
public final WorkflowsClient.ListWorkflowsPagedResponse listWorkflows(ListWorkflowsRequest request)
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);
}
}
Parameter | |
---|---|
Name | Description |
request | ListWorkflowsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
WorkflowsClient.ListWorkflowsPagedResponse |
listWorkflows(LocationName parent)
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);
}
}
Parameter | |
---|---|
Name | Description |
parent | LocationName Required. Project and location from which the workflows should be listed. Format: projects/{project}/locations/{location} |
Returns | |
---|---|
Type | Description |
WorkflowsClient.ListWorkflowsPagedResponse |
listWorkflows(String parent)
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);
}
}
Parameter | |
---|---|
Name | Description |
parent | String Required. Project and location from which the workflows should be listed. Format: projects/{project}/locations/{location} |
Returns | |
---|---|
Type | Description |
WorkflowsClient.ListWorkflowsPagedResponse |
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;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListWorkflowsRequest,ListWorkflowsResponse> |
listWorkflowsPagedCallable()
public final UnaryCallable<ListWorkflowsRequest,WorkflowsClient.ListWorkflowsPagedResponse> 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);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListWorkflowsRequest,ListWorkflowsPagedResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
updateWorkflowAsync(UpdateWorkflowRequest request)
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 may be created as a result of a successful update operation. In that case, such revision will be 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();
}
Parameter | |
---|---|
Name | Description |
request | UpdateWorkflowRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Workflow,OperationMetadata> |
updateWorkflowAsync(Workflow workflow, FieldMask updateMask)
public final OperationFuture<Workflow,OperationMetadata> updateWorkflowAsync(Workflow workflow, 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 may be created as a result of a successful update operation. In that case, such revision will be 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 | |
---|---|
Name | Description |
workflow | Workflow Required. Workflow to be updated. |
updateMask | FieldMask List of fields to be updated. If not present, the entire workflow will be updated. |
Returns | |
---|---|
Type | Description |
OperationFuture<Workflow,OperationMetadata> |
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 may be created as a result of a successful update operation. In that case, such revision will be 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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<UpdateWorkflowRequest,Operation> |
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 may be created as a result of a successful update operation. In that case, such revision will be 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();
}
Returns | |
---|---|
Type | Description |
OperationCallable<UpdateWorkflowRequest,Workflow,OperationMetadata> |