Skip to content
Snippets Groups Projects
Commit d72559b1 authored by Fotis Soldatos's avatar Fotis Soldatos
Browse files

feat(policy): introduce ContextService & ContextGateway interfaces

parent 1d77cb00
No related branches found
No related tags found
1 merge request!54Release 2.0.0
Showing
with 1217 additions and 15 deletions
/*
* Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
*
* 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
*
* http://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 eu.teraflow.policy.context;
import eu.teraflow.policy.context.model.Device;
import eu.teraflow.policy.context.model.Service;
import eu.teraflow.policy.context.model.ServiceId;
import eu.teraflow.policy.model.PolicyRuleBasic;
import io.smallrye.mutiny.Uni;
public interface ContextGateway {
// Context related methods
Uni<Service> getService(ServiceId serviceId);
Uni<ServiceId> setService(Service service);
Uni<Device> getDevice(String deviceId);
// Context-policy related methods
Uni<PolicyRuleBasic> getPolicyRule(String policyRuleId);
Uni<String> setPolicyRule(PolicyRuleBasic policyRuleBasic);
}
/*
* Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
*
* 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
*
* http://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 eu.teraflow.policy.context;
import context.MutinyContextServiceGrpc.MutinyContextServiceStub;
import context_policy.MutinyContextPolicyServiceGrpc.MutinyContextPolicyServiceStub;
import eu.teraflow.policy.Serializer;
import eu.teraflow.policy.context.model.Device;
import eu.teraflow.policy.context.model.Service;
import eu.teraflow.policy.context.model.ServiceId;
import eu.teraflow.policy.model.PolicyRuleBasic;
import io.quarkus.grpc.GrpcClient;
import io.smallrye.mutiny.Uni;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
@ApplicationScoped
public class ContextGatewayImpl implements ContextGateway {
@GrpcClient("context")
MutinyContextServiceStub streamingDelegateContext;
// TODO remove client when RPCs declared in context-policy.proto are moved in context.proto
// and use streamingDelegateContext for all methods
@GrpcClient("context_policy")
MutinyContextPolicyServiceStub streamingDelegateContextPolicy;
private final Serializer serializer;
@Inject
public ContextGatewayImpl(Serializer serializer) {
this.serializer = serializer;
}
@Override
public Uni<Service> getService(ServiceId serviceId) {
final var serializedServiceId = serializer.serialize(serviceId);
return streamingDelegateContext
.getService(serializedServiceId)
.onItem()
.transform(serializer::deserialize);
}
@Override
public Uni<ServiceId> setService(Service service) {
final var serializedService = serializer.serialize(service);
return streamingDelegateContext
.setService(serializedService)
.onItem()
.transform(serializer::deserialize);
}
@Override
public Uni<Device> getDevice(String deviceId) {
final var serializedDeviceId = serializer.serializeDeviceId(deviceId);
return streamingDelegateContext
.getDevice(serializedDeviceId)
.onItem()
.transform(serializer::deserialize);
}
@Override
public Uni<PolicyRuleBasic> getPolicyRule(String policyRuleId) {
final var serializedPolicyRuleId = serializer.serializePolicyRuleId(policyRuleId);
return streamingDelegateContextPolicy
.getPolicyRule(serializedPolicyRuleId)
.onItem()
.transform(serializer::deserialize);
}
@Override
public Uni<String> setPolicyRule(PolicyRuleBasic policyRuleBasic) {
final var serializedPolicyRuleBasic = serializer.serialize(policyRuleBasic);
return streamingDelegateContextPolicy
.setPolicyRule(serializedPolicyRuleBasic)
.onItem()
.transform(serializer::deserialize);
}
}
...@@ -16,4 +16,21 @@ ...@@ -16,4 +16,21 @@
package eu.teraflow.policy.context; package eu.teraflow.policy.context;
public interface ContextService {} import eu.teraflow.policy.context.model.Device;
import eu.teraflow.policy.context.model.Service;
import eu.teraflow.policy.context.model.ServiceId;
import eu.teraflow.policy.model.PolicyRuleBasic;
import io.smallrye.mutiny.Uni;
public interface ContextService {
Uni<Service> getService(ServiceId serviceId);
Uni<ServiceId> setService(Service service);
Uni<Device> getDevice(String deviceId);
Uni<PolicyRuleBasic> getPolicyRule(String policyRuleId);
Uni<String> setPolicyRule(PolicyRuleBasic policyRuleBasic);
}
/*
* Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
*
* 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
*
* http://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 eu.teraflow.policy.context;
import eu.teraflow.policy.context.model.Device;
import eu.teraflow.policy.context.model.Service;
import eu.teraflow.policy.context.model.ServiceId;
import eu.teraflow.policy.model.PolicyRuleBasic;
import io.smallrye.mutiny.Uni;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
@ApplicationScoped
public class ContextServiceImpl implements ContextService {
private final ContextGateway contextGateway;
@Inject
public ContextServiceImpl(ContextGateway contextGateway) {
this.contextGateway = contextGateway;
}
@Override
public Uni<Service> getService(ServiceId serviceId) {
return contextGateway.getService(serviceId);
}
@Override
public Uni<ServiceId> setService(Service service) {
return contextGateway.setService(service);
}
@Override
public Uni<Device> getDevice(String deviceId) {
return contextGateway.getDevice(deviceId);
}
@Override
public Uni<PolicyRuleBasic> getPolicyRule(String policyRuleId) {
return contextGateway.getPolicyRule(policyRuleId);
}
@Override
public Uni<String> setPolicyRule(PolicyRuleBasic policyRuleBasic) {
return contextGateway.setPolicyRule(policyRuleBasic);
}
}
../../../../../proto/context-policy.proto
\ No newline at end of file
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: context-policy.proto
package context_policy;
public final class ContextPolicy {
private ContextPolicy() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions(
(com.google.protobuf.ExtensionRegistryLite) registry);
}
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\024context-policy.proto\022\016context_policy\032\r" +
"context.proto\032\014policy.proto2\324\002\n\024ContextP" +
"olicyService\022?\n\021ListPolicyRuleIds\022\016.cont" +
"ext.Empty\032\030.policy.PolicyRuleIdList\"\000\022;\n" +
"\017ListPolicyRules\022\016.context.Empty\032\026.polic" +
"y.PolicyRuleList\"\000\022@\n\rGetPolicyRule\022\024.po" +
"licy.PolicyRuleId\032\027.policy.PolicyRuleBas" +
"ic\"\000\022@\n\rSetPolicyRule\022\027.policy.PolicyRul" +
"eBasic\032\024.policy.PolicyRuleId\"\000\022:\n\020Remove" +
"PolicyRule\022\024.policy.PolicyRuleId\032\016.conte" +
"xt.Empty\"\000b\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
context.ContextOuterClass.getDescriptor(),
policy.Policy.getDescriptor(),
});
context.ContextOuterClass.getDescriptor();
policy.Policy.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}
package context_policy;
import io.quarkus.grpc.runtime.MutinyService;
@javax.annotation.Generated(
value = "by Mutiny Grpc generator",
comments = "Source: context-policy.proto")
public interface ContextPolicyService extends MutinyService {
io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleIdList> listPolicyRuleIds(context.ContextOuterClass.Empty request);
io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleList> listPolicyRules(context.ContextOuterClass.Empty request);
io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleBasic> getPolicyRule(policy.Policy.PolicyRuleId request);
io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleId> setPolicyRule(policy.Policy.PolicyRuleBasic request);
io.smallrye.mutiny.Uni<context.ContextOuterClass.Empty> removePolicyRule(policy.Policy.PolicyRuleId request);
}
\ No newline at end of file
package context_policy;
import io.grpc.BindableService;
import io.quarkus.grpc.GrpcService;
import io.quarkus.grpc.runtime.MutinyBean;
@javax.annotation.Generated(
value = "by Mutiny Grpc generator",
comments = "Source: context-policy.proto")
public class ContextPolicyServiceBean extends MutinyContextPolicyServiceGrpc.ContextPolicyServiceImplBase implements BindableService, MutinyBean {
private final ContextPolicyService delegate;
ContextPolicyServiceBean(@GrpcService ContextPolicyService delegate) {
this.delegate = delegate;
}
@Override
public io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleIdList> listPolicyRuleIds(context.ContextOuterClass.Empty request) {
try {
return delegate.listPolicyRuleIds(request);
} catch (UnsupportedOperationException e) {
throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
}
}
@Override
public io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleList> listPolicyRules(context.ContextOuterClass.Empty request) {
try {
return delegate.listPolicyRules(request);
} catch (UnsupportedOperationException e) {
throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
}
}
@Override
public io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleBasic> getPolicyRule(policy.Policy.PolicyRuleId request) {
try {
return delegate.getPolicyRule(request);
} catch (UnsupportedOperationException e) {
throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
}
}
@Override
public io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleId> setPolicyRule(policy.Policy.PolicyRuleBasic request) {
try {
return delegate.setPolicyRule(request);
} catch (UnsupportedOperationException e) {
throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
}
}
@Override
public io.smallrye.mutiny.Uni<context.ContextOuterClass.Empty> removePolicyRule(policy.Policy.PolicyRuleId request) {
try {
return delegate.removePolicyRule(request);
} catch (UnsupportedOperationException e) {
throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
}
}
}
\ No newline at end of file
package context_policy;
import java.util.function.BiFunction;
import io.quarkus.grpc.runtime.MutinyClient;
@javax.annotation.Generated(
value = "by Mutiny Grpc generator",
comments = "Source: context-policy.proto")
public class ContextPolicyServiceClient implements ContextPolicyService, MutinyClient<MutinyContextPolicyServiceGrpc.MutinyContextPolicyServiceStub> {
private final MutinyContextPolicyServiceGrpc.MutinyContextPolicyServiceStub stub;
public ContextPolicyServiceClient(String name, io.grpc.Channel channel, BiFunction<String, MutinyContextPolicyServiceGrpc.MutinyContextPolicyServiceStub, MutinyContextPolicyServiceGrpc.MutinyContextPolicyServiceStub> stubConfigurator) {
this.stub = stubConfigurator.apply(name,MutinyContextPolicyServiceGrpc.newMutinyStub(channel));
}
@Override
public MutinyContextPolicyServiceGrpc.MutinyContextPolicyServiceStub getStub() {
return stub;
}
@Override
public io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleIdList> listPolicyRuleIds(context.ContextOuterClass.Empty request) {
return stub.listPolicyRuleIds(request);
}
@Override
public io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleList> listPolicyRules(context.ContextOuterClass.Empty request) {
return stub.listPolicyRules(request);
}
@Override
public io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleBasic> getPolicyRule(policy.Policy.PolicyRuleId request) {
return stub.getPolicyRule(request);
}
@Override
public io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleId> setPolicyRule(policy.Policy.PolicyRuleBasic request) {
return stub.setPolicyRule(request);
}
@Override
public io.smallrye.mutiny.Uni<context.ContextOuterClass.Empty> removePolicyRule(policy.Policy.PolicyRuleId request) {
return stub.removePolicyRule(request);
}
}
\ No newline at end of file
package context_policy;
import static io.grpc.MethodDescriptor.generateFullMethodName;
/**
* <pre>
* created as a separate service to prevent import-loops in context and policy
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.38.1)",
comments = "Source: context-policy.proto")
public final class ContextPolicyServiceGrpc {
private ContextPolicyServiceGrpc() {}
public static final String SERVICE_NAME = "context_policy.ContextPolicyService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<context.ContextOuterClass.Empty,
policy.Policy.PolicyRuleIdList> getListPolicyRuleIdsMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "ListPolicyRuleIds",
requestType = context.ContextOuterClass.Empty.class,
responseType = policy.Policy.PolicyRuleIdList.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<context.ContextOuterClass.Empty,
policy.Policy.PolicyRuleIdList> getListPolicyRuleIdsMethod() {
io.grpc.MethodDescriptor<context.ContextOuterClass.Empty, policy.Policy.PolicyRuleIdList> getListPolicyRuleIdsMethod;
if ((getListPolicyRuleIdsMethod = ContextPolicyServiceGrpc.getListPolicyRuleIdsMethod) == null) {
synchronized (ContextPolicyServiceGrpc.class) {
if ((getListPolicyRuleIdsMethod = ContextPolicyServiceGrpc.getListPolicyRuleIdsMethod) == null) {
ContextPolicyServiceGrpc.getListPolicyRuleIdsMethod = getListPolicyRuleIdsMethod =
io.grpc.MethodDescriptor.<context.ContextOuterClass.Empty, policy.Policy.PolicyRuleIdList>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListPolicyRuleIds"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
context.ContextOuterClass.Empty.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
policy.Policy.PolicyRuleIdList.getDefaultInstance()))
.setSchemaDescriptor(new ContextPolicyServiceMethodDescriptorSupplier("ListPolicyRuleIds"))
.build();
}
}
}
return getListPolicyRuleIdsMethod;
}
private static volatile io.grpc.MethodDescriptor<context.ContextOuterClass.Empty,
policy.Policy.PolicyRuleList> getListPolicyRulesMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "ListPolicyRules",
requestType = context.ContextOuterClass.Empty.class,
responseType = policy.Policy.PolicyRuleList.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<context.ContextOuterClass.Empty,
policy.Policy.PolicyRuleList> getListPolicyRulesMethod() {
io.grpc.MethodDescriptor<context.ContextOuterClass.Empty, policy.Policy.PolicyRuleList> getListPolicyRulesMethod;
if ((getListPolicyRulesMethod = ContextPolicyServiceGrpc.getListPolicyRulesMethod) == null) {
synchronized (ContextPolicyServiceGrpc.class) {
if ((getListPolicyRulesMethod = ContextPolicyServiceGrpc.getListPolicyRulesMethod) == null) {
ContextPolicyServiceGrpc.getListPolicyRulesMethod = getListPolicyRulesMethod =
io.grpc.MethodDescriptor.<context.ContextOuterClass.Empty, policy.Policy.PolicyRuleList>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListPolicyRules"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
context.ContextOuterClass.Empty.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
policy.Policy.PolicyRuleList.getDefaultInstance()))
.setSchemaDescriptor(new ContextPolicyServiceMethodDescriptorSupplier("ListPolicyRules"))
.build();
}
}
}
return getListPolicyRulesMethod;
}
private static volatile io.grpc.MethodDescriptor<policy.Policy.PolicyRuleId,
policy.Policy.PolicyRuleBasic> getGetPolicyRuleMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "GetPolicyRule",
requestType = policy.Policy.PolicyRuleId.class,
responseType = policy.Policy.PolicyRuleBasic.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<policy.Policy.PolicyRuleId,
policy.Policy.PolicyRuleBasic> getGetPolicyRuleMethod() {
io.grpc.MethodDescriptor<policy.Policy.PolicyRuleId, policy.Policy.PolicyRuleBasic> getGetPolicyRuleMethod;
if ((getGetPolicyRuleMethod = ContextPolicyServiceGrpc.getGetPolicyRuleMethod) == null) {
synchronized (ContextPolicyServiceGrpc.class) {
if ((getGetPolicyRuleMethod = ContextPolicyServiceGrpc.getGetPolicyRuleMethod) == null) {
ContextPolicyServiceGrpc.getGetPolicyRuleMethod = getGetPolicyRuleMethod =
io.grpc.MethodDescriptor.<policy.Policy.PolicyRuleId, policy.Policy.PolicyRuleBasic>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetPolicyRule"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
policy.Policy.PolicyRuleId.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
policy.Policy.PolicyRuleBasic.getDefaultInstance()))
.setSchemaDescriptor(new ContextPolicyServiceMethodDescriptorSupplier("GetPolicyRule"))
.build();
}
}
}
return getGetPolicyRuleMethod;
}
private static volatile io.grpc.MethodDescriptor<policy.Policy.PolicyRuleBasic,
policy.Policy.PolicyRuleId> getSetPolicyRuleMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "SetPolicyRule",
requestType = policy.Policy.PolicyRuleBasic.class,
responseType = policy.Policy.PolicyRuleId.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<policy.Policy.PolicyRuleBasic,
policy.Policy.PolicyRuleId> getSetPolicyRuleMethod() {
io.grpc.MethodDescriptor<policy.Policy.PolicyRuleBasic, policy.Policy.PolicyRuleId> getSetPolicyRuleMethod;
if ((getSetPolicyRuleMethod = ContextPolicyServiceGrpc.getSetPolicyRuleMethod) == null) {
synchronized (ContextPolicyServiceGrpc.class) {
if ((getSetPolicyRuleMethod = ContextPolicyServiceGrpc.getSetPolicyRuleMethod) == null) {
ContextPolicyServiceGrpc.getSetPolicyRuleMethod = getSetPolicyRuleMethod =
io.grpc.MethodDescriptor.<policy.Policy.PolicyRuleBasic, policy.Policy.PolicyRuleId>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "SetPolicyRule"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
policy.Policy.PolicyRuleBasic.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
policy.Policy.PolicyRuleId.getDefaultInstance()))
.setSchemaDescriptor(new ContextPolicyServiceMethodDescriptorSupplier("SetPolicyRule"))
.build();
}
}
}
return getSetPolicyRuleMethod;
}
private static volatile io.grpc.MethodDescriptor<policy.Policy.PolicyRuleId,
context.ContextOuterClass.Empty> getRemovePolicyRuleMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "RemovePolicyRule",
requestType = policy.Policy.PolicyRuleId.class,
responseType = context.ContextOuterClass.Empty.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<policy.Policy.PolicyRuleId,
context.ContextOuterClass.Empty> getRemovePolicyRuleMethod() {
io.grpc.MethodDescriptor<policy.Policy.PolicyRuleId, context.ContextOuterClass.Empty> getRemovePolicyRuleMethod;
if ((getRemovePolicyRuleMethod = ContextPolicyServiceGrpc.getRemovePolicyRuleMethod) == null) {
synchronized (ContextPolicyServiceGrpc.class) {
if ((getRemovePolicyRuleMethod = ContextPolicyServiceGrpc.getRemovePolicyRuleMethod) == null) {
ContextPolicyServiceGrpc.getRemovePolicyRuleMethod = getRemovePolicyRuleMethod =
io.grpc.MethodDescriptor.<policy.Policy.PolicyRuleId, context.ContextOuterClass.Empty>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "RemovePolicyRule"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
policy.Policy.PolicyRuleId.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
context.ContextOuterClass.Empty.getDefaultInstance()))
.setSchemaDescriptor(new ContextPolicyServiceMethodDescriptorSupplier("RemovePolicyRule"))
.build();
}
}
}
return getRemovePolicyRuleMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static ContextPolicyServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<ContextPolicyServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<ContextPolicyServiceStub>() {
@java.lang.Override
public ContextPolicyServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ContextPolicyServiceStub(channel, callOptions);
}
};
return ContextPolicyServiceStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static ContextPolicyServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<ContextPolicyServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<ContextPolicyServiceBlockingStub>() {
@java.lang.Override
public ContextPolicyServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ContextPolicyServiceBlockingStub(channel, callOptions);
}
};
return ContextPolicyServiceBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static ContextPolicyServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<ContextPolicyServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<ContextPolicyServiceFutureStub>() {
@java.lang.Override
public ContextPolicyServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ContextPolicyServiceFutureStub(channel, callOptions);
}
};
return ContextPolicyServiceFutureStub.newStub(factory, channel);
}
/**
* <pre>
* created as a separate service to prevent import-loops in context and policy
* </pre>
*/
public static abstract class ContextPolicyServiceImplBase implements io.grpc.BindableService {
/**
*/
public void listPolicyRuleIds(context.ContextOuterClass.Empty request,
io.grpc.stub.StreamObserver<policy.Policy.PolicyRuleIdList> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getListPolicyRuleIdsMethod(), responseObserver);
}
/**
*/
public void listPolicyRules(context.ContextOuterClass.Empty request,
io.grpc.stub.StreamObserver<policy.Policy.PolicyRuleList> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getListPolicyRulesMethod(), responseObserver);
}
/**
*/
public void getPolicyRule(policy.Policy.PolicyRuleId request,
io.grpc.stub.StreamObserver<policy.Policy.PolicyRuleBasic> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetPolicyRuleMethod(), responseObserver);
}
/**
*/
public void setPolicyRule(policy.Policy.PolicyRuleBasic request,
io.grpc.stub.StreamObserver<policy.Policy.PolicyRuleId> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSetPolicyRuleMethod(), responseObserver);
}
/**
*/
public void removePolicyRule(policy.Policy.PolicyRuleId request,
io.grpc.stub.StreamObserver<context.ContextOuterClass.Empty> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getRemovePolicyRuleMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getListPolicyRuleIdsMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
context.ContextOuterClass.Empty,
policy.Policy.PolicyRuleIdList>(
this, METHODID_LIST_POLICY_RULE_IDS)))
.addMethod(
getListPolicyRulesMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
context.ContextOuterClass.Empty,
policy.Policy.PolicyRuleList>(
this, METHODID_LIST_POLICY_RULES)))
.addMethod(
getGetPolicyRuleMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
policy.Policy.PolicyRuleId,
policy.Policy.PolicyRuleBasic>(
this, METHODID_GET_POLICY_RULE)))
.addMethod(
getSetPolicyRuleMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
policy.Policy.PolicyRuleBasic,
policy.Policy.PolicyRuleId>(
this, METHODID_SET_POLICY_RULE)))
.addMethod(
getRemovePolicyRuleMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
policy.Policy.PolicyRuleId,
context.ContextOuterClass.Empty>(
this, METHODID_REMOVE_POLICY_RULE)))
.build();
}
}
/**
* <pre>
* created as a separate service to prevent import-loops in context and policy
* </pre>
*/
public static final class ContextPolicyServiceStub extends io.grpc.stub.AbstractAsyncStub<ContextPolicyServiceStub> {
private ContextPolicyServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected ContextPolicyServiceStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ContextPolicyServiceStub(channel, callOptions);
}
/**
*/
public void listPolicyRuleIds(context.ContextOuterClass.Empty request,
io.grpc.stub.StreamObserver<policy.Policy.PolicyRuleIdList> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getListPolicyRuleIdsMethod(), getCallOptions()), request, responseObserver);
}
/**
*/
public void listPolicyRules(context.ContextOuterClass.Empty request,
io.grpc.stub.StreamObserver<policy.Policy.PolicyRuleList> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getListPolicyRulesMethod(), getCallOptions()), request, responseObserver);
}
/**
*/
public void getPolicyRule(policy.Policy.PolicyRuleId request,
io.grpc.stub.StreamObserver<policy.Policy.PolicyRuleBasic> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getGetPolicyRuleMethod(), getCallOptions()), request, responseObserver);
}
/**
*/
public void setPolicyRule(policy.Policy.PolicyRuleBasic request,
io.grpc.stub.StreamObserver<policy.Policy.PolicyRuleId> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getSetPolicyRuleMethod(), getCallOptions()), request, responseObserver);
}
/**
*/
public void removePolicyRule(policy.Policy.PolicyRuleId request,
io.grpc.stub.StreamObserver<context.ContextOuterClass.Empty> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getRemovePolicyRuleMethod(), getCallOptions()), request, responseObserver);
}
}
/**
* <pre>
* created as a separate service to prevent import-loops in context and policy
* </pre>
*/
public static final class ContextPolicyServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<ContextPolicyServiceBlockingStub> {
private ContextPolicyServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected ContextPolicyServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ContextPolicyServiceBlockingStub(channel, callOptions);
}
/**
*/
public policy.Policy.PolicyRuleIdList listPolicyRuleIds(context.ContextOuterClass.Empty request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getListPolicyRuleIdsMethod(), getCallOptions(), request);
}
/**
*/
public policy.Policy.PolicyRuleList listPolicyRules(context.ContextOuterClass.Empty request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getListPolicyRulesMethod(), getCallOptions(), request);
}
/**
*/
public policy.Policy.PolicyRuleBasic getPolicyRule(policy.Policy.PolicyRuleId request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getGetPolicyRuleMethod(), getCallOptions(), request);
}
/**
*/
public policy.Policy.PolicyRuleId setPolicyRule(policy.Policy.PolicyRuleBasic request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getSetPolicyRuleMethod(), getCallOptions(), request);
}
/**
*/
public context.ContextOuterClass.Empty removePolicyRule(policy.Policy.PolicyRuleId request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getRemovePolicyRuleMethod(), getCallOptions(), request);
}
}
/**
* <pre>
* created as a separate service to prevent import-loops in context and policy
* </pre>
*/
public static final class ContextPolicyServiceFutureStub extends io.grpc.stub.AbstractFutureStub<ContextPolicyServiceFutureStub> {
private ContextPolicyServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected ContextPolicyServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ContextPolicyServiceFutureStub(channel, callOptions);
}
/**
*/
public com.google.common.util.concurrent.ListenableFuture<policy.Policy.PolicyRuleIdList> listPolicyRuleIds(
context.ContextOuterClass.Empty request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getListPolicyRuleIdsMethod(), getCallOptions()), request);
}
/**
*/
public com.google.common.util.concurrent.ListenableFuture<policy.Policy.PolicyRuleList> listPolicyRules(
context.ContextOuterClass.Empty request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getListPolicyRulesMethod(), getCallOptions()), request);
}
/**
*/
public com.google.common.util.concurrent.ListenableFuture<policy.Policy.PolicyRuleBasic> getPolicyRule(
policy.Policy.PolicyRuleId request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getGetPolicyRuleMethod(), getCallOptions()), request);
}
/**
*/
public com.google.common.util.concurrent.ListenableFuture<policy.Policy.PolicyRuleId> setPolicyRule(
policy.Policy.PolicyRuleBasic request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getSetPolicyRuleMethod(), getCallOptions()), request);
}
/**
*/
public com.google.common.util.concurrent.ListenableFuture<context.ContextOuterClass.Empty> removePolicyRule(
policy.Policy.PolicyRuleId request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getRemovePolicyRuleMethod(), getCallOptions()), request);
}
}
private static final int METHODID_LIST_POLICY_RULE_IDS = 0;
private static final int METHODID_LIST_POLICY_RULES = 1;
private static final int METHODID_GET_POLICY_RULE = 2;
private static final int METHODID_SET_POLICY_RULE = 3;
private static final int METHODID_REMOVE_POLICY_RULE = 4;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final ContextPolicyServiceImplBase serviceImpl;
private final int methodId;
MethodHandlers(ContextPolicyServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_LIST_POLICY_RULE_IDS:
serviceImpl.listPolicyRuleIds((context.ContextOuterClass.Empty) request,
(io.grpc.stub.StreamObserver<policy.Policy.PolicyRuleIdList>) responseObserver);
break;
case METHODID_LIST_POLICY_RULES:
serviceImpl.listPolicyRules((context.ContextOuterClass.Empty) request,
(io.grpc.stub.StreamObserver<policy.Policy.PolicyRuleList>) responseObserver);
break;
case METHODID_GET_POLICY_RULE:
serviceImpl.getPolicyRule((policy.Policy.PolicyRuleId) request,
(io.grpc.stub.StreamObserver<policy.Policy.PolicyRuleBasic>) responseObserver);
break;
case METHODID_SET_POLICY_RULE:
serviceImpl.setPolicyRule((policy.Policy.PolicyRuleBasic) request,
(io.grpc.stub.StreamObserver<policy.Policy.PolicyRuleId>) responseObserver);
break;
case METHODID_REMOVE_POLICY_RULE:
serviceImpl.removePolicyRule((policy.Policy.PolicyRuleId) request,
(io.grpc.stub.StreamObserver<context.ContextOuterClass.Empty>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private static abstract class ContextPolicyServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
ContextPolicyServiceBaseDescriptorSupplier() {}
@java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return context_policy.ContextPolicy.getDescriptor();
}
@java.lang.Override
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
return getFileDescriptor().findServiceByName("ContextPolicyService");
}
}
private static final class ContextPolicyServiceFileDescriptorSupplier
extends ContextPolicyServiceBaseDescriptorSupplier {
ContextPolicyServiceFileDescriptorSupplier() {}
}
private static final class ContextPolicyServiceMethodDescriptorSupplier
extends ContextPolicyServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
ContextPolicyServiceMethodDescriptorSupplier(String methodName) {
this.methodName = methodName;
}
@java.lang.Override
public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
return getServiceDescriptor().findMethodByName(methodName);
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (ContextPolicyServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new ContextPolicyServiceFileDescriptorSupplier())
.addMethod(getListPolicyRuleIdsMethod())
.addMethod(getListPolicyRulesMethod())
.addMethod(getGetPolicyRuleMethod())
.addMethod(getSetPolicyRuleMethod())
.addMethod(getRemovePolicyRuleMethod())
.build();
}
}
}
return result;
}
}
package context_policy;
import static context_policy.ContextPolicyServiceGrpc.getServiceDescriptor;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
@javax.annotation.Generated(
value = "by Mutiny Grpc generator",
comments = "Source: context-policy.proto")
public final class MutinyContextPolicyServiceGrpc implements io.quarkus.grpc.runtime.MutinyGrpc {
private MutinyContextPolicyServiceGrpc() {}
public static MutinyContextPolicyServiceStub newMutinyStub(io.grpc.Channel channel) {
return new MutinyContextPolicyServiceStub(channel);
}
/**
* <pre>
* created as a separate service to prevent import-loops in context and policy
* </pre>
*/
public static final class MutinyContextPolicyServiceStub extends io.grpc.stub.AbstractStub<MutinyContextPolicyServiceStub> implements io.quarkus.grpc.runtime.MutinyStub {
private ContextPolicyServiceGrpc.ContextPolicyServiceStub delegateStub;
private MutinyContextPolicyServiceStub(io.grpc.Channel channel) {
super(channel);
delegateStub = ContextPolicyServiceGrpc.newStub(channel);
}
private MutinyContextPolicyServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
delegateStub = ContextPolicyServiceGrpc.newStub(channel).build(channel, callOptions);
}
@Override
protected MutinyContextPolicyServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new MutinyContextPolicyServiceStub(channel, callOptions);
}
public io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleIdList> listPolicyRuleIds(context.ContextOuterClass.Empty request) {
return io.quarkus.grpc.runtime.ClientCalls.oneToOne(request, delegateStub::listPolicyRuleIds);
}
public io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleList> listPolicyRules(context.ContextOuterClass.Empty request) {
return io.quarkus.grpc.runtime.ClientCalls.oneToOne(request, delegateStub::listPolicyRules);
}
public io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleBasic> getPolicyRule(policy.Policy.PolicyRuleId request) {
return io.quarkus.grpc.runtime.ClientCalls.oneToOne(request, delegateStub::getPolicyRule);
}
public io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleId> setPolicyRule(policy.Policy.PolicyRuleBasic request) {
return io.quarkus.grpc.runtime.ClientCalls.oneToOne(request, delegateStub::setPolicyRule);
}
public io.smallrye.mutiny.Uni<context.ContextOuterClass.Empty> removePolicyRule(policy.Policy.PolicyRuleId request) {
return io.quarkus.grpc.runtime.ClientCalls.oneToOne(request, delegateStub::removePolicyRule);
}
}
/**
* <pre>
* created as a separate service to prevent import-loops in context and policy
* </pre>
*/
public static abstract class ContextPolicyServiceImplBase implements io.grpc.BindableService {
private String compression;
/**
* Set whether the server will try to use a compressed response.
*
* @param compression the compression, e.g {@code gzip}
*/
public ContextPolicyServiceImplBase withCompression(String compression) {
this.compression = compression;
return this;
}
public io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleIdList> listPolicyRuleIds(context.ContextOuterClass.Empty request) {
throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
}
public io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleList> listPolicyRules(context.ContextOuterClass.Empty request) {
throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
}
public io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleBasic> getPolicyRule(policy.Policy.PolicyRuleId request) {
throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
}
public io.smallrye.mutiny.Uni<policy.Policy.PolicyRuleId> setPolicyRule(policy.Policy.PolicyRuleBasic request) {
throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
}
public io.smallrye.mutiny.Uni<context.ContextOuterClass.Empty> removePolicyRule(policy.Policy.PolicyRuleId request) {
throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
context_policy.ContextPolicyServiceGrpc.getListPolicyRuleIdsMethod(),
asyncUnaryCall(
new MethodHandlers<
context.ContextOuterClass.Empty,
policy.Policy.PolicyRuleIdList>(
this, METHODID_LIST_POLICY_RULE_IDS, compression)))
.addMethod(
context_policy.ContextPolicyServiceGrpc.getListPolicyRulesMethod(),
asyncUnaryCall(
new MethodHandlers<
context.ContextOuterClass.Empty,
policy.Policy.PolicyRuleList>(
this, METHODID_LIST_POLICY_RULES, compression)))
.addMethod(
context_policy.ContextPolicyServiceGrpc.getGetPolicyRuleMethod(),
asyncUnaryCall(
new MethodHandlers<
policy.Policy.PolicyRuleId,
policy.Policy.PolicyRuleBasic>(
this, METHODID_GET_POLICY_RULE, compression)))
.addMethod(
context_policy.ContextPolicyServiceGrpc.getSetPolicyRuleMethod(),
asyncUnaryCall(
new MethodHandlers<
policy.Policy.PolicyRuleBasic,
policy.Policy.PolicyRuleId>(
this, METHODID_SET_POLICY_RULE, compression)))
.addMethod(
context_policy.ContextPolicyServiceGrpc.getRemovePolicyRuleMethod(),
asyncUnaryCall(
new MethodHandlers<
policy.Policy.PolicyRuleId,
context.ContextOuterClass.Empty>(
this, METHODID_REMOVE_POLICY_RULE, compression)))
.build();
}
}
private static final int METHODID_LIST_POLICY_RULE_IDS = 0;
private static final int METHODID_LIST_POLICY_RULES = 1;
private static final int METHODID_GET_POLICY_RULE = 2;
private static final int METHODID_SET_POLICY_RULE = 3;
private static final int METHODID_REMOVE_POLICY_RULE = 4;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final ContextPolicyServiceImplBase serviceImpl;
private final int methodId;
private final String compression;
MethodHandlers(ContextPolicyServiceImplBase serviceImpl, int methodId, String compression) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
this.compression = compression;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_LIST_POLICY_RULE_IDS:
io.quarkus.grpc.runtime.ServerCalls.oneToOne((context.ContextOuterClass.Empty) request,
(io.grpc.stub.StreamObserver<policy.Policy.PolicyRuleIdList>) responseObserver,
compression,
serviceImpl::listPolicyRuleIds);
break;
case METHODID_LIST_POLICY_RULES:
io.quarkus.grpc.runtime.ServerCalls.oneToOne((context.ContextOuterClass.Empty) request,
(io.grpc.stub.StreamObserver<policy.Policy.PolicyRuleList>) responseObserver,
compression,
serviceImpl::listPolicyRules);
break;
case METHODID_GET_POLICY_RULE:
io.quarkus.grpc.runtime.ServerCalls.oneToOne((policy.Policy.PolicyRuleId) request,
(io.grpc.stub.StreamObserver<policy.Policy.PolicyRuleBasic>) responseObserver,
compression,
serviceImpl::getPolicyRule);
break;
case METHODID_SET_POLICY_RULE:
io.quarkus.grpc.runtime.ServerCalls.oneToOne((policy.Policy.PolicyRuleBasic) request,
(io.grpc.stub.StreamObserver<policy.Policy.PolicyRuleId>) responseObserver,
compression,
serviceImpl::setPolicyRule);
break;
case METHODID_REMOVE_POLICY_RULE:
io.quarkus.grpc.runtime.ServerCalls.oneToOne((policy.Policy.PolicyRuleId) request,
(io.grpc.stub.StreamObserver<context.ContextOuterClass.Empty>) responseObserver,
compression,
serviceImpl::removePolicyRule);
break;
default:
throw new java.lang.AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new java.lang.AssertionError();
}
}
}
}
\ No newline at end of file
...@@ -3,20 +3,20 @@ apiVersion: v1 ...@@ -3,20 +3,20 @@ apiVersion: v1
kind: Service kind: Service
metadata: metadata:
annotations: annotations:
app.quarkus.io/commit-id: 342ed841a2fd5a8c0ab65464b4e178bc63981fb3 app.quarkus.io/commit-id: 1d77cb00ae8f577885de32f01f4740f865853863
app.quarkus.io/build-timestamp: 2022-07-22 - 09:19:09 +0000 app.quarkus.io/build-timestamp: 2022-07-26 - 10:46:55 +0000
labels: labels:
app.kubernetes.io/name: policyservice app.kubernetes.io/name: policyservice
app: policyservice app: policyservice
name: policyservice name: policyservice
spec: spec:
ports: ports:
- name: grpc
port: 6060
targetPort: 6060
- name: http - name: http
port: 8080 port: 8080
targetPort: 8080 targetPort: 8080
- name: grpc
port: 6060
targetPort: 6060
selector: selector:
app.kubernetes.io/name: policyservice app.kubernetes.io/name: policyservice
type: ClusterIP type: ClusterIP
...@@ -25,8 +25,8 @@ apiVersion: apps/v1 ...@@ -25,8 +25,8 @@ apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
annotations: annotations:
app.quarkus.io/commit-id: 342ed841a2fd5a8c0ab65464b4e178bc63981fb3 app.quarkus.io/commit-id: 1d77cb00ae8f577885de32f01f4740f865853863
app.quarkus.io/build-timestamp: 2022-07-22 - 09:19:09 +0000 app.quarkus.io/build-timestamp: 2022-07-26 - 10:46:55 +0000
labels: labels:
app: policyservice app: policyservice
app.kubernetes.io/name: policyservice app.kubernetes.io/name: policyservice
...@@ -39,8 +39,8 @@ spec: ...@@ -39,8 +39,8 @@ spec:
template: template:
metadata: metadata:
annotations: annotations:
app.quarkus.io/commit-id: 342ed841a2fd5a8c0ab65464b4e178bc63981fb3 app.quarkus.io/commit-id: 1d77cb00ae8f577885de32f01f4740f865853863
app.quarkus.io/build-timestamp: 2022-07-22 - 09:19:09 +0000 app.quarkus.io/build-timestamp: 2022-07-26 - 10:46:55 +0000
labels: labels:
app: policyservice app: policyservice
app.kubernetes.io/name: policyservice app.kubernetes.io/name: policyservice
...@@ -51,12 +51,12 @@ spec: ...@@ -51,12 +51,12 @@ spec:
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
- name: SERVICE_SERVICE_HOST
value: serviceservice
- name: MONITORING_SERVICE_HOST - name: MONITORING_SERVICE_HOST
value: monitoringservice value: monitoringservice
- name: CONTEXT_SERVICE_HOST - name: CONTEXT_SERVICE_HOST
value: contextservice value: contextservice
- name: SERVICE_SERVICE_HOST
value: serviceservice
image: registry.gitlab.com/teraflow-h2020/controller/policy:0.1.0 image: registry.gitlab.com/teraflow-h2020/controller/policy:0.1.0
imagePullPolicy: Always imagePullPolicy: Always
livenessProbe: livenessProbe:
...@@ -71,12 +71,12 @@ spec: ...@@ -71,12 +71,12 @@ spec:
timeoutSeconds: 10 timeoutSeconds: 10
name: policyservice name: policyservice
ports: ports:
- containerPort: 6060
name: grpc
protocol: TCP
- containerPort: 8080 - containerPort: 8080
name: http name: http
protocol: TCP protocol: TCP
- containerPort: 6060
name: grpc
protocol: TCP
readinessProbe: readinessProbe:
failureThreshold: 3 failureThreshold: 3
httpGet: httpGet:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment