150 lines
5.2 KiB
Go
150 lines
5.2 KiB
Go
// Copyright (c) Mainflux
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.3.0
|
|
// - protoc v4.23.3
|
|
// source: things/policies/auth.proto
|
|
|
|
package policies
|
|
|
|
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.32.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion7
|
|
|
|
const (
|
|
ThingsService_Authorize_FullMethodName = "/mainflux.things.policies.ThingsService/Authorize"
|
|
ThingsService_Identify_FullMethodName = "/mainflux.things.policies.ThingsService/Identify"
|
|
)
|
|
|
|
// ThingsServiceClient is the client API for ThingsService 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.
|
|
type ThingsServiceClient interface {
|
|
Authorize(ctx context.Context, in *AuthorizeReq, opts ...grpc.CallOption) (*AuthorizeRes, error)
|
|
Identify(ctx context.Context, in *Key, opts ...grpc.CallOption) (*ClientID, error)
|
|
}
|
|
|
|
type thingsServiceClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewThingsServiceClient(cc grpc.ClientConnInterface) ThingsServiceClient {
|
|
return &thingsServiceClient{cc}
|
|
}
|
|
|
|
func (c *thingsServiceClient) Authorize(ctx context.Context, in *AuthorizeReq, opts ...grpc.CallOption) (*AuthorizeRes, error) {
|
|
out := new(AuthorizeRes)
|
|
err := c.cc.Invoke(ctx, ThingsService_Authorize_FullMethodName, in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *thingsServiceClient) Identify(ctx context.Context, in *Key, opts ...grpc.CallOption) (*ClientID, error) {
|
|
out := new(ClientID)
|
|
err := c.cc.Invoke(ctx, ThingsService_Identify_FullMethodName, in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// ThingsServiceServer is the server API for ThingsService service.
|
|
// All implementations must embed UnimplementedThingsServiceServer
|
|
// for forward compatibility
|
|
type ThingsServiceServer interface {
|
|
Authorize(context.Context, *AuthorizeReq) (*AuthorizeRes, error)
|
|
Identify(context.Context, *Key) (*ClientID, error)
|
|
mustEmbedUnimplementedThingsServiceServer()
|
|
}
|
|
|
|
// UnimplementedThingsServiceServer must be embedded to have forward compatible implementations.
|
|
type UnimplementedThingsServiceServer struct {
|
|
}
|
|
|
|
func (UnimplementedThingsServiceServer) Authorize(context.Context, *AuthorizeReq) (*AuthorizeRes, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method Authorize not implemented")
|
|
}
|
|
func (UnimplementedThingsServiceServer) Identify(context.Context, *Key) (*ClientID, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method Identify not implemented")
|
|
}
|
|
func (UnimplementedThingsServiceServer) mustEmbedUnimplementedThingsServiceServer() {}
|
|
|
|
// UnsafeThingsServiceServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to ThingsServiceServer will
|
|
// result in compilation errors.
|
|
type UnsafeThingsServiceServer interface {
|
|
mustEmbedUnimplementedThingsServiceServer()
|
|
}
|
|
|
|
func RegisterThingsServiceServer(s grpc.ServiceRegistrar, srv ThingsServiceServer) {
|
|
s.RegisterService(&ThingsService_ServiceDesc, srv)
|
|
}
|
|
|
|
func _ThingsService_Authorize_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(AuthorizeReq)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(ThingsServiceServer).Authorize(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: ThingsService_Authorize_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(ThingsServiceServer).Authorize(ctx, req.(*AuthorizeReq))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _ThingsService_Identify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(Key)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(ThingsServiceServer).Identify(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: ThingsService_Identify_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(ThingsServiceServer).Identify(ctx, req.(*Key))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// ThingsService_ServiceDesc is the grpc.ServiceDesc for ThingsService service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var ThingsService_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "mainflux.things.policies.ThingsService",
|
|
HandlerType: (*ThingsServiceServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "Authorize",
|
|
Handler: _ThingsService_Authorize_Handler,
|
|
},
|
|
{
|
|
MethodName: "Identify",
|
|
Handler: _ThingsService_Identify_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "things/policies/auth.proto",
|
|
}
|