Initial QSfera import

This commit is contained in:
Курнат Андрей
2026-06-07 10:20:04 +03:00
commit 2315f25754
16485 changed files with 4826827 additions and 0 deletions
@@ -0,0 +1,123 @@
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
package mocks
import (
"context"
"github.com/qsfera/server/protogen/gen/qsfera/services/policies/v0"
mock "github.com/stretchr/testify/mock"
"go-micro.dev/v4/client"
)
// NewPoliciesProviderService creates a new instance of PoliciesProviderService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewPoliciesProviderService(t interface {
mock.TestingT
Cleanup(func())
}) *PoliciesProviderService {
mock := &PoliciesProviderService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// PoliciesProviderService is an autogenerated mock type for the PoliciesProviderService type
type PoliciesProviderService struct {
mock.Mock
}
type PoliciesProviderService_Expecter struct {
mock *mock.Mock
}
func (_m *PoliciesProviderService) EXPECT() *PoliciesProviderService_Expecter {
return &PoliciesProviderService_Expecter{mock: &_m.Mock}
}
// Evaluate provides a mock function for the type PoliciesProviderService
func (_mock *PoliciesProviderService) Evaluate(ctx context.Context, in *v0.EvaluateRequest, opts ...client.CallOption) (*v0.EvaluateResponse, error) {
var tmpRet mock.Arguments
if len(opts) > 0 {
tmpRet = _mock.Called(ctx, in, opts)
} else {
tmpRet = _mock.Called(ctx, in)
}
ret := tmpRet
if len(ret) == 0 {
panic("no return value specified for Evaluate")
}
var r0 *v0.EvaluateResponse
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, *v0.EvaluateRequest, ...client.CallOption) (*v0.EvaluateResponse, error)); ok {
return returnFunc(ctx, in, opts...)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, *v0.EvaluateRequest, ...client.CallOption) *v0.EvaluateResponse); ok {
r0 = returnFunc(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.EvaluateResponse)
}
}
if returnFunc, ok := ret.Get(1).(func(context.Context, *v0.EvaluateRequest, ...client.CallOption) error); ok {
r1 = returnFunc(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// PoliciesProviderService_Evaluate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Evaluate'
type PoliciesProviderService_Evaluate_Call struct {
*mock.Call
}
// Evaluate is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.EvaluateRequest
// - opts ...client.CallOption
func (_e *PoliciesProviderService_Expecter) Evaluate(ctx interface{}, in interface{}, opts ...interface{}) *PoliciesProviderService_Evaluate_Call {
return &PoliciesProviderService_Evaluate_Call{Call: _e.mock.On("Evaluate",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *PoliciesProviderService_Evaluate_Call) Run(run func(ctx context.Context, in *v0.EvaluateRequest, opts ...client.CallOption)) *PoliciesProviderService_Evaluate_Call {
_c.Call.Run(func(args mock.Arguments) {
var arg0 context.Context
if args[0] != nil {
arg0 = args[0].(context.Context)
}
var arg1 *v0.EvaluateRequest
if args[1] != nil {
arg1 = args[1].(*v0.EvaluateRequest)
}
var arg2 []client.CallOption
var variadicArgs []client.CallOption
if len(args) > 2 {
variadicArgs = args[2].([]client.CallOption)
}
arg2 = variadicArgs
run(
arg0,
arg1,
arg2...,
)
})
return _c
}
func (_c *PoliciesProviderService_Evaluate_Call) Return(evaluateResponse *v0.EvaluateResponse, err error) *PoliciesProviderService_Evaluate_Call {
_c.Call.Return(evaluateResponse, err)
return _c
}
func (_c *PoliciesProviderService_Evaluate_Call) RunAndReturn(run func(ctx context.Context, in *v0.EvaluateRequest, opts ...client.CallOption) (*v0.EvaluateResponse, error)) *PoliciesProviderService_Evaluate_Call {
_c.Call.Return(run)
return _c
}
@@ -0,0 +1,269 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc (unknown)
// source: qsfera/services/policies/v0/policies.proto
package v0
import (
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
v0 "github.com/qsfera/server/protogen/gen/qsfera/messages/policies/v0"
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type EvaluateRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
Environment *v0.Environment `protobuf:"bytes,2,opt,name=environment,proto3" json:"environment,omitempty"`
}
func (x *EvaluateRequest) Reset() {
*x = EvaluateRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_qsfera_services_policies_v0_policies_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EvaluateRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EvaluateRequest) ProtoMessage() {}
func (x *EvaluateRequest) ProtoReflect() protoreflect.Message {
mi := &file_qsfera_services_policies_v0_policies_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use EvaluateRequest.ProtoReflect.Descriptor instead.
func (*EvaluateRequest) Descriptor() ([]byte, []int) {
return file_qsfera_services_policies_v0_policies_proto_rawDescGZIP(), []int{0}
}
func (x *EvaluateRequest) GetQuery() string {
if x != nil {
return x.Query
}
return ""
}
func (x *EvaluateRequest) GetEnvironment() *v0.Environment {
if x != nil {
return x.Environment
}
return nil
}
type EvaluateResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"`
}
func (x *EvaluateResponse) Reset() {
*x = EvaluateResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_qsfera_services_policies_v0_policies_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EvaluateResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EvaluateResponse) ProtoMessage() {}
func (x *EvaluateResponse) ProtoReflect() protoreflect.Message {
mi := &file_qsfera_services_policies_v0_policies_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use EvaluateResponse.ProtoReflect.Descriptor instead.
func (*EvaluateResponse) Descriptor() ([]byte, []int) {
return file_qsfera_services_policies_v0_policies_proto_rawDescGZIP(), []int{1}
}
func (x *EvaluateResponse) GetResult() bool {
if x != nil {
return x.Result
}
return false
}
var File_qsfera_services_policies_v0_policies_proto protoreflect.FileDescriptor
var file_qsfera_services_policies_v0_policies_proto_rawDesc = []byte{
0x0a, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x73, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x76, 0x30,
0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x1e, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x73, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2e, 0x76, 0x30, 0x1a,
0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x73, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x76, 0x30, 0x2f,
0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61,
0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e,
0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x76, 0x0a, 0x0f,
0x45, 0x76, 0x61, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x4d, 0x0a, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,
0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x70, 0x65,
0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e,
0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x45, 0x6e, 0x76, 0x69,
0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,
0x6d, 0x65, 0x6e, 0x74, 0x22, 0x2a, 0x0a, 0x10, 0x45, 0x76, 0x61, 0x6c, 0x75, 0x61, 0x74, 0x65,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75,
0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74,
0x32, 0xa8, 0x01, 0x0a, 0x10, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x50, 0x72, 0x6f,
0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x93, 0x01, 0x0a, 0x08, 0x45, 0x76, 0x61, 0x6c, 0x75, 0x61,
0x74, 0x65, 0x12, 0x2f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x73,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73,
0x2e, 0x76, 0x30, 0x2e, 0x45, 0x76, 0x61, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e,
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65,
0x73, 0x2e, 0x76, 0x30, 0x2e, 0x45, 0x76, 0x61, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x3a, 0x01, 0x2a,
0x22, 0x19, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69,
0x65, 0x73, 0x2f, 0x65, 0x76, 0x61, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x42, 0xf8, 0x02, 0x5a, 0x4c,
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x63,
0x6c, 0x6f, 0x75, 0x64, 0x2d, 0x65, 0x75, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6c, 0x6f, 0x75,
0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x6f,
0x70, 0x65, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x76, 0x30, 0x92, 0x41, 0xa6, 0x02,
0x12, 0xb9, 0x01, 0x0a, 0x12, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x20, 0x70,
0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x22, 0x51, 0x0a, 0x0e, 0x4f, 0x70, 0x65, 0x6e, 0x43,
0x6c, 0x6f, 0x75, 0x64, 0x20, 0x47, 0x6d, 0x62, 0x48, 0x12, 0x29, 0x68, 0x74, 0x74, 0x70, 0x73,
0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70,
0x65, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2d, 0x65, 0x75, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x63,
0x6c, 0x6f, 0x75, 0x64, 0x1a, 0x14, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x40, 0x6f, 0x70,
0x65, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x65, 0x75, 0x2a, 0x49, 0x0a, 0x0a, 0x41, 0x70,
0x61, 0x63, 0x68, 0x65, 0x2d, 0x32, 0x2e, 0x30, 0x12, 0x3b, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a,
0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65,
0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2d, 0x65, 0x75, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6c,
0x6f, 0x75, 0x64, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x2f, 0x6d, 0x61, 0x69, 0x6e, 0x2f, 0x4c, 0x49,
0x43, 0x45, 0x4e, 0x53, 0x45, 0x32, 0x05, 0x31, 0x2e, 0x30, 0x2e, 0x30, 0x2a, 0x02, 0x01, 0x02,
0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73,
0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f,
0x6a, 0x73, 0x6f, 0x6e, 0x72, 0x40, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65,
0x72, 0x20, 0x4d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x12, 0x2c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a,
0x2f, 0x2f, 0x64, 0x6f, 0x63, 0x73, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64,
0x2e, 0x65, 0x75, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x70, 0x6f, 0x6c,
0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_qsfera_services_policies_v0_policies_proto_rawDescOnce sync.Once
file_qsfera_services_policies_v0_policies_proto_rawDescData = file_qsfera_services_policies_v0_policies_proto_rawDesc
)
func file_qsfera_services_policies_v0_policies_proto_rawDescGZIP() []byte {
file_qsfera_services_policies_v0_policies_proto_rawDescOnce.Do(func() {
file_qsfera_services_policies_v0_policies_proto_rawDescData = protoimpl.X.CompressGZIP(file_qsfera_services_policies_v0_policies_proto_rawDescData)
})
return file_qsfera_services_policies_v0_policies_proto_rawDescData
}
var file_qsfera_services_policies_v0_policies_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_qsfera_services_policies_v0_policies_proto_goTypes = []interface{}{
(*EvaluateRequest)(nil), // 0: qsfera.services.policies.v0.EvaluateRequest
(*EvaluateResponse)(nil), // 1: qsfera.services.policies.v0.EvaluateResponse
(*v0.Environment)(nil), // 2: qsfera.messages.policies.v0.Environment
}
var file_qsfera_services_policies_v0_policies_proto_depIdxs = []int32{
2, // 0: qsfera.services.policies.v0.EvaluateRequest.environment:type_name -> qsfera.messages.policies.v0.Environment
0, // 1: qsfera.services.policies.v0.policiesProvider.Evaluate:input_type -> qsfera.services.policies.v0.EvaluateRequest
1, // 2: qsfera.services.policies.v0.policiesProvider.Evaluate:output_type -> qsfera.services.policies.v0.EvaluateResponse
2, // [2:3] is the sub-list for method output_type
1, // [1:2] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_qsfera_services_policies_v0_policies_proto_init() }
func file_qsfera_services_policies_v0_policies_proto_init() {
if File_qsfera_services_policies_v0_policies_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_qsfera_services_policies_v0_policies_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EvaluateRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_qsfera_services_policies_v0_policies_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EvaluateResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_qsfera_services_policies_v0_policies_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_qsfera_services_policies_v0_policies_proto_goTypes,
DependencyIndexes: file_qsfera_services_policies_v0_policies_proto_depIdxs,
MessageInfos: file_qsfera_services_policies_v0_policies_proto_msgTypes,
}.Build()
File_qsfera_services_policies_v0_policies_proto = out.File
file_qsfera_services_policies_v0_policies_proto_rawDesc = nil
file_qsfera_services_policies_v0_policies_proto_goTypes = nil
file_qsfera_services_policies_v0_policies_proto_depIdxs = nil
}
@@ -0,0 +1,103 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: qsfera/services/policies/v0/policies.proto
package v0
import (
fmt "fmt"
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
_ "github.com/qsfera/server/protogen/gen/qsfera/messages/policies/v0"
_ "google.golang.org/genproto/googleapis/api/annotations"
proto "google.golang.org/protobuf/proto"
math "math"
)
import (
context "context"
api "go-micro.dev/v4/api"
client "go-micro.dev/v4/client"
server "go-micro.dev/v4/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for PoliciesProvider service
func NewPoliciesProviderEndpoints() []*api.Endpoint {
return []*api.Endpoint{
{
Name: "PoliciesProvider.Evaluate",
Path: []string{"/api/v0/policies/evaluate"},
Method: []string{"POST"},
Handler: "rpc",
},
}
}
// Client API for PoliciesProvider service
type PoliciesProviderService interface {
Evaluate(ctx context.Context, in *EvaluateRequest, opts ...client.CallOption) (*EvaluateResponse, error)
}
type policiesProviderService struct {
c client.Client
name string
}
func NewPoliciesProviderService(name string, c client.Client) PoliciesProviderService {
return &policiesProviderService{
c: c,
name: name,
}
}
func (c *policiesProviderService) Evaluate(ctx context.Context, in *EvaluateRequest, opts ...client.CallOption) (*EvaluateResponse, error) {
req := c.c.NewRequest(c.name, "PoliciesProvider.Evaluate", in)
out := new(EvaluateResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for PoliciesProvider service
type PoliciesProviderHandler interface {
Evaluate(context.Context, *EvaluateRequest, *EvaluateResponse) error
}
func RegisterPoliciesProviderHandler(s server.Server, hdlr PoliciesProviderHandler, opts ...server.HandlerOption) error {
type policiesProvider interface {
Evaluate(ctx context.Context, in *EvaluateRequest, out *EvaluateResponse) error
}
type PoliciesProvider struct {
policiesProvider
}
h := &policiesProviderHandler{hdlr}
opts = append(opts, api.WithEndpoint(&api.Endpoint{
Name: "PoliciesProvider.Evaluate",
Path: []string{"/api/v0/policies/evaluate"},
Method: []string{"POST"},
Handler: "rpc",
}))
return s.Handle(s.NewHandler(&PoliciesProvider{h}, opts...))
}
type policiesProviderHandler struct {
PoliciesProviderHandler
}
func (h *policiesProviderHandler) Evaluate(ctx context.Context, in *EvaluateRequest, out *EvaluateResponse) error {
return h.PoliciesProviderHandler.Evaluate(ctx, in, out)
}
@@ -0,0 +1,216 @@
{
"swagger": "2.0",
"info": {
"title": "КуСфера policies",
"version": "1.0.0",
"contact": {
"name": "КуСфера",
"url": "",
"email": ""
},
"license": {
"name": "Apache-2.0",
"url": ""
}
},
"tags": [
{
"name": "policiesProvider"
}
],
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/api/v0/policies/evaluate": {
"post": {
"operationId": "policiesProvider_Evaluate",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v0EvaluateResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v0EvaluateRequest"
}
}
],
"tags": [
"policiesProvider"
]
}
}
},
"definitions": {
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
}
}
},
"v0Environment": {
"type": "object",
"properties": {
"stage": {
"$ref": "#/definitions/v0Stage"
},
"user": {
"$ref": "#/definitions/v0User"
},
"request": {
"$ref": "#/definitions/v0Request"
},
"resource": {
"$ref": "#/definitions/v0Resource"
}
}
},
"v0EvaluateRequest": {
"type": "object",
"properties": {
"query": {
"type": "string"
},
"environment": {
"$ref": "#/definitions/v0Environment"
}
}
},
"v0EvaluateResponse": {
"type": "object",
"properties": {
"result": {
"type": "boolean"
}
}
},
"v0Request": {
"type": "object",
"properties": {
"method": {
"type": "string"
},
"path": {
"type": "string"
}
}
},
"v0Resource": {
"type": "object",
"properties": {
"id": {
"$ref": "#/definitions/v0ResourceID"
},
"name": {
"type": "string"
},
"size": {
"type": "string",
"format": "uint64"
},
"url": {
"type": "string"
}
}
},
"v0ResourceID": {
"type": "object",
"properties": {
"storageId": {
"type": "string"
},
"opaqueId": {
"type": "string"
},
"spaceId": {
"type": "string"
}
}
},
"v0Stage": {
"type": "string",
"enum": [
"STAGE_PP",
"STAGE_HTTP"
],
"default": "STAGE_PP"
},
"v0User": {
"type": "object",
"properties": {
"id": {
"$ref": "#/definitions/v0UserID"
},
"username": {
"type": "string"
},
"mail": {
"type": "string"
},
"displayName": {
"type": "string"
},
"groups": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"v0UserID": {
"type": "object",
"properties": {
"opaqueId": {
"type": "string"
}
}
}
},
"externalDocs": {
"description": "Developer Manual",
"url": ""
}
}
@@ -0,0 +1,121 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc (unknown)
// source: qsfera/services/policies/v0/policies.proto
package v0
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 (
PoliciesProvider_Evaluate_FullMethodName = "/qsfera.services.policies.v0.policiesProvider/Evaluate"
)
// PoliciesProviderClient is the client API for PoliciesProvider 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 PoliciesProviderClient interface {
Evaluate(ctx context.Context, in *EvaluateRequest, opts ...grpc.CallOption) (*EvaluateResponse, error)
}
type policiesProviderClient struct {
cc grpc.ClientConnInterface
}
func NewPoliciesProviderClient(cc grpc.ClientConnInterface) PoliciesProviderClient {
return &policiesProviderClient{cc}
}
func (c *policiesProviderClient) Evaluate(ctx context.Context, in *EvaluateRequest, opts ...grpc.CallOption) (*EvaluateResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(EvaluateResponse)
err := c.cc.Invoke(ctx, PoliciesProvider_Evaluate_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// PoliciesProviderServer is the server API for PoliciesProvider service.
// All implementations must embed UnimplementedPoliciesProviderServer
// for forward compatibility.
type PoliciesProviderServer interface {
Evaluate(context.Context, *EvaluateRequest) (*EvaluateResponse, error)
mustEmbedUnimplementedPoliciesProviderServer()
}
// UnimplementedPoliciesProviderServer 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 UnimplementedPoliciesProviderServer struct{}
func (UnimplementedPoliciesProviderServer) Evaluate(context.Context, *EvaluateRequest) (*EvaluateResponse, error) {
return nil, status.Error(codes.Unimplemented, "method Evaluate not implemented")
}
func (UnimplementedPoliciesProviderServer) mustEmbedUnimplementedPoliciesProviderServer() {}
func (UnimplementedPoliciesProviderServer) testEmbeddedByValue() {}
// UnsafePoliciesProviderServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PoliciesProviderServer will
// result in compilation errors.
type UnsafePoliciesProviderServer interface {
mustEmbedUnimplementedPoliciesProviderServer()
}
func RegisterPoliciesProviderServer(s grpc.ServiceRegistrar, srv PoliciesProviderServer) {
// If the following call panics, it indicates UnimplementedPoliciesProviderServer 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(&PoliciesProvider_ServiceDesc, srv)
}
func _PoliciesProvider_Evaluate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EvaluateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PoliciesProviderServer).Evaluate(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PoliciesProvider_Evaluate_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PoliciesProviderServer).Evaluate(ctx, req.(*EvaluateRequest))
}
return interceptor(ctx, in, info, handler)
}
// PoliciesProvider_ServiceDesc is the grpc.ServiceDesc for PoliciesProvider service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PoliciesProvider_ServiceDesc = grpc.ServiceDesc{
ServiceName: "qsfera.services.policies.v0.policiesProvider",
HandlerType: (*PoliciesProviderServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Evaluate",
Handler: _PoliciesProvider_Evaluate_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "qsfera/services/policies/v0/policies.proto",
}