![JAR search and dependency download from the Maven repository](/logo.png)
com.google.cloud.dataproc.v1.stub.GrpcWorkflowTemplateServiceStub Maven / Gradle / Ivy
Show all versions of google-cloud-dataproc Show documentation
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.dataproc.v1.stub;
import static com.google.cloud.dataproc.v1.WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
import com.google.api.gax.grpc.GrpcCallSettings;
import com.google.api.gax.grpc.GrpcStubCallableFactory;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.RequestParamsBuilder;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest;
import com.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest;
import com.google.cloud.dataproc.v1.GetWorkflowTemplateRequest;
import com.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest;
import com.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest;
import com.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest;
import com.google.cloud.dataproc.v1.ListWorkflowTemplatesResponse;
import com.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest;
import com.google.cloud.dataproc.v1.WorkflowMetadata;
import com.google.cloud.dataproc.v1.WorkflowTemplate;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
import com.google.iam.v1.TestIamPermissionsRequest;
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.longrunning.stub.GrpcOperationsStub;
import com.google.protobuf.Empty;
import io.grpc.MethodDescriptor;
import io.grpc.protobuf.ProtoUtils;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* gRPC stub implementation for the WorkflowTemplateService service API.
*
* This class is for advanced usage and reflects the underlying API directly.
*/
@Generated("by gapic-generator-java")
public class GrpcWorkflowTemplateServiceStub extends WorkflowTemplateServiceStub {
private static final MethodDescriptor
createWorkflowTemplateMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.dataproc.v1.WorkflowTemplateService/CreateWorkflowTemplate")
.setRequestMarshaller(
ProtoUtils.marshaller(CreateWorkflowTemplateRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(WorkflowTemplate.getDefaultInstance()))
.build();
private static final MethodDescriptor
getWorkflowTemplateMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.dataproc.v1.WorkflowTemplateService/GetWorkflowTemplate")
.setRequestMarshaller(
ProtoUtils.marshaller(GetWorkflowTemplateRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(WorkflowTemplate.getDefaultInstance()))
.build();
private static final MethodDescriptor
instantiateWorkflowTemplateMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.dataproc.v1.WorkflowTemplateService/InstantiateWorkflowTemplate")
.setRequestMarshaller(
ProtoUtils.marshaller(InstantiateWorkflowTemplateRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
instantiateInlineWorkflowTemplateMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.dataproc.v1.WorkflowTemplateService/InstantiateInlineWorkflowTemplate")
.setRequestMarshaller(
ProtoUtils.marshaller(
InstantiateInlineWorkflowTemplateRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
updateWorkflowTemplateMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.dataproc.v1.WorkflowTemplateService/UpdateWorkflowTemplate")
.setRequestMarshaller(
ProtoUtils.marshaller(UpdateWorkflowTemplateRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(WorkflowTemplate.getDefaultInstance()))
.build();
private static final MethodDescriptor
listWorkflowTemplatesMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.dataproc.v1.WorkflowTemplateService/ListWorkflowTemplates")
.setRequestMarshaller(
ProtoUtils.marshaller(ListWorkflowTemplatesRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListWorkflowTemplatesResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
deleteWorkflowTemplateMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.dataproc.v1.WorkflowTemplateService/DeleteWorkflowTemplate")
.setRequestMarshaller(
ProtoUtils.marshaller(DeleteWorkflowTemplateRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
.build();
private static final MethodDescriptor setIamPolicyMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.iam.v1.IAMPolicy/SetIamPolicy")
.setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance()))
.build();
private static final MethodDescriptor getIamPolicyMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.iam.v1.IAMPolicy/GetIamPolicy")
.setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance()))
.build();
private static final MethodDescriptor
testIamPermissionsMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.iam.v1.IAMPolicy/TestIamPermissions")
.setRequestMarshaller(
ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance()))
.build();
private final UnaryCallable
createWorkflowTemplateCallable;
private final UnaryCallable
getWorkflowTemplateCallable;
private final UnaryCallable
instantiateWorkflowTemplateCallable;
private final OperationCallable
instantiateWorkflowTemplateOperationCallable;
private final UnaryCallable
instantiateInlineWorkflowTemplateCallable;
private final OperationCallable
instantiateInlineWorkflowTemplateOperationCallable;
private final UnaryCallable
updateWorkflowTemplateCallable;
private final UnaryCallable
listWorkflowTemplatesCallable;
private final UnaryCallable
listWorkflowTemplatesPagedCallable;
private final UnaryCallable deleteWorkflowTemplateCallable;
private final UnaryCallable setIamPolicyCallable;
private final UnaryCallable getIamPolicyCallable;
private final UnaryCallable
testIamPermissionsCallable;
private final BackgroundResource backgroundResources;
private final GrpcOperationsStub operationsStub;
private final GrpcStubCallableFactory callableFactory;
public static final GrpcWorkflowTemplateServiceStub create(
WorkflowTemplateServiceStubSettings settings) throws IOException {
return new GrpcWorkflowTemplateServiceStub(settings, ClientContext.create(settings));
}
public static final GrpcWorkflowTemplateServiceStub create(ClientContext clientContext)
throws IOException {
return new GrpcWorkflowTemplateServiceStub(
WorkflowTemplateServiceStubSettings.newBuilder().build(), clientContext);
}
public static final GrpcWorkflowTemplateServiceStub create(
ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException {
return new GrpcWorkflowTemplateServiceStub(
WorkflowTemplateServiceStubSettings.newBuilder().build(), clientContext, callableFactory);
}
/**
* Constructs an instance of GrpcWorkflowTemplateServiceStub, 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.
*/
protected GrpcWorkflowTemplateServiceStub(
WorkflowTemplateServiceStubSettings settings, ClientContext clientContext)
throws IOException {
this(settings, clientContext, new GrpcWorkflowTemplateServiceCallableFactory());
}
/**
* Constructs an instance of GrpcWorkflowTemplateServiceStub, 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.
*/
protected GrpcWorkflowTemplateServiceStub(
WorkflowTemplateServiceStubSettings settings,
ClientContext clientContext,
GrpcStubCallableFactory callableFactory)
throws IOException {
this.callableFactory = callableFactory;
this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory);
GrpcCallSettings
createWorkflowTemplateTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(createWorkflowTemplateMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings
getWorkflowTemplateTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getWorkflowTemplateMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
instantiateWorkflowTemplateTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(instantiateWorkflowTemplateMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
instantiateInlineWorkflowTemplateTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(instantiateInlineWorkflowTemplateMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings
updateWorkflowTemplateTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(updateWorkflowTemplateMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("template.name", String.valueOf(request.getTemplate().getName()));
return builder.build();
})
.build();
GrpcCallSettings
listWorkflowTemplatesTransportSettings =
GrpcCallSettings
.newBuilder()
.setMethodDescriptor(listWorkflowTemplatesMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings deleteWorkflowTemplateTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(deleteWorkflowTemplateMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings setIamPolicyTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(setIamPolicyMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("resource", String.valueOf(request.getResource()));
return builder.build();
})
.build();
GrpcCallSettings getIamPolicyTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getIamPolicyMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("resource", String.valueOf(request.getResource()));
return builder.build();
})
.build();
GrpcCallSettings
testIamPermissionsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(testIamPermissionsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("resource", String.valueOf(request.getResource()));
return builder.build();
})
.build();
this.createWorkflowTemplateCallable =
callableFactory.createUnaryCallable(
createWorkflowTemplateTransportSettings,
settings.createWorkflowTemplateSettings(),
clientContext);
this.getWorkflowTemplateCallable =
callableFactory.createUnaryCallable(
getWorkflowTemplateTransportSettings,
settings.getWorkflowTemplateSettings(),
clientContext);
this.instantiateWorkflowTemplateCallable =
callableFactory.createUnaryCallable(
instantiateWorkflowTemplateTransportSettings,
settings.instantiateWorkflowTemplateSettings(),
clientContext);
this.instantiateWorkflowTemplateOperationCallable =
callableFactory.createOperationCallable(
instantiateWorkflowTemplateTransportSettings,
settings.instantiateWorkflowTemplateOperationSettings(),
clientContext,
operationsStub);
this.instantiateInlineWorkflowTemplateCallable =
callableFactory.createUnaryCallable(
instantiateInlineWorkflowTemplateTransportSettings,
settings.instantiateInlineWorkflowTemplateSettings(),
clientContext);
this.instantiateInlineWorkflowTemplateOperationCallable =
callableFactory.createOperationCallable(
instantiateInlineWorkflowTemplateTransportSettings,
settings.instantiateInlineWorkflowTemplateOperationSettings(),
clientContext,
operationsStub);
this.updateWorkflowTemplateCallable =
callableFactory.createUnaryCallable(
updateWorkflowTemplateTransportSettings,
settings.updateWorkflowTemplateSettings(),
clientContext);
this.listWorkflowTemplatesCallable =
callableFactory.createUnaryCallable(
listWorkflowTemplatesTransportSettings,
settings.listWorkflowTemplatesSettings(),
clientContext);
this.listWorkflowTemplatesPagedCallable =
callableFactory.createPagedCallable(
listWorkflowTemplatesTransportSettings,
settings.listWorkflowTemplatesSettings(),
clientContext);
this.deleteWorkflowTemplateCallable =
callableFactory.createUnaryCallable(
deleteWorkflowTemplateTransportSettings,
settings.deleteWorkflowTemplateSettings(),
clientContext);
this.setIamPolicyCallable =
callableFactory.createUnaryCallable(
setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext);
this.getIamPolicyCallable =
callableFactory.createUnaryCallable(
getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext);
this.testIamPermissionsCallable =
callableFactory.createUnaryCallable(
testIamPermissionsTransportSettings,
settings.testIamPermissionsSettings(),
clientContext);
this.backgroundResources =
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}
public GrpcOperationsStub getOperationsStub() {
return operationsStub;
}
@Override
public UnaryCallable
createWorkflowTemplateCallable() {
return createWorkflowTemplateCallable;
}
@Override
public UnaryCallable getWorkflowTemplateCallable() {
return getWorkflowTemplateCallable;
}
@Override
public UnaryCallable
instantiateWorkflowTemplateCallable() {
return instantiateWorkflowTemplateCallable;
}
@Override
public OperationCallable
instantiateWorkflowTemplateOperationCallable() {
return instantiateWorkflowTemplateOperationCallable;
}
@Override
public UnaryCallable
instantiateInlineWorkflowTemplateCallable() {
return instantiateInlineWorkflowTemplateCallable;
}
@Override
public OperationCallable
instantiateInlineWorkflowTemplateOperationCallable() {
return instantiateInlineWorkflowTemplateOperationCallable;
}
@Override
public UnaryCallable
updateWorkflowTemplateCallable() {
return updateWorkflowTemplateCallable;
}
@Override
public UnaryCallable
listWorkflowTemplatesCallable() {
return listWorkflowTemplatesCallable;
}
@Override
public UnaryCallable
listWorkflowTemplatesPagedCallable() {
return listWorkflowTemplatesPagedCallable;
}
@Override
public UnaryCallable deleteWorkflowTemplateCallable() {
return deleteWorkflowTemplateCallable;
}
@Override
public UnaryCallable setIamPolicyCallable() {
return setIamPolicyCallable;
}
@Override
public UnaryCallable getIamPolicyCallable() {
return getIamPolicyCallable;
}
@Override
public UnaryCallable
testIamPermissionsCallable() {
return testIamPermissionsCallable;
}
@Override
public final void close() {
try {
backgroundResources.close();
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new IllegalStateException("Failed to close resource", e);
}
}
@Override
public void shutdown() {
backgroundResources.shutdown();
}
@Override
public boolean isShutdown() {
return backgroundResources.isShutdown();
}
@Override
public boolean isTerminated() {
return backgroundResources.isTerminated();
}
@Override
public void shutdownNow() {
backgroundResources.shutdownNow();
}
@Override
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
return backgroundResources.awaitTermination(duration, unit);
}
}