Add 'settings/' from commit '230545a4a75b0611988fbcea51336a6c316d6a3d'
git-subtree-dir: settings git-subtree-mainline:c26f7b390agit-subtree-split:230545a4a7
This commit is contained in:
@@ -0,0 +1,186 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/micro/go-micro/v2/client"
|
||||
)
|
||||
|
||||
// MockBundleService can be used to write tests against the bundle service.
|
||||
/*
|
||||
To create a mock overwrite the functions of an instance like this:
|
||||
|
||||
```go
|
||||
func mockBundleSvc(returnErr bool) proto.BundleService {
|
||||
if returnErr {
|
||||
return &proto.MockBundleService{
|
||||
ListBundlesFunc: func(ctx context.Context, in *proto.ListBundlesRequest, opts ...client.CallOption) (out *proto.ListBundlesResponse, err error) {
|
||||
return nil, fmt.Errorf("error returned by mockBundleSvc LIST")
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
return &proto.MockBundleService{
|
||||
ListBundlesFunc: func(ctx context.Context, in *proto.ListBundlesRequest, opts ...client.CallOption) (out *proto.ListBundlesResponse, err error) {
|
||||
return &proto.ListBundlesResponse{
|
||||
Bundles: []*proto.Bundle{
|
||||
{
|
||||
Id: "hello-there",
|
||||
},
|
||||
},
|
||||
}, nil
|
||||
},
|
||||
}
|
||||
}
|
||||
```
|
||||
*/
|
||||
type MockBundleService struct {
|
||||
ListBundlesFunc func(ctx context.Context, req *ListBundlesRequest, opts ...client.CallOption) (*ListBundlesResponse, error)
|
||||
GetBundleFunc func(ctx context.Context, req *GetBundleRequest, opts ...client.CallOption) (*GetBundleResponse, error)
|
||||
SaveBundleFunc func(ctx context.Context, req *SaveBundleRequest, opts ...client.CallOption) (*SaveBundleResponse, error)
|
||||
AddSettingToBundleFunc func(ctx context.Context, req *AddSettingToBundleRequest, opts ...client.CallOption) (*AddSettingToBundleResponse, error)
|
||||
RemoveSettingFromBundleFunc func(ctx context.Context, req *RemoveSettingFromBundleRequest, opts ...client.CallOption) (*empty.Empty, error)
|
||||
}
|
||||
|
||||
// ListBundles will panic if the function has been called, but not mocked
|
||||
func (m MockBundleService) ListBundles(ctx context.Context, req *ListBundlesRequest, opts ...client.CallOption) (*ListBundlesResponse, error) {
|
||||
if m.ListBundlesFunc != nil {
|
||||
return m.ListBundlesFunc(ctx, req, opts...)
|
||||
}
|
||||
panic("ListBundlesFunc was called in test but not mocked")
|
||||
}
|
||||
|
||||
// GetBundle will panic if the function has been called, but not mocked
|
||||
func (m MockBundleService) GetBundle(ctx context.Context, req *GetBundleRequest, opts ...client.CallOption) (*GetBundleResponse, error) {
|
||||
if m.GetBundleFunc != nil {
|
||||
return m.GetBundleFunc(ctx, req, opts...)
|
||||
}
|
||||
panic("GetBundleFunc was called in test but not mocked")
|
||||
}
|
||||
|
||||
// SaveBundle will panic if the function has been called, but not mocked
|
||||
func (m MockBundleService) SaveBundle(ctx context.Context, req *SaveBundleRequest, opts ...client.CallOption) (*SaveBundleResponse, error) {
|
||||
if m.SaveBundleFunc != nil {
|
||||
return m.SaveBundleFunc(ctx, req, opts...)
|
||||
}
|
||||
panic("SaveBundleFunc was called in test but not mocked")
|
||||
}
|
||||
|
||||
// AddSettingToBundle will panic if the function has been called, but not mocked
|
||||
func (m MockBundleService) AddSettingToBundle(ctx context.Context, req *AddSettingToBundleRequest, opts ...client.CallOption) (*AddSettingToBundleResponse, error) {
|
||||
if m.AddSettingToBundleFunc != nil {
|
||||
return m.AddSettingToBundleFunc(ctx, req, opts...)
|
||||
}
|
||||
panic("AddSettingToBundleFunc was called in test but not mocked")
|
||||
}
|
||||
|
||||
// RemoveSettingFromBundle will panic if the function has been called, but not mocked
|
||||
func (m MockBundleService) RemoveSettingFromBundle(ctx context.Context, req *RemoveSettingFromBundleRequest, opts ...client.CallOption) (*empty.Empty, error) {
|
||||
if m.RemoveSettingFromBundleFunc != nil {
|
||||
return m.RemoveSettingFromBundleFunc(ctx, req, opts...)
|
||||
}
|
||||
panic("RemoveSettingFromBundleFunc was called in test but not mocked")
|
||||
}
|
||||
|
||||
// MockValueService can be used to write tests against the value service.
|
||||
type MockValueService struct {
|
||||
ListValuesFunc func(ctx context.Context, req *ListValuesRequest, opts ...client.CallOption) (*ListValuesResponse, error)
|
||||
GetValueFunc func(ctx context.Context, req *GetValueRequest, opts ...client.CallOption) (*GetValueResponse, error)
|
||||
GetValueByUniqueIdentifiersFunc func(ctx context.Context, req *GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*GetValueResponse, error)
|
||||
SaveValueFunc func(ctx context.Context, req *SaveValueRequest, opts ...client.CallOption) (*SaveValueResponse, error)
|
||||
}
|
||||
|
||||
// ListValues will panic if the function has been called, but not mocked
|
||||
func (m MockValueService) ListValues(ctx context.Context, req *ListValuesRequest, opts ...client.CallOption) (*ListValuesResponse, error) {
|
||||
if m.ListValuesFunc != nil {
|
||||
return m.ListValuesFunc(ctx, req, opts...)
|
||||
}
|
||||
panic("ListValuesFunc was called in test but not mocked")
|
||||
}
|
||||
|
||||
// GetValue will panic if the function has been called, but not mocked
|
||||
func (m MockValueService) GetValue(ctx context.Context, req *GetValueRequest, opts ...client.CallOption) (*GetValueResponse, error) {
|
||||
if m.GetValueFunc != nil {
|
||||
return m.GetValueFunc(ctx, req, opts...)
|
||||
}
|
||||
panic("GetValueFunc was called in test but not mocked")
|
||||
}
|
||||
|
||||
// GetValueByUniqueIdentifiers will panic if the function has been called, but not mocked
|
||||
func (m MockValueService) GetValueByUniqueIdentifiers(ctx context.Context, req *GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*GetValueResponse, error) {
|
||||
if m.GetValueByUniqueIdentifiersFunc != nil {
|
||||
return m.GetValueByUniqueIdentifiersFunc(ctx, req, opts...)
|
||||
}
|
||||
panic("GetValueByUniqueIdentifiersFunc was called in test but not mocked")
|
||||
}
|
||||
|
||||
// SaveValue will panic if the function has been called, but not mocked
|
||||
func (m MockValueService) SaveValue(ctx context.Context, req *SaveValueRequest, opts ...client.CallOption) (*SaveValueResponse, error) {
|
||||
if m.SaveValueFunc != nil {
|
||||
return m.SaveValueFunc(ctx, req, opts...)
|
||||
}
|
||||
panic("SaveValueFunc was called in test but not mocked")
|
||||
}
|
||||
|
||||
// MockRoleService will panic if the function has been called, but not mocked
|
||||
type MockRoleService struct {
|
||||
ListRolesFunc func(ctx context.Context, req *ListBundlesRequest, opts ...client.CallOption) (*ListBundlesResponse, error)
|
||||
ListRoleAssignmentsFunc func(ctx context.Context, req *ListRoleAssignmentsRequest, opts ...client.CallOption) (*ListRoleAssignmentsResponse, error)
|
||||
AssignRoleToUserFunc func(ctx context.Context, req *AssignRoleToUserRequest, opts ...client.CallOption) (*AssignRoleToUserResponse, error)
|
||||
RemoveRoleFromUserFunc func(ctx context.Context, req *RemoveRoleFromUserRequest, opts ...client.CallOption) (*empty.Empty, error)
|
||||
}
|
||||
|
||||
// ListRoles will panic if the function has been called, but not mocked
|
||||
func (m MockRoleService) ListRoles(ctx context.Context, req *ListBundlesRequest, opts ...client.CallOption) (*ListBundlesResponse, error) {
|
||||
if m.ListRolesFunc != nil {
|
||||
return m.ListRolesFunc(ctx, req, opts...)
|
||||
}
|
||||
panic("ListRolesFunc was called in test but not mocked")
|
||||
}
|
||||
|
||||
// ListRoleAssignments will panic if the function has been called, but not mocked
|
||||
func (m MockRoleService) ListRoleAssignments(ctx context.Context, req *ListRoleAssignmentsRequest, opts ...client.CallOption) (*ListRoleAssignmentsResponse, error) {
|
||||
if m.ListRoleAssignmentsFunc != nil {
|
||||
return m.ListRoleAssignmentsFunc(ctx, req, opts...)
|
||||
}
|
||||
panic("ListRoleAssignmentsFunc was called in test but not mocked")
|
||||
}
|
||||
|
||||
// AssignRoleToUser will panic if the function has been called, but not mocked
|
||||
func (m MockRoleService) AssignRoleToUser(ctx context.Context, req *AssignRoleToUserRequest, opts ...client.CallOption) (*AssignRoleToUserResponse, error) {
|
||||
if m.AssignRoleToUserFunc != nil {
|
||||
return m.AssignRoleToUserFunc(ctx, req, opts...)
|
||||
}
|
||||
panic("AssignRoleToUserFunc was called in test but not mocked")
|
||||
}
|
||||
|
||||
// RemoveRoleFromUser will panic if the function has been called, but not mocked
|
||||
func (m MockRoleService) RemoveRoleFromUser(ctx context.Context, req *RemoveRoleFromUserRequest, opts ...client.CallOption) (*empty.Empty, error) {
|
||||
if m.RemoveRoleFromUserFunc != nil {
|
||||
return m.RemoveRoleFromUserFunc(ctx, req, opts...)
|
||||
}
|
||||
panic("RemoveRoleFromUserFunc was called in test but not mocked")
|
||||
}
|
||||
|
||||
// MockPermissionService will panic if the function has been called, but not mocked
|
||||
type MockPermissionService struct {
|
||||
ListPermissionsByResourceFunc func(ctx context.Context, req *ListPermissionsByResourceRequest, opts ...client.CallOption) (*ListPermissionsByResourceResponse, error)
|
||||
GetPermissionByIDFunc func(ctx context.Context, req *GetPermissionByIDRequest, opts ...client.CallOption) (*GetPermissionByIDResponse, error)
|
||||
}
|
||||
|
||||
// ListPermissionsByResource will panic if the function has been called, but not mocked
|
||||
func (m MockPermissionService) ListPermissionsByResource(ctx context.Context, req *ListPermissionsByResourceRequest, opts ...client.CallOption) (*ListPermissionsByResourceResponse, error) {
|
||||
if m.ListPermissionsByResourceFunc != nil {
|
||||
return m.ListPermissionsByResourceFunc(ctx, req, opts...)
|
||||
}
|
||||
panic("ListPermissionsByResourceFunc was called in test but not mocked")
|
||||
}
|
||||
|
||||
// GetPermissionByID will panic if the function has been called, but not mocked
|
||||
func (m MockPermissionService) GetPermissionByID(ctx context.Context, req *GetPermissionByIDRequest, opts ...client.CallOption) (*GetPermissionByIDResponse, error) {
|
||||
if m.GetPermissionByIDFunc != nil {
|
||||
return m.GetPermissionByIDFunc(ctx, req, opts...)
|
||||
}
|
||||
panic("GetPermissionByIDFunc was called in test but not mocked")
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,674 @@
|
||||
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
||||
// source: settings.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
empty "github.com/golang/protobuf/ptypes/empty"
|
||||
_ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options"
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
math "math"
|
||||
)
|
||||
|
||||
import (
|
||||
context "context"
|
||||
api "github.com/micro/go-micro/v2/api"
|
||||
client "github.com/micro/go-micro/v2/client"
|
||||
server "github.com/micro/go-micro/v2/server"
|
||||
)
|
||||
|
||||
// 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
|
||||
|
||||
// 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 BundleService service
|
||||
|
||||
func NewBundleServiceEndpoints() []*api.Endpoint {
|
||||
return []*api.Endpoint{
|
||||
&api.Endpoint{
|
||||
Name: "BundleService.SaveBundle",
|
||||
Path: []string{"/api/v0/settings/bundle-save"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
&api.Endpoint{
|
||||
Name: "BundleService.GetBundle",
|
||||
Path: []string{"/api/v0/settings/bundle-get"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
&api.Endpoint{
|
||||
Name: "BundleService.ListBundles",
|
||||
Path: []string{"/api/v0/settings/bundles-list"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
&api.Endpoint{
|
||||
Name: "BundleService.AddSettingToBundle",
|
||||
Path: []string{"/api/v0/settings/bundles-add-setting"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
&api.Endpoint{
|
||||
Name: "BundleService.RemoveSettingFromBundle",
|
||||
Path: []string{"/api/v0/settings/bundles-remove-setting"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Client API for BundleService service
|
||||
|
||||
type BundleService interface {
|
||||
SaveBundle(ctx context.Context, in *SaveBundleRequest, opts ...client.CallOption) (*SaveBundleResponse, error)
|
||||
GetBundle(ctx context.Context, in *GetBundleRequest, opts ...client.CallOption) (*GetBundleResponse, error)
|
||||
ListBundles(ctx context.Context, in *ListBundlesRequest, opts ...client.CallOption) (*ListBundlesResponse, error)
|
||||
AddSettingToBundle(ctx context.Context, in *AddSettingToBundleRequest, opts ...client.CallOption) (*AddSettingToBundleResponse, error)
|
||||
RemoveSettingFromBundle(ctx context.Context, in *RemoveSettingFromBundleRequest, opts ...client.CallOption) (*empty.Empty, error)
|
||||
}
|
||||
|
||||
type bundleService struct {
|
||||
c client.Client
|
||||
name string
|
||||
}
|
||||
|
||||
func NewBundleService(name string, c client.Client) BundleService {
|
||||
return &bundleService{
|
||||
c: c,
|
||||
name: name,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *bundleService) SaveBundle(ctx context.Context, in *SaveBundleRequest, opts ...client.CallOption) (*SaveBundleResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "BundleService.SaveBundle", in)
|
||||
out := new(SaveBundleResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *bundleService) GetBundle(ctx context.Context, in *GetBundleRequest, opts ...client.CallOption) (*GetBundleResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "BundleService.GetBundle", in)
|
||||
out := new(GetBundleResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *bundleService) ListBundles(ctx context.Context, in *ListBundlesRequest, opts ...client.CallOption) (*ListBundlesResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "BundleService.ListBundles", in)
|
||||
out := new(ListBundlesResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *bundleService) AddSettingToBundle(ctx context.Context, in *AddSettingToBundleRequest, opts ...client.CallOption) (*AddSettingToBundleResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "BundleService.AddSettingToBundle", in)
|
||||
out := new(AddSettingToBundleResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *bundleService) RemoveSettingFromBundle(ctx context.Context, in *RemoveSettingFromBundleRequest, opts ...client.CallOption) (*empty.Empty, error) {
|
||||
req := c.c.NewRequest(c.name, "BundleService.RemoveSettingFromBundle", in)
|
||||
out := new(empty.Empty)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for BundleService service
|
||||
|
||||
type BundleServiceHandler interface {
|
||||
SaveBundle(context.Context, *SaveBundleRequest, *SaveBundleResponse) error
|
||||
GetBundle(context.Context, *GetBundleRequest, *GetBundleResponse) error
|
||||
ListBundles(context.Context, *ListBundlesRequest, *ListBundlesResponse) error
|
||||
AddSettingToBundle(context.Context, *AddSettingToBundleRequest, *AddSettingToBundleResponse) error
|
||||
RemoveSettingFromBundle(context.Context, *RemoveSettingFromBundleRequest, *empty.Empty) error
|
||||
}
|
||||
|
||||
func RegisterBundleServiceHandler(s server.Server, hdlr BundleServiceHandler, opts ...server.HandlerOption) error {
|
||||
type bundleService interface {
|
||||
SaveBundle(ctx context.Context, in *SaveBundleRequest, out *SaveBundleResponse) error
|
||||
GetBundle(ctx context.Context, in *GetBundleRequest, out *GetBundleResponse) error
|
||||
ListBundles(ctx context.Context, in *ListBundlesRequest, out *ListBundlesResponse) error
|
||||
AddSettingToBundle(ctx context.Context, in *AddSettingToBundleRequest, out *AddSettingToBundleResponse) error
|
||||
RemoveSettingFromBundle(ctx context.Context, in *RemoveSettingFromBundleRequest, out *empty.Empty) error
|
||||
}
|
||||
type BundleService struct {
|
||||
bundleService
|
||||
}
|
||||
h := &bundleServiceHandler{hdlr}
|
||||
opts = append(opts, api.WithEndpoint(&api.Endpoint{
|
||||
Name: "BundleService.SaveBundle",
|
||||
Path: []string{"/api/v0/settings/bundle-save"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
}))
|
||||
opts = append(opts, api.WithEndpoint(&api.Endpoint{
|
||||
Name: "BundleService.GetBundle",
|
||||
Path: []string{"/api/v0/settings/bundle-get"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
}))
|
||||
opts = append(opts, api.WithEndpoint(&api.Endpoint{
|
||||
Name: "BundleService.ListBundles",
|
||||
Path: []string{"/api/v0/settings/bundles-list"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
}))
|
||||
opts = append(opts, api.WithEndpoint(&api.Endpoint{
|
||||
Name: "BundleService.AddSettingToBundle",
|
||||
Path: []string{"/api/v0/settings/bundles-add-setting"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
}))
|
||||
opts = append(opts, api.WithEndpoint(&api.Endpoint{
|
||||
Name: "BundleService.RemoveSettingFromBundle",
|
||||
Path: []string{"/api/v0/settings/bundles-remove-setting"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
}))
|
||||
return s.Handle(s.NewHandler(&BundleService{h}, opts...))
|
||||
}
|
||||
|
||||
type bundleServiceHandler struct {
|
||||
BundleServiceHandler
|
||||
}
|
||||
|
||||
func (h *bundleServiceHandler) SaveBundle(ctx context.Context, in *SaveBundleRequest, out *SaveBundleResponse) error {
|
||||
return h.BundleServiceHandler.SaveBundle(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *bundleServiceHandler) GetBundle(ctx context.Context, in *GetBundleRequest, out *GetBundleResponse) error {
|
||||
return h.BundleServiceHandler.GetBundle(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *bundleServiceHandler) ListBundles(ctx context.Context, in *ListBundlesRequest, out *ListBundlesResponse) error {
|
||||
return h.BundleServiceHandler.ListBundles(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *bundleServiceHandler) AddSettingToBundle(ctx context.Context, in *AddSettingToBundleRequest, out *AddSettingToBundleResponse) error {
|
||||
return h.BundleServiceHandler.AddSettingToBundle(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *bundleServiceHandler) RemoveSettingFromBundle(ctx context.Context, in *RemoveSettingFromBundleRequest, out *empty.Empty) error {
|
||||
return h.BundleServiceHandler.RemoveSettingFromBundle(ctx, in, out)
|
||||
}
|
||||
|
||||
// Api Endpoints for ValueService service
|
||||
|
||||
func NewValueServiceEndpoints() []*api.Endpoint {
|
||||
return []*api.Endpoint{
|
||||
&api.Endpoint{
|
||||
Name: "ValueService.SaveValue",
|
||||
Path: []string{"/api/v0/settings/values-save"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
&api.Endpoint{
|
||||
Name: "ValueService.GetValue",
|
||||
Path: []string{"/api/v0/settings/values-get"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
&api.Endpoint{
|
||||
Name: "ValueService.ListValues",
|
||||
Path: []string{"/api/v0/settings/values-list"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
&api.Endpoint{
|
||||
Name: "ValueService.GetValueByUniqueIdentifiers",
|
||||
Path: []string{"/api/v0/settings/values-get-by-unique-identifiers"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Client API for ValueService service
|
||||
|
||||
type ValueService interface {
|
||||
SaveValue(ctx context.Context, in *SaveValueRequest, opts ...client.CallOption) (*SaveValueResponse, error)
|
||||
GetValue(ctx context.Context, in *GetValueRequest, opts ...client.CallOption) (*GetValueResponse, error)
|
||||
ListValues(ctx context.Context, in *ListValuesRequest, opts ...client.CallOption) (*ListValuesResponse, error)
|
||||
GetValueByUniqueIdentifiers(ctx context.Context, in *GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*GetValueResponse, error)
|
||||
}
|
||||
|
||||
type valueService struct {
|
||||
c client.Client
|
||||
name string
|
||||
}
|
||||
|
||||
func NewValueService(name string, c client.Client) ValueService {
|
||||
return &valueService{
|
||||
c: c,
|
||||
name: name,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *valueService) SaveValue(ctx context.Context, in *SaveValueRequest, opts ...client.CallOption) (*SaveValueResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "ValueService.SaveValue", in)
|
||||
out := new(SaveValueResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *valueService) GetValue(ctx context.Context, in *GetValueRequest, opts ...client.CallOption) (*GetValueResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "ValueService.GetValue", in)
|
||||
out := new(GetValueResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *valueService) ListValues(ctx context.Context, in *ListValuesRequest, opts ...client.CallOption) (*ListValuesResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "ValueService.ListValues", in)
|
||||
out := new(ListValuesResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *valueService) GetValueByUniqueIdentifiers(ctx context.Context, in *GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*GetValueResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "ValueService.GetValueByUniqueIdentifiers", in)
|
||||
out := new(GetValueResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for ValueService service
|
||||
|
||||
type ValueServiceHandler interface {
|
||||
SaveValue(context.Context, *SaveValueRequest, *SaveValueResponse) error
|
||||
GetValue(context.Context, *GetValueRequest, *GetValueResponse) error
|
||||
ListValues(context.Context, *ListValuesRequest, *ListValuesResponse) error
|
||||
GetValueByUniqueIdentifiers(context.Context, *GetValueByUniqueIdentifiersRequest, *GetValueResponse) error
|
||||
}
|
||||
|
||||
func RegisterValueServiceHandler(s server.Server, hdlr ValueServiceHandler, opts ...server.HandlerOption) error {
|
||||
type valueService interface {
|
||||
SaveValue(ctx context.Context, in *SaveValueRequest, out *SaveValueResponse) error
|
||||
GetValue(ctx context.Context, in *GetValueRequest, out *GetValueResponse) error
|
||||
ListValues(ctx context.Context, in *ListValuesRequest, out *ListValuesResponse) error
|
||||
GetValueByUniqueIdentifiers(ctx context.Context, in *GetValueByUniqueIdentifiersRequest, out *GetValueResponse) error
|
||||
}
|
||||
type ValueService struct {
|
||||
valueService
|
||||
}
|
||||
h := &valueServiceHandler{hdlr}
|
||||
opts = append(opts, api.WithEndpoint(&api.Endpoint{
|
||||
Name: "ValueService.SaveValue",
|
||||
Path: []string{"/api/v0/settings/values-save"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
}))
|
||||
opts = append(opts, api.WithEndpoint(&api.Endpoint{
|
||||
Name: "ValueService.GetValue",
|
||||
Path: []string{"/api/v0/settings/values-get"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
}))
|
||||
opts = append(opts, api.WithEndpoint(&api.Endpoint{
|
||||
Name: "ValueService.ListValues",
|
||||
Path: []string{"/api/v0/settings/values-list"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
}))
|
||||
opts = append(opts, api.WithEndpoint(&api.Endpoint{
|
||||
Name: "ValueService.GetValueByUniqueIdentifiers",
|
||||
Path: []string{"/api/v0/settings/values-get-by-unique-identifiers"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
}))
|
||||
return s.Handle(s.NewHandler(&ValueService{h}, opts...))
|
||||
}
|
||||
|
||||
type valueServiceHandler struct {
|
||||
ValueServiceHandler
|
||||
}
|
||||
|
||||
func (h *valueServiceHandler) SaveValue(ctx context.Context, in *SaveValueRequest, out *SaveValueResponse) error {
|
||||
return h.ValueServiceHandler.SaveValue(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *valueServiceHandler) GetValue(ctx context.Context, in *GetValueRequest, out *GetValueResponse) error {
|
||||
return h.ValueServiceHandler.GetValue(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *valueServiceHandler) ListValues(ctx context.Context, in *ListValuesRequest, out *ListValuesResponse) error {
|
||||
return h.ValueServiceHandler.ListValues(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *valueServiceHandler) GetValueByUniqueIdentifiers(ctx context.Context, in *GetValueByUniqueIdentifiersRequest, out *GetValueResponse) error {
|
||||
return h.ValueServiceHandler.GetValueByUniqueIdentifiers(ctx, in, out)
|
||||
}
|
||||
|
||||
// Api Endpoints for RoleService service
|
||||
|
||||
func NewRoleServiceEndpoints() []*api.Endpoint {
|
||||
return []*api.Endpoint{
|
||||
&api.Endpoint{
|
||||
Name: "RoleService.ListRoles",
|
||||
Path: []string{"/api/v0/settings/roles-list"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
&api.Endpoint{
|
||||
Name: "RoleService.ListRoleAssignments",
|
||||
Path: []string{"/api/v0/settings/assignments-list"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
&api.Endpoint{
|
||||
Name: "RoleService.AssignRoleToUser",
|
||||
Path: []string{"/api/v0/settings/assignments-add"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
&api.Endpoint{
|
||||
Name: "RoleService.RemoveRoleFromUser",
|
||||
Path: []string{"/api/v0/settings/assignments-remove"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Client API for RoleService service
|
||||
|
||||
type RoleService interface {
|
||||
ListRoles(ctx context.Context, in *ListBundlesRequest, opts ...client.CallOption) (*ListBundlesResponse, error)
|
||||
ListRoleAssignments(ctx context.Context, in *ListRoleAssignmentsRequest, opts ...client.CallOption) (*ListRoleAssignmentsResponse, error)
|
||||
AssignRoleToUser(ctx context.Context, in *AssignRoleToUserRequest, opts ...client.CallOption) (*AssignRoleToUserResponse, error)
|
||||
RemoveRoleFromUser(ctx context.Context, in *RemoveRoleFromUserRequest, opts ...client.CallOption) (*empty.Empty, error)
|
||||
}
|
||||
|
||||
type roleService struct {
|
||||
c client.Client
|
||||
name string
|
||||
}
|
||||
|
||||
func NewRoleService(name string, c client.Client) RoleService {
|
||||
return &roleService{
|
||||
c: c,
|
||||
name: name,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *roleService) ListRoles(ctx context.Context, in *ListBundlesRequest, opts ...client.CallOption) (*ListBundlesResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "RoleService.ListRoles", in)
|
||||
out := new(ListBundlesResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *roleService) ListRoleAssignments(ctx context.Context, in *ListRoleAssignmentsRequest, opts ...client.CallOption) (*ListRoleAssignmentsResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "RoleService.ListRoleAssignments", in)
|
||||
out := new(ListRoleAssignmentsResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *roleService) AssignRoleToUser(ctx context.Context, in *AssignRoleToUserRequest, opts ...client.CallOption) (*AssignRoleToUserResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "RoleService.AssignRoleToUser", in)
|
||||
out := new(AssignRoleToUserResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *roleService) RemoveRoleFromUser(ctx context.Context, in *RemoveRoleFromUserRequest, opts ...client.CallOption) (*empty.Empty, error) {
|
||||
req := c.c.NewRequest(c.name, "RoleService.RemoveRoleFromUser", in)
|
||||
out := new(empty.Empty)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for RoleService service
|
||||
|
||||
type RoleServiceHandler interface {
|
||||
ListRoles(context.Context, *ListBundlesRequest, *ListBundlesResponse) error
|
||||
ListRoleAssignments(context.Context, *ListRoleAssignmentsRequest, *ListRoleAssignmentsResponse) error
|
||||
AssignRoleToUser(context.Context, *AssignRoleToUserRequest, *AssignRoleToUserResponse) error
|
||||
RemoveRoleFromUser(context.Context, *RemoveRoleFromUserRequest, *empty.Empty) error
|
||||
}
|
||||
|
||||
func RegisterRoleServiceHandler(s server.Server, hdlr RoleServiceHandler, opts ...server.HandlerOption) error {
|
||||
type roleService interface {
|
||||
ListRoles(ctx context.Context, in *ListBundlesRequest, out *ListBundlesResponse) error
|
||||
ListRoleAssignments(ctx context.Context, in *ListRoleAssignmentsRequest, out *ListRoleAssignmentsResponse) error
|
||||
AssignRoleToUser(ctx context.Context, in *AssignRoleToUserRequest, out *AssignRoleToUserResponse) error
|
||||
RemoveRoleFromUser(ctx context.Context, in *RemoveRoleFromUserRequest, out *empty.Empty) error
|
||||
}
|
||||
type RoleService struct {
|
||||
roleService
|
||||
}
|
||||
h := &roleServiceHandler{hdlr}
|
||||
opts = append(opts, api.WithEndpoint(&api.Endpoint{
|
||||
Name: "RoleService.ListRoles",
|
||||
Path: []string{"/api/v0/settings/roles-list"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
}))
|
||||
opts = append(opts, api.WithEndpoint(&api.Endpoint{
|
||||
Name: "RoleService.ListRoleAssignments",
|
||||
Path: []string{"/api/v0/settings/assignments-list"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
}))
|
||||
opts = append(opts, api.WithEndpoint(&api.Endpoint{
|
||||
Name: "RoleService.AssignRoleToUser",
|
||||
Path: []string{"/api/v0/settings/assignments-add"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
}))
|
||||
opts = append(opts, api.WithEndpoint(&api.Endpoint{
|
||||
Name: "RoleService.RemoveRoleFromUser",
|
||||
Path: []string{"/api/v0/settings/assignments-remove"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
}))
|
||||
return s.Handle(s.NewHandler(&RoleService{h}, opts...))
|
||||
}
|
||||
|
||||
type roleServiceHandler struct {
|
||||
RoleServiceHandler
|
||||
}
|
||||
|
||||
func (h *roleServiceHandler) ListRoles(ctx context.Context, in *ListBundlesRequest, out *ListBundlesResponse) error {
|
||||
return h.RoleServiceHandler.ListRoles(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *roleServiceHandler) ListRoleAssignments(ctx context.Context, in *ListRoleAssignmentsRequest, out *ListRoleAssignmentsResponse) error {
|
||||
return h.RoleServiceHandler.ListRoleAssignments(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *roleServiceHandler) AssignRoleToUser(ctx context.Context, in *AssignRoleToUserRequest, out *AssignRoleToUserResponse) error {
|
||||
return h.RoleServiceHandler.AssignRoleToUser(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *roleServiceHandler) RemoveRoleFromUser(ctx context.Context, in *RemoveRoleFromUserRequest, out *empty.Empty) error {
|
||||
return h.RoleServiceHandler.RemoveRoleFromUser(ctx, in, out)
|
||||
}
|
||||
|
||||
// Api Endpoints for PermissionService service
|
||||
|
||||
func NewPermissionServiceEndpoints() []*api.Endpoint {
|
||||
return []*api.Endpoint{
|
||||
&api.Endpoint{
|
||||
Name: "PermissionService.ListPermissionsByResource",
|
||||
Path: []string{"/api/v0/settings/permissions-list-by-resource"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
&api.Endpoint{
|
||||
Name: "PermissionService.GetPermissionByID",
|
||||
Path: []string{"/api/v0/settings/permissions-get-by-id"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Client API for PermissionService service
|
||||
|
||||
type PermissionService interface {
|
||||
ListPermissionsByResource(ctx context.Context, in *ListPermissionsByResourceRequest, opts ...client.CallOption) (*ListPermissionsByResourceResponse, error)
|
||||
GetPermissionByID(ctx context.Context, in *GetPermissionByIDRequest, opts ...client.CallOption) (*GetPermissionByIDResponse, error)
|
||||
}
|
||||
|
||||
type permissionService struct {
|
||||
c client.Client
|
||||
name string
|
||||
}
|
||||
|
||||
func NewPermissionService(name string, c client.Client) PermissionService {
|
||||
return &permissionService{
|
||||
c: c,
|
||||
name: name,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *permissionService) ListPermissionsByResource(ctx context.Context, in *ListPermissionsByResourceRequest, opts ...client.CallOption) (*ListPermissionsByResourceResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "PermissionService.ListPermissionsByResource", in)
|
||||
out := new(ListPermissionsByResourceResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *permissionService) GetPermissionByID(ctx context.Context, in *GetPermissionByIDRequest, opts ...client.CallOption) (*GetPermissionByIDResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "PermissionService.GetPermissionByID", in)
|
||||
out := new(GetPermissionByIDResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for PermissionService service
|
||||
|
||||
type PermissionServiceHandler interface {
|
||||
ListPermissionsByResource(context.Context, *ListPermissionsByResourceRequest, *ListPermissionsByResourceResponse) error
|
||||
GetPermissionByID(context.Context, *GetPermissionByIDRequest, *GetPermissionByIDResponse) error
|
||||
}
|
||||
|
||||
func RegisterPermissionServiceHandler(s server.Server, hdlr PermissionServiceHandler, opts ...server.HandlerOption) error {
|
||||
type permissionService interface {
|
||||
ListPermissionsByResource(ctx context.Context, in *ListPermissionsByResourceRequest, out *ListPermissionsByResourceResponse) error
|
||||
GetPermissionByID(ctx context.Context, in *GetPermissionByIDRequest, out *GetPermissionByIDResponse) error
|
||||
}
|
||||
type PermissionService struct {
|
||||
permissionService
|
||||
}
|
||||
h := &permissionServiceHandler{hdlr}
|
||||
opts = append(opts, api.WithEndpoint(&api.Endpoint{
|
||||
Name: "PermissionService.ListPermissionsByResource",
|
||||
Path: []string{"/api/v0/settings/permissions-list-by-resource"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
}))
|
||||
opts = append(opts, api.WithEndpoint(&api.Endpoint{
|
||||
Name: "PermissionService.GetPermissionByID",
|
||||
Path: []string{"/api/v0/settings/permissions-get-by-id"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
}))
|
||||
return s.Handle(s.NewHandler(&PermissionService{h}, opts...))
|
||||
}
|
||||
|
||||
type permissionServiceHandler struct {
|
||||
PermissionServiceHandler
|
||||
}
|
||||
|
||||
func (h *permissionServiceHandler) ListPermissionsByResource(ctx context.Context, in *ListPermissionsByResourceRequest, out *ListPermissionsByResourceResponse) error {
|
||||
return h.PermissionServiceHandler.ListPermissionsByResource(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *permissionServiceHandler) GetPermissionByID(ctx context.Context, in *GetPermissionByIDRequest, out *GetPermissionByIDResponse) error {
|
||||
return h.PermissionServiceHandler.GetPermissionByID(ctx, in, out)
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,414 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package proto;
|
||||
option go_package = "pkg/proto/v0;proto";
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "protoc-gen-swagger/options/annotations.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
|
||||
info: {
|
||||
title: "Settings";
|
||||
version: "1.0";
|
||||
contact: {
|
||||
name: "ownCloud GmbH";
|
||||
url: "https://github.com/owncloud/ocis-settings";
|
||||
email: "support@owncloud.com";
|
||||
};
|
||||
license: {
|
||||
name: "Apache-2.0";
|
||||
url: "https://github.com/owncloud/ocis-settings/blob/master/LICENSE";
|
||||
};
|
||||
};
|
||||
schemes: HTTP;
|
||||
schemes: HTTPS;
|
||||
consumes: "application/json";
|
||||
produces: "application/json";
|
||||
external_docs: {
|
||||
description: "Developer Manual";
|
||||
url: "http://owncloud.github.io/extensions/ocis_settings/";
|
||||
};
|
||||
};
|
||||
|
||||
service BundleService {
|
||||
rpc SaveBundle(SaveBundleRequest) returns (SaveBundleResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v0/settings/bundle-save",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc GetBundle(GetBundleRequest) returns (GetBundleResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v0/settings/bundle-get",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc ListBundles(ListBundlesRequest) returns (ListBundlesResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v0/settings/bundles-list",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc AddSettingToBundle(AddSettingToBundleRequest) returns (AddSettingToBundleResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v0/settings/bundles-add-setting",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc RemoveSettingFromBundle(RemoveSettingFromBundleRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v0/settings/bundles-remove-setting",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
service ValueService {
|
||||
rpc SaveValue(SaveValueRequest) returns (SaveValueResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v0/settings/values-save",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc GetValue(GetValueRequest) returns (GetValueResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v0/settings/values-get",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc ListValues(ListValuesRequest) returns (ListValuesResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v0/settings/values-list",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc GetValueByUniqueIdentifiers(GetValueByUniqueIdentifiersRequest) returns (GetValueResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v0/settings/values-get-by-unique-identifiers",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
service RoleService {
|
||||
rpc ListRoles(ListBundlesRequest) returns (ListBundlesResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v0/settings/roles-list",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc ListRoleAssignments(ListRoleAssignmentsRequest) returns (ListRoleAssignmentsResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v0/settings/assignments-list",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc AssignRoleToUser(AssignRoleToUserRequest) returns (AssignRoleToUserResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v0/settings/assignments-add",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc RemoveRoleFromUser(RemoveRoleFromUserRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v0/settings/assignments-remove",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
service PermissionService {
|
||||
rpc ListPermissionsByResource(ListPermissionsByResourceRequest) returns (ListPermissionsByResourceResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v0/settings/permissions-list-by-resource",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc GetPermissionByID(GetPermissionByIDRequest) returns (GetPermissionByIDResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v0/settings/permissions-get-by-id",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// ---
|
||||
// requests and responses for settings bundles
|
||||
// ---
|
||||
message SaveBundleRequest {
|
||||
Bundle bundle = 1;
|
||||
}
|
||||
|
||||
message SaveBundleResponse {
|
||||
Bundle bundle = 1;
|
||||
}
|
||||
|
||||
message GetBundleRequest {
|
||||
string bundle_id = 1;
|
||||
}
|
||||
|
||||
message GetBundleResponse {
|
||||
Bundle bundle = 1;
|
||||
}
|
||||
|
||||
message ListBundlesRequest {
|
||||
repeated string bundle_ids = 1;
|
||||
}
|
||||
|
||||
message ListBundlesResponse {
|
||||
repeated Bundle bundles = 1;
|
||||
}
|
||||
|
||||
message AddSettingToBundleRequest {
|
||||
string bundle_id = 1;
|
||||
Setting setting = 2;
|
||||
}
|
||||
|
||||
message AddSettingToBundleResponse {
|
||||
Setting setting = 1;
|
||||
}
|
||||
|
||||
message RemoveSettingFromBundleRequest {
|
||||
string bundle_id = 1;
|
||||
string setting_id = 2;
|
||||
}
|
||||
|
||||
// ---
|
||||
// requests and responses for settings values
|
||||
// ---
|
||||
|
||||
message SaveValueRequest {
|
||||
Value value = 1;
|
||||
}
|
||||
|
||||
message SaveValueResponse {
|
||||
ValueWithIdentifier value = 1;
|
||||
}
|
||||
|
||||
message GetValueRequest {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message GetValueResponse {
|
||||
ValueWithIdentifier value = 1;
|
||||
}
|
||||
|
||||
message ListValuesRequest {
|
||||
string bundle_id = 1;
|
||||
string account_uuid = 2;
|
||||
}
|
||||
|
||||
message ListValuesResponse {
|
||||
repeated ValueWithIdentifier values = 1;
|
||||
}
|
||||
|
||||
message GetValueByUniqueIdentifiersRequest{
|
||||
string account_uuid = 1;
|
||||
string setting_id = 2;
|
||||
}
|
||||
|
||||
message ValueWithIdentifier {
|
||||
Identifier identifier = 1;
|
||||
Value value = 2;
|
||||
}
|
||||
|
||||
message Identifier {
|
||||
string extension = 1;
|
||||
string bundle = 2;
|
||||
string setting = 3;
|
||||
}
|
||||
|
||||
// --
|
||||
// requests and responses for role assignments
|
||||
// ---
|
||||
|
||||
message ListRoleAssignmentsRequest {
|
||||
string account_uuid = 1;
|
||||
}
|
||||
|
||||
message ListRoleAssignmentsResponse {
|
||||
repeated UserRoleAssignment assignments = 1;
|
||||
}
|
||||
|
||||
message AssignRoleToUserRequest {
|
||||
string account_uuid = 1;
|
||||
// the role_id is a bundle_id internally
|
||||
string role_id = 2;
|
||||
}
|
||||
|
||||
message AssignRoleToUserResponse {
|
||||
UserRoleAssignment assignment = 1;
|
||||
}
|
||||
|
||||
message RemoveRoleFromUserRequest {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message UserRoleAssignment {
|
||||
// id is generated upon saving the assignment
|
||||
string id = 1;
|
||||
string account_uuid = 2;
|
||||
// the role_id is a bundle_id internally
|
||||
string role_id = 3;
|
||||
}
|
||||
|
||||
// --
|
||||
// requests and responses for permissions
|
||||
// ---
|
||||
|
||||
message ListPermissionsByResourceRequest {
|
||||
Resource resource = 1;
|
||||
}
|
||||
|
||||
message ListPermissionsByResourceResponse {
|
||||
repeated Permission permissions = 1;
|
||||
}
|
||||
|
||||
message GetPermissionByIDRequest {
|
||||
string permission_id = 1;
|
||||
}
|
||||
|
||||
message GetPermissionByIDResponse {
|
||||
Permission permission = 1;
|
||||
}
|
||||
|
||||
// ---
|
||||
// resource payloads
|
||||
// ---
|
||||
|
||||
message Resource {
|
||||
enum Type {
|
||||
TYPE_UNKNOWN = 0;
|
||||
TYPE_SYSTEM = 1;
|
||||
TYPE_FILE = 2;
|
||||
TYPE_SHARE = 3;
|
||||
TYPE_SETTING = 4;
|
||||
TYPE_BUNDLE = 5;
|
||||
TYPE_USER = 6;
|
||||
TYPE_GROUP = 7;
|
||||
}
|
||||
Type type = 1;
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
// ---
|
||||
// payloads for bundles
|
||||
// ---
|
||||
|
||||
message Bundle {
|
||||
enum Type {
|
||||
TYPE_UNKNOWN = 0;
|
||||
TYPE_DEFAULT = 1;
|
||||
TYPE_ROLE = 2;
|
||||
}
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
Type type = 3;
|
||||
string extension = 4;
|
||||
string display_name = 5;
|
||||
repeated Setting settings = 6;
|
||||
Resource resource = 7;
|
||||
}
|
||||
|
||||
message Setting {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string display_name = 3;
|
||||
string description = 4;
|
||||
oneof value {
|
||||
Int int_value = 5;
|
||||
String string_value = 6;
|
||||
Bool bool_value = 7;
|
||||
SingleChoiceList single_choice_value = 8;
|
||||
MultiChoiceList multi_choice_value = 9;
|
||||
Permission permission_value = 10;
|
||||
}
|
||||
Resource resource = 11;
|
||||
}
|
||||
|
||||
message Int {
|
||||
int64 default = 1;
|
||||
int64 min = 2;
|
||||
int64 max = 3;
|
||||
int64 step = 4;
|
||||
string placeholder = 5;
|
||||
}
|
||||
|
||||
message String {
|
||||
string default = 1;
|
||||
bool required = 2;
|
||||
int32 min_length = 3;
|
||||
int32 max_length = 4;
|
||||
string placeholder = 5;
|
||||
}
|
||||
|
||||
message Bool {
|
||||
bool default = 1;
|
||||
string label = 2;
|
||||
}
|
||||
|
||||
message SingleChoiceList {
|
||||
repeated ListOption options = 1;
|
||||
}
|
||||
|
||||
message MultiChoiceList {
|
||||
repeated ListOption options = 1;
|
||||
}
|
||||
|
||||
message ListOption {
|
||||
ListOptionValue value = 1;
|
||||
bool default = 2;
|
||||
string display_value = 3;
|
||||
}
|
||||
|
||||
message Permission {
|
||||
enum Operation {
|
||||
OPERATION_UNKNOWN = 0;
|
||||
OPERATION_CREATE = 1;
|
||||
OPERATION_READ = 2;
|
||||
OPERATION_UPDATE = 3;
|
||||
OPERATION_DELETE = 4;
|
||||
OPERATION_WRITE = 5;// WRITE is a combination of CREATE and UPDATE
|
||||
OPERATION_READWRITE = 6;// READWRITE is a combination of READ and WRITE
|
||||
}
|
||||
Operation operation = 1;
|
||||
enum Constraint {
|
||||
CONSTRAINT_UNKNOWN = 0;
|
||||
CONSTRAINT_OWN = 1;
|
||||
CONSTRAINT_SHARED = 2;
|
||||
CONSTRAINT_ALL = 3;
|
||||
}
|
||||
Constraint constraint = 2;
|
||||
}
|
||||
|
||||
// ---
|
||||
// payloads for values
|
||||
// ---
|
||||
|
||||
message Value {
|
||||
// id is the id of the Value. It is generated on saving it.
|
||||
string id = 1;
|
||||
string bundle_id = 2;
|
||||
// setting_id is the id of the setting from within its bundle.
|
||||
string setting_id = 3;
|
||||
string account_uuid = 4;
|
||||
Resource resource = 5;
|
||||
oneof value {
|
||||
bool bool_value = 6;
|
||||
int64 int_value = 7;
|
||||
string string_value = 8;
|
||||
ListValue list_value = 9;
|
||||
}
|
||||
}
|
||||
|
||||
message ListValue {
|
||||
repeated ListOptionValue values = 1;
|
||||
}
|
||||
|
||||
message ListOptionValue {
|
||||
oneof option {
|
||||
string string_value = 1;
|
||||
int64 int_value = 2;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user