220 lines
8.6 KiB
Go
220 lines
8.6 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.6.2
|
|
// - protoc (unknown)
|
|
// source: guard/v1/guard.proto
|
|
|
|
package guardv1
|
|
|
|
import (
|
|
context "context"
|
|
grpc "google.golang.org/grpc"
|
|
codes "google.golang.org/grpc/codes"
|
|
status "google.golang.org/grpc/status"
|
|
)
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the grpc package it is being compiled against.
|
|
// Requires gRPC-Go v1.64.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion9
|
|
|
|
const (
|
|
GuardService_Configure_FullMethodName = "/guard.v1.GuardService/Configure"
|
|
GuardService_Describe_FullMethodName = "/guard.v1.GuardService/Describe"
|
|
GuardService_Judge_FullMethodName = "/guard.v1.GuardService/Judge"
|
|
)
|
|
|
|
// GuardServiceClient is the client API for GuardService service.
|
|
//
|
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
|
//
|
|
// GuardService is the surface a guard extension serves. A guard judges one
|
|
// concrete action and answers with a ceiling on the five-level scale. The host
|
|
// asks every running guard about every action and runs the action at the lowest
|
|
// ceiling.
|
|
type GuardServiceClient interface {
|
|
// Configure hands the guard its settings and resolved secrets, once, right
|
|
// after launch and before any Judge.
|
|
Configure(ctx context.Context, in *ConfigureRequest, opts ...grpc.CallOption) (*ConfigureResponse, error)
|
|
// Describe names the guard and says whether its verdicts count.
|
|
Describe(ctx context.Context, in *DescribeRequest, opts ...grpc.CallOption) (*DescribeResponse, error)
|
|
// Judge returns the guard's verdict on one action. The host enforces the
|
|
// request's deadline: a guard that errors, answers late or answers without
|
|
// a ceiling holds the action at propose and wait, unless it is advisory.
|
|
Judge(ctx context.Context, in *JudgeRequest, opts ...grpc.CallOption) (*JudgeResponse, error)
|
|
}
|
|
|
|
type guardServiceClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewGuardServiceClient(cc grpc.ClientConnInterface) GuardServiceClient {
|
|
return &guardServiceClient{cc}
|
|
}
|
|
|
|
func (c *guardServiceClient) Configure(ctx context.Context, in *ConfigureRequest, opts ...grpc.CallOption) (*ConfigureResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(ConfigureResponse)
|
|
err := c.cc.Invoke(ctx, GuardService_Configure_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *guardServiceClient) Describe(ctx context.Context, in *DescribeRequest, opts ...grpc.CallOption) (*DescribeResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(DescribeResponse)
|
|
err := c.cc.Invoke(ctx, GuardService_Describe_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *guardServiceClient) Judge(ctx context.Context, in *JudgeRequest, opts ...grpc.CallOption) (*JudgeResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(JudgeResponse)
|
|
err := c.cc.Invoke(ctx, GuardService_Judge_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// GuardServiceServer is the server API for GuardService service.
|
|
// All implementations must embed UnimplementedGuardServiceServer
|
|
// for forward compatibility.
|
|
//
|
|
// GuardService is the surface a guard extension serves. A guard judges one
|
|
// concrete action and answers with a ceiling on the five-level scale. The host
|
|
// asks every running guard about every action and runs the action at the lowest
|
|
// ceiling.
|
|
type GuardServiceServer interface {
|
|
// Configure hands the guard its settings and resolved secrets, once, right
|
|
// after launch and before any Judge.
|
|
Configure(context.Context, *ConfigureRequest) (*ConfigureResponse, error)
|
|
// Describe names the guard and says whether its verdicts count.
|
|
Describe(context.Context, *DescribeRequest) (*DescribeResponse, error)
|
|
// Judge returns the guard's verdict on one action. The host enforces the
|
|
// request's deadline: a guard that errors, answers late or answers without
|
|
// a ceiling holds the action at propose and wait, unless it is advisory.
|
|
Judge(context.Context, *JudgeRequest) (*JudgeResponse, error)
|
|
mustEmbedUnimplementedGuardServiceServer()
|
|
}
|
|
|
|
// UnimplementedGuardServiceServer must be embedded to have
|
|
// forward compatible implementations.
|
|
//
|
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
|
// pointer dereference when methods are called.
|
|
type UnimplementedGuardServiceServer struct{}
|
|
|
|
func (UnimplementedGuardServiceServer) Configure(context.Context, *ConfigureRequest) (*ConfigureResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method Configure not implemented")
|
|
}
|
|
func (UnimplementedGuardServiceServer) Describe(context.Context, *DescribeRequest) (*DescribeResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method Describe not implemented")
|
|
}
|
|
func (UnimplementedGuardServiceServer) Judge(context.Context, *JudgeRequest) (*JudgeResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method Judge not implemented")
|
|
}
|
|
func (UnimplementedGuardServiceServer) mustEmbedUnimplementedGuardServiceServer() {}
|
|
func (UnimplementedGuardServiceServer) testEmbeddedByValue() {}
|
|
|
|
// UnsafeGuardServiceServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to GuardServiceServer will
|
|
// result in compilation errors.
|
|
type UnsafeGuardServiceServer interface {
|
|
mustEmbedUnimplementedGuardServiceServer()
|
|
}
|
|
|
|
func RegisterGuardServiceServer(s grpc.ServiceRegistrar, srv GuardServiceServer) {
|
|
// If the following call panics, it indicates UnimplementedGuardServiceServer was
|
|
// embedded by pointer and is nil. This will cause panics if an
|
|
// unimplemented method is ever invoked, so we test this at initialization
|
|
// time to prevent it from happening at runtime later due to I/O.
|
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
|
t.testEmbeddedByValue()
|
|
}
|
|
s.RegisterService(&GuardService_ServiceDesc, srv)
|
|
}
|
|
|
|
func _GuardService_Configure_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ConfigureRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(GuardServiceServer).Configure(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: GuardService_Configure_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(GuardServiceServer).Configure(ctx, req.(*ConfigureRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _GuardService_Describe_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(DescribeRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(GuardServiceServer).Describe(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: GuardService_Describe_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(GuardServiceServer).Describe(ctx, req.(*DescribeRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _GuardService_Judge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(JudgeRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(GuardServiceServer).Judge(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: GuardService_Judge_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(GuardServiceServer).Judge(ctx, req.(*JudgeRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// GuardService_ServiceDesc is the grpc.ServiceDesc for GuardService service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var GuardService_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "guard.v1.GuardService",
|
|
HandlerType: (*GuardServiceServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "Configure",
|
|
Handler: _GuardService_Configure_Handler,
|
|
},
|
|
{
|
|
MethodName: "Describe",
|
|
Handler: _GuardService_Describe_Handler,
|
|
},
|
|
{
|
|
MethodName: "Judge",
|
|
Handler: _GuardService_Judge_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "guard/v1/guard.proto",
|
|
}
|