Add basic support for script-runner (protobuf, grpc)

This commit is contained in:
Denis Arh
2019-08-23 13:49:35 +02:00
parent b15629afe2
commit dff0df54cb
243 changed files with 175633 additions and 60 deletions
+1 -1
View File
@@ -269,7 +269,7 @@ func (r record) buildQuery(module *types.Module, f types.RecordFilter) (query sq
func (r record) Create(record *types.Record) (*types.Record, error) {
record.ID = factory.Sonyflake.NextID()
if err := r.db().Replace("compose_record", record); err != nil {
if err := r.db().Insert("compose_record", record); err != nil {
return nil, errors.Wrap(err, "could not update record")
}
+4
View File
@@ -84,6 +84,10 @@ func (r trigger) Find(filter types.TriggerFilter) (set types.TriggerSet, f types
query = query.Where("rel_namespace = ?", filter.NamespaceID)
}
if filter.ModuleID > 0 {
query = query.Where("rel_module = ?", filter.ModuleID)
}
if f.Query != "" {
q := "%" + f.Query + "%"
query = query.Where("name like ?", q)
+150 -43
View File
@@ -22,13 +22,17 @@ type (
logger *zap.Logger
ac recordAccessController
sr *scriptRunner
recordRepo repository.RecordRepository
moduleRepo repository.ModuleRepository
nsRepo repository.NamespaceRepository
tRepo repository.TriggerRepository
}
recordAccessController interface {
CanCreateRecord(context.Context, *types.Module) bool
CanReadNamespace(context.Context, *types.Namespace) bool
CanReadModule(context.Context, *types.Module) bool
CanReadRecord(context.Context, *types.Module) bool
CanUpdateRecord(context.Context, *types.Module) bool
@@ -63,20 +67,25 @@ func Record() RecordService {
return (&record{
logger: DefaultLogger.Named("record"),
ac: DefaultAccessControl,
sr: DefaultScriptRunner,
}).With(context.Background())
}
func (svc record) With(ctx context.Context) RecordService {
db := repository.DB(ctx)
return &record{
db: db,
ctx: ctx,
logger: svc.logger,
ac: svc.ac,
sr: svc.sr,
recordRepo: repository.Record(ctx, db),
moduleRepo: repository.Module(ctx, db),
nsRepo: repository.Namespace(ctx, db),
tRepo: repository.Trigger(ctx, db),
}
}
@@ -126,6 +135,22 @@ func (svc record) loadModule(namespaceID, moduleID uint64) (m *types.Module, err
return
}
func (svc record) loadNamespace(namespaceID uint64) (ns *types.Namespace, err error) {
if namespaceID == 0 {
return nil, ErrNamespaceRequired.withStack()
}
if ns, err = svc.nsRepo.FindByID(namespaceID); err != nil {
return
}
if !svc.ac.CanReadNamespace(svc.ctx, ns) {
return nil, ErrNoReadPermissions.withStack()
}
return
}
func (svc record) Report(namespaceID, moduleID uint64, metrics, dimensions, filter string) (out interface{}, err error) {
var m *types.Module
if m, err = svc.loadModule(namespaceID, moduleID); err != nil {
@@ -176,12 +201,8 @@ func (svc record) Export(filter types.RecordFilter, enc Encoder) error {
}
func (svc record) Create(mod *types.Record) (r *types.Record, err error) {
if mod.NamespaceID == 0 {
return nil, ErrNamespaceRequired
}
var m *types.Module
if m, err = svc.loadModule(mod.NamespaceID, mod.ModuleID); err != nil {
ns, m, r, tt, err := svc.loadCombo(mod.NamespaceID, mod.ModuleID, 0)
if err != nil {
return
}
@@ -189,24 +210,37 @@ func (svc record) Create(mod *types.Record) (r *types.Record, err error) {
return nil, ErrNoCreatePermissions.withStack()
}
if mod.Values, err = svc.sanitizeValues(m, mod.Values); err != nil {
creatorID := auth.GetIdentityFromContext(svc.ctx).Identity()
r = &types.Record{
ModuleID: mod.ModuleID,
NamespaceID: mod.NamespaceID,
CreatedBy: creatorID,
OwnedBy: creatorID,
CreatedAt: time.Now(),
}
if err = svc.copyChanges(m, mod, r); err != nil {
return
}
mod.OwnedBy = auth.GetIdentityFromContext(svc.ctx).Identity()
mod.CreatedBy = mod.OwnedBy
mod.CreatedAt = time.Now()
mod = nil // make sure we do not use it anymore
if err = tt.WalkByAction("beforeCreate", svc.runTrigger(svc.ctx, ns, m, r)); err != nil {
return
}
defer func() {
_ = tt.WalkByAction("afterCreate", svc.runTrigger(svc.ctx, ns, m, r))
}()
return r, svc.db.Transaction(func() (err error) {
if r, err = svc.recordRepo.Create(mod); err != nil {
if r, err = svc.recordRepo.Create(r); err != nil {
return
}
if err = svc.recordRepo.UpdateValues(r.ID, mod.Values); err != nil {
return
}
if err = svc.preloadValues(m, r); err != nil {
if err = svc.recordRepo.UpdateValues(r.ID, r.Values); err != nil {
return
}
@@ -219,16 +253,8 @@ func (svc record) Update(mod *types.Record) (r *types.Record, err error) {
return nil, ErrInvalidID.withStack()
}
if mod.NamespaceID == 0 {
return nil, ErrNamespaceRequired
}
var m *types.Module
if m, err = svc.loadModule(mod.NamespaceID, mod.ModuleID); err != nil {
return
}
if r, err = svc.recordRepo.FindByID(mod.NamespaceID, mod.ID); err != nil {
ns, m, r, tt, err := svc.loadCombo(mod.NamespaceID, mod.ModuleID, mod.ID)
if err != nil {
return
}
@@ -236,24 +262,35 @@ func (svc record) Update(mod *types.Record) (r *types.Record, err error) {
return nil, ErrNoUpdatePermissions.withStack()
}
// Test if stale (update has an older copy)
if isStale(mod.UpdatedAt, r.UpdatedAt, r.CreatedAt) {
return nil, ErrStaleData.withStack()
}
if mod.Values, err = svc.sanitizeValues(m, mod.Values); err != nil {
return
}
now := time.Now()
r.UpdatedAt = &now
r.UpdatedBy = auth.GetIdentityFromContext(svc.ctx).Identity()
if err = svc.copyChanges(m, mod, r); err != nil {
return
}
mod = nil // make sure we do not use it anymore
if err = tt.WalkByAction("beforeUpdate", svc.runTrigger(svc.ctx, ns, m, r)); err != nil {
return
}
defer func() {
_ = tt.WalkByAction("afterUpdate", svc.runTrigger(svc.ctx, ns, m, r))
}()
return r, svc.db.Transaction(func() (err error) {
if r, err = svc.recordRepo.Update(r); err != nil {
return
}
if err = svc.recordRepo.UpdateValues(r.ID, mod.Values); err != nil {
if err = svc.recordRepo.UpdateValues(r.ID, r.Values); err != nil {
return
}
@@ -266,26 +303,29 @@ func (svc record) DeleteByID(namespaceID, recordID uint64) (err error) {
return ErrInvalidID.withStack()
}
if namespaceID == 0 {
return ErrNamespaceRequired
ns, m, r, tt, err := svc.loadCombo(namespaceID, 0, recordID)
if err != nil {
return
}
if err = tt.WalkByAction("beforeDelete", svc.runTrigger(svc.ctx, ns, m, r)); err != nil {
return
}
defer func() {
_ = tt.WalkByAction("afterDelete", svc.runTrigger(svc.ctx, ns, m, r))
}()
err = svc.db.Transaction(func() (err error) {
var record *types.Record
if record, err = svc.recordRepo.FindByID(namespaceID, recordID); err != nil {
return errors.Wrap(err, "nonexistent record")
}
now := time.Now()
record.DeletedAt = &now
record.DeletedBy = auth.GetIdentityFromContext(svc.ctx).Identity()
r.DeletedAt = &now
r.DeletedBy = auth.GetIdentityFromContext(svc.ctx).Identity()
if err = svc.recordRepo.Delete(record); err != nil {
if err = svc.recordRepo.Delete(r); err != nil {
return
}
if err = svc.recordRepo.DeleteValues(record); err != nil {
if err = svc.recordRepo.DeleteValues(r); err != nil {
return
}
@@ -295,6 +335,73 @@ func (svc record) DeleteByID(namespaceID, recordID uint64) (err error) {
return errors.Wrap(err, "unable to delete record")
}
func (svc record) loadCombo(namespaceID, moduleID, recordID uint64) (ns *types.Namespace, m *types.Module, r *types.Record, tt types.TriggerSet, err error) {
if namespaceID == 0 {
err = ErrNamespaceRequired
return
}
if ns, err = svc.loadNamespace(namespaceID); err != nil {
return
}
if recordID > 0 {
if r, err = svc.recordRepo.FindByID(namespaceID, recordID); err != nil {
return
}
moduleID = r.ModuleID
}
if m, err = svc.loadModule(ns.ID, moduleID); err != nil {
return
}
tt, _, err = svc.tRepo.Find(types.TriggerFilter{
NamespaceID: ns.ID,
ModuleID: m.ID,
})
return
}
func (svc record) runTrigger(ctx context.Context, ns *types.Namespace, m *types.Module, r *types.Record) func(t *types.Trigger) error {
svc.logger.Debug("initializing trigger runner")
return func(t *types.Trigger) error {
svc.logger.Debug("running trigger", zap.Uint64("triggerID", t.ID))
if svc.sr == nil {
// No script runner set
svc.logger.Debug("script runner not set")
return nil
}
// pr == processed record
pr, err := svc.sr.Record(svc.ctx, t, ns, m, r)
if err != nil {
svc.logger.Debug("failed to run record script", zap.Error(err))
return err
}
if pr == nil {
// Did not get any processed record,
// consider canceled
return errors.New("aborted by automation")
}
return svc.copyChanges(m, pr, r)
}
}
// Copies changes from mod to r(ecord)
func (svc record) copyChanges(m *types.Module, mod, r *types.Record) (err error) {
// Automation scripts are allowed to modify record owner & values.
if mod.OwnedBy > 0 {
r.OwnedBy = mod.OwnedBy
}
r.Values, err = svc.sanitizeValues(m, mod.Values)
return err
}
// Validates and filters record values
func (svc record) sanitizeValues(module *types.Module, values types.RecordValueSet) (out types.RecordValueSet, err error) {
// Make sure there are no multi values in a non-multi value fields
+153
View File
@@ -0,0 +1,153 @@
package service
import (
"context"
"errors"
"os"
"time"
"go.uber.org/zap"
"google.golang.org/grpc"
"google.golang.org/grpc/grpclog"
"github.com/cortezaproject/corteza-server/compose/proto"
"github.com/cortezaproject/corteza-server/compose/types"
"github.com/cortezaproject/corteza-server/internal/auth"
)
// Script runner provides an interface to corteza-corredor (Spanish for runner) service
// that helps us with execution of JavaScript code -- compose's triggers & automation code
//
// corteza-server communicates with corteza-corredor via gRPC protocol.
//
// This service accepts ns/trigger/module/record (combinations), makes a call via gRPC protocol and
// returns record/module/ns or just tests trigger's script
type (
scriptRunner struct {
addr string
logger *zap.Logger
conn *grpc.ClientConn
client proto.ScriptRunnerClient
jwtEncoder auth.TokenEncoder
}
Runnable interface {
proto.Runnable
IsCritical() bool
GetRunnerID() uint64
}
)
func ScriptRunner(addr string) *scriptRunner {
return &scriptRunner{
addr: addr,
logger: DefaultLogger.Named("script-runner"),
jwtEncoder: auth.DefaultJwtHandler,
}
}
func (svc *scriptRunner) Connect() (err error) {
if svc.conn != nil {
return nil
}
grpclog.SetLoggerV2(grpclog.NewLoggerV2WithVerbosity(os.Stdout, os.Stdout, os.Stdout, 0))
svc.conn, err = grpc.Dial(
svc.addr,
grpc.WithInsecure(),
grpc.WithBackoffMaxDelay(time.Second))
if err != nil {
return
}
svc.client = proto.NewScriptRunnerClient(svc.conn)
return
}
func (svc scriptRunner) Close() error {
return svc.conn.Close()
}
func (svc scriptRunner) callOptions() []grpc.CallOption {
return []grpc.CallOption{
grpc.WaitForReady(true),
}
}
// Creates a new JWT for
func (svc scriptRunner) getJWT(ctx context.Context, r Runnable) string {
if r.GetRunnerID() > 0 {
// @todo implement this
// at the moment we do not he the ability fetch user info from non-system service
// extend/implement this feature when our services will know how to communicate with each-other
}
return svc.jwtEncoder.Encode(auth.GetIdentityFromContext(ctx))
}
func (svc scriptRunner) Namespace(ctx context.Context, s Runnable, ns *types.Namespace) (*types.Namespace, error) {
panic("scriptRunner.Namespace() not implemented")
}
func (svc scriptRunner) Module(ctx context.Context, s Runnable, ns *types.Namespace, m *types.Module) (*types.Module, error) {
panic("scriptRunner.Module() not implemented")
}
func (svc scriptRunner) Record(ctx context.Context, s Runnable, ns *types.Namespace, m *types.Module, r *types.Record) (*types.Record, error) {
if s == nil {
return nil, errors.New("script not provided")
}
if ns == nil {
return nil, errors.New("namespace not provided")
}
if m == nil {
return nil, errors.New("module not provided")
}
svc.logger.Debug("executing script", zap.Any("record", r))
ctx, cancelFn := context.WithTimeout(ctx, time.Second*5)
defer cancelFn()
rsp, err := svc.client.Record(
ctx,
&proto.RunRecordRequest{
JWT: svc.getJWT(ctx, s),
Script: proto.ScriptFromRunnable(s),
Namespace: proto.FromNamespace(ns),
Module: proto.FromModule(m),
Record: proto.FromRecord(r),
},
svc.callOptions()...,
)
svc.logger.Debug("call sent")
if err != nil {
svc.logger.Debug("script executed, did not return record", zap.Error(err))
if !s.IsCritical() {
// This was not a critical call and we do not care about
// errors from script running service.
return r, nil
}
return nil, err
}
if s.IsAsync() {
svc.logger.Debug("script executed / async")
// Async call, we do not care about what we get back
return r, nil
}
svc.logger.Debug("script executed", zap.Any("record", rsp.Record))
// Result from the automation script
return proto.ToRecord(rsp.Record), nil
}
+8
View File
@@ -38,6 +38,8 @@ var (
DefaultNotification NotificationService
DefaultAttachment AttachmentService
DefaultNamespace NamespaceService
DefaultScriptRunner *scriptRunner // @todo interface
)
func Init(ctx context.Context, log *zap.Logger, c Config) (err error) {
@@ -56,6 +58,12 @@ func Init(ctx context.Context, log *zap.Logger, c Config) (err error) {
DefaultAccessControl = AccessControl(DefaultPermissions)
DefaultScriptRunner = ScriptRunner("localhost:50051")
err = DefaultScriptRunner.Connect()
if err != nil {
return
}
DefaultRecord = Record()
DefaultModule = Module()
DefaultTrigger = Trigger()
+51
View File
@@ -0,0 +1,51 @@
package proto
import (
"time"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/cortezaproject/corteza-server/compose/types"
)
func ToRecord(i *Record) *types.Record {
if i == nil {
return nil
}
var t = &types.Record{
ID: i.RecordID,
ModuleID: i.ModuleID,
NamespaceID: i.NamespaceID,
OwnedBy: i.OwnedBy,
CreatedBy: i.CreatedBy,
UpdatedBy: i.UpdatedBy,
DeletedBy: i.DeletedBy,
CreatedAt: toTime(i.CreatedAt),
UpdatedAt: toTimePtr(i.UpdatedAt),
DeletedAt: toTimePtr(i.DeletedAt),
Values: make([]*types.RecordValue, len(i.Values)),
}
for v := range i.Values {
t.Values[v] = &types.RecordValue{
Value: i.Values[v].Value,
Name: i.Values[v].Name,
}
}
return t
}
// Converts time.Time (ptr AND value) to *timestamp.Timestamp
//
// Intentionally ignoring
func toTime(ts *timestamp.Timestamp) time.Time {
var t = time.Time{}
return t.Add(time.Duration(ts.GetNanos()) + (time.Duration(ts.GetSeconds()) * time.Second))
}
func toTimePtr(ts *timestamp.Timestamp) *time.Time {
var t = toTime(ts)
return &t
}
+192
View File
@@ -0,0 +1,192 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: module.proto
package proto
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type Module struct {
ModuleID uint64 `protobuf:"varint,1,opt,name=moduleID,proto3" json:"moduleID,omitempty"`
NamespaceID uint64 `protobuf:"varint,2,opt,name=namespaceID,proto3" json:"namespaceID,omitempty"`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
CreatedAt *timestamp.Timestamp `protobuf:"bytes,8,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
UpdatedAt *timestamp.Timestamp `protobuf:"bytes,9,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"`
DeletedAt *timestamp.Timestamp `protobuf:"bytes,10,opt,name=deletedAt,proto3" json:"deletedAt,omitempty"`
Fields []*ModuleField `protobuf:"bytes,15,rep,name=fields,proto3" json:"fields,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Module) Reset() { *m = Module{} }
func (m *Module) String() string { return proto.CompactTextString(m) }
func (*Module) ProtoMessage() {}
func (*Module) Descriptor() ([]byte, []int) {
return fileDescriptor_ae7704718fb7daeb, []int{0}
}
func (m *Module) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Module.Unmarshal(m, b)
}
func (m *Module) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Module.Marshal(b, m, deterministic)
}
func (m *Module) XXX_Merge(src proto.Message) {
xxx_messageInfo_Module.Merge(m, src)
}
func (m *Module) XXX_Size() int {
return xxx_messageInfo_Module.Size(m)
}
func (m *Module) XXX_DiscardUnknown() {
xxx_messageInfo_Module.DiscardUnknown(m)
}
var xxx_messageInfo_Module proto.InternalMessageInfo
func (m *Module) GetModuleID() uint64 {
if m != nil {
return m.ModuleID
}
return 0
}
func (m *Module) GetNamespaceID() uint64 {
if m != nil {
return m.NamespaceID
}
return 0
}
func (m *Module) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *Module) GetCreatedAt() *timestamp.Timestamp {
if m != nil {
return m.CreatedAt
}
return nil
}
func (m *Module) GetUpdatedAt() *timestamp.Timestamp {
if m != nil {
return m.UpdatedAt
}
return nil
}
func (m *Module) GetDeletedAt() *timestamp.Timestamp {
if m != nil {
return m.DeletedAt
}
return nil
}
func (m *Module) GetFields() []*ModuleField {
if m != nil {
return m.Fields
}
return nil
}
type ModuleField struct {
FieldID uint64 `protobuf:"varint,1,opt,name=fieldID,proto3" json:"fieldID,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Kind string `protobuf:"bytes,3,opt,name=kind,proto3" json:"kind,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ModuleField) Reset() { *m = ModuleField{} }
func (m *ModuleField) String() string { return proto.CompactTextString(m) }
func (*ModuleField) ProtoMessage() {}
func (*ModuleField) Descriptor() ([]byte, []int) {
return fileDescriptor_ae7704718fb7daeb, []int{1}
}
func (m *ModuleField) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ModuleField.Unmarshal(m, b)
}
func (m *ModuleField) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ModuleField.Marshal(b, m, deterministic)
}
func (m *ModuleField) XXX_Merge(src proto.Message) {
xxx_messageInfo_ModuleField.Merge(m, src)
}
func (m *ModuleField) XXX_Size() int {
return xxx_messageInfo_ModuleField.Size(m)
}
func (m *ModuleField) XXX_DiscardUnknown() {
xxx_messageInfo_ModuleField.DiscardUnknown(m)
}
var xxx_messageInfo_ModuleField proto.InternalMessageInfo
func (m *ModuleField) GetFieldID() uint64 {
if m != nil {
return m.FieldID
}
return 0
}
func (m *ModuleField) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *ModuleField) GetKind() string {
if m != nil {
return m.Kind
}
return ""
}
func init() {
proto.RegisterType((*Module)(nil), "compose.Module")
proto.RegisterType((*ModuleField)(nil), "compose.ModuleField")
}
func init() { proto.RegisterFile("module.proto", fileDescriptor_ae7704718fb7daeb) }
var fileDescriptor_ae7704718fb7daeb = []byte{
// 259 bytes of a gzipped FileDescriptorProto
0x1f,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xc1, 0x4c, 0xee, 0x21, 0x3d, 0x76,
0xd8, 0x8b, 0x81, 0xde, 0xb0, 0x4d, 0x55, 0x1c, 0x6e, 0xf9, 0xd4, 0x22, 0xf7, 0x05, 0xbd, 0x5a,
0xb1, 0x9e, 0x3c, 0xbb, 0x0f, 0x28, 0x16, 0x67, 0x42, 0x21, 0x73, 0x42, 0xe8, 0x6e, 0x5e, 0x43,
0x31, 0xf1, 0xa2, 0x18, 0x02, 0xc9, 0x4f, 0x77, 0x16, 0x73, 0x59, 0x76, 0x7e, 0xce, 0xbe, 0xae,
0x7c, 0xbe, 0xd4, 0x3d, 0x0f, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x74, 0x31, 0xbc, 0x25, 0xd3,
0x01, 0x00, 0x00,
}
+133
View File
@@ -0,0 +1,133 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: namespace.proto
package proto
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type Namespace struct {
NamespaceID uint64 `protobuf:"varint,1,opt,name=namespaceID,proto3" json:"namespaceID,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Slug string `protobuf:"bytes,3,opt,name=slug,proto3" json:"slug,omitempty"`
Enabled bool `protobuf:"varint,4,opt,name=enabled,proto3" json:"enabled,omitempty"`
CreatedAt *timestamp.Timestamp `protobuf:"bytes,8,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
UpdatedAt *timestamp.Timestamp `protobuf:"bytes,9,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"`
DeletedAt *timestamp.Timestamp `protobuf:"bytes,10,opt,name=deletedAt,proto3" json:"deletedAt,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Namespace) Reset() { *m = Namespace{} }
func (m *Namespace) String() string { return proto.CompactTextString(m) }
func (*Namespace) ProtoMessage() {}
func (*Namespace) Descriptor() ([]byte, []int) {
return fileDescriptor_ecb1e126f615f5dd, []int{0}
}
func (m *Namespace) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Namespace.Unmarshal(m, b)
}
func (m *Namespace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Namespace.Marshal(b, m, deterministic)
}
func (m *Namespace) XXX_Merge(src proto.Message) {
xxx_messageInfo_Namespace.Merge(m, src)
}
func (m *Namespace) XXX_Size() int {
return xxx_messageInfo_Namespace.Size(m)
}
func (m *Namespace) XXX_DiscardUnknown() {
xxx_messageInfo_Namespace.DiscardUnknown(m)
}
var xxx_messageInfo_Namespace proto.InternalMessageInfo
func (m *Namespace) GetNamespaceID() uint64 {
if m != nil {
return m.NamespaceID
}
return 0
}
func (m *Namespace) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *Namespace) GetSlug() string {
if m != nil {
return m.Slug
}
return ""
}
func (m *Namespace) GetEnabled() bool {
if m != nil {
return m.Enabled
}
return false
}
func (m *Namespace) GetCreatedAt() *timestamp.Timestamp {
if m != nil {
return m.CreatedAt
}
return nil
}
func (m *Namespace) GetUpdatedAt() *timestamp.Timestamp {
if m != nil {
return m.UpdatedAt
}
return nil
}
func (m *Namespace) GetDeletedAt() *timestamp.Timestamp {
if m != nil {
return m.DeletedAt
}
return nil
}
func init() {
proto.RegisterType((*Namespace)(nil), "compose.Namespace")
}
func init() { proto.RegisterFile("namespace.proto", fileDescriptor_ecb1e126f615f5dd) }
var fileDescriptor_ecb1e126f615f5dd = []byte{
// 213 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 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0xdf, 0xdc, 0xe0, 0x97,
0xf6, 0xf3, 0xba, 0x00, 0x37, 0xeb, 0xf3, 0xf8, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xb4, 0x34, 0xc5,
0xd1, 0x6c, 0x01, 0x00, 0x00,
}
+218
View File
@@ -0,0 +1,218 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: record.proto
package proto
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type Record struct {
RecordID uint64 `protobuf:"varint,1,opt,name=recordID,proto3" json:"recordID,omitempty"`
ModuleID uint64 `protobuf:"varint,2,opt,name=moduleID,proto3" json:"moduleID,omitempty"`
NamespaceID uint64 `protobuf:"varint,3,opt,name=namespaceID,proto3" json:"namespaceID,omitempty"`
OwnedBy uint64 `protobuf:"varint,4,opt,name=ownedBy,proto3" json:"ownedBy,omitempty"`
CreatedBy uint64 `protobuf:"varint,5,opt,name=createdBy,proto3" json:"createdBy,omitempty"`
UpdatedBy uint64 `protobuf:"varint,6,opt,name=updatedBy,proto3" json:"updatedBy,omitempty"`
DeletedBy uint64 `protobuf:"varint,7,opt,name=deletedBy,proto3" json:"deletedBy,omitempty"`
CreatedAt *timestamp.Timestamp `protobuf:"bytes,8,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
UpdatedAt *timestamp.Timestamp `protobuf:"bytes,9,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"`
DeletedAt *timestamp.Timestamp `protobuf:"bytes,10,opt,name=deletedAt,proto3" json:"deletedAt,omitempty"`
Values []*RecordValue `protobuf:"bytes,15,rep,name=values,proto3" json:"values,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Record) Reset() { *m = Record{} }
func (m *Record) String() string { return proto.CompactTextString(m) }
func (*Record) ProtoMessage() {}
func (*Record) Descriptor() ([]byte, []int) {
return fileDescriptor_bf94fd919e302a1d, []int{0}
}
func (m *Record) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Record.Unmarshal(m, b)
}
func (m *Record) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Record.Marshal(b, m, deterministic)
}
func (m *Record) XXX_Merge(src proto.Message) {
xxx_messageInfo_Record.Merge(m, src)
}
func (m *Record) XXX_Size() int {
return xxx_messageInfo_Record.Size(m)
}
func (m *Record) XXX_DiscardUnknown() {
xxx_messageInfo_Record.DiscardUnknown(m)
}
var xxx_messageInfo_Record proto.InternalMessageInfo
func (m *Record) GetRecordID() uint64 {
if m != nil {
return m.RecordID
}
return 0
}
func (m *Record) GetModuleID() uint64 {
if m != nil {
return m.ModuleID
}
return 0
}
func (m *Record) GetNamespaceID() uint64 {
if m != nil {
return m.NamespaceID
}
return 0
}
func (m *Record) GetOwnedBy() uint64 {
if m != nil {
return m.OwnedBy
}
return 0
}
func (m *Record) GetCreatedBy() uint64 {
if m != nil {
return m.CreatedBy
}
return 0
}
func (m *Record) GetUpdatedBy() uint64 {
if m != nil {
return m.UpdatedBy
}
return 0
}
func (m *Record) GetDeletedBy() uint64 {
if m != nil {
return m.DeletedBy
}
return 0
}
func (m *Record) GetCreatedAt() *timestamp.Timestamp {
if m != nil {
return m.CreatedAt
}
return nil
}
func (m *Record) GetUpdatedAt() *timestamp.Timestamp {
if m != nil {
return m.UpdatedAt
}
return nil
}
func (m *Record) GetDeletedAt() *timestamp.Timestamp {
if m != nil {
return m.DeletedAt
}
return nil
}
func (m *Record) GetValues() []*RecordValue {
if m != nil {
return m.Values
}
return nil
}
type RecordValue struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RecordValue) Reset() { *m = RecordValue{} }
func (m *RecordValue) String() string { return proto.CompactTextString(m) }
func (*RecordValue) ProtoMessage() {}
func (*RecordValue) Descriptor() ([]byte, []int) {
return fileDescriptor_bf94fd919e302a1d, []int{1}
}
func (m *RecordValue) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RecordValue.Unmarshal(m, b)
}
func (m *RecordValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RecordValue.Marshal(b, m, deterministic)
}
func (m *RecordValue) XXX_Merge(src proto.Message) {
xxx_messageInfo_RecordValue.Merge(m, src)
}
func (m *RecordValue) XXX_Size() int {
return xxx_messageInfo_RecordValue.Size(m)
}
func (m *RecordValue) XXX_DiscardUnknown() {
xxx_messageInfo_RecordValue.DiscardUnknown(m)
}
var xxx_messageInfo_RecordValue proto.InternalMessageInfo
func (m *RecordValue) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *RecordValue) GetValue() string {
if m != nil {
return m.Value
}
return ""
}
func init() {
proto.RegisterType((*Record)(nil), "compose.Record")
proto.RegisterType((*RecordValue)(nil), "compose.RecordValue")
}
func init() { proto.RegisterFile("record.proto", fileDescriptor_bf94fd919e302a1d) }
var fileDescriptor_bf94fd919e302a1d = []byte{
// 297 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0x3f, 0x6b, 0xc3, 0x30,
0x10, 0xc5, 0x49, 0xfd, 0x2f, 0x3e, 0x17, 0x0a, 0x22, 0x83, 0x30, 0x85, 0x9a, 0x4c, 0x1e, 0x8a,
0x02, 0xe9, 0xd0, 0xae, 0x0e, 0x59, 0xb2, 0x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x14, 0x9a,
0xc3, 0xf5, 0xa4, 0x33, 0xb3, 0x47, 0x08, 0xbf, 0xcb, 0x66, 0xc4, 0x81, 0xdf, 0x65, 0x5e, 0x9e,
0x6c, 0x57, 0x62, 0x6a, 0x50, 0xd8, 0x72, 0xde, 0x0c, 0x94, 0x93, 0x67, 0xfd, 0x0c, 0xc9, 0x85,
0xcc, 0x18, 0xf8, 0x66, 0xdb, 0x54, 0x5a, 0x2c, 0xe9, 0x9f, 0xad, 0x20, 0x20, 0x33, 0xb5, 0x15,
0x4b, 0x3b, 0xec, 0xa2, 0xf7, 0xc0, 0xbe, 0x23, 0xa4, 0xcf, 0xd3, 0x7f, 0x00, 0x00, 0x00, 0xff,
0xff, 0xbf, 0x75, 0x72, 0x13, 0x37, 0x02, 0x00, 0x00,
}
+704
View File
@@ -0,0 +1,704 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: script_runner.proto
package proto
import (
context "context"
fmt "fmt"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type RunTestRequest struct {
Source string `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RunTestRequest) Reset() { *m = RunTestRequest{} }
func (m *RunTestRequest) String() string { return proto.CompactTextString(m) }
func (*RunTestRequest) ProtoMessage() {}
func (*RunTestRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_62210b9e3e4a7a06, []int{0}
}
func (m *RunTestRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RunTestRequest.Unmarshal(m, b)
}
func (m *RunTestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RunTestRequest.Marshal(b, m, deterministic)
}
func (m *RunTestRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_RunTestRequest.Merge(m, src)
}
func (m *RunTestRequest) XXX_Size() int {
return xxx_messageInfo_RunTestRequest.Size(m)
}
func (m *RunTestRequest) XXX_DiscardUnknown() {
xxx_messageInfo_RunTestRequest.DiscardUnknown(m)
}
var xxx_messageInfo_RunTestRequest proto.InternalMessageInfo
func (m *RunTestRequest) GetSource() string {
if m != nil {
return m.Source
}
return ""
}
func (m *RunTestRequest) GetName() string {
if m != nil {
return m.Name
}
return ""
}
type RunNamespaceRequest struct {
JWT string `protobuf:"bytes,1,opt,name=JWT,proto3" json:"JWT,omitempty"`
Script *Script `protobuf:"bytes,2,opt,name=script,proto3" json:"script,omitempty"`
Namespace *Namespace `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RunNamespaceRequest) Reset() { *m = RunNamespaceRequest{} }
func (m *RunNamespaceRequest) String() string { return proto.CompactTextString(m) }
func (*RunNamespaceRequest) ProtoMessage() {}
func (*RunNamespaceRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_62210b9e3e4a7a06, []int{1}
}
func (m *RunNamespaceRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RunNamespaceRequest.Unmarshal(m, b)
}
func (m *RunNamespaceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RunNamespaceRequest.Marshal(b, m, deterministic)
}
func (m *RunNamespaceRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_RunNamespaceRequest.Merge(m, src)
}
func (m *RunNamespaceRequest) XXX_Size() int {
return xxx_messageInfo_RunNamespaceRequest.Size(m)
}
func (m *RunNamespaceRequest) XXX_DiscardUnknown() {
xxx_messageInfo_RunNamespaceRequest.DiscardUnknown(m)
}
var xxx_messageInfo_RunNamespaceRequest proto.InternalMessageInfo
func (m *RunNamespaceRequest) GetJWT() string {
if m != nil {
return m.JWT
}
return ""
}
func (m *RunNamespaceRequest) GetScript() *Script {
if m != nil {
return m.Script
}
return nil
}
func (m *RunNamespaceRequest) GetNamespace() *Namespace {
if m != nil {
return m.Namespace
}
return nil
}
type RunModuleRequest struct {
JWT string `protobuf:"bytes,1,opt,name=JWT,proto3" json:"JWT,omitempty"`
Script *Script `protobuf:"bytes,2,opt,name=script,proto3" json:"script,omitempty"`
Namespace *Namespace `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"`
Module *Module `protobuf:"bytes,4,opt,name=module,proto3" json:"module,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RunModuleRequest) Reset() { *m = RunModuleRequest{} }
func (m *RunModuleRequest) String() string { return proto.CompactTextString(m) }
func (*RunModuleRequest) ProtoMessage() {}
func (*RunModuleRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_62210b9e3e4a7a06, []int{2}
}
func (m *RunModuleRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RunModuleRequest.Unmarshal(m, b)
}
func (m *RunModuleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RunModuleRequest.Marshal(b, m, deterministic)
}
func (m *RunModuleRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_RunModuleRequest.Merge(m, src)
}
func (m *RunModuleRequest) XXX_Size() int {
return xxx_messageInfo_RunModuleRequest.Size(m)
}
func (m *RunModuleRequest) XXX_DiscardUnknown() {
xxx_messageInfo_RunModuleRequest.DiscardUnknown(m)
}
var xxx_messageInfo_RunModuleRequest proto.InternalMessageInfo
func (m *RunModuleRequest) GetJWT() string {
if m != nil {
return m.JWT
}
return ""
}
func (m *RunModuleRequest) GetScript() *Script {
if m != nil {
return m.Script
}
return nil
}
func (m *RunModuleRequest) GetNamespace() *Namespace {
if m != nil {
return m.Namespace
}
return nil
}
func (m *RunModuleRequest) GetModule() *Module {
if m != nil {
return m.Module
}
return nil
}
type RunRecordRequest struct {
JWT string `protobuf:"bytes,1,opt,name=JWT,proto3" json:"JWT,omitempty"`
Script *Script `protobuf:"bytes,2,opt,name=script,proto3" json:"script,omitempty"`
Namespace *Namespace `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"`
Module *Module `protobuf:"bytes,4,opt,name=module,proto3" json:"module,omitempty"`
Record *Record `protobuf:"bytes,5,opt,name=record,proto3" json:"record,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RunRecordRequest) Reset() { *m = RunRecordRequest{} }
func (m *RunRecordRequest) String() string { return proto.CompactTextString(m) }
func (*RunRecordRequest) ProtoMessage() {}
func (*RunRecordRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_62210b9e3e4a7a06, []int{3}
}
func (m *RunRecordRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RunRecordRequest.Unmarshal(m, b)
}
func (m *RunRecordRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RunRecordRequest.Marshal(b, m, deterministic)
}
func (m *RunRecordRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_RunRecordRequest.Merge(m, src)
}
func (m *RunRecordRequest) XXX_Size() int {
return xxx_messageInfo_RunRecordRequest.Size(m)
}
func (m *RunRecordRequest) XXX_DiscardUnknown() {
xxx_messageInfo_RunRecordRequest.DiscardUnknown(m)
}
var xxx_messageInfo_RunRecordRequest proto.InternalMessageInfo
func (m *RunRecordRequest) GetJWT() string {
if m != nil {
return m.JWT
}
return ""
}
func (m *RunRecordRequest) GetScript() *Script {
if m != nil {
return m.Script
}
return nil
}
func (m *RunRecordRequest) GetNamespace() *Namespace {
if m != nil {
return m.Namespace
}
return nil
}
func (m *RunRecordRequest) GetModule() *Module {
if m != nil {
return m.Module
}
return nil
}
func (m *RunRecordRequest) GetRecord() *Record {
if m != nil {
return m.Record
}
return nil
}
type RunTestResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RunTestResponse) Reset() { *m = RunTestResponse{} }
func (m *RunTestResponse) String() string { return proto.CompactTextString(m) }
func (*RunTestResponse) ProtoMessage() {}
func (*RunTestResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_62210b9e3e4a7a06, []int{4}
}
func (m *RunTestResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RunTestResponse.Unmarshal(m, b)
}
func (m *RunTestResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RunTestResponse.Marshal(b, m, deterministic)
}
func (m *RunTestResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_RunTestResponse.Merge(m, src)
}
func (m *RunTestResponse) XXX_Size() int {
return xxx_messageInfo_RunTestResponse.Size(m)
}
func (m *RunTestResponse) XXX_DiscardUnknown() {
xxx_messageInfo_RunTestResponse.DiscardUnknown(m)
}
var xxx_messageInfo_RunTestResponse proto.InternalMessageInfo
type RunNamespaceResponse struct {
Namespace *Namespace `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RunNamespaceResponse) Reset() { *m = RunNamespaceResponse{} }
func (m *RunNamespaceResponse) String() string { return proto.CompactTextString(m) }
func (*RunNamespaceResponse) ProtoMessage() {}
func (*RunNamespaceResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_62210b9e3e4a7a06, []int{5}
}
func (m *RunNamespaceResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RunNamespaceResponse.Unmarshal(m, b)
}
func (m *RunNamespaceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RunNamespaceResponse.Marshal(b, m, deterministic)
}
func (m *RunNamespaceResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_RunNamespaceResponse.Merge(m, src)
}
func (m *RunNamespaceResponse) XXX_Size() int {
return xxx_messageInfo_RunNamespaceResponse.Size(m)
}
func (m *RunNamespaceResponse) XXX_DiscardUnknown() {
xxx_messageInfo_RunNamespaceResponse.DiscardUnknown(m)
}
var xxx_messageInfo_RunNamespaceResponse proto.InternalMessageInfo
func (m *RunNamespaceResponse) GetNamespace() *Namespace {
if m != nil {
return m.Namespace
}
return nil
}
type RunModuleResponse struct {
Module *Module `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RunModuleResponse) Reset() { *m = RunModuleResponse{} }
func (m *RunModuleResponse) String() string { return proto.CompactTextString(m) }
func (*RunModuleResponse) ProtoMessage() {}
func (*RunModuleResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_62210b9e3e4a7a06, []int{6}
}
func (m *RunModuleResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RunModuleResponse.Unmarshal(m, b)
}
func (m *RunModuleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RunModuleResponse.Marshal(b, m, deterministic)
}
func (m *RunModuleResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_RunModuleResponse.Merge(m, src)
}
func (m *RunModuleResponse) XXX_Size() int {
return xxx_messageInfo_RunModuleResponse.Size(m)
}
func (m *RunModuleResponse) XXX_DiscardUnknown() {
xxx_messageInfo_RunModuleResponse.DiscardUnknown(m)
}
var xxx_messageInfo_RunModuleResponse proto.InternalMessageInfo
func (m *RunModuleResponse) GetModule() *Module {
if m != nil {
return m.Module
}
return nil
}
type RunRecordResponse struct {
Record *Record `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RunRecordResponse) Reset() { *m = RunRecordResponse{} }
func (m *RunRecordResponse) String() string { return proto.CompactTextString(m) }
func (*RunRecordResponse) ProtoMessage() {}
func (*RunRecordResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_62210b9e3e4a7a06, []int{7}
}
func (m *RunRecordResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RunRecordResponse.Unmarshal(m, b)
}
func (m *RunRecordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RunRecordResponse.Marshal(b, m, deterministic)
}
func (m *RunRecordResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_RunRecordResponse.Merge(m, src)
}
func (m *RunRecordResponse) XXX_Size() int {
return xxx_messageInfo_RunRecordResponse.Size(m)
}
func (m *RunRecordResponse) XXX_DiscardUnknown() {
xxx_messageInfo_RunRecordResponse.DiscardUnknown(m)
}
var xxx_messageInfo_RunRecordResponse proto.InternalMessageInfo
func (m *RunRecordResponse) GetRecord() *Record {
if m != nil {
return m.Record
}
return nil
}
type Script struct {
Source string `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Timeout uint32 `protobuf:"varint,3,opt,name=timeout,proto3" json:"timeout,omitempty"`
Async bool `protobuf:"varint,4,opt,name=async,proto3" json:"async,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Script) Reset() { *m = Script{} }
func (m *Script) String() string { return proto.CompactTextString(m) }
func (*Script) ProtoMessage() {}
func (*Script) Descriptor() ([]byte, []int) {
return fileDescriptor_62210b9e3e4a7a06, []int{8}
}
func (m *Script) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Script.Unmarshal(m, b)
}
func (m *Script) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Script.Marshal(b, m, deterministic)
}
func (m *Script) XXX_Merge(src proto.Message) {
xxx_messageInfo_Script.Merge(m, src)
}
func (m *Script) XXX_Size() int {
return xxx_messageInfo_Script.Size(m)
}
func (m *Script) XXX_DiscardUnknown() {
xxx_messageInfo_Script.DiscardUnknown(m)
}
var xxx_messageInfo_Script proto.InternalMessageInfo
func (m *Script) GetSource() string {
if m != nil {
return m.Source
}
return ""
}
func (m *Script) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *Script) GetTimeout() uint32 {
if m != nil {
return m.Timeout
}
return 0
}
func (m *Script) GetAsync() bool {
if m != nil {
return m.Async
}
return false
}
func init() {
proto.RegisterType((*RunTestRequest)(nil), "compose.RunTestRequest")
proto.RegisterType((*RunNamespaceRequest)(nil), "compose.RunNamespaceRequest")
proto.RegisterType((*RunModuleRequest)(nil), "compose.RunModuleRequest")
proto.RegisterType((*RunRecordRequest)(nil), "compose.RunRecordRequest")
proto.RegisterType((*RunTestResponse)(nil), "compose.RunTestResponse")
proto.RegisterType((*RunNamespaceResponse)(nil), "compose.RunNamespaceResponse")
proto.RegisterType((*RunModuleResponse)(nil), "compose.RunModuleResponse")
proto.RegisterType((*RunRecordResponse)(nil), "compose.RunRecordResponse")
proto.RegisterType((*Script)(nil), "compose.Script")
}
func init() { proto.RegisterFile("script_runner.proto", fileDescriptor_62210b9e3e4a7a06) }
var fileDescriptor_62210b9e3e4a7a06 = []byte{
// 414 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0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x7d, 0x02, 0x6f,
0xf2, 0x7d, 0x02, 0xbf, 0x4d, 0x67, 0xad, 0x9b, 0xa6, 0xf9, 0x87, 0xba, 0x0b, 0xcc, 0xcf, 0xf1,
0x5b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0x24, 0x92, 0xac, 0xf5, 0x04, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// ScriptRunnerClient is the client API for ScriptRunner service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type ScriptRunnerClient interface {
Test(ctx context.Context, in *RunTestRequest, opts ...grpc.CallOption) (*RunTestResponse, error)
Namespace(ctx context.Context, in *RunNamespaceRequest, opts ...grpc.CallOption) (*RunNamespaceResponse, error)
Module(ctx context.Context, in *RunModuleRequest, opts ...grpc.CallOption) (*RunModuleResponse, error)
Record(ctx context.Context, in *RunRecordRequest, opts ...grpc.CallOption) (*RunRecordResponse, error)
}
type scriptRunnerClient struct {
cc *grpc.ClientConn
}
func NewScriptRunnerClient(cc *grpc.ClientConn) ScriptRunnerClient {
return &scriptRunnerClient{cc}
}
func (c *scriptRunnerClient) Test(ctx context.Context, in *RunTestRequest, opts ...grpc.CallOption) (*RunTestResponse, error) {
out := new(RunTestResponse)
err := c.cc.Invoke(ctx, "/compose.ScriptRunner/Test", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *scriptRunnerClient) Namespace(ctx context.Context, in *RunNamespaceRequest, opts ...grpc.CallOption) (*RunNamespaceResponse, error) {
out := new(RunNamespaceResponse)
err := c.cc.Invoke(ctx, "/compose.ScriptRunner/Namespace", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *scriptRunnerClient) Module(ctx context.Context, in *RunModuleRequest, opts ...grpc.CallOption) (*RunModuleResponse, error) {
out := new(RunModuleResponse)
err := c.cc.Invoke(ctx, "/compose.ScriptRunner/Module", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *scriptRunnerClient) Record(ctx context.Context, in *RunRecordRequest, opts ...grpc.CallOption) (*RunRecordResponse, error) {
out := new(RunRecordResponse)
err := c.cc.Invoke(ctx, "/compose.ScriptRunner/Record", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ScriptRunnerServer is the server API for ScriptRunner service.
type ScriptRunnerServer interface {
Test(context.Context, *RunTestRequest) (*RunTestResponse, error)
Namespace(context.Context, *RunNamespaceRequest) (*RunNamespaceResponse, error)
Module(context.Context, *RunModuleRequest) (*RunModuleResponse, error)
Record(context.Context, *RunRecordRequest) (*RunRecordResponse, error)
}
// UnimplementedScriptRunnerServer can be embedded to have forward compatible implementations.
type UnimplementedScriptRunnerServer struct {
}
func (*UnimplementedScriptRunnerServer) Test(ctx context.Context, req *RunTestRequest) (*RunTestResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Test not implemented")
}
func (*UnimplementedScriptRunnerServer) Namespace(ctx context.Context, req *RunNamespaceRequest) (*RunNamespaceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Namespace not implemented")
}
func (*UnimplementedScriptRunnerServer) Module(ctx context.Context, req *RunModuleRequest) (*RunModuleResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Module not implemented")
}
func (*UnimplementedScriptRunnerServer) Record(ctx context.Context, req *RunRecordRequest) (*RunRecordResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Record not implemented")
}
func RegisterScriptRunnerServer(s *grpc.Server, srv ScriptRunnerServer) {
s.RegisterService(&_ScriptRunner_serviceDesc, srv)
}
func _ScriptRunner_Test_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RunTestRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptRunnerServer).Test(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/compose.ScriptRunner/Test",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptRunnerServer).Test(ctx, req.(*RunTestRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ScriptRunner_Namespace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RunNamespaceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptRunnerServer).Namespace(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/compose.ScriptRunner/Namespace",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptRunnerServer).Namespace(ctx, req.(*RunNamespaceRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ScriptRunner_Module_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RunModuleRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptRunnerServer).Module(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/compose.ScriptRunner/Module",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptRunnerServer).Module(ctx, req.(*RunModuleRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ScriptRunner_Record_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RunRecordRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScriptRunnerServer).Record(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/compose.ScriptRunner/Record",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScriptRunnerServer).Record(ctx, req.(*RunRecordRequest))
}
return interceptor(ctx, in, info, handler)
}
var _ScriptRunner_serviceDesc = grpc.ServiceDesc{
ServiceName: "compose.ScriptRunner",
HandlerType: (*ScriptRunnerServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Test",
Handler: _ScriptRunner_Test_Handler,
},
{
MethodName: "Namespace",
Handler: _ScriptRunner_Namespace_Handler,
},
{
MethodName: "Module",
Handler: _ScriptRunner_Module_Handler,
},
{
MethodName: "Record",
Handler: _ScriptRunner_Record_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "script_runner.proto",
}
+121
View File
@@ -0,0 +1,121 @@
package proto
import (
"time"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/cortezaproject/corteza-server/compose/types"
)
type (
Runnable interface {
IsAsync() bool
GetName() string
GetSource() string
GetTimeout() uint32
}
)
func FromRecord(i *types.Record) *Record {
if i == nil {
return nil
}
var p = &Record{
RecordID: i.ID,
ModuleID: i.ModuleID,
NamespaceID: i.NamespaceID,
OwnedBy: i.OwnedBy,
CreatedBy: i.CreatedBy,
UpdatedBy: i.UpdatedBy,
DeletedBy: i.DeletedBy,
CreatedAt: fromTime(i.CreatedAt),
UpdatedAt: fromTime(i.UpdatedAt),
DeletedAt: fromTime(i.DeletedAt),
Values: make([]*RecordValue, len(i.Values)),
}
for v := range i.Values {
p.Values[v] = &RecordValue{
Value: i.Values[v].Value,
Name: i.Values[v].Name,
}
}
return p
}
func FromModule(i *types.Module) *Module {
if i == nil {
return nil
}
var p = &Module{
ModuleID: i.ID,
NamespaceID: i.NamespaceID,
Name: i.Name,
CreatedAt: fromTime(i.CreatedAt),
UpdatedAt: fromTime(i.UpdatedAt),
DeletedAt: fromTime(i.DeletedAt),
Fields: make([]*ModuleField, len(i.Fields)),
}
for f := range i.Fields {
p.Fields[f] = &ModuleField{
FieldID: i.Fields[f].ID,
Name: i.Fields[f].Name,
Kind: i.Fields[f].Kind,
}
}
return p
}
func FromNamespace(i *types.Namespace) *Namespace {
if i == nil {
return nil
}
var p = &Namespace{
NamespaceID: i.ID,
Name: i.Name,
Slug: i.Slug,
Enabled: i.Enabled,
CreatedAt: fromTime(i.CreatedAt),
UpdatedAt: fromTime(i.UpdatedAt),
DeletedAt: fromTime(i.DeletedAt),
}
return p
}
func ScriptFromRunnable(s Runnable) *Script {
if s == nil {
return nil
}
return &Script{
Source: s.GetSource(),
Name: s.GetName(),
Timeout: s.GetTimeout(),
Async: s.IsAsync(),
}
}
// Converts time.Time (ptr AND value) to *timestamp.Timestamp
//
// Intentionally ignoring
func fromTime(i interface{}) *timestamp.Timestamp {
switch t := i.(type) {
case *time.Time:
if t == nil {
return nil
}
return &timestamp.Timestamp{Seconds: t.Unix(), Nanos: int32(t.Nanosecond())}
case time.Time:
return &timestamp.Timestamp{Seconds: t.Unix(), Nanos: int32(t.Nanosecond())}
default:
return nil
}
}
+64 -8
View File
@@ -2,6 +2,7 @@ package types
import (
"database/sql/driver"
"fmt"
"strings"
"time"
@@ -11,20 +12,29 @@ import (
type (
ActionSet []string
Trigger struct {
ID uint64 `json:"triggerID,string" db:"id"`
ModuleID uint64 `json:"moduleID,string,omitempty" db:"rel_module"`
Name string `json:"name" db:"name"`
Actions ActionSet `json:"actions" db:"actions"`
Enabled bool `json:"enabled" db:"enabled"`
Source string `json:"source" db:"source"`
NamespaceID uint64 `json:"namespaceID,string" db:"rel_namespace"`
ID uint64 `json:"triggerID,string" db:"id"`
NamespaceID uint64 `json:"namespaceID,string" db:"rel_namespace"`
ModuleID uint64 `json:"moduleID,string,omitempty" db:"rel_module"`
Name string `json:"name" db:"name"`
Actions ActionSet `json:"actions" db:"actions"`
Enabled bool `json:"enabled" db:"enabled"`
Source string `json:"source" db:"source"`
// Weight int `json:"weight" db:"weight"`
CreatedAt time.Time `db:"created_at" json:"createdAt,omitempty"`
UpdatedAt *time.Time `db:"updated_at" json:"updatedAt,omitempty"`
DeletedAt *time.Time `db:"deleted_at" json:"deletedAt,omitempty"`
}
Script struct {
Source string `json:"source"`
Language string `json:"language"`
Critical bool `json:"critical"`
Async bool `json:"async"`
Timeout uint32 `json:"timeout"`
RunAs uint64 `json:"runAs,string"`
}
TriggerFilter struct {
NamespaceID uint64 `json:"namespaceID,string"`
Query string `json:"query"`
@@ -36,6 +46,30 @@ type (
}
)
func (t Trigger) IsCritical() bool {
return true
}
func (t Trigger) IsAsync() bool {
return false
}
func (t Trigger) GetRunnerID() uint64 {
return 0
}
func (t Trigger) GetTimeout() uint32 {
return 0
}
func (t Trigger) GetName() string {
return fmt.Sprintf("%d %s", t.ID, t.Name)
}
func (t Trigger) GetSource() string {
return t.Source
}
func (set *ActionSet) Scan(src interface{}) error {
if ser, ok := src.([]uint8); ok {
var tmp = make([]string, 0)
@@ -54,6 +88,28 @@ func (set ActionSet) Value() (driver.Value, error) {
return strings.Trim(strings.Join(set, ","), " ,"), nil
}
func (set ActionSet) Has(action ...string) bool {
for _, a := range set {
for _, i := range action {
if i == a {
return true
}
}
}
return false
}
func (set TriggerSet) WalkByAction(action string, fn func(t *Trigger) error) error {
return set.Walk(func(t *Trigger) error {
if !t.Actions.Has(action) {
return nil
}
return fn(t)
})
}
// Resource returns a system resource ID for this type
func (t Trigger) PermissionResource() permissions.Resource {
return TriggerPermissionResource.AppendID(t.ID)