@Generated(value="by gapic-generator") @BetaApi public class WorkflowTemplateServiceClient extends Object implements BackgroundResource
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:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(parent, template);
}
Note: close() needs to be called on the workflowTemplateServiceClient 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:
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 WorkflowTemplateServiceSettings to create(). For example:
To customize credentials:
WorkflowTemplateServiceSettings workflowTemplateServiceSettings =
WorkflowTemplateServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
WorkflowTemplateServiceClient workflowTemplateServiceClient =
WorkflowTemplateServiceClient.create(workflowTemplateServiceSettings);
To customize the endpoint:
WorkflowTemplateServiceSettings workflowTemplateServiceSettings =
WorkflowTemplateServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
WorkflowTemplateServiceClient workflowTemplateServiceClient =
WorkflowTemplateServiceClient.create(workflowTemplateServiceSettings);
Modifier and Type | Class and Description |
---|---|
static class |
WorkflowTemplateServiceClient.ListWorkflowTemplatesFixedSizeCollection |
static class |
WorkflowTemplateServiceClient.ListWorkflowTemplatesPage |
static class |
WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
WorkflowTemplateServiceClient(WorkflowTemplateServiceSettings settings)
Constructs an instance of WorkflowTemplateServiceClient, using the given settings.
|
protected |
WorkflowTemplateServiceClient(WorkflowTemplateServiceStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static WorkflowTemplateServiceClient |
create()
Constructs an instance of WorkflowTemplateServiceClient with default settings.
|
static WorkflowTemplateServiceClient |
create(WorkflowTemplateServiceSettings settings)
Constructs an instance of WorkflowTemplateServiceClient, using the given settings.
|
static WorkflowTemplateServiceClient |
create(WorkflowTemplateServiceStub stub)
Constructs an instance of WorkflowTemplateServiceClient, using the given stub for making calls.
|
com.google.cloud.dataproc.v1.WorkflowTemplate |
createWorkflowTemplate(com.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest request)
Creates new workflow template.
|
com.google.cloud.dataproc.v1.WorkflowTemplate |
createWorkflowTemplate(com.google.cloud.dataproc.v1.RegionName parent,
com.google.cloud.dataproc.v1.WorkflowTemplate template)
Creates new workflow template.
|
com.google.cloud.dataproc.v1.WorkflowTemplate |
createWorkflowTemplate(String parent,
com.google.cloud.dataproc.v1.WorkflowTemplate template)
Creates new workflow template.
|
UnaryCallable<com.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest,com.google.cloud.dataproc.v1.WorkflowTemplate> |
createWorkflowTemplateCallable()
Creates new workflow template.
|
void |
deleteWorkflowTemplate(com.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest request)
Deletes a workflow template.
|
void |
deleteWorkflowTemplate(String name)
Deletes a workflow template.
|
void |
deleteWorkflowTemplate(com.google.cloud.dataproc.v1.WorkflowTemplateName name)
Deletes a workflow template.
|
UnaryCallable<com.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest,Empty> |
deleteWorkflowTemplateCallable()
Deletes a workflow template.
|
OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
WorkflowTemplateServiceSettings |
getSettings() |
WorkflowTemplateServiceStub |
getStub() |
com.google.cloud.dataproc.v1.WorkflowTemplate |
getWorkflowTemplate(com.google.cloud.dataproc.v1.GetWorkflowTemplateRequest request)
Retrieves the latest workflow template.
|
com.google.cloud.dataproc.v1.WorkflowTemplate |
getWorkflowTemplate(String name)
Retrieves the latest workflow template.
|
com.google.cloud.dataproc.v1.WorkflowTemplate |
getWorkflowTemplate(com.google.cloud.dataproc.v1.WorkflowTemplateName name)
Retrieves the latest workflow template.
|
UnaryCallable<com.google.cloud.dataproc.v1.GetWorkflowTemplateRequest,com.google.cloud.dataproc.v1.WorkflowTemplate> |
getWorkflowTemplateCallable()
Retrieves the latest workflow template.
|
OperationFuture<Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> |
instantiateInlineWorkflowTemplateAsync(com.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest request)
Instantiates a template and begins execution.
|
OperationFuture<Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> |
instantiateInlineWorkflowTemplateAsync(String parent,
com.google.cloud.dataproc.v1.WorkflowTemplate template)
Instantiates a template and begins execution.
|
UnaryCallable<com.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest,Operation> |
instantiateInlineWorkflowTemplateCallable()
Instantiates a template and begins execution.
|
OperationCallable<com.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest,Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> |
instantiateInlineWorkflowTemplateOperationCallable()
Instantiates a template and begins execution.
|
OperationFuture<Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> |
instantiateWorkflowTemplateAsync(com.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest request)
Instantiates a template and begins execution.
|
OperationFuture<Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> |
instantiateWorkflowTemplateAsync(String name)
Instantiates a template and begins execution.
|
OperationFuture<Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> |
instantiateWorkflowTemplateAsync(String name,
Map<String,String> parameters)
Instantiates a template and begins execution.
|
OperationFuture<Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> |
instantiateWorkflowTemplateAsync(com.google.cloud.dataproc.v1.WorkflowTemplateName name)
Instantiates a template and begins execution.
|
OperationFuture<Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> |
instantiateWorkflowTemplateAsync(com.google.cloud.dataproc.v1.WorkflowTemplateName name,
Map<String,String> parameters)
Instantiates a template and begins execution.
|
UnaryCallable<com.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest,Operation> |
instantiateWorkflowTemplateCallable()
Instantiates a template and begins execution.
|
OperationCallable<com.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest,Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> |
instantiateWorkflowTemplateOperationCallable()
Instantiates a template and begins execution.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse |
listWorkflowTemplates(com.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest request)
Lists workflows that match the specified filter in the request.
|
WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse |
listWorkflowTemplates(com.google.cloud.dataproc.v1.RegionName parent)
Lists workflows that match the specified filter in the request.
|
WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse |
listWorkflowTemplates(String parent)
Lists workflows that match the specified filter in the request.
|
UnaryCallable<com.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest,com.google.cloud.dataproc.v1.ListWorkflowTemplatesResponse> |
listWorkflowTemplatesCallable()
Lists workflows that match the specified filter in the request.
|
UnaryCallable<com.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest,WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse> |
listWorkflowTemplatesPagedCallable()
Lists workflows that match the specified filter in the request.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.cloud.dataproc.v1.WorkflowTemplate |
updateWorkflowTemplate(com.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest request)
Updates (replaces) workflow template.
|
com.google.cloud.dataproc.v1.WorkflowTemplate |
updateWorkflowTemplate(com.google.cloud.dataproc.v1.WorkflowTemplate template)
Updates (replaces) workflow template.
|
UnaryCallable<com.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest,com.google.cloud.dataproc.v1.WorkflowTemplate> |
updateWorkflowTemplateCallable()
Updates (replaces) workflow template.
|
protected WorkflowTemplateServiceClient(WorkflowTemplateServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected WorkflowTemplateServiceClient(WorkflowTemplateServiceStub stub)
public static final WorkflowTemplateServiceClient create() throws IOException
IOException
public static final WorkflowTemplateServiceClient create(WorkflowTemplateServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final WorkflowTemplateServiceClient create(WorkflowTemplateServiceStub stub)
public final WorkflowTemplateServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public WorkflowTemplateServiceStub getStub()
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationsClient getOperationsClient()
public final com.google.cloud.dataproc.v1.WorkflowTemplate createWorkflowTemplate(com.google.cloud.dataproc.v1.RegionName parent, com.google.cloud.dataproc.v1.WorkflowTemplate template)
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(parent, template);
}
parent
- Required. The "resource name" of the region, as described in
https://cloud.google.com/apis/design/resource_names of the form
`projects/{project_id}/regions/{region}`template
- Required. The Dataproc workflow template to create.ApiException
- if the remote call failspublic final com.google.cloud.dataproc.v1.WorkflowTemplate createWorkflowTemplate(String parent, com.google.cloud.dataproc.v1.WorkflowTemplate template)
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(parent.toString(), template);
}
parent
- Required. The "resource name" of the region, as described in
https://cloud.google.com/apis/design/resource_names of the form
`projects/{project_id}/regions/{region}`template
- Required. The Dataproc workflow template to create.ApiException
- if the remote call failspublic final com.google.cloud.dataproc.v1.WorkflowTemplate createWorkflowTemplate(com.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest request)
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
CreateWorkflowTemplateRequest request = CreateWorkflowTemplateRequest.newBuilder()
.setParent(parent.toString())
.setTemplate(template)
.build();
WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest,com.google.cloud.dataproc.v1.WorkflowTemplate> createWorkflowTemplateCallable()
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
CreateWorkflowTemplateRequest request = CreateWorkflowTemplateRequest.newBuilder()
.setParent(parent.toString())
.setTemplate(template)
.build();
ApiFuture<WorkflowTemplate> future = workflowTemplateServiceClient.createWorkflowTemplateCallable().futureCall(request);
// Do something
WorkflowTemplate response = future.get();
}
public final com.google.cloud.dataproc.v1.WorkflowTemplate getWorkflowTemplate(com.google.cloud.dataproc.v1.WorkflowTemplateName name)
Can retrieve previously instantiated template by specifying optional version parameter.
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(name);
}
name
- Required. The "resource name" of the workflow template, as described in
https://cloud.google.com/apis/design/resource_names of the form
`projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`ApiException
- if the remote call failspublic final com.google.cloud.dataproc.v1.WorkflowTemplate getWorkflowTemplate(String name)
Can retrieve previously instantiated template by specifying optional version parameter.
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(name.toString());
}
name
- Required. The "resource name" of the workflow template, as described in
https://cloud.google.com/apis/design/resource_names of the form
`projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`ApiException
- if the remote call failspublic final com.google.cloud.dataproc.v1.WorkflowTemplate getWorkflowTemplate(com.google.cloud.dataproc.v1.GetWorkflowTemplateRequest request)
Can retrieve previously instantiated template by specifying optional version parameter.
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
GetWorkflowTemplateRequest request = GetWorkflowTemplateRequest.newBuilder()
.setName(name.toString())
.build();
WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.dataproc.v1.GetWorkflowTemplateRequest,com.google.cloud.dataproc.v1.WorkflowTemplate> getWorkflowTemplateCallable()
Can retrieve previously instantiated template by specifying optional version parameter.
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
GetWorkflowTemplateRequest request = GetWorkflowTemplateRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<WorkflowTemplate> future = workflowTemplateServiceClient.getWorkflowTemplateCallable().futureCall(request);
// Do something
WorkflowTemplate response = future.get();
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> instantiateWorkflowTemplateAsync(com.google.cloud.dataproc.v1.WorkflowTemplateName name)
The returned Operation can be used to track execution of workflow by polling [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when entire workflow is finished.
The running workflow can be aborted via [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.
The [Operation.metadata][google.longrunning.Operation.metadata] will be [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata].
On successful completion, [Operation.response][google.longrunning.Operation.response] will be [Empty][google.protobuf.Empty].
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name).get();
}
name
- Required. The "resource name" of the workflow template, as described in
https://cloud.google.com/apis/design/resource_names of the form
`projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> instantiateWorkflowTemplateAsync(String name)
The returned Operation can be used to track execution of workflow by polling [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when entire workflow is finished.
The running workflow can be aborted via [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.
The [Operation.metadata][google.longrunning.Operation.metadata] will be [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata].
On successful completion, [Operation.response][google.longrunning.Operation.response] will be [Empty][google.protobuf.Empty].
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name.toString()).get();
}
name
- Required. The "resource name" of the workflow template, as described in
https://cloud.google.com/apis/design/resource_names of the form
`projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> instantiateWorkflowTemplateAsync(com.google.cloud.dataproc.v1.WorkflowTemplateName name, Map<String,String> parameters)
The returned Operation can be used to track execution of workflow by polling [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when entire workflow is finished.
The running workflow can be aborted via [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.
The [Operation.metadata][google.longrunning.Operation.metadata] will be [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata].
On successful completion, [Operation.response][google.longrunning.Operation.response] will be [Empty][google.protobuf.Empty].
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
Map<String, String> parameters = new HashMap<>();
workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name, parameters).get();
}
name
- Required. The "resource name" of the workflow template, as described in
https://cloud.google.com/apis/design/resource_names of the form
`projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`parameters
- Optional. Map from parameter names to values that should be used for those
parameters. Values may not exceed 100 characters.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> instantiateWorkflowTemplateAsync(String name, Map<String,String> parameters)
The returned Operation can be used to track execution of workflow by polling [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when entire workflow is finished.
The running workflow can be aborted via [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.
The [Operation.metadata][google.longrunning.Operation.metadata] will be [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata].
On successful completion, [Operation.response][google.longrunning.Operation.response] will be [Empty][google.protobuf.Empty].
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
Map<String, String> parameters = new HashMap<>();
workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name.toString(), parameters).get();
}
name
- Required. The "resource name" of the workflow template, as described in
https://cloud.google.com/apis/design/resource_names of the form
`projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`parameters
- Optional. Map from parameter names to values that should be used for those
parameters. Values may not exceed 100 characters.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> instantiateWorkflowTemplateAsync(com.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest request)
The returned Operation can be used to track execution of workflow by polling [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when entire workflow is finished.
The running workflow can be aborted via [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.
The [Operation.metadata][google.longrunning.Operation.metadata] will be [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata].
On successful completion, [Operation.response][google.longrunning.Operation.response] will be [Empty][google.protobuf.Empty].
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
InstantiateWorkflowTemplateRequest request = InstantiateWorkflowTemplateRequest.newBuilder()
.setName(name.toString())
.build();
workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable<com.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest,Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> instantiateWorkflowTemplateOperationCallable()
The returned Operation can be used to track execution of workflow by polling [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when entire workflow is finished.
The running workflow can be aborted via [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.
The [Operation.metadata][google.longrunning.Operation.metadata] will be [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata].
On successful completion, [Operation.response][google.longrunning.Operation.response] will be [Empty][google.protobuf.Empty].
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
InstantiateWorkflowTemplateRequest request = InstantiateWorkflowTemplateRequest.newBuilder()
.setName(name.toString())
.build();
OperationFuture<Empty, WorkflowMetadata> future = workflowTemplateServiceClient.instantiateWorkflowTemplateOperationCallable().futureCall(request);
// Do something
future.get();
}
public final UnaryCallable<com.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest,Operation> instantiateWorkflowTemplateCallable()
The returned Operation can be used to track execution of workflow by polling [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when entire workflow is finished.
The running workflow can be aborted via [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.
The [Operation.metadata][google.longrunning.Operation.metadata] will be [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata].
On successful completion, [Operation.response][google.longrunning.Operation.response] will be [Empty][google.protobuf.Empty].
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
InstantiateWorkflowTemplateRequest request = InstantiateWorkflowTemplateRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Operation> future = workflowTemplateServiceClient.instantiateWorkflowTemplateCallable().futureCall(request);
// Do something
future.get();
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> instantiateInlineWorkflowTemplateAsync(String parent, com.google.cloud.dataproc.v1.WorkflowTemplate template)
This method is equivalent to executing the sequence [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate], [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate], [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate].
The returned Operation can be used to track execution of workflow by polling [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when entire workflow is finished.
The running workflow can be aborted via [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.
The [Operation.metadata][google.longrunning.Operation.metadata] will be [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata].
On successful completion, [Operation.response][google.longrunning.Operation.response] will be [Empty][google.protobuf.Empty].
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
workflowTemplateServiceClient.instantiateInlineWorkflowTemplateAsync(formattedParent, template).get();
}
parent
- Required. The "resource name" of the workflow template region, as described in
https://cloud.google.com/apis/design/resource_names of the form
`projects/{project_id}/regions/{region}`template
- Required. The workflow template to instantiate.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> instantiateInlineWorkflowTemplateAsync(com.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest request)
This method is equivalent to executing the sequence [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate], [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate], [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate].
The returned Operation can be used to track execution of workflow by polling [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when entire workflow is finished.
The running workflow can be aborted via [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.
The [Operation.metadata][google.longrunning.Operation.metadata] will be [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata].
On successful completion, [Operation.response][google.longrunning.Operation.response] will be [Empty][google.protobuf.Empty].
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
InstantiateInlineWorkflowTemplateRequest request = InstantiateInlineWorkflowTemplateRequest.newBuilder()
.setParent(formattedParent)
.setTemplate(template)
.build();
workflowTemplateServiceClient.instantiateInlineWorkflowTemplateAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable<com.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest,Empty,com.google.cloud.dataproc.v1.WorkflowMetadata> instantiateInlineWorkflowTemplateOperationCallable()
This method is equivalent to executing the sequence [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate], [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate], [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate].
The returned Operation can be used to track execution of workflow by polling [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when entire workflow is finished.
The running workflow can be aborted via [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.
The [Operation.metadata][google.longrunning.Operation.metadata] will be [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata].
On successful completion, [Operation.response][google.longrunning.Operation.response] will be [Empty][google.protobuf.Empty].
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
InstantiateInlineWorkflowTemplateRequest request = InstantiateInlineWorkflowTemplateRequest.newBuilder()
.setParent(formattedParent)
.setTemplate(template)
.build();
OperationFuture<Empty, WorkflowMetadata> future = workflowTemplateServiceClient.instantiateInlineWorkflowTemplateOperationCallable().futureCall(request);
// Do something
future.get();
}
public final UnaryCallable<com.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest,Operation> instantiateInlineWorkflowTemplateCallable()
This method is equivalent to executing the sequence [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate], [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate], [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate].
The returned Operation can be used to track execution of workflow by polling [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when entire workflow is finished.
The running workflow can be aborted via [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.
The [Operation.metadata][google.longrunning.Operation.metadata] will be [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata].
On successful completion, [Operation.response][google.longrunning.Operation.response] will be [Empty][google.protobuf.Empty].
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
InstantiateInlineWorkflowTemplateRequest request = InstantiateInlineWorkflowTemplateRequest.newBuilder()
.setParent(formattedParent)
.setTemplate(template)
.build();
ApiFuture<Operation> future = workflowTemplateServiceClient.instantiateInlineWorkflowTemplateCallable().futureCall(request);
// Do something
future.get();
}
public final com.google.cloud.dataproc.v1.WorkflowTemplate updateWorkflowTemplate(com.google.cloud.dataproc.v1.WorkflowTemplate template)
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
WorkflowTemplate response = workflowTemplateServiceClient.updateWorkflowTemplate(template);
}
template
- Required. The updated workflow template.
The `template.version` field must match the current version.
ApiException
- if the remote call failspublic final com.google.cloud.dataproc.v1.WorkflowTemplate updateWorkflowTemplate(com.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest request)
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
UpdateWorkflowTemplateRequest request = UpdateWorkflowTemplateRequest.newBuilder()
.setTemplate(template)
.build();
WorkflowTemplate response = workflowTemplateServiceClient.updateWorkflowTemplate(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest,com.google.cloud.dataproc.v1.WorkflowTemplate> updateWorkflowTemplateCallable()
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
UpdateWorkflowTemplateRequest request = UpdateWorkflowTemplateRequest.newBuilder()
.setTemplate(template)
.build();
ApiFuture<WorkflowTemplate> future = workflowTemplateServiceClient.updateWorkflowTemplateCallable().futureCall(request);
// Do something
WorkflowTemplate response = future.get();
}
public final WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse listWorkflowTemplates(com.google.cloud.dataproc.v1.RegionName parent)
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
for (WorkflowTemplate element : workflowTemplateServiceClient.listWorkflowTemplates(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The "resource name" of the region, as described in
https://cloud.google.com/apis/design/resource_names of the form
`projects/{project_id}/regions/{region}`ApiException
- if the remote call failspublic final WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse listWorkflowTemplates(String parent)
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
for (WorkflowTemplate element : workflowTemplateServiceClient.listWorkflowTemplates(parent.toString()).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The "resource name" of the region, as described in
https://cloud.google.com/apis/design/resource_names of the form
`projects/{project_id}/regions/{region}`ApiException
- if the remote call failspublic final WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse listWorkflowTemplates(com.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest request)
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
ListWorkflowTemplatesRequest request = ListWorkflowTemplatesRequest.newBuilder()
.setParent(parent.toString())
.build();
for (WorkflowTemplate element : workflowTemplateServiceClient.listWorkflowTemplates(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest,WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse> listWorkflowTemplatesPagedCallable()
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
ListWorkflowTemplatesRequest request = ListWorkflowTemplatesRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListWorkflowTemplatesPagedResponse> future = workflowTemplateServiceClient.listWorkflowTemplatesPagedCallable().futureCall(request);
// Do something
for (WorkflowTemplate element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest,com.google.cloud.dataproc.v1.ListWorkflowTemplatesResponse> listWorkflowTemplatesCallable()
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
ListWorkflowTemplatesRequest request = ListWorkflowTemplatesRequest.newBuilder()
.setParent(parent.toString())
.build();
while (true) {
ListWorkflowTemplatesResponse response = workflowTemplateServiceClient.listWorkflowTemplatesCallable().call(request);
for (WorkflowTemplate element : response.getTemplatesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final void deleteWorkflowTemplate(com.google.cloud.dataproc.v1.WorkflowTemplateName name)
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
workflowTemplateServiceClient.deleteWorkflowTemplate(name);
}
name
- Required. The "resource name" of the workflow template, as described in
https://cloud.google.com/apis/design/resource_names of the form
`projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`ApiException
- if the remote call failspublic final void deleteWorkflowTemplate(String name)
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
workflowTemplateServiceClient.deleteWorkflowTemplate(name.toString());
}
name
- Required. The "resource name" of the workflow template, as described in
https://cloud.google.com/apis/design/resource_names of the form
`projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`ApiException
- if the remote call failspublic final void deleteWorkflowTemplate(com.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest request)
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
DeleteWorkflowTemplateRequest request = DeleteWorkflowTemplateRequest.newBuilder()
.setName(name.toString())
.build();
workflowTemplateServiceClient.deleteWorkflowTemplate(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest,Empty> deleteWorkflowTemplateCallable()
Sample code:
try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
DeleteWorkflowTemplateRequest request = DeleteWorkflowTemplateRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = workflowTemplateServiceClient.deleteWorkflowTemplateCallable().futureCall(request);
// Do something
future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.