Merge pull request #2960 from owncloud/proto_refactor

Proto refactor
This commit is contained in:
Willy Kloucek
2022-02-01 09:13:52 +01:00
committed by GitHub
143 changed files with 12148 additions and 14980 deletions

3
.gitignore vendored
View File

@@ -36,3 +36,6 @@ vendor-bin/**/composer.lock
**/l10n/locale
**/l10n/template.pot
# protogen autogenerated
protogen/buf.sha1.lock

View File

@@ -1,3 +1,5 @@
SHA1_LOCK_FILE := $(abspath $(CURDIR)/../protogen/buf.sha1.lock)
# bingo creates symlinks from the -l option in GOBIN, from where
# we can easily use it with buf. To have the symlinks inside this
# repo and on a known location, we set GOBIN to .bingo in the root
@@ -11,6 +13,12 @@ protoc-deps: $(BINGO)
@cd .. && GOPATH="" GOBIN=".bingo" $(BINGO) get -l github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
.PHONY: buf-generate
buf-generate: $(BUF) protoc-deps
$(BUF) generate
buf-generate: $(BUF) protoc-deps $(SHA1_LOCK_FILE)
@find $(abspath $(CURDIR)/../protogen/proto/) -type f -print0 | sort -z | xargs -0 sha1sum > buf.sha1.lock.tmp
@cmp $(SHA1_LOCK_FILE) buf.sha1.lock.tmp --quiet || $(MAKE) -B $(SHA1_LOCK_FILE)
@rm -f buf.sha1.lock.tmp
$(SHA1_LOCK_FILE):
@echo "generating protobuf content"
cd ../protogen/proto && $(BUF) generate
find $(abspath $(CURDIR)/../protogen/proto/) -type f -print0 | sort -z | xargs -0 sha1sum > $(SHA1_LOCK_FILE)

View File

@@ -49,9 +49,6 @@ node_modules:
yarn install --immutable
############ protobuf ############
PROTO_VERSION := v0
PROTO_SRC := pkg/proto/$(PROTO_VERSION)
include ../.make/protobuf.mk
.PHONY: protobuf

View File

@@ -1,29 +0,0 @@
version: v1
plugins:
- name: go
path: ../.bingo/protoc-gen-go
out: pkg/
opt:
- paths=source_relative
- name: micro
path: ../.bingo/protoc-gen-micro
out: pkg/
opt:
- paths=source_relative
- name: microweb
path: ../.bingo/protoc-gen-microweb
out: pkg/
opt:
- paths=source_relative
- name: openapiv2
path: ../.bingo/protoc-gen-openapiv2
out: pkg/
- name: doc
path: ../.bingo/protoc-gen-doc
out: ../docs/extensions/accounts
opt:
- ./templates/GRPC.tmpl,grpc.md

View File

@@ -1,17 +0,0 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: googleapis
repository: googleapis
branch: main
commit: ca45b9d9c51849e898845743a28b0eb0
digest: b1--B2JdvzLV2KI5pYMG9AHJHFGznqXfZKjKwcqBuXhGgw=
create_time: 2021-10-14T15:09:30.598677Z
- remote: buf.build
owner: grpc-ecosystem
repository: grpc-gateway
branch: main
commit: 462ede5f3dee45569df6317bda220b1b
digest: b1-4FNKWjnS2yafyeOdqW8u-s7w1pJBHjz0Z6CbOL-Ipk0=
create_time: 2021-10-14T01:55:03.476639Z

View File

@@ -3,17 +3,19 @@ package command
import (
"fmt"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/asim/go-micro/plugins/client/grpc/v4"
"github.com/owncloud/ocis/accounts/pkg/config"
"github.com/owncloud/ocis/accounts/pkg/flagset"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/urfave/cli/v2"
)
// AddAccount command creates a new account
func AddAccount(cfg *config.Config) *cli.Command {
a := &accounts.Account{
PasswordProfile: &accounts.PasswordProfile{},
a := &accountsmsg.Account{
PasswordProfile: &accountsmsg.PasswordProfile{},
}
return &cli.Command{
Name: "add",
@@ -43,8 +45,8 @@ func AddAccount(cfg *config.Config) *cli.Command {
},
Action: func(c *cli.Context) error {
accSvcID := cfg.GRPC.Namespace + "." + cfg.Service.Name
accSvc := accounts.NewAccountsService(accSvcID, grpc.NewClient())
_, err := accSvc.CreateAccount(c.Context, &accounts.CreateAccountRequest{
accSvc := accountssvc.NewAccountsService(accSvcID, grpc.NewClient())
_, err := accSvc.CreateAccount(c.Context, &accountssvc.CreateAccountRequest{
Account: a,
})

View File

@@ -5,12 +5,14 @@ import (
"os"
"strconv"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/owncloud/ocis/accounts/pkg/flagset"
"github.com/asim/go-micro/plugins/client/grpc/v4"
tw "github.com/olekukonko/tablewriter"
"github.com/owncloud/ocis/accounts/pkg/config"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/urfave/cli/v2"
)
@@ -30,8 +32,8 @@ func InspectAccount(cfg *config.Config) *cli.Command {
}
uid := c.Args().First()
accSvc := accounts.NewAccountsService(accServiceID, grpc.NewClient())
acc, err := accSvc.GetAccount(c.Context, &accounts.GetAccountRequest{
accSvc := accountssvc.NewAccountsService(accServiceID, grpc.NewClient())
acc, err := accSvc.GetAccount(c.Context, &accountssvc.GetAccountRequest{
Id: uid,
})
@@ -45,7 +47,7 @@ func InspectAccount(cfg *config.Config) *cli.Command {
}}
}
func buildAccountInspectTable(acc *accounts.Account) *tw.Table {
func buildAccountInspectTable(acc *accountsmsg.Account) *tw.Table {
table := tw.NewWriter(os.Stdout)
table.SetAutoMergeCells(true)
table.AppendBulk([][]string{

View File

@@ -5,12 +5,14 @@ import (
"os"
"strconv"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/owncloud/ocis/accounts/pkg/flagset"
"github.com/asim/go-micro/plugins/client/grpc/v4"
tw "github.com/olekukonko/tablewriter"
"github.com/owncloud/ocis/accounts/pkg/config"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/urfave/cli/v2"
)
@@ -24,8 +26,8 @@ func ListAccounts(cfg *config.Config) *cli.Command {
Flags: flagset.ListAccountsWithConfig(cfg),
Action: func(c *cli.Context) error {
accSvcID := cfg.GRPC.Namespace + "." + cfg.Service.Name
accSvc := accounts.NewAccountsService(accSvcID, grpc.NewClient())
resp, err := accSvc.ListAccounts(c.Context, &accounts.ListAccountsRequest{})
accSvc := accountssvc.NewAccountsService(accSvcID, grpc.NewClient())
resp, err := accSvc.ListAccounts(c.Context, &accountssvc.ListAccountsRequest{})
if err != nil {
fmt.Println(fmt.Errorf("could not list accounts %w", err))
@@ -38,7 +40,7 @@ func ListAccounts(cfg *config.Config) *cli.Command {
}
// buildAccountsListTable creates an ascii table for printing on the cli
func buildAccountsListTable(accs []*accounts.Account) *tw.Table {
func buildAccountsListTable(accs []*accountsmsg.Account) *tw.Table {
table := tw.NewWriter(os.Stdout)
table.SetHeader([]string{"Id", "DisplayName", "Mail", "AccountEnabled"})
table.SetAutoFormatHeaders(false)

View File

@@ -4,9 +4,10 @@ import (
"context"
"fmt"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/asim/go-micro/plugins/client/grpc/v4"
"github.com/owncloud/ocis/accounts/pkg/config"
index "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/urfave/cli/v2"
merrors "go-micro.dev/v4/errors"
)
@@ -20,9 +21,9 @@ func RebuildIndex(cdf *config.Config) *cli.Command {
Aliases: []string{"rebuild", "ri"},
Action: func(ctx *cli.Context) error {
idxSvcID := "com.owncloud.api.accounts"
idxSvc := index.NewIndexService(idxSvcID, grpc.NewClient())
idxSvc := accountssvc.NewIndexService(idxSvcID, grpc.NewClient())
_, err := idxSvc.RebuildIndex(context.Background(), &index.RebuildIndexRequest{})
_, err := idxSvc.RebuildIndex(context.Background(), &accountssvc.RebuildIndexRequest{})
if err != nil {
fmt.Println(merrors.FromError(err).Detail)
return err

View File

@@ -4,11 +4,12 @@ import (
"fmt"
"os"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/owncloud/ocis/accounts/pkg/flagset"
"github.com/asim/go-micro/plugins/client/grpc/v4"
"github.com/owncloud/ocis/accounts/pkg/config"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/urfave/cli/v2"
)
@@ -29,8 +30,8 @@ func RemoveAccount(cfg *config.Config) *cli.Command {
}
uid := c.Args().First()
accSvc := accounts.NewAccountsService(accServiceID, grpc.NewClient())
_, err := accSvc.DeleteAccount(c.Context, &accounts.DeleteAccountRequest{Id: uid})
accSvc := accountssvc.NewAccountsService(accServiceID, grpc.NewClient())
_, err := accSvc.DeleteAccount(c.Context, &accountssvc.DeleteAccountRequest{Id: uid})
if err != nil {
fmt.Println(fmt.Errorf("could not delete account %w", err))

View File

@@ -4,19 +4,21 @@ import (
"errors"
"fmt"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/owncloud/ocis/accounts/pkg/flagset"
"github.com/asim/go-micro/plugins/client/grpc/v4"
"github.com/owncloud/ocis/accounts/pkg/config"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/urfave/cli/v2"
"google.golang.org/genproto/protobuf/field_mask"
)
// UpdateAccount command for modifying accounts including password policies
func UpdateAccount(cfg *config.Config) *cli.Command {
a := &accounts.Account{
PasswordProfile: &accounts.PasswordProfile{},
a := &accountsmsg.Account{
PasswordProfile: &accountsmsg.PasswordProfile{},
}
return &cli.Command{
Name: "update",
@@ -42,8 +44,8 @@ func UpdateAccount(cfg *config.Config) *cli.Command {
Action: func(c *cli.Context) error {
a.Id = c.Args().First()
accSvcID := cfg.GRPC.Namespace + "." + cfg.Service.Name
accSvc := accounts.NewAccountsService(accSvcID, grpc.NewClient())
_, err := accSvc.UpdateAccount(c.Context, &accounts.UpdateAccountRequest{
accSvc := accountssvc.NewAccountsService(accSvcID, grpc.NewClient())
_, err := accSvc.UpdateAccount(c.Context, &accountssvc.UpdateAccountRequest{
Account: a,
UpdateMask: buildAccUpdateMask(c.FlagNames()),
})

View File

@@ -1,16 +1,17 @@
package flagset
import (
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
"github.com/owncloud/ocis/accounts/pkg/config"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/urfave/cli/v2"
)
// UpdateAccountWithConfig applies update command flags to cfg
func UpdateAccountWithConfig(cfg *config.Config, a *accounts.Account) []cli.Flag {
func UpdateAccountWithConfig(cfg *config.Config, a *accountsmsg.Account) []cli.Flag {
if a.PasswordProfile == nil {
a.PasswordProfile = &accounts.PasswordProfile{}
a.PasswordProfile = &accountsmsg.PasswordProfile{}
}
return []cli.Flag{
@@ -92,9 +93,9 @@ func UpdateAccountWithConfig(cfg *config.Config, a *accounts.Account) []cli.Flag
}
// AddAccountWithConfig applies create command flags to cfg
func AddAccountWithConfig(cfg *config.Config, a *accounts.Account) []cli.Flag {
func AddAccountWithConfig(cfg *config.Config, a *accountsmsg.Account) []cli.Flag {
if a.PasswordProfile == nil {
a.PasswordProfile = &accounts.PasswordProfile{}
a.PasswordProfile = &accountsmsg.PasswordProfile{}
}
return []cli.Flag{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,8 @@
package grpc
import (
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
"github.com/owncloud/ocis/ocis-pkg/version"
)
@@ -21,13 +22,13 @@ func Server(opts ...Option) grpc.Service {
grpc.Version(version.String),
)
if err := proto.RegisterAccountsServiceHandler(service.Server(), handler); err != nil {
if err := accountssvc.RegisterAccountsServiceHandler(service.Server(), handler); err != nil {
options.Logger.Fatal().Err(err).Msg("could not register service handler")
}
if err := proto.RegisterGroupsServiceHandler(service.Server(), handler); err != nil {
if err := accountssvc.RegisterGroupsServiceHandler(service.Server(), handler); err != nil {
options.Logger.Fatal().Err(err).Msg("could not register groups handler")
}
if err := proto.RegisterIndexServiceHandler(service.Server(), handler); err != nil {
if err := accountssvc.RegisterIndexServiceHandler(service.Server(), handler); err != nil {
options.Logger.Fatal().Err(err).Msg("could not register index handler")
}

View File

@@ -1,10 +1,11 @@
package http
import (
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/go-chi/chi/v5"
chimiddleware "github.com/go-chi/chi/v5/middleware"
"github.com/owncloud/ocis/accounts/pkg/assets"
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocis-pkg/account"
"github.com/owncloud/ocis/ocis-pkg/cors"
"github.com/owncloud/ocis/ocis-pkg/middleware"
@@ -66,8 +67,8 @@ func Server(opts ...Option) http.Service {
))
mux.Route(options.Config.HTTP.Root, func(r chi.Router) {
proto.RegisterAccountsServiceWeb(r, handler)
proto.RegisterGroupsServiceWeb(r, handler)
accountssvc.RegisterAccountsServiceWeb(r, handler)
accountssvc.RegisterGroupsServiceWeb(r, handler)
})
err := micro.RegisterHandler(service.Server(), mux)

View File

@@ -16,17 +16,19 @@ import (
"go.opentelemetry.io/otel/attribute"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/gofrs/uuid"
"github.com/golang/protobuf/ptypes/empty"
fieldmask_utils "github.com/mennanov/fieldmask-utils"
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/accounts/pkg/storage"
accTracing "github.com/owncloud/ocis/accounts/pkg/tracing"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/ocis-pkg/middleware"
"github.com/owncloud/ocis/ocis-pkg/roles"
"github.com/owncloud/ocis/ocis-pkg/sync"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
settings_svc "github.com/owncloud/ocis/settings/pkg/service/v0"
"github.com/rs/zerolog"
merrors "go-micro.dev/v4/errors"
@@ -47,13 +49,13 @@ const passwordValidCacheExpiration = 10 * time.Minute
// login eq \"teddy\" and password eq \"F&1!b90t111!\"
var authQuery = regexp.MustCompile(`^login eq '(.*)' and password eq '(.*)'$`) // TODO how is ' escaped in the password?
func (s Service) expandMemberOf(a *proto.Account) {
func (s Service) expandMemberOf(a *accountsmsg.Account) {
if a == nil {
return
}
expanded := []*proto.Group{}
expanded := []*accountsmsg.Group{}
for i := range a.MemberOf {
g := &proto.Group{}
g := &accountsmsg.Group{}
// TODO resolve by name, when a create or update is issued they may not have an id? fall back to searching the group id in the index?
if err := s.repo.LoadGroup(context.Background(), a.MemberOf[i].Id, g); err == nil {
g.Members = nil // always hide members when expanding
@@ -112,8 +114,8 @@ func (s Service) serviceUserToIndex() (teardownServiceUser func()) {
return func() {}
}
func (s Service) getInMemoryServiceUser() proto.Account {
return proto.Account{
func (s Service) getInMemoryServiceUser() accountsmsg.Account {
return accountsmsg.Account{
AccountEnabled: true,
Id: s.Config.ServiceUser.UUID,
PreferredName: s.Config.ServiceUser.Username,
@@ -126,7 +128,7 @@ func (s Service) getInMemoryServiceUser() proto.Account {
// ListAccounts implements the AccountsServiceHandler interface
// the query contains account properties
func (s Service) ListAccounts(ctx context.Context, in *proto.ListAccountsRequest, out *proto.ListAccountsResponse) (err error) {
func (s Service) ListAccounts(ctx context.Context, in *accountssvc.ListAccountsRequest, out *accountssvc.ListAccountsResponse) (err error) {
var span trace.Span
ctx, span = accTracing.TraceProvider.Tracer("accounts").Start(ctx, "Accounts.ListAccounts")
defer span.End()
@@ -152,18 +154,18 @@ func (s Service) ListAccounts(ctx context.Context, in *proto.ListAccountsRequest
return merrors.Unauthorized(s.id, "account not found or invalid credentials")
}
ids, err := s.index.FindBy(&proto.Account{}, "OnPremisesSamAccountName", match[1])
ids, err := s.index.FindBy(&accountsmsg.Account{}, "OnPremisesSamAccountName", match[1])
if err != nil || len(ids) > 1 {
return merrors.Unauthorized(s.id, "account not found or invalid credentials")
}
if len(ids) == 0 {
ids, err = s.index.FindBy(&proto.Account{}, "Mail", match[1])
ids, err = s.index.FindBy(&accountsmsg.Account{}, "Mail", match[1])
if err != nil || len(ids) != 1 {
return merrors.Unauthorized(s.id, "account not found or invalid credentials")
}
}
a := &proto.Account{}
a := &accountsmsg.Account{}
err = s.repo.LoadAccount(ctx, ids[0], a)
if err != nil || a.PasswordProfile == nil || len(a.PasswordProfile.Password) == 0 {
return merrors.Unauthorized(s.id, "account not found or invalid credentials")
@@ -211,7 +213,7 @@ func (s Service) ListAccounts(ctx context.Context, in *proto.ListAccountsRequest
}
a.PasswordProfile.Password = ""
out.Accounts = []*proto.Account{a}
out.Accounts = []*accountsmsg.Account{a}
return nil
}
@@ -246,10 +248,10 @@ func (s Service) ListAccounts(ctx context.Context, in *proto.ListAccountsRequest
}
searchResults, err := s.findAccountsByQuery(ctx, in.Query)
out.Accounts = make([]*proto.Account, 0, len(searchResults))
out.Accounts = make([]*accountsmsg.Account, 0, len(searchResults))
for _, hit := range searchResults {
a := &proto.Account{}
a := &accountsmsg.Account{}
if hit == s.Config.ServiceUser.UUID {
acc := s.getInMemoryServiceUser()
a = &acc
@@ -276,11 +278,11 @@ func (s Service) ListAccounts(ctx context.Context, in *proto.ListAccountsRequest
}
func (s Service) findAccountsByQuery(ctx context.Context, query string) ([]string, error) {
return s.index.Query(ctx, &proto.Account{}, query)
return s.index.Query(ctx, &accountsmsg.Account{}, query)
}
// GetAccount implements the AccountsServiceHandler interface
func (s Service) GetAccount(ctx context.Context, in *proto.GetAccountRequest, out *proto.Account) (err error) {
func (s Service) GetAccount(ctx context.Context, in *accountssvc.GetAccountRequest, out *accountsmsg.Account) (err error) {
var span trace.Span
ctx, span = accTracing.TraceProvider.Tracer("accounts").Start(ctx, "Accounts.GetAccount")
@@ -337,7 +339,7 @@ func (s Service) GetAccount(ctx context.Context, in *proto.GetAccountRequest, ou
}
// CreateAccount implements the AccountsServiceHandler interface
func (s Service) CreateAccount(ctx context.Context, in *proto.CreateAccountRequest, out *proto.Account) (err error) {
func (s Service) CreateAccount(ctx context.Context, in *accountssvc.CreateAccountRequest, out *accountsmsg.Account) (err error) {
var span trace.Span
ctx, span = accTracing.TraceProvider.Tracer("accounts").Start(ctx, "Accounts.CreateAccount")
@@ -428,8 +430,8 @@ func (s Service) CreateAccount(ctx context.Context, in *proto.CreateAccountReque
out.GidNumber = userDefaultGID
}
r := proto.ListGroupsResponse{}
err = s.ListGroups(ctx, &proto.ListGroupsRequest{}, &r)
r := accountssvc.ListGroupsResponse{}
err = s.ListGroups(ctx, &accountssvc.ListGroupsRequest{}, &r)
if err != nil {
// rollback account creation
return err
@@ -453,7 +455,7 @@ func (s Service) CreateAccount(ctx context.Context, in *proto.CreateAccountReque
if s.RoleService == nil {
return merrors.InternalServerError(s.id, "could not assign role to account: roleService not configured")
}
if _, err = s.RoleService.AssignRoleToUser(ctx, &settings.AssignRoleToUserRequest{
if _, err = s.RoleService.AssignRoleToUser(ctx, &settingssvc.AssignRoleToUserRequest{
AccountUuid: out.Id,
RoleId: settings_svc.BundleUUIDRoleUser,
}); err != nil {
@@ -464,7 +466,7 @@ func (s Service) CreateAccount(ctx context.Context, in *proto.CreateAccountReque
}
// rollbackCreateAccount tries to rollback changes made by `CreateAccount` if parts of it failed.
func (s Service) rollbackCreateAccount(ctx context.Context, acc *proto.Account) {
func (s Service) rollbackCreateAccount(ctx context.Context, acc *accountsmsg.Account) {
err := s.index.Delete(acc)
if err != nil {
s.log.Err(err).Msg("failed to rollback account from indices")
@@ -478,7 +480,7 @@ func (s Service) rollbackCreateAccount(ctx context.Context, acc *proto.Account)
// UpdateAccount implements the AccountsServiceHandler interface
// read only fields are ignored
// TODO how can we unset specific values? using the update mask
func (s Service) UpdateAccount(ctx context.Context, in *proto.UpdateAccountRequest, out *proto.Account) (err error) {
func (s Service) UpdateAccount(ctx context.Context, in *accountssvc.UpdateAccountRequest, out *accountsmsg.Account) (err error) {
var span trace.Span
ctx, span = accTracing.TraceProvider.Tracer("accounts").Start(ctx, "Accounts.UpdateAccount")
@@ -568,7 +570,7 @@ func (s Service) UpdateAccount(ctx context.Context, in *proto.UpdateAccountReque
if in.Account.PasswordProfile != nil {
if out.PasswordProfile == nil {
out.PasswordProfile = &proto.PasswordProfile{}
out.PasswordProfile = &accountsmsg.PasswordProfile{}
}
if in.Account.PasswordProfile.Password != "" {
// encrypt password
@@ -601,7 +603,7 @@ func (s Service) UpdateAccount(ctx context.Context, in *proto.UpdateAccountReque
}
// We need to reload the old account state to be able to compute the update
old := &proto.Account{}
old := &accountsmsg.Account{}
if err = s.repo.LoadAccount(ctx, id, old); err != nil {
s.log.Error().Err(err).Str("id", out.Id).Msg("could not load old account representation during update, maybe the account got deleted meanwhile?")
return merrors.InternalServerError(s.id, "could not load current account for update: %v", err.Error())
@@ -653,7 +655,7 @@ var updatableAccountPaths = map[string]struct{}{
}
// DeleteAccount implements the AccountsServiceHandler interface
func (s Service) DeleteAccount(ctx context.Context, in *proto.DeleteAccountRequest, out *empty.Empty) (err error) {
func (s Service) DeleteAccount(ctx context.Context, in *accountssvc.DeleteAccountRequest, out *empty.Empty) (err error) {
var span trace.Span
ctx, span = accTracing.TraceProvider.Tracer("accounts").Start(ctx, "Accounts.DeleteAccount")
@@ -668,7 +670,7 @@ func (s Service) DeleteAccount(ctx context.Context, in *proto.DeleteAccountReque
return merrors.InternalServerError(s.id, "could not clean up account id: %v", err.Error())
}
a := &proto.Account{}
a := &accountsmsg.Account{}
if err = s.repo.LoadAccount(ctx, id, a); err != nil {
if storage.IsNotFoundErr(err) {
return merrors.NotFound(s.id, "account not found: %v", err.Error())
@@ -680,7 +682,7 @@ func (s Service) DeleteAccount(ctx context.Context, in *proto.DeleteAccountReque
// delete member relationship in groups
for i := range a.MemberOf {
err = s.RemoveMember(ctx, &proto.RemoveMemberRequest{
err = s.RemoveMember(ctx, &accountssvc.RemoveMemberRequest{
GroupId: a.MemberOf[i].Id,
AccountId: id,
}, a.MemberOf[i])
@@ -707,7 +709,7 @@ func (s Service) DeleteAccount(ctx context.Context, in *proto.DeleteAccountReque
return
}
func validateAccount(serviceID string, a *proto.Account) error {
func validateAccount(serviceID string, a *accountsmsg.Account) error {
if err := validateAccountPreferredName(serviceID, a); err != nil {
return err
}
@@ -720,21 +722,21 @@ func validateAccount(serviceID string, a *proto.Account) error {
return nil
}
func validateAccountPreferredName(serviceID string, a *proto.Account) error {
func validateAccountPreferredName(serviceID string, a *accountsmsg.Account) error {
if !isValidUsername(a.PreferredName) {
return merrors.BadRequest(serviceID, "preferred_name '%s' must be at least the local part of an email", a.PreferredName)
}
return nil
}
func validateAccountOnPremisesSamAccountName(serviceID string, a *proto.Account) error {
func validateAccountOnPremisesSamAccountName(serviceID string, a *accountsmsg.Account) error {
if !isValidUsername(a.OnPremisesSamAccountName) {
return merrors.BadRequest(serviceID, "on_premises_sam_account_name '%s' must be at least the local part of an email", a.OnPremisesSamAccountName)
}
return nil
}
func validateAccountEmail(serviceID string, a *proto.Account) error {
func validateAccountEmail(serviceID string, a *accountsmsg.Account) error {
if !isValidEmail(a.Mail) {
return merrors.BadRequest(serviceID, "mail '%s' must be a valid email", a.Mail)
}
@@ -808,7 +810,7 @@ func validateUpdate(mask *field_mask.FieldMask, updatablePaths map[string]struct
}
// debugLogAccount returns a debug-log event with detailed account-info, and filtered password data
func (s Service) debugLogAccount(a *proto.Account) *zerolog.Event {
func (s Service) debugLogAccount(a *accountsmsg.Account) *zerolog.Event {
return s.log.Debug().Fields(map[string]interface{}{
"Id": a.Id,
"Mail": a.Mail,
@@ -834,7 +836,7 @@ func (s Service) debugLogAccount(a *proto.Account) *zerolog.Event {
func (s Service) accountExists(ctx context.Context, username, mail, id string) (exists bool, err error) {
var ids []string
ids, err = s.index.FindBy(&proto.Account{}, "preferred_name", username)
ids, err = s.index.FindBy(&accountsmsg.Account{}, "preferred_name", username)
if err != nil {
return false, err
}
@@ -842,7 +844,7 @@ func (s Service) accountExists(ctx context.Context, username, mail, id string) (
return true, nil
}
ids, err = s.index.FindBy(&proto.Account{}, "on_premises_sam_account_name", username)
ids, err = s.index.FindBy(&accountsmsg.Account{}, "on_premises_sam_account_name", username)
if err != nil {
return false, err
}
@@ -850,7 +852,7 @@ func (s Service) accountExists(ctx context.Context, username, mail, id string) (
return true, nil
}
ids, err = s.index.FindBy(&proto.Account{}, "mail", mail)
ids, err = s.index.FindBy(&accountsmsg.Account{}, "mail", mail)
if err != nil {
return false, err
}
@@ -858,7 +860,7 @@ func (s Service) accountExists(ctx context.Context, username, mail, id string) (
return true, nil
}
a := &proto.Account{}
a := &accountsmsg.Account{}
err = s.repo.LoadAccount(ctx, id, a)
if err == nil {
return true, nil

View File

@@ -9,13 +9,16 @@ import (
"testing"
"time"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/golang/protobuf/ptypes/empty"
"github.com/owncloud/ocis/accounts/pkg/config"
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
olog "github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/ocis-pkg/middleware"
"github.com/owncloud/ocis/ocis-pkg/roles"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
settingsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/settings/v0"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
ssvc "github.com/owncloud/ocis/settings/pkg/service/v0"
"github.com/stretchr/testify/assert"
"go-micro.dev/v4/client"
@@ -26,7 +29,7 @@ import (
const dataPath = "/tmp/ocis-accounts-tests"
var (
roleServiceMock settings.RoleService
roleServiceMock settingssvc.RoleService
s *Service
)
@@ -98,10 +101,10 @@ func TestPermissionsListAccounts(t *testing.T) {
defer teardown()
ctx := buildTestCtx(t, scenario.roleIDs)
request := &proto.ListAccountsRequest{
request := &accountssvc.ListAccountsRequest{
Query: scenario.query,
}
response := &proto.ListAccountsResponse{}
response := &accountssvc.ListAccountsResponse{}
err := s.ListAccounts(ctx, request, response)
if scenario.permissionError != nil {
assert.Equal(t, scenario.permissionError, err)
@@ -145,8 +148,8 @@ func TestPermissionsGetAccount(t *testing.T) {
defer teardown()
ctx := buildTestCtx(t, scenario.roleIDs)
request := &proto.GetAccountRequest{}
response := &proto.Account{}
request := &accountssvc.GetAccountRequest{}
response := &accountsmsg.Account{}
err := s.GetAccount(ctx, request, response)
if scenario.permissionError != nil {
assert.Equal(t, scenario.permissionError, err)
@@ -193,8 +196,8 @@ func TestPermissionsCreateAccount(t *testing.T) {
defer teardown()
ctx := buildTestCtx(t, scenario.roleIDs)
request := &proto.CreateAccountRequest{}
response := &proto.Account{}
request := &accountssvc.CreateAccountRequest{}
response := &accountsmsg.Account{}
err := s.CreateAccount(ctx, request, response)
if scenario.permissionError != nil {
assert.Equal(t, scenario.permissionError, err)
@@ -241,8 +244,8 @@ func TestPermissionsUpdateAccount(t *testing.T) {
defer teardown()
ctx := buildTestCtx(t, scenario.roleIDs)
request := &proto.UpdateAccountRequest{}
response := &proto.Account{}
request := &accountssvc.UpdateAccountRequest{}
response := &accountsmsg.Account{}
err := s.UpdateAccount(ctx, request, response)
if scenario.permissionError != nil {
assert.Equal(t, scenario.permissionError, err)
@@ -289,7 +292,7 @@ func TestPermissionsDeleteAccount(t *testing.T) {
defer teardown()
ctx := buildTestCtx(t, scenario.roleIDs)
request := &proto.DeleteAccountRequest{}
request := &accountssvc.DeleteAccountRequest{}
response := &empty.Empty{}
err := s.DeleteAccount(ctx, request, response)
if scenario.permissionError != nil {
@@ -313,15 +316,15 @@ func buildTestCtx(t *testing.T, roleIDs []string) context.Context {
return ctx
}
func buildRoleServiceMock() settings.RoleService {
defaultRoles := map[string]*settings.Bundle{
func buildRoleServiceMock() settingssvc.RoleService {
defaultRoles := map[string]*settingsmsg.Bundle{
ssvc.BundleUUIDRoleAdmin: {
Id: ssvc.BundleUUIDRoleAdmin,
Type: settings.Bundle_TYPE_ROLE,
Resource: &settings.Resource{
Type: settings.Resource_TYPE_SYSTEM,
Type: settingsmsg.Bundle_TYPE_ROLE,
Resource: &settingsmsg.Resource{
Type: settingsmsg.Resource_TYPE_SYSTEM,
},
Settings: []*settings.Setting{
Settings: []*settingsmsg.Setting{
{
Id: AccountManagementPermissionID,
},
@@ -329,37 +332,37 @@ func buildRoleServiceMock() settings.RoleService {
},
ssvc.BundleUUIDRoleUser: {
Id: ssvc.BundleUUIDRoleUser,
Type: settings.Bundle_TYPE_ROLE,
Resource: &settings.Resource{
Type: settings.Resource_TYPE_SYSTEM,
Type: settingsmsg.Bundle_TYPE_ROLE,
Resource: &settingsmsg.Resource{
Type: settingsmsg.Resource_TYPE_SYSTEM,
},
Settings: []*settings.Setting{},
Settings: []*settingsmsg.Setting{},
},
ssvc.BundleUUIDRoleGuest: {
Id: ssvc.BundleUUIDRoleGuest,
Type: settings.Bundle_TYPE_ROLE,
Resource: &settings.Resource{
Type: settings.Resource_TYPE_SYSTEM,
Type: settingsmsg.Bundle_TYPE_ROLE,
Resource: &settingsmsg.Resource{
Type: settingsmsg.Resource_TYPE_SYSTEM,
},
Settings: []*settings.Setting{},
Settings: []*settingsmsg.Setting{},
},
}
return settings.MockRoleService{
ListRolesFunc: func(ctx context.Context, req *settings.ListBundlesRequest, opts ...client.CallOption) (res *settings.ListBundlesResponse, err error) {
payload := make([]*settings.Bundle, 0)
return settingssvc.MockRoleService{
ListRolesFunc: func(ctx context.Context, req *settingssvc.ListBundlesRequest, opts ...client.CallOption) (res *settingssvc.ListBundlesResponse, err error) {
payload := make([]*settingsmsg.Bundle, 0)
for _, roleID := range req.BundleIds {
if defaultRoles[roleID] != nil {
payload = append(payload, defaultRoles[roleID])
}
}
return &settings.ListBundlesResponse{
return &settingssvc.ListBundlesResponse{
Bundles: payload,
}, nil
},
AssignRoleToUserFunc: func(ctx context.Context, req *settings.AssignRoleToUserRequest, opts ...client.CallOption) (res *settings.AssignRoleToUserResponse, err error) {
AssignRoleToUserFunc: func(ctx context.Context, req *settingssvc.AssignRoleToUserRequest, opts ...client.CallOption) (res *settingssvc.AssignRoleToUserResponse, err error) {
// mock can be empty. function is called during service start. actual role assignments not needed for the tests.
return &settings.AssignRoleToUserResponse{
Assignment: &settings.UserRoleAssignment{},
return &settingssvc.AssignRoleToUserResponse{
Assignment: &settingsmsg.UserRoleAssignment{},
}, nil
},
}

View File

@@ -5,22 +5,24 @@ import (
"path"
"strconv"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/gofrs/uuid"
"github.com/golang/protobuf/ptypes/empty"
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/accounts/pkg/storage"
merrors "go-micro.dev/v4/errors"
p "google.golang.org/protobuf/proto"
)
func (s Service) expandMembers(g *proto.Group) {
func (s Service) expandMembers(g *accountsmsg.Group) {
if g == nil {
return
}
expanded := []*proto.Account{}
expanded := []*accountsmsg.Account{}
for i := range g.Members {
// TODO resolve by name, when a create or update is issued they may not have an id? fall back to searching the group id in the index?
a := &proto.Account{}
a := &accountsmsg.Account{}
if err := s.repo.LoadAccount(context.Background(), g.Members[i].Id, a); err == nil {
expanded = append(expanded, a)
} else {
@@ -32,14 +34,14 @@ func (s Service) expandMembers(g *proto.Group) {
}
// deflateMembers replaces the users of a group with an instance that only contains the id
func (s Service) deflateMembers(g *proto.Group) {
func (s Service) deflateMembers(g *accountsmsg.Group) {
if g == nil {
return
}
deflated := []*proto.Account{}
deflated := []*accountsmsg.Account{}
for i := range g.Members {
if g.Members[i].Id != "" {
deflated = append(deflated, &proto.Account{Id: g.Members[i].Id})
deflated = append(deflated, &accountsmsg.Account{Id: g.Members[i].Id})
} else {
// TODO fetch and use an id when group only has a name but no id
s.log.Error().Str("id", g.Id).Interface("account", g.Members[i]).Msg("resolving members by name is not implemented yet")
@@ -49,7 +51,7 @@ func (s Service) deflateMembers(g *proto.Group) {
}
// ListGroups implements the GroupsServiceHandler interface
func (s Service) ListGroups(ctx context.Context, in *proto.ListGroupsRequest, out *proto.ListGroupsResponse) (err error) {
func (s Service) ListGroups(ctx context.Context, in *accountssvc.ListGroupsRequest, out *accountssvc.ListGroupsResponse) (err error) {
if in.Query == "" {
err = s.repo.LoadGroups(ctx, &out.Groups)
if err != nil {
@@ -68,10 +70,10 @@ func (s Service) ListGroups(ctx context.Context, in *proto.ListGroupsRequest, ou
}
searchResults, err := s.findGroupsByQuery(ctx, in.Query)
out.Groups = make([]*proto.Group, 0, len(searchResults))
out.Groups = make([]*accountsmsg.Group, 0, len(searchResults))
for _, hit := range searchResults {
g := &proto.Group{}
g := &accountsmsg.Group{}
if err = s.repo.LoadGroup(ctx, hit, g); err != nil {
s.log.Error().Err(err).Str("group", hit).Msg("could not load group, skipping")
continue
@@ -88,11 +90,11 @@ func (s Service) ListGroups(ctx context.Context, in *proto.ListGroupsRequest, ou
return
}
func (s Service) findGroupsByQuery(ctx context.Context, query string) ([]string, error) {
return s.index.Query(ctx, &proto.Group{}, query)
return s.index.Query(ctx, &accountsmsg.Group{}, query)
}
// GetGroup implements the GroupsServiceHandler interface
func (s Service) GetGroup(c context.Context, in *proto.GetGroupRequest, out *proto.Group) (err error) {
func (s Service) GetGroup(c context.Context, in *accountssvc.GetGroupRequest, out *accountsmsg.Group) (err error) {
var id string
if id, err = cleanupID(in.Id); err != nil {
return merrors.InternalServerError(s.id, "could not clean up group id: %v", err.Error())
@@ -116,7 +118,7 @@ func (s Service) GetGroup(c context.Context, in *proto.GetGroupRequest, out *pro
}
// CreateGroup implements the GroupsServiceHandler interface
func (s Service) CreateGroup(c context.Context, in *proto.CreateGroupRequest, out *proto.Group) (err error) {
func (s Service) CreateGroup(c context.Context, in *accountssvc.CreateGroupRequest, out *accountsmsg.Group) (err error) {
if in.Group == nil {
return merrors.InternalServerError(s.id, "invalid group: empty")
}
@@ -159,7 +161,7 @@ func (s Service) CreateGroup(c context.Context, in *proto.CreateGroupRequest, ou
}
// rollbackCreateGroup tries to rollback changes made by `CreateGroup` if parts of it failed.
func (s Service) rollbackCreateGroup(ctx context.Context, group *proto.Group) {
func (s Service) rollbackCreateGroup(ctx context.Context, group *accountsmsg.Group) {
err := s.index.Delete(group)
if err != nil {
s.log.Err(err).Msg("failed to rollback group from indices")
@@ -171,18 +173,18 @@ func (s Service) rollbackCreateGroup(ctx context.Context, group *proto.Group) {
}
// UpdateGroup implements the GroupsServiceHandler interface
func (s Service) UpdateGroup(c context.Context, in *proto.UpdateGroupRequest, out *proto.Group) (err error) {
func (s Service) UpdateGroup(c context.Context, in *accountssvc.UpdateGroupRequest, out *accountsmsg.Group) (err error) {
return merrors.InternalServerError(s.id, "not implemented")
}
// DeleteGroup implements the GroupsServiceHandler interface
func (s Service) DeleteGroup(c context.Context, in *proto.DeleteGroupRequest, out *empty.Empty) (err error) {
func (s Service) DeleteGroup(c context.Context, in *accountssvc.DeleteGroupRequest, out *empty.Empty) (err error) {
var id string
if id, err = cleanupID(in.Id); err != nil {
return merrors.InternalServerError(s.id, "could not clean up group id: %v", err.Error())
}
g := &proto.Group{}
g := &accountsmsg.Group{}
if err = s.repo.LoadGroup(c, id, g); err != nil {
if storage.IsNotFoundErr(err) {
return merrors.NotFound(s.id, "group not found: %v", err.Error())
@@ -192,7 +194,7 @@ func (s Service) DeleteGroup(c context.Context, in *proto.DeleteGroupRequest, ou
// delete memberof relationship in users
for i := range g.Members {
err = s.RemoveMember(c, &proto.RemoveMemberRequest{
err = s.RemoveMember(c, &accountssvc.RemoveMemberRequest{
AccountId: g.Members[i].Id,
GroupId: id,
}, g)
@@ -219,7 +221,7 @@ func (s Service) DeleteGroup(c context.Context, in *proto.DeleteGroupRequest, ou
}
// AddMember implements the GroupsServiceHandler interface
func (s Service) AddMember(c context.Context, in *proto.AddMemberRequest, out *proto.Group) (err error) {
func (s Service) AddMember(c context.Context, in *accountssvc.AddMemberRequest, out *accountsmsg.Group) (err error) {
// cleanup ids
var groupID string
if groupID, err = cleanupID(in.GroupId); err != nil {
@@ -232,7 +234,7 @@ func (s Service) AddMember(c context.Context, in *proto.AddMemberRequest, out *p
}
// load structs
a := &proto.Account{}
a := &accountsmsg.Account{}
if err = s.repo.LoadAccount(c, accountID, a); err != nil {
if storage.IsNotFoundErr(err) {
return merrors.NotFound(s.id, "group not found: %v", err.Error())
@@ -240,7 +242,7 @@ func (s Service) AddMember(c context.Context, in *proto.AddMemberRequest, out *p
return merrors.InternalServerError(s.id, "could not load group: %v", err.Error())
}
g := &proto.Group{}
g := &accountsmsg.Group{}
if err = s.repo.LoadGroup(c, groupID, g); err != nil {
if storage.IsNotFoundErr(err) {
return merrors.NotFound(s.id, "could not load group: %v", err.Error())
@@ -255,7 +257,7 @@ func (s Service) AddMember(c context.Context, in *proto.AddMemberRequest, out *p
alreadyRelated = true
}
}
aref := &proto.Account{
aref := &accountsmsg.Account{
Id: a.Id,
}
if !alreadyRelated {
@@ -271,7 +273,7 @@ func (s Service) AddMember(c context.Context, in *proto.AddMemberRequest, out *p
}
}
// only store the reference to prevent recursion when marshaling json
gref := &proto.Group{
gref := &accountsmsg.Group{
Id: g.Id,
}
if !alreadyRelated {
@@ -292,7 +294,7 @@ func (s Service) AddMember(c context.Context, in *proto.AddMemberRequest, out *p
}
// RemoveMember implements the GroupsServiceHandler interface
func (s Service) RemoveMember(c context.Context, in *proto.RemoveMemberRequest, out *proto.Group) (err error) {
func (s Service) RemoveMember(c context.Context, in *accountssvc.RemoveMemberRequest, out *accountsmsg.Group) (err error) {
// cleanup ids
var groupID string
@@ -306,7 +308,7 @@ func (s Service) RemoveMember(c context.Context, in *proto.RemoveMemberRequest,
}
// load structs
a := &proto.Account{}
a := &accountsmsg.Account{}
if err = s.repo.LoadAccount(c, accountID, a); err != nil {
if storage.IsNotFoundErr(err) {
return merrors.NotFound(s.id, "could not load account: %v", err.Error())
@@ -315,7 +317,7 @@ func (s Service) RemoveMember(c context.Context, in *proto.RemoveMemberRequest,
return merrors.InternalServerError(s.id, "could not load account: %v", err.Error())
}
g := &proto.Group{}
g := &accountsmsg.Group{}
if err = s.repo.LoadGroup(c, groupID, g); err != nil {
if storage.IsNotFoundErr(err) {
return merrors.NotFound(s.id, "could not load group: %v", err.Error())
@@ -325,7 +327,7 @@ func (s Service) RemoveMember(c context.Context, in *proto.RemoveMemberRequest,
}
//remove the account from the group if it exists
newMembers := []*proto.Account{}
newMembers := []*accountsmsg.Account{}
for i := range g.Members {
if g.Members[i].Id != a.Id {
newMembers = append(newMembers, g.Members[i])
@@ -334,7 +336,7 @@ func (s Service) RemoveMember(c context.Context, in *proto.RemoveMemberRequest,
g.Members = newMembers
// remove the group from the account if it exists
newGroups := []*proto.Group{}
newGroups := []*accountsmsg.Group{}
for i := range a.MemberOf {
if a.MemberOf[i].Id != g.Id {
newGroups = append(newGroups, a.MemberOf[i])
@@ -358,14 +360,14 @@ func (s Service) RemoveMember(c context.Context, in *proto.RemoveMemberRequest,
}
// ListMembers implements the GroupsServiceHandler interface
func (s Service) ListMembers(c context.Context, in *proto.ListMembersRequest, out *proto.ListMembersResponse) (err error) {
func (s Service) ListMembers(c context.Context, in *accountssvc.ListMembersRequest, out *accountssvc.ListMembersResponse) (err error) {
// cleanup ids
var groupID string
if groupID, err = cleanupID(in.Id); err != nil {
return merrors.InternalServerError(s.id, "could not clean up group id: %v", err.Error())
}
g := &proto.Group{}
g := &accountsmsg.Group{}
if err = s.repo.LoadGroup(c, groupID, g); err != nil {
if storage.IsNotFoundErr(err) {
return merrors.NotFound(s.id, "group not found: %v", err.Error())

View File

@@ -4,16 +4,18 @@ import (
"context"
"fmt"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/owncloud/ocis/accounts/pkg/storage"
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocis-pkg/indexer"
"github.com/owncloud/ocis/ocis-pkg/indexer/config"
"github.com/owncloud/ocis/ocis-pkg/indexer/option"
)
// RebuildIndex deletes all indices (in memory and on storage) and rebuilds them from scratch.
func (s Service) RebuildIndex(ctx context.Context, request *proto.RebuildIndexRequest, response *proto.RebuildIndexResponse) error {
func (s Service) RebuildIndex(ctx context.Context, request *accountssvc.RebuildIndexRequest, response *accountssvc.RebuildIndexResponse) error {
if err := s.index.Reset(); err != nil {
return fmt.Errorf("failed to delete index containers: %w", err)
}
@@ -36,26 +38,26 @@ func (s Service) RebuildIndex(ctx context.Context, request *proto.RebuildIndexRe
// recreateContainers adds all indices to the indexer that we have for this service.
func recreateContainers(idx *indexer.Indexer, cfg *config.Config) error {
// Accounts
if err := idx.AddIndex(&proto.Account{}, "Id", "Id", "accounts", "non_unique", nil, true); err != nil {
if err := idx.AddIndex(&accountsmsg.Account{}, "Id", "Id", "accounts", "non_unique", nil, true); err != nil {
return err
}
if err := idx.AddIndex(&proto.Account{}, "DisplayName", "Id", "accounts", "non_unique", nil, true); err != nil {
if err := idx.AddIndex(&accountsmsg.Account{}, "DisplayName", "Id", "accounts", "non_unique", nil, true); err != nil {
return err
}
if err := idx.AddIndex(&proto.Account{}, "Mail", "Id", "accounts", "unique", nil, true); err != nil {
if err := idx.AddIndex(&accountsmsg.Account{}, "Mail", "Id", "accounts", "unique", nil, true); err != nil {
return err
}
if err := idx.AddIndex(&proto.Account{}, "OnPremisesSamAccountName", "Id", "accounts", "unique", nil, true); err != nil {
if err := idx.AddIndex(&accountsmsg.Account{}, "OnPremisesSamAccountName", "Id", "accounts", "unique", nil, true); err != nil {
return err
}
if err := idx.AddIndex(&proto.Account{}, "PreferredName", "Id", "accounts", "unique", nil, true); err != nil {
if err := idx.AddIndex(&accountsmsg.Account{}, "PreferredName", "Id", "accounts", "unique", nil, true); err != nil {
return err
}
if err := idx.AddIndex(&proto.Account{}, "UidNumber", "Id", "accounts", "autoincrement", &option.Bound{
if err := idx.AddIndex(&accountsmsg.Account{}, "UidNumber", "Id", "accounts", "autoincrement", &option.Bound{
Lower: cfg.Index.UID.Lower,
Upper: cfg.Index.UID.Upper,
}, false); err != nil {
@@ -63,15 +65,15 @@ func recreateContainers(idx *indexer.Indexer, cfg *config.Config) error {
}
// Groups
if err := idx.AddIndex(&proto.Group{}, "OnPremisesSamAccountName", "Id", "groups", "unique", nil, false); err != nil {
if err := idx.AddIndex(&accountsmsg.Group{}, "OnPremisesSamAccountName", "Id", "groups", "unique", nil, false); err != nil {
return err
}
if err := idx.AddIndex(&proto.Group{}, "DisplayName", "Id", "groups", "non_unique", nil, false); err != nil {
if err := idx.AddIndex(&accountsmsg.Group{}, "DisplayName", "Id", "groups", "non_unique", nil, false); err != nil {
return err
}
if err := idx.AddIndex(&proto.Group{}, "GidNumber", "Id", "groups", "autoincrement", &option.Bound{
if err := idx.AddIndex(&accountsmsg.Group{}, "GidNumber", "Id", "groups", "autoincrement", &option.Bound{
Lower: cfg.Index.GID.Lower,
Upper: cfg.Index.GID.Upper,
}, false); err != nil {
@@ -83,7 +85,7 @@ func recreateContainers(idx *indexer.Indexer, cfg *config.Config) error {
// reindexDocuments loads all existing documents and adds them to the index.
func reindexDocuments(ctx context.Context, repo storage.Repo, index *indexer.Indexer) error {
accounts := make([]*proto.Account, 0)
accounts := make([]*accountsmsg.Account, 0)
if err := repo.LoadAccounts(ctx, &accounts); err != nil {
return err
}
@@ -94,7 +96,7 @@ func reindexDocuments(ctx context.Context, repo storage.Repo, index *indexer.Ind
}
}
groups := make([]*proto.Group, 0)
groups := make([]*accountsmsg.Group, 0)
if err := repo.LoadGroups(ctx, &groups); err != nil {
return err
}

View File

@@ -4,7 +4,7 @@ import (
"github.com/owncloud/ocis/accounts/pkg/config"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/ocis-pkg/roles"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
)
// Option defines a single option function.
@@ -14,7 +14,7 @@ type Option func(o *Options)
type Options struct {
Logger log.Logger
Config *config.Config
RoleService settings.RoleService
RoleService settingssvc.RoleService
RoleManager *roles.Manager
}
@@ -43,7 +43,7 @@ func Config(val *config.Config) Option {
}
// RoleService provides a function to set the RoleService option.
func RoleService(val settings.RoleService) Option {
func RoleService(val settingssvc.RoleService) Option {
return func(o *Options) {
o.RoleService = val
}

View File

@@ -6,7 +6,8 @@ import (
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
olog "github.com/owncloud/ocis/ocis-pkg/log"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
settingsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/settings/v0"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
ssvc "github.com/owncloud/ocis/settings/pkg/service/v0"
)
@@ -27,7 +28,7 @@ const (
// RegisterPermissions registers permissions for account management and group management with the settings service.
func RegisterPermissions(l *olog.Logger) {
service := settings.NewBundleService("com.owncloud.api.settings", grpc.DefaultClient)
service := settingssvc.NewBundleService("com.owncloud.api.settings", grpc.DefaultClient)
permissionRequests := generateAccountManagementPermissionsRequests()
for i := range permissionRequests {
@@ -41,61 +42,61 @@ func RegisterPermissions(l *olog.Logger) {
}
}
func generateAccountManagementPermissionsRequests() []settings.AddSettingToBundleRequest {
return []settings.AddSettingToBundleRequest{
func generateAccountManagementPermissionsRequests() []settingssvc.AddSettingToBundleRequest {
return []settingssvc.AddSettingToBundleRequest{
{
BundleId: ssvc.BundleUUIDRoleAdmin,
Setting: &settings.Setting{
Setting: &settingsmsg.Setting{
Id: AccountManagementPermissionID,
Name: AccountManagementPermissionName,
DisplayName: "Account Management",
Description: "This permission gives full access to everything that is related to account management.",
Resource: &settings.Resource{
Type: settings.Resource_TYPE_USER,
Resource: &settingsmsg.Resource{
Type: settingsmsg.Resource_TYPE_USER,
Id: "all",
},
Value: &settings.Setting_PermissionValue{
PermissionValue: &settings.Permission{
Operation: settings.Permission_OPERATION_READWRITE,
Constraint: settings.Permission_CONSTRAINT_ALL,
Value: &settingsmsg.Setting_PermissionValue{
PermissionValue: &settingsmsg.Permission{
Operation: settingsmsg.Permission_OPERATION_READWRITE,
Constraint: settingsmsg.Permission_CONSTRAINT_ALL,
},
},
},
},
{
BundleId: ssvc.BundleUUIDRoleAdmin,
Setting: &settings.Setting{
Setting: &settingsmsg.Setting{
Id: GroupManagementPermissionID,
Name: GroupManagementPermissionName,
DisplayName: "Group Management",
Description: "This permission gives full access to everything that is related to group management.",
Resource: &settings.Resource{
Type: settings.Resource_TYPE_GROUP,
Resource: &settingsmsg.Resource{
Type: settingsmsg.Resource_TYPE_GROUP,
Id: "all",
},
Value: &settings.Setting_PermissionValue{
PermissionValue: &settings.Permission{
Operation: settings.Permission_OPERATION_READWRITE,
Constraint: settings.Permission_CONSTRAINT_ALL,
Value: &settingsmsg.Setting_PermissionValue{
PermissionValue: &settingsmsg.Permission{
Operation: settingsmsg.Permission_OPERATION_READWRITE,
Constraint: settingsmsg.Permission_CONSTRAINT_ALL,
},
},
},
},
{
BundleId: ssvc.BundleUUIDRoleUser,
Setting: &settings.Setting{
Setting: &settingsmsg.Setting{
Id: SelfManagementPermissionID,
Name: SelfManagementPermissionName,
DisplayName: "Self Management",
Description: "This permission gives access to self management.",
Resource: &settings.Resource{
Type: settings.Resource_TYPE_USER,
Resource: &settingsmsg.Resource{
Type: settingsmsg.Resource_TYPE_USER,
Id: "me",
},
Value: &settings.Setting_PermissionValue{
PermissionValue: &settings.Permission{
Operation: settings.Permission_OPERATION_READWRITE,
Constraint: settings.Permission_CONSTRAINT_OWN,
Value: &settingsmsg.Setting_PermissionValue{
PermissionValue: &settingsmsg.Permission{
Operation: settingsmsg.Permission_OPERATION_READWRITE,
Constraint: settingsmsg.Permission_CONSTRAINT_OWN,
},
},
},

View File

@@ -8,6 +8,7 @@ import (
"strings"
"time"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
"github.com/pkg/errors"
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
@@ -18,11 +19,10 @@ import (
idxerrs "github.com/owncloud/ocis/ocis-pkg/indexer/errors"
"github.com/owncloud/ocis/accounts/pkg/config"
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocis-pkg/log"
oreg "github.com/owncloud/ocis/ocis-pkg/registry"
"github.com/owncloud/ocis/ocis-pkg/roles"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
)
// userDefaultGID is the default integer representing the "users" group.
@@ -36,7 +36,7 @@ func New(opts ...Option) (s *Service, err error) {
roleService := options.RoleService
if roleService == nil {
roleService = settings.NewRoleService("com.owncloud.api.settings", grpc.DefaultClient)
roleService = settingssvc.NewRoleService("com.owncloud.api.settings", grpc.DefaultClient)
}
roleManager := options.RoleManager
if roleManager == nil {
@@ -162,7 +162,7 @@ func configFromSvc(cfg *config.Config) (*idxcfg.Config, error) {
}
func (s Service) createDefaultAccounts(withDemoAccounts bool) (err error) {
accounts := []proto.Account{
accounts := []accountsmsg.Account{
{
Id: "4c510ada-c86b-4815-8820-42cdf82c3d51",
PreferredName: "einstein",
@@ -171,11 +171,11 @@ func (s Service) createDefaultAccounts(withDemoAccounts bool) (err error) {
DisplayName: "Albert Einstein",
UidNumber: 20000,
GidNumber: 30000,
PasswordProfile: &proto.PasswordProfile{
PasswordProfile: &accountsmsg.PasswordProfile{
Password: "$2a$11$4WNffzgU/WrIRiDnwu8OnOwgOIIUqR/2Ptvp7WJAQCTSgSrylyuvC",
},
AccountEnabled: true,
MemberOf: []*proto.Group{
MemberOf: []*accountsmsg.Group{
{Id: "509a9dcd-bb37-4f4f-a01a-19dca27d9cfa"}, // users
{Id: "6040aa17-9c64-4fef-9bd0-77234d71bad0"}, // sailing-lovers
{Id: "dd58e5ec-842e-498b-8800-61f2ec6f911f"}, // violin-haters
@@ -190,11 +190,11 @@ func (s Service) createDefaultAccounts(withDemoAccounts bool) (err error) {
DisplayName: "Marie Curie",
UidNumber: 20001,
GidNumber: 30000,
PasswordProfile: &proto.PasswordProfile{
PasswordProfile: &accountsmsg.PasswordProfile{
Password: "$2a$11$Wu2XcDnE6G2No8C88FVWluNHyXuQQi0cHzSe82Vni8AdwIO12fphC",
},
AccountEnabled: true,
MemberOf: []*proto.Group{
MemberOf: []*accountsmsg.Group{
{Id: "509a9dcd-bb37-4f4f-a01a-19dca27d9cfa"}, // users
{Id: "7b87fd49-286e-4a5f-bafd-c535d5dd997a"}, // radium-lovers
{Id: "cedc21aa-4072-4614-8676-fa9165f598ff"}, // polonium-lovers
@@ -209,11 +209,11 @@ func (s Service) createDefaultAccounts(withDemoAccounts bool) (err error) {
DisplayName: "Richard Feynman",
UidNumber: 20002,
GidNumber: 30000,
PasswordProfile: &proto.PasswordProfile{
PasswordProfile: &accountsmsg.PasswordProfile{
Password: "$2a$11$6Lak4zh1xUkpObg2rrOotOTdQYGj2Uu/sowcVLhub.8qYIr.CxzEW",
},
AccountEnabled: true,
MemberOf: []*proto.Group{
MemberOf: []*accountsmsg.Group{
{Id: "509a9dcd-bb37-4f4f-a01a-19dca27d9cfa"}, // users
{Id: "a1726108-01f8-4c30-88df-2b1a9d1cba1a"}, // quantum-lovers
{Id: "167cbee2-0518-455a-bfb2-031fe0621e5d"}, // philosophy-haters
@@ -229,11 +229,11 @@ func (s Service) createDefaultAccounts(withDemoAccounts bool) (err error) {
DisplayName: "Maurice Moss",
UidNumber: 20003,
GidNumber: 30000,
PasswordProfile: &proto.PasswordProfile{
PasswordProfile: &accountsmsg.PasswordProfile{
Password: "$2a$11$jvI6PHuvrimpcCHzL2Q2WOqfm1FGdYAuSYZBDahr/B48fpiFxyDy2",
},
AccountEnabled: true,
MemberOf: []*proto.Group{
MemberOf: []*accountsmsg.Group{
{Id: "509a9dcd-bb37-4f4f-a01a-19dca27d9cfa"}, // users
},
},
@@ -245,11 +245,11 @@ func (s Service) createDefaultAccounts(withDemoAccounts bool) (err error) {
DisplayName: "Admin",
UidNumber: 20004,
GidNumber: 30000,
PasswordProfile: &proto.PasswordProfile{
PasswordProfile: &accountsmsg.PasswordProfile{
Password: "$2a$11$En9VIUtqOdDyUl.LuUq2KeuBb5A2n8zE0lkJ2v6IDRSaOamhNq6Uu",
},
AccountEnabled: true,
MemberOf: []*proto.Group{
MemberOf: []*accountsmsg.Group{
{Id: "509a9dcd-bb37-4f4f-a01a-19dca27d9cfa"}, // users
},
},
@@ -262,11 +262,11 @@ func (s Service) createDefaultAccounts(withDemoAccounts bool) (err error) {
DisplayName: "Kopano IDP",
UidNumber: 10000,
GidNumber: 15000,
PasswordProfile: &proto.PasswordProfile{
PasswordProfile: &accountsmsg.PasswordProfile{
Password: "$2y$12$ywfGLDPsSlBTVZU0g.2GZOPO8Wap3rVOpm8e3192VlytNdGWH7x72",
},
AccountEnabled: true,
MemberOf: []*proto.Group{
MemberOf: []*accountsmsg.Group{
{Id: "34f38767-c937-4eb6-b847-1c175829a2a0"}, // sysusers
},
},
@@ -278,11 +278,11 @@ func (s Service) createDefaultAccounts(withDemoAccounts bool) (err error) {
DisplayName: "Reva Inter Operability Platform",
UidNumber: 10001,
GidNumber: 15000,
PasswordProfile: &proto.PasswordProfile{
PasswordProfile: &accountsmsg.PasswordProfile{
Password: "$2a$11$40xzy3rO8Tq4j2VkFbKz8Ow19BRaqaixEjAR0IbvQXxtOvMtkjwzy",
},
AccountEnabled: true,
MemberOf: []*proto.Group{
MemberOf: []*accountsmsg.Group{
{Id: "34f38767-c937-4eb6-b847-1c175829a2a0"}, // sysusers
},
},
@@ -300,7 +300,7 @@ func (s Service) createDefaultAccounts(withDemoAccounts bool) (err error) {
continue
}
a := &proto.Account{}
a := &accountsmsg.Account{}
err := s.repo.LoadAccount(context.Background(), accounts[i].Id, a)
if !storage.IsNotFoundErr(err) {
continue // account already exists -> do not overwrite
@@ -344,35 +344,35 @@ func (s Service) createDefaultAccounts(withDemoAccounts bool) (err error) {
}
func (s Service) createDefaultGroups(withDemoGroups bool) (err error) {
groups := []proto.Group{
{Id: "34f38767-c937-4eb6-b847-1c175829a2a0", GidNumber: 15000, OnPremisesSamAccountName: "sysusers", DisplayName: "Technical users", Description: "A group for technical users. They should not show up in sharing dialogs.", Members: []*proto.Account{
groups := []accountsmsg.Group{
{Id: "34f38767-c937-4eb6-b847-1c175829a2a0", GidNumber: 15000, OnPremisesSamAccountName: "sysusers", DisplayName: "Technical users", Description: "A group for technical users. They should not show up in sharing dialogs.", Members: []*accountsmsg.Account{
{Id: "820ba2a1-3f54-4538-80a4-2d73007e30bf"}, // idp
{Id: "bc596f3c-c955-4328-80a0-60d018b4ad57"}, // reva
}},
{Id: "509a9dcd-bb37-4f4f-a01a-19dca27d9cfa", GidNumber: 30000, OnPremisesSamAccountName: "users", DisplayName: "Users", Description: "A group every normal user belongs to.", Members: []*proto.Account{
{Id: "509a9dcd-bb37-4f4f-a01a-19dca27d9cfa", GidNumber: 30000, OnPremisesSamAccountName: "users", DisplayName: "Users", Description: "A group every normal user belongs to.", Members: []*accountsmsg.Account{
{Id: "4c510ada-c86b-4815-8820-42cdf82c3d51"}, // einstein
{Id: "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"}, // marie
{Id: "932b4540-8d16-481e-8ef4-588e4b6b151c"}, // feynman
}},
{Id: "6040aa17-9c64-4fef-9bd0-77234d71bad0", GidNumber: 30001, OnPremisesSamAccountName: "sailing-lovers", DisplayName: "Sailing lovers", Members: []*proto.Account{
{Id: "6040aa17-9c64-4fef-9bd0-77234d71bad0", GidNumber: 30001, OnPremisesSamAccountName: "sailing-lovers", DisplayName: "Sailing lovers", Members: []*accountsmsg.Account{
{Id: "4c510ada-c86b-4815-8820-42cdf82c3d51"}, // einstein
}},
{Id: "dd58e5ec-842e-498b-8800-61f2ec6f911f", GidNumber: 30002, OnPremisesSamAccountName: "violin-haters", DisplayName: "Violin haters", Members: []*proto.Account{
{Id: "dd58e5ec-842e-498b-8800-61f2ec6f911f", GidNumber: 30002, OnPremisesSamAccountName: "violin-haters", DisplayName: "Violin haters", Members: []*accountsmsg.Account{
{Id: "4c510ada-c86b-4815-8820-42cdf82c3d51"}, // einstein
}},
{Id: "7b87fd49-286e-4a5f-bafd-c535d5dd997a", GidNumber: 30003, OnPremisesSamAccountName: "radium-lovers", DisplayName: "Radium lovers", Members: []*proto.Account{
{Id: "7b87fd49-286e-4a5f-bafd-c535d5dd997a", GidNumber: 30003, OnPremisesSamAccountName: "radium-lovers", DisplayName: "Radium lovers", Members: []*accountsmsg.Account{
{Id: "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"}, // marie
}},
{Id: "cedc21aa-4072-4614-8676-fa9165f598ff", GidNumber: 30004, OnPremisesSamAccountName: "polonium-lovers", DisplayName: "Polonium lovers", Members: []*proto.Account{
{Id: "cedc21aa-4072-4614-8676-fa9165f598ff", GidNumber: 30004, OnPremisesSamAccountName: "polonium-lovers", DisplayName: "Polonium lovers", Members: []*accountsmsg.Account{
{Id: "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"}, // marie
}},
{Id: "a1726108-01f8-4c30-88df-2b1a9d1cba1a", GidNumber: 30005, OnPremisesSamAccountName: "quantum-lovers", DisplayName: "Quantum lovers", Members: []*proto.Account{
{Id: "a1726108-01f8-4c30-88df-2b1a9d1cba1a", GidNumber: 30005, OnPremisesSamAccountName: "quantum-lovers", DisplayName: "Quantum lovers", Members: []*accountsmsg.Account{
{Id: "932b4540-8d16-481e-8ef4-588e4b6b151c"}, // feynman
}},
{Id: "167cbee2-0518-455a-bfb2-031fe0621e5d", GidNumber: 30006, OnPremisesSamAccountName: "philosophy-haters", DisplayName: "Philosophy haters", Members: []*proto.Account{
{Id: "167cbee2-0518-455a-bfb2-031fe0621e5d", GidNumber: 30006, OnPremisesSamAccountName: "philosophy-haters", DisplayName: "Philosophy haters", Members: []*accountsmsg.Account{
{Id: "932b4540-8d16-481e-8ef4-588e4b6b151c"}, // feynman
}},
{Id: "262982c1-2362-4afa-bfdf-8cbfef64a06e", GidNumber: 30007, OnPremisesSamAccountName: "physics-lovers", DisplayName: "Physics lovers", Members: []*proto.Account{
{Id: "262982c1-2362-4afa-bfdf-8cbfef64a06e", GidNumber: 30007, OnPremisesSamAccountName: "physics-lovers", DisplayName: "Physics lovers", Members: []*accountsmsg.Account{
{Id: "4c510ada-c86b-4815-8820-42cdf82c3d51"}, // einstein
{Id: "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"}, // marie
{Id: "932b4540-8d16-481e-8ef4-588e4b6b151c"}, // feynman
@@ -389,7 +389,7 @@ func (s Service) createDefaultGroups(withDemoGroups bool) (err error) {
continue
}
g := &proto.Group{}
g := &accountsmsg.Group{}
err := s.repo.LoadGroup(context.Background(), groups[i].Id, g)
if !storage.IsNotFoundErr(err) {
continue // group already exists -> do not overwrite
@@ -447,7 +447,7 @@ type Service struct {
log log.Logger
Config *config.Config
index *indexer.Indexer
RoleService settings.RoleService
RoleService settingssvc.RoleService
RoleManager *roles.Manager
repo storage.Repo
}

View File

@@ -16,9 +16,9 @@ import (
"github.com/cs3org/reva/pkg/token/manager/jwt"
"github.com/cs3org/reva/pkg/utils"
"github.com/owncloud/ocis/accounts/pkg/config"
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
olog "github.com/owncloud/ocis/ocis-pkg/log"
metadatastorage "github.com/owncloud/ocis/ocis-pkg/metadata_storage"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
"google.golang.org/grpc/metadata"
)
@@ -69,7 +69,7 @@ func NewCS3Repo(cfg *config.Config) (Repo, error) {
}
// WriteAccount writes an account via cs3 and modifies the provided account (e.g. with a generated id).
func (r CS3Repo) WriteAccount(ctx context.Context, a *proto.Account) (err error) {
func (r CS3Repo) WriteAccount(ctx context.Context, a *accountsmsg.Account) (err error) {
ctx, err = r.getAuthenticatedContext(ctx)
if err != nil {
return err
@@ -90,7 +90,7 @@ func (r CS3Repo) WriteAccount(ctx context.Context, a *proto.Account) (err error)
}
// LoadAccount loads an account via cs3 by id and writes it to the provided account
func (r CS3Repo) LoadAccount(ctx context.Context, id string, a *proto.Account) (err error) {
func (r CS3Repo) LoadAccount(ctx context.Context, id string, a *accountsmsg.Account) (err error) {
ctx, err = r.getAuthenticatedContext(ctx)
if err != nil {
return err
@@ -100,7 +100,7 @@ func (r CS3Repo) LoadAccount(ctx context.Context, id string, a *proto.Account) (
}
// LoadAccounts loads all the accounts from the cs3 api
func (r CS3Repo) LoadAccounts(ctx context.Context, a *[]*proto.Account) (err error) {
func (r CS3Repo) LoadAccounts(ctx context.Context, a *[]*accountsmsg.Account) (err error) {
ctx, err = r.getAuthenticatedContext(ctx)
if err != nil {
return err
@@ -118,7 +118,7 @@ func (r CS3Repo) LoadAccounts(ctx context.Context, a *[]*proto.Account) (err err
log := olog.NewLogger(olog.Pretty(r.cfg.Log.Pretty), olog.Color(r.cfg.Log.Color), olog.Level(r.cfg.Log.Level))
for i := range res.Infos {
acc := &proto.Account{}
acc := &accountsmsg.Account{}
err := r.loadAccount(ctx, filepath.Base(res.Infos[i].Path), acc)
if err != nil {
log.Err(err).Msg("could not load account")
@@ -129,7 +129,7 @@ func (r CS3Repo) LoadAccounts(ctx context.Context, a *[]*proto.Account) (err err
return nil
}
func (r CS3Repo) loadAccount(ctx context.Context, id string, a *proto.Account) error {
func (r CS3Repo) loadAccount(ctx context.Context, id string, a *accountsmsg.Account) error {
account, err := r.metadataStorage.SimpleDownload(ctx, r.accountURL(id))
if err != nil {
if metadatastorage.IsNotFoundErr(err) {
@@ -167,7 +167,7 @@ func (r CS3Repo) DeleteAccount(ctx context.Context, id string) (err error) {
}
// WriteGroup writes a group via cs3 and modifies the provided group (e.g. with a generated id).
func (r CS3Repo) WriteGroup(ctx context.Context, g *proto.Group) (err error) {
func (r CS3Repo) WriteGroup(ctx context.Context, g *accountsmsg.Group) (err error) {
ctx, err = r.getAuthenticatedContext(ctx)
if err != nil {
return err
@@ -187,7 +187,7 @@ func (r CS3Repo) WriteGroup(ctx context.Context, g *proto.Group) (err error) {
}
// LoadGroup loads a group via cs3 by id and writes it to the provided group
func (r CS3Repo) LoadGroup(ctx context.Context, id string, g *proto.Group) (err error) {
func (r CS3Repo) LoadGroup(ctx context.Context, id string, g *accountsmsg.Group) (err error) {
ctx, err = r.getAuthenticatedContext(ctx)
if err != nil {
return err
@@ -197,7 +197,7 @@ func (r CS3Repo) LoadGroup(ctx context.Context, id string, g *proto.Group) (err
}
// LoadGroups loads all the groups from the cs3 api
func (r CS3Repo) LoadGroups(ctx context.Context, g *[]*proto.Group) (err error) {
func (r CS3Repo) LoadGroups(ctx context.Context, g *[]*accountsmsg.Group) (err error) {
ctx, err = r.getAuthenticatedContext(ctx)
if err != nil {
return err
@@ -215,7 +215,7 @@ func (r CS3Repo) LoadGroups(ctx context.Context, g *[]*proto.Group) (err error)
log := olog.NewLogger(olog.Pretty(r.cfg.Log.Pretty), olog.Color(r.cfg.Log.Color), olog.Level(r.cfg.Log.Level))
for i := range res.Infos {
grp := &proto.Group{}
grp := &accountsmsg.Group{}
err := r.loadGroup(ctx, filepath.Base(res.Infos[i].Path), grp)
if err != nil {
log.Err(err).Msg("could not load account")
@@ -226,7 +226,7 @@ func (r CS3Repo) LoadGroups(ctx context.Context, g *[]*proto.Group) (err error)
return nil
}
func (r CS3Repo) loadGroup(ctx context.Context, id string, g *proto.Group) error {
func (r CS3Repo) loadGroup(ctx context.Context, id string, g *accountsmsg.Group) error {
group, err := r.metadataStorage.SimpleDownload(ctx, r.groupURL(id))
if err != nil {
if metadatastorage.IsNotFoundErr(err) {

View File

@@ -4,8 +4,8 @@ package storage
//import (
// "context"
// accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
// "github.com/owncloud/ocis/accounts/pkg/config"
// "github.com/owncloud/ocis/accounts/pkg/proto/v0"
// "github.com/stretchr/testify/assert"
// "testing"
//)
@@ -25,7 +25,7 @@ package storage
// r, err := NewCS3Repo("hello", cfg)
// assert.NoError(t, err)
//
// err = r.WriteAccount(context.Background(), &proto.Account{
// err = r.WriteAccount(context.Background(), &accountsmsg.Account{
// Id: "fefef-egegweg-gegeg",
// AccountEnabled: true,
// DisplayName: "Mike Jones",
@@ -39,14 +39,14 @@ package storage
// r, err := NewCS3Repo("hello", cfg)
// assert.NoError(t, err)
//
// err = r.WriteAccount(context.Background(), &proto.Account{
// err = r.WriteAccount(context.Background(), &accountsmsg.Account{
// Id: "fefef-egegweg-gegeg",
// AccountEnabled: true,
// DisplayName: "Mike Jones",
// Mail: "mike@example.com",
// })
//
// acc := &proto.Account{}
// acc := &accountsmsg.Account{}
// err = r.LoadAccount(context.Background(), "fefef-egegweg-gegeg", acc)
//
// assert.NoError(t, err)
@@ -59,7 +59,7 @@ package storage
// r, err := NewCS3Repo("hello", cfg)
// assert.NoError(t, err)
//
// err = r.WriteAccount(context.Background(), &proto.Account{
// err = r.WriteAccount(context.Background(), &accountsmsg.Account{
// Id: "delete-me-id",
// AccountEnabled: true,
// DisplayName: "Mike Jones",

View File

@@ -8,8 +8,9 @@ import (
"path/filepath"
"sync"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
"github.com/owncloud/ocis/accounts/pkg/config"
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
olog "github.com/owncloud/ocis/ocis-pkg/log"
)
@@ -43,7 +44,7 @@ func NewDiskRepo(cfg *config.Config, log olog.Logger) DiskRepo {
}
// WriteAccount to the local filesystem
func (r DiskRepo) WriteAccount(ctx context.Context, a *proto.Account) (err error) {
func (r DiskRepo) WriteAccount(ctx context.Context, a *accountsmsg.Account) (err error) {
// leave only the group id
r.deflateMemberOf(a)
@@ -57,7 +58,7 @@ func (r DiskRepo) WriteAccount(ctx context.Context, a *proto.Account) (err error
}
// LoadAccount from the local filesystem
func (r DiskRepo) LoadAccount(ctx context.Context, id string, a *proto.Account) (err error) {
func (r DiskRepo) LoadAccount(ctx context.Context, id string, a *accountsmsg.Account) (err error) {
path := filepath.Join(r.cfg.Repo.Disk.Path, accountsFolder, id)
var data []byte
if data, err = ioutil.ReadFile(path); err != nil {
@@ -71,14 +72,14 @@ func (r DiskRepo) LoadAccount(ctx context.Context, id string, a *proto.Account)
}
// LoadAccounts loads all the accounts from the local filesystem
func (r DiskRepo) LoadAccounts(ctx context.Context, a *[]*proto.Account) (err error) {
func (r DiskRepo) LoadAccounts(ctx context.Context, a *[]*accountsmsg.Account) (err error) {
root := filepath.Join(r.cfg.Repo.Disk.Path, accountsFolder)
infos, err := ioutil.ReadDir(root)
if err != nil {
return err
}
for i := range infos {
acc := &proto.Account{}
acc := &accountsmsg.Account{}
if e := r.LoadAccount(ctx, infos[i].Name(), acc); e != nil {
r.log.Err(e).Msg("could not load account")
continue
@@ -101,7 +102,7 @@ func (r DiskRepo) DeleteAccount(ctx context.Context, id string) (err error) {
}
// WriteGroup to the local filesystem
func (r DiskRepo) WriteGroup(ctx context.Context, g *proto.Group) (err error) {
func (r DiskRepo) WriteGroup(ctx context.Context, g *accountsmsg.Group) (err error) {
// leave only the member id
r.deflateMembers(g)
@@ -119,7 +120,7 @@ func (r DiskRepo) WriteGroup(ctx context.Context, g *proto.Group) (err error) {
}
// LoadGroup from the local filesystem
func (r DiskRepo) LoadGroup(ctx context.Context, id string, g *proto.Group) (err error) {
func (r DiskRepo) LoadGroup(ctx context.Context, id string, g *accountsmsg.Group) (err error) {
path := filepath.Join(r.cfg.Repo.Disk.Path, groupsFolder, id)
groupLock.Lock()
@@ -137,14 +138,14 @@ func (r DiskRepo) LoadGroup(ctx context.Context, id string, g *proto.Group) (err
}
// LoadGroups loads all the groups from the local filesystem
func (r DiskRepo) LoadGroups(ctx context.Context, g *[]*proto.Group) (err error) {
func (r DiskRepo) LoadGroups(ctx context.Context, g *[]*accountsmsg.Group) (err error) {
root := filepath.Join(r.cfg.Repo.Disk.Path, groupsFolder)
infos, err := ioutil.ReadDir(root)
if err != nil {
return err
}
for i := range infos {
grp := &proto.Group{}
grp := &accountsmsg.Group{}
if e := r.LoadGroup(ctx, infos[i].Name(), grp); e != nil {
r.log.Err(e).Msg("could not load group")
continue
@@ -167,14 +168,14 @@ func (r DiskRepo) DeleteGroup(ctx context.Context, id string) (err error) {
}
// deflateMemberOf replaces the groups of a user with an instance that only contains the id
func (r DiskRepo) deflateMemberOf(a *proto.Account) {
func (r DiskRepo) deflateMemberOf(a *accountsmsg.Account) {
if a == nil {
return
}
var deflated []*proto.Group
var deflated []*accountsmsg.Group
for i := range a.MemberOf {
if a.MemberOf[i].Id != "" {
deflated = append(deflated, &proto.Group{Id: a.MemberOf[i].Id})
deflated = append(deflated, &accountsmsg.Group{Id: a.MemberOf[i].Id})
} else {
// TODO fetch and use an id when group only has a name but no id
r.log.Error().Str("id", a.Id).Interface("group", a.MemberOf[i]).Msg("resolving groups by name is not implemented yet")
@@ -184,14 +185,14 @@ func (r DiskRepo) deflateMemberOf(a *proto.Account) {
}
// deflateMembers replaces the users of a group with an instance that only contains the id
func (r DiskRepo) deflateMembers(g *proto.Group) {
func (r DiskRepo) deflateMembers(g *accountsmsg.Group) {
if g == nil {
return
}
var deflated []*proto.Account
var deflated []*accountsmsg.Account
for i := range g.Members {
if g.Members[i].Id != "" {
deflated = append(deflated, &proto.Account{Id: g.Members[i].Id})
deflated = append(deflated, &accountsmsg.Account{Id: g.Members[i].Id})
} else {
// TODO fetch and use an id when group only has a name but no id
r.log.Error().Str("id", g.Id).Interface("account", g.Members[i]).Msg("resolving members by name is not implemented yet")

View File

@@ -3,7 +3,7 @@ package storage
import (
"context"
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
)
const (
@@ -13,12 +13,12 @@ const (
// Repo defines the storage operations
type Repo interface {
WriteAccount(ctx context.Context, a *proto.Account) (err error)
LoadAccount(ctx context.Context, id string, a *proto.Account) (err error)
LoadAccounts(ctx context.Context, a *[]*proto.Account) (err error)
WriteAccount(ctx context.Context, a *accountsmsg.Account) (err error)
LoadAccount(ctx context.Context, id string, a *accountsmsg.Account) (err error)
LoadAccounts(ctx context.Context, a *[]*accountsmsg.Account) (err error)
DeleteAccount(ctx context.Context, id string) (err error)
WriteGroup(ctx context.Context, g *proto.Group) (err error)
LoadGroup(ctx context.Context, id string, g *proto.Group) (err error)
LoadGroups(ctx context.Context, g *[]*proto.Group) (err error)
WriteGroup(ctx context.Context, g *accountsmsg.Group) (err error)
LoadGroup(ctx context.Context, id string, g *accountsmsg.Group) (err error)
LoadGroups(ctx context.Context, g *[]*accountsmsg.Group) (err error)
DeleteGroup(ctx context.Context, id string) (err error)
}

View File

@@ -1,75 +0,0 @@
---
title: "GRPC API"
date: 2018-05-02T00:00:00+00:00
weight: 50
geekdocRepo: https://github.com/owncloud/ocis-thumbnails
geekdocEditPath: edit/master/docs
geekdocFilePath: grpc.md
---
{{`{{< toc >}}`}}
{{ range .Files -}}
## {{ .Name }}
{{ .Description }}
{{- range .Messages -}}
{{- /* remove newline */}}### {{ .LongName }}
{{ .Description }}
{{ if .HasFields -}}
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
{{ range .Fields -}}
| {{.Name}} | [{{.LongType}}](#{{.LongType | lower | replace "." "" }}) | {{.Label}} | {{nobr .Description}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end }} |
{{ end -}}
{{ end }}
{{ if .HasExtensions -}}
| Extension | Type | Base | Number | Description |
| --------- | ---- | ---- | ------ | ----------- |
{{ range .Extensions -}}
| {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{nobr .Description}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end}} |
{{ end -}}
{{ end -}}
{{ end -}}
{{- range .Enums -}}
### {{ .LongName }}
{{ .Description }}
| Name | Number | Description |
| ---- | ------ | ----------- |
{{range .Values -}}
| {{.Name}} | {{.Number}} | {{nobr .Description}} |
{{ end -}}
{{ end -}}
{{ if .HasExtensions }}
### File-level Extensions
| Extension | Type | Base | Number | Description |
| --------- | ---- | ---- | ------ | ----------- |
{{ range .Extensions -}}
| {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{nobr .Description}}{{if .DefaultValue}} Default: `{{.DefaultValue}}`{{end}} |
{{ end -}}
{{ end -}}
{{- range .Services }}
### {{ .Name }}
{{ .Description }}
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
{{ range .Methods -}}
| {{.Name}} | [{{.RequestLongType}}](#{{.RequestLongType | lower | replace "." "" }}){{if .RequestStreaming}} stream{{end}} | [{{.ResponseLongType}}](#{{.ResponseLongType | lower | replace "." "" }}){{if .ResponseStreaming}} stream{{end}} | {{nobr .Description}} |
{{ end -}}
{{ end -}}
{{ end }}
## Scalar Value Types
| .proto Type | Notes | C++ | Java |
| ----------- | ----- | --- | ---- |
{{ range .Scalars -}}
| {{`{{< div id="`}}{{.ProtoType}}{{`" content="`}}{{.ProtoType}}{{`" >}}`}} | {{.Notes}} | {{.CppType}} | {{.JavaType}} |
{{ end }}

View File

@@ -25,7 +25,7 @@ export const request = (method, url, body, queryParameters, form, config) => {
}
}
/*==========================================================
*
*
==========================================================*/
/**
* Creates an account
@@ -33,7 +33,7 @@ export const request = (method, url, body, queryParameters, form, config) => {
* url: AccountsService_CreateAccountURL
* method: AccountsService_CreateAccount_TYPE
* raw_url: AccountsService_CreateAccount_RAW_URL
* @param body -
* @param body -
*/
export const AccountsService_CreateAccount = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -79,7 +79,7 @@ export const AccountsService_CreateAccountURL = function(parameters = {}) {
* url: AccountsService_DeleteAccountURL
* method: AccountsService_DeleteAccount_TYPE
* raw_url: AccountsService_DeleteAccount_RAW_URL
* @param body -
* @param body -
*/
export const AccountsService_DeleteAccount = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -125,7 +125,7 @@ export const AccountsService_DeleteAccountURL = function(parameters = {}) {
* url: AccountsService_GetAccountURL
* method: AccountsService_GetAccount_TYPE
* raw_url: AccountsService_GetAccount_RAW_URL
* @param body -
* @param body -
*/
export const AccountsService_GetAccount = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -171,7 +171,7 @@ export const AccountsService_GetAccountURL = function(parameters = {}) {
* url: AccountsService_ListAccountsURL
* method: AccountsService_ListAccounts_TYPE
* raw_url: AccountsService_ListAccounts_RAW_URL
* @param body -
* @param body -
*/
export const AccountsService_ListAccounts = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -217,7 +217,7 @@ export const AccountsService_ListAccountsURL = function(parameters = {}) {
* url: AccountsService_UpdateAccountURL
* method: AccountsService_UpdateAccount_TYPE
* raw_url: AccountsService_UpdateAccount_RAW_URL
* @param body -
* @param body -
*/
export const AccountsService_UpdateAccount = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -287,7 +287,7 @@ display names that include both "Test" and "String"
export const GroupsService_ListGroups = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
const config = parameters.$config
let path = '/v0/groups'
let path = '/v1/groups'
let body
let queryParameters = {}
let form = {}
@@ -311,7 +311,7 @@ export const GroupsService_ListGroups = function(parameters = {}) {
return request('get', domain + path, body, queryParameters, form, config)
}
export const GroupsService_ListGroups_RAW_URL = function() {
return '/v0/groups'
return '/v1/groups'
}
export const GroupsService_ListGroups_TYPE = function() {
return 'get'
@@ -319,7 +319,7 @@ export const GroupsService_ListGroups_TYPE = function() {
export const GroupsService_ListGroupsURL = function(parameters = {}) {
let queryParameters = {}
const domain = parameters.$domain ? parameters.$domain : getDomain()
let path = '/v0/groups'
let path = '/v1/groups'
if (parameters['pageSize'] !== undefined) {
queryParameters['page_size'] = parameters['pageSize']
}
@@ -351,7 +351,7 @@ export const GroupsService_ListGroupsURL = function(parameters = {}) {
export const GroupsService_CreateGroup = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
const config = parameters.$config
let path = '/v0/groups'
let path = '/v1/groups'
let body
let queryParameters = {}
let form = {}
@@ -369,7 +369,7 @@ export const GroupsService_CreateGroup = function(parameters = {}) {
return request('post', domain + path, body, queryParameters, form, config)
}
export const GroupsService_CreateGroup_RAW_URL = function() {
return '/v0/groups'
return '/v1/groups'
}
export const GroupsService_CreateGroup_TYPE = function() {
return 'post'
@@ -377,7 +377,7 @@ export const GroupsService_CreateGroup_TYPE = function() {
export const GroupsService_CreateGroupURL = function(parameters = {}) {
let queryParameters = {}
const domain = parameters.$domain ? parameters.$domain : getDomain()
let path = '/v0/groups'
let path = '/v1/groups'
if (parameters.$queryParameters) {
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
@@ -399,7 +399,7 @@ Returned by default. Inherited from directoryObject. Key. Not nullable. Read-onl
export const GroupsService_UpdateGroup = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
const config = parameters.$config
let path = '/v0/groups/{group.id}'
let path = '/v1/groups/{group.id}'
let body
let queryParameters = {}
let form = {}
@@ -421,7 +421,7 @@ export const GroupsService_UpdateGroup = function(parameters = {}) {
return request('patch', domain + path, body, queryParameters, form, config)
}
export const GroupsService_UpdateGroup_RAW_URL = function() {
return '/v0/groups/{group.id}'
return '/v1/groups/{group.id}'
}
export const GroupsService_UpdateGroup_TYPE = function() {
return 'patch'
@@ -429,7 +429,7 @@ export const GroupsService_UpdateGroup_TYPE = function() {
export const GroupsService_UpdateGroupURL = function(parameters = {}) {
let queryParameters = {}
const domain = parameters.$domain ? parameters.$domain : getDomain()
let path = '/v0/groups/{group.id}'
let path = '/v1/groups/{group.id}'
path = path.replace('{group.id}', `${parameters['groupId']}`)
if (parameters.$queryParameters) {
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
@@ -445,12 +445,12 @@ export const GroupsService_UpdateGroupURL = function(parameters = {}) {
* url: GroupsService_GetGroupURL
* method: GroupsService_GetGroup_TYPE
* raw_url: GroupsService_GetGroup_RAW_URL
* @param id -
* @param id -
*/
export const GroupsService_GetGroup = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
const config = parameters.$config
let path = '/v0/groups/{id}'
let path = '/v1/groups/{id}'
let body
let queryParameters = {}
let form = {}
@@ -466,7 +466,7 @@ export const GroupsService_GetGroup = function(parameters = {}) {
return request('get', domain + path, body, queryParameters, form, config)
}
export const GroupsService_GetGroup_RAW_URL = function() {
return '/v0/groups/{id}'
return '/v1/groups/{id}'
}
export const GroupsService_GetGroup_TYPE = function() {
return 'get'
@@ -474,7 +474,7 @@ export const GroupsService_GetGroup_TYPE = function() {
export const GroupsService_GetGroupURL = function(parameters = {}) {
let queryParameters = {}
const domain = parameters.$domain ? parameters.$domain : getDomain()
let path = '/v0/groups/{id}'
let path = '/v1/groups/{id}'
path = path.replace('{id}', `${parameters['id']}`)
if (parameters.$queryParameters) {
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
@@ -490,12 +490,12 @@ export const GroupsService_GetGroupURL = function(parameters = {}) {
* url: GroupsService_DeleteGroupURL
* method: GroupsService_DeleteGroup_TYPE
* raw_url: GroupsService_DeleteGroup_RAW_URL
* @param id -
* @param id -
*/
export const GroupsService_DeleteGroup = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
const config = parameters.$config
let path = '/v0/groups/{id}'
let path = '/v1/groups/{id}'
let body
let queryParameters = {}
let form = {}
@@ -511,7 +511,7 @@ export const GroupsService_DeleteGroup = function(parameters = {}) {
return request('delete', domain + path, body, queryParameters, form, config)
}
export const GroupsService_DeleteGroup_RAW_URL = function() {
return '/v0/groups/{id}'
return '/v1/groups/{id}'
}
export const GroupsService_DeleteGroup_TYPE = function() {
return 'delete'
@@ -519,7 +519,7 @@ export const GroupsService_DeleteGroup_TYPE = function() {
export const GroupsService_DeleteGroupURL = function(parameters = {}) {
let queryParameters = {}
const domain = parameters.$domain ? parameters.$domain : getDomain()
let path = '/v0/groups/{id}'
let path = '/v1/groups/{id}'
path = path.replace('{id}', `${parameters['id']}`)
if (parameters.$queryParameters) {
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
@@ -536,7 +536,7 @@ export const GroupsService_DeleteGroupURL = function(parameters = {}) {
* method: GroupsService_ListMembers_TYPE
* raw_url: GroupsService_ListMembers_RAW_URL
* @param id - The group id
* @param pageSize -
* @param pageSize -
* @param pageToken - Optional. A pagination token returned from a previous call to `Get`
that indicates from where search should continue.
* @param fieldMaskPaths - The set of field mask paths.
@@ -560,7 +560,7 @@ display names that include both "Test" and "String"
export const GroupsService_ListMembers = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
const config = parameters.$config
let path = '/v0/groups/{id}/members/$ref'
let path = '/v1/groups/{id}/members/$ref'
let body
let queryParameters = {}
let form = {}
@@ -588,7 +588,7 @@ export const GroupsService_ListMembers = function(parameters = {}) {
return request('get', domain + path, body, queryParameters, form, config)
}
export const GroupsService_ListMembers_RAW_URL = function() {
return '/v0/groups/{id}/members/$ref'
return '/v1/groups/{id}/members/$ref'
}
export const GroupsService_ListMembers_TYPE = function() {
return 'get'
@@ -596,7 +596,7 @@ export const GroupsService_ListMembers_TYPE = function() {
export const GroupsService_ListMembersURL = function(parameters = {}) {
let queryParameters = {}
const domain = parameters.$domain ? parameters.$domain : getDomain()
let path = '/v0/groups/{id}/members/$ref'
let path = '/v1/groups/{id}/members/$ref'
path = path.replace('{id}', `${parameters['id']}`)
if (parameters['pageSize'] !== undefined) {
queryParameters['page_size'] = parameters['pageSize']
@@ -625,12 +625,12 @@ export const GroupsService_ListMembersURL = function(parameters = {}) {
* method: GroupsService_AddMember_TYPE
* raw_url: GroupsService_AddMember_RAW_URL
* @param id - The account id to add
* @param body -
* @param body -
*/
export const GroupsService_AddMember = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
const config = parameters.$config
let path = '/v0/groups/{id}/members/$ref'
let path = '/v1/groups/{id}/members/$ref'
let body
let queryParameters = {}
let form = {}
@@ -652,7 +652,7 @@ export const GroupsService_AddMember = function(parameters = {}) {
return request('post', domain + path, body, queryParameters, form, config)
}
export const GroupsService_AddMember_RAW_URL = function() {
return '/v0/groups/{id}/members/$ref'
return '/v1/groups/{id}/members/$ref'
}
export const GroupsService_AddMember_TYPE = function() {
return 'post'
@@ -660,7 +660,7 @@ export const GroupsService_AddMember_TYPE = function() {
export const GroupsService_AddMemberURL = function(parameters = {}) {
let queryParameters = {}
const domain = parameters.$domain ? parameters.$domain : getDomain()
let path = '/v0/groups/{id}/members/$ref'
let path = '/v1/groups/{id}/members/$ref'
path = path.replace('{id}', `${parameters['id']}`)
if (parameters.$queryParameters) {
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
@@ -682,7 +682,7 @@ export const GroupsService_AddMemberURL = function(parameters = {}) {
export const GroupsService_RemoveMember = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
const config = parameters.$config
let path = '/v0/groups/{id}/members/{account_id}/$ref'
let path = '/v1/groups/{id}/members/{account_id}/$ref'
let body
let queryParameters = {}
let form = {}
@@ -702,7 +702,7 @@ export const GroupsService_RemoveMember = function(parameters = {}) {
return request('delete', domain + path, body, queryParameters, form, config)
}
export const GroupsService_RemoveMember_RAW_URL = function() {
return '/v0/groups/{id}/members/{account_id}/$ref'
return '/v1/groups/{id}/members/{account_id}/$ref'
}
export const GroupsService_RemoveMember_TYPE = function() {
return 'delete'
@@ -710,7 +710,7 @@ export const GroupsService_RemoveMember_TYPE = function() {
export const GroupsService_RemoveMemberURL = function(parameters = {}) {
let queryParameters = {}
const domain = parameters.$domain ? parameters.$domain : getDomain()
let path = '/v0/groups/{id}/members/{account_id}/$ref'
let path = '/v1/groups/{id}/members/{account_id}/$ref'
path = path.replace('{id}', `${parameters['id']}`)
path = path.replace('{account_id}', `${parameters['accountId']}`)
if (parameters.$queryParameters) {
@@ -720,4 +720,4 @@ export const GroupsService_RemoveMemberURL = function(parameters = {}) {
}
let keys = Object.keys(queryParameters)
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
}
}

View File

@@ -25,15 +25,15 @@ export const request = (method, url, body, queryParameters, form, config) => {
}
}
/*==========================================================
*
*
==========================================================*/
/**
*
*
* request: RoleService_AssignRoleToUser
* url: RoleService_AssignRoleToUserURL
* method: RoleService_AssignRoleToUser_TYPE
* raw_url: RoleService_AssignRoleToUser_RAW_URL
* @param body -
* @param body -
*/
export const RoleService_AssignRoleToUser = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -74,12 +74,12 @@ export const RoleService_AssignRoleToUserURL = function(parameters = {}) {
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
}
/**
*
*
* request: RoleService_ListRoleAssignments
* url: RoleService_ListRoleAssignmentsURL
* method: RoleService_ListRoleAssignments_TYPE
* raw_url: RoleService_ListRoleAssignments_RAW_URL
* @param body -
* @param body -
*/
export const RoleService_ListRoleAssignments = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -120,12 +120,12 @@ export const RoleService_ListRoleAssignmentsURL = function(parameters = {}) {
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
}
/**
*
*
* request: RoleService_RemoveRoleFromUser
* url: RoleService_RemoveRoleFromUserURL
* method: RoleService_RemoveRoleFromUser_TYPE
* raw_url: RoleService_RemoveRoleFromUser_RAW_URL
* @param body -
* @param body -
*/
export const RoleService_RemoveRoleFromUser = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -166,12 +166,12 @@ export const RoleService_RemoveRoleFromUserURL = function(parameters = {}) {
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
}
/**
*
*
* request: BundleService_GetBundle
* url: BundleService_GetBundleURL
* method: BundleService_GetBundle_TYPE
* raw_url: BundleService_GetBundle_RAW_URL
* @param body -
* @param body -
*/
export const BundleService_GetBundle = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -212,12 +212,12 @@ export const BundleService_GetBundleURL = function(parameters = {}) {
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
}
/**
*
*
* request: BundleService_SaveBundle
* url: BundleService_SaveBundleURL
* method: BundleService_SaveBundle_TYPE
* raw_url: BundleService_SaveBundle_RAW_URL
* @param body -
* @param body -
*/
export const BundleService_SaveBundle = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -258,12 +258,12 @@ export const BundleService_SaveBundleURL = function(parameters = {}) {
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
}
/**
*
*
* request: BundleService_AddSettingToBundle
* url: BundleService_AddSettingToBundleURL
* method: BundleService_AddSettingToBundle_TYPE
* raw_url: BundleService_AddSettingToBundle_RAW_URL
* @param body -
* @param body -
*/
export const BundleService_AddSettingToBundle = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -304,12 +304,12 @@ export const BundleService_AddSettingToBundleURL = function(parameters = {}) {
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
}
/**
*
*
* request: BundleService_ListBundles
* url: BundleService_ListBundlesURL
* method: BundleService_ListBundles_TYPE
* raw_url: BundleService_ListBundles_RAW_URL
* @param body -
* @param body -
*/
export const BundleService_ListBundles = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -350,12 +350,12 @@ export const BundleService_ListBundlesURL = function(parameters = {}) {
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
}
/**
*
*
* request: BundleService_RemoveSettingFromBundle
* url: BundleService_RemoveSettingFromBundleURL
* method: BundleService_RemoveSettingFromBundle_TYPE
* raw_url: BundleService_RemoveSettingFromBundle_RAW_URL
* @param body -
* @param body -
*/
export const BundleService_RemoveSettingFromBundle = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -396,12 +396,12 @@ export const BundleService_RemoveSettingFromBundleURL = function(parameters = {}
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
}
/**
*
*
* request: RoleService_ListRoles
* url: RoleService_ListRolesURL
* method: RoleService_ListRoles_TYPE
* raw_url: RoleService_ListRoles_RAW_URL
* @param body -
* @param body -
*/
export const RoleService_ListRoles = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -442,12 +442,12 @@ export const RoleService_ListRolesURL = function(parameters = {}) {
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
}
/**
*
*
* request: ValueService_GetValue
* url: ValueService_GetValueURL
* method: ValueService_GetValue_TYPE
* raw_url: ValueService_GetValue_RAW_URL
* @param body -
* @param body -
*/
export const ValueService_GetValue = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -488,12 +488,12 @@ export const ValueService_GetValueURL = function(parameters = {}) {
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
}
/**
*
*
* request: ValueService_GetValueByUniqueIdentifiers
* url: ValueService_GetValueByUniqueIdentifiersURL
* method: ValueService_GetValueByUniqueIdentifiers_TYPE
* raw_url: ValueService_GetValueByUniqueIdentifiers_RAW_URL
* @param body -
* @param body -
*/
export const ValueService_GetValueByUniqueIdentifiers = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -534,12 +534,12 @@ export const ValueService_GetValueByUniqueIdentifiersURL = function(parameters =
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
}
/**
*
*
* request: ValueService_ListValues
* url: ValueService_ListValuesURL
* method: ValueService_ListValues_TYPE
* raw_url: ValueService_ListValues_RAW_URL
* @param body -
* @param body -
*/
export const ValueService_ListValues = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -580,12 +580,12 @@ export const ValueService_ListValuesURL = function(parameters = {}) {
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
}
/**
*
*
* request: ValueService_SaveValue
* url: ValueService_SaveValueURL
* method: ValueService_SaveValue_TYPE
* raw_url: ValueService_SaveValue_RAW_URL
* @param body -
* @param body -
*/
export const ValueService_SaveValue = function(parameters = {}) {
const domain = parameters.$domain ? parameters.$domain : getDomain()
@@ -624,4 +624,4 @@ export const ValueService_SaveValueURL = function(parameters = {}) {
}
let keys = Object.keys(queryParameters)
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
}
}

1
docs/.gitignore vendored
View File

@@ -1,2 +1,3 @@
hugo/
grpc_apis/
mutagen.yml.lock

3
docs/grpc_apis/_index.md Normal file
View File

@@ -0,0 +1,3 @@
---
title: GRPC apis
---

View File

@@ -4,9 +4,10 @@ import (
"context"
"fmt"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
glauthcfg "github.com/glauth/glauth/v2/pkg/config"
"github.com/oklog/run"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/glauth/pkg/config"
"github.com/owncloud/ocis/glauth/pkg/config/parser"
"github.com/owncloud/ocis/glauth/pkg/logging"
@@ -179,7 +180,7 @@ func Server(cfg *config.Config) *cli.Command {
}
// getAccountsServices returns an ocis-accounts service
func getAccountsServices() (accounts.AccountsService, accounts.GroupsService) {
return accounts.NewAccountsService("com.owncloud.api.accounts", grpc.DefaultClient),
accounts.NewGroupsService("com.owncloud.api.accounts", grpc.DefaultClient)
func getAccountsServices() (accountssvc.AccountsService, accountssvc.GroupsService) {
return accountssvc.NewAccountsService("com.owncloud.api.accounts", grpc.DefaultClient),
accountssvc.NewGroupsService("com.owncloud.api.accounts", grpc.DefaultClient)
}

View File

@@ -8,12 +8,14 @@ import (
"strconv"
"strings"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/glauth/glauth/v2/pkg/config"
"github.com/glauth/glauth/v2/pkg/handler"
"github.com/glauth/glauth/v2/pkg/stats"
ber "github.com/nmcclain/asn1-ber"
"github.com/nmcclain/ldap"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/ocis-pkg/middleware"
"go-micro.dev/v4/metadata"
@@ -27,8 +29,8 @@ const (
)
type ocisHandler struct {
as accounts.AccountsService
gs accounts.GroupsService
as accountssvc.AccountsService
gs accountssvc.GroupsService
log log.Logger
basedn string
nameFormat string
@@ -86,7 +88,7 @@ func (h ocisHandler) Bind(bindDN, bindSimplePw string, conn net.Conn) (ldap.LDAP
ctx = metadata.Set(ctx, middleware.RoleIDs, string(roleIDs))
// check password
res, err := h.as.ListAccounts(ctx, &accounts.ListAccountsRequest{
res, err := h.as.ListAccounts(ctx, &accountssvc.ListAccountsRequest{
//Query: fmt.Sprintf("username eq '%s'", username),
// TODO this allows looking up users when you know the username using basic auth
// adding the password to the query is an option but sending this over the wire a la scim seems ugly
@@ -209,7 +211,7 @@ func (h ocisHandler) Search(bindDN string, searchReq ldap.SearchRequest, conn ne
Msg("parsed query")
switch qtype {
case usersQuery:
accounts, err := h.as.ListAccounts(ctx, &accounts.ListAccountsRequest{
accounts, err := h.as.ListAccounts(ctx, &accountssvc.ListAccountsRequest{
Query: query,
})
if err != nil {
@@ -229,7 +231,7 @@ func (h ocisHandler) Search(bindDN string, searchReq ldap.SearchRequest, conn ne
}
entries = append(entries, h.mapAccounts(accounts.Accounts)...)
case groupsQuery:
groups, err := h.gs.ListGroups(ctx, &accounts.ListGroupsRequest{
groups, err := h.gs.ListGroups(ctx, &accountssvc.ListGroupsRequest{
Query: query,
})
if err != nil {
@@ -275,7 +277,7 @@ func attribute(name string, values ...string) *ldap.EntryAttribute {
}
}
func (h ocisHandler) mapAccounts(accounts []*accounts.Account) []*ldap.Entry {
func (h ocisHandler) mapAccounts(accounts []*accountsmsg.Account) []*ldap.Entry {
entries := make([]*ldap.Entry, 0, len(accounts))
for i := range accounts {
attrs := []*ldap.EntryAttribute{
@@ -314,7 +316,7 @@ func (h ocisHandler) mapAccounts(accounts []*accounts.Account) []*ldap.Entry {
return entries
}
func (h ocisHandler) mapGroups(groups []*accounts.Group) []*ldap.Entry {
func (h ocisHandler) mapGroups(groups []*accountsmsg.Group) []*ldap.Entry {
entries := make([]*ldap.Entry, 0, len(groups))
for i := range groups {
attrs := []*ldap.EntryAttribute{

View File

@@ -3,8 +3,9 @@ package glauth
import (
"context"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/glauth/glauth/v2/pkg/config"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocis-pkg/log"
)
@@ -23,8 +24,8 @@ type Options struct {
NameFormat string
GroupFormat string
RoleBundleUUID string
AccountsService accounts.AccountsService
GroupsService accounts.GroupsService
AccountsService accountssvc.AccountsService
GroupsService accountssvc.GroupsService
}
// newOptions initializes the available default options.
@@ -102,14 +103,14 @@ func GroupFormat(val string) Option {
}
// AccountsService provides an AccountsService client to set the AccountsService option.
func AccountsService(val accounts.AccountsService) Option {
func AccountsService(val accountssvc.AccountsService) Option {
return func(o *Options) {
o.AccountsService = val
}
}
// GroupsService provides an GroupsService client to set the GroupsService option.
func GroupsService(val accounts.GroupsService) Option {
func GroupsService(val accountssvc.GroupsService) Option {
return func(o *Options) {
o.GroupsService = val
}

View File

@@ -26,8 +26,8 @@ import (
"github.com/owncloud/ocis/graph/pkg/service/v0/errorcode"
"github.com/owncloud/ocis/graph/pkg/service/v0/net"
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
sproto "github.com/owncloud/ocis/settings/pkg/proto/v0"
settingsSvc "github.com/owncloud/ocis/settings/pkg/service/v0"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
settingsServiceExt "github.com/owncloud/ocis/settings/pkg/service/v0"
"gopkg.in/yaml.v2"
merrors "go-micro.dev/v4/errors"
@@ -155,10 +155,10 @@ func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request) {
return
}
s := sproto.NewPermissionService("com.owncloud.api.settings", grpc.DefaultClient)
s := settingssvc.NewPermissionService("com.owncloud.api.settings", grpc.DefaultClient)
_, err := s.GetPermissionByID(r.Context(), &sproto.GetPermissionByIDRequest{
PermissionId: settingsSvc.CreateSpacePermissionID,
_, err := s.GetPermissionByID(r.Context(), &settingssvc.GetPermissionByIDRequest{
PermissionId: settingsServiceExt.CreateSpacePermissionID,
})
if err != nil {
// if the permission is not existing for the user in context we can assume we don't have it. Return 401.
@@ -379,15 +379,15 @@ func (g Graph) ListStorageSpacesWithFilters(ctx context.Context, filters []*stor
client := g.GetGatewayClient()
permissions := make(map[string]struct{}, 1)
s := sproto.NewPermissionService("com.owncloud.api.settings", grpc.DefaultClient)
s := settingssvc.NewPermissionService("com.owncloud.api.settings", grpc.DefaultClient)
_, err := s.GetPermissionByID(ctx, &sproto.GetPermissionByIDRequest{
PermissionId: settingsSvc.ListAllSpacesPermissionID,
_, err := s.GetPermissionByID(ctx, &settingssvc.GetPermissionByIDRequest{
PermissionId: settingsServiceExt.ListAllSpacesPermissionID,
})
// No error means the user has the permission
if err == nil {
permissions[settingsSvc.ListAllSpacesPermissionName] = struct{}{}
permissions[settingsServiceExt.ListAllSpacesPermissionName] = struct{}{}
}
value, err := json.Marshal(permissions)
if err != nil {
@@ -683,8 +683,8 @@ func getQuota(quota *libregraph.Quota, defaultQuota string) *storageprovider.Quo
}
func canSetSpaceQuota(ctx context.Context, user *userv1beta1.User) (bool, error) {
settingsService := sproto.NewPermissionService("com.owncloud.api.settings", grpc.DefaultClient)
_, err := settingsService.GetPermissionByID(ctx, &sproto.GetPermissionByIDRequest{PermissionId: settingsSvc.SetSpaceQuotaPermissionID})
settingsService := settingssvc.NewPermissionService("com.owncloud.api.settings", grpc.DefaultClient)
_, err := settingsService.GetPermissionByID(ctx, &settingssvc.GetPermissionByIDRequest{PermissionId: settingsServiceExt.SetSpaceQuotaPermissionID})
if err != nil {
merror := merrors.FromError(err)
if merror.Status == http.StatusText(http.StatusNotFound) {

View File

@@ -8,7 +8,7 @@ import (
"github.com/owncloud/ocis/ocis-pkg/indexer/option"
//. "github.com/owncloud/ocis/ocis-pkg/indexer/test"
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
"github.com/stretchr/testify/assert"
)
@@ -236,7 +236,7 @@ func TestAdd(t *testing.T) {
}),
option.WithDataDir(tmpDir),
option.WithFilesDir(filepath.Join(tmpDir, "data")),
option.WithEntity(&proto.Account{}),
option.WithEntity(&accountsmsg.Account{}),
option.WithTypeName("owncloud.Account"),
option.WithIndexBy("UidNumber"),
)

View File

@@ -2,34 +2,35 @@ package roles
import (
"time"
"github.com/owncloud/ocis/ocis-pkg/sync"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
settingsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/settings/v0"
)
// cache is a cache implementation for roles, keyed by roleIDs.
type cache struct {
sc sync.Cache
ttl time.Duration
sc sync.Cache
ttl time.Duration
}
// newCache returns a new instance of Cache.
func newCache(capacity int, ttl time.Duration) cache {
return cache{
ttl: ttl,
sc: sync.NewCache(capacity),
ttl: ttl,
sc: sync.NewCache(capacity),
}
}
// get gets a role-bundle by a given `roleID`.
func (c *cache) get(roleID string) *settings.Bundle {
func (c *cache) get(roleID string) *settingsmsg.Bundle {
if ce := c.sc.Load(roleID); ce != nil {
return ce.V.(*settings.Bundle)
return ce.V.(*settingsmsg.Bundle)
}
return nil
}
// set sets a roleID / role-bundle.
func (c *cache) set(roleID string, value *settings.Bundle) {
func (c *cache) set(roleID string, value *settingsmsg.Bundle) {
c.sc.Store(roleID, value, time.Now().Add(c.ttl))
}
}

View File

@@ -1,12 +1,13 @@
package roles
import (
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
"github.com/stretchr/testify/assert"
"strconv"
"sync"
"testing"
"time"
settingsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/settings/v0"
"github.com/stretchr/testify/assert"
)
func cacheRunner(size int, ttl time.Duration) (*cache, func(f func(v string))) {
@@ -29,10 +30,10 @@ func cacheRunner(size int, ttl time.Duration) (*cache, func(f func(v string))) {
func BenchmarkCache(b *testing.B) {
b.ReportAllocs()
size := 1024
c, cr := cacheRunner(size, 100 * time.Millisecond)
c, cr := cacheRunner(size, 100*time.Millisecond)
cr(func(v string) { c.set(v, &settings.Bundle{})})
cr(func(v string) { c.get(v)})
cr(func(v string) { c.set(v, &settingsmsg.Bundle{}) })
cr(func(v string) { c.get(v) })
}
func TestCache(t *testing.T) {
@@ -41,7 +42,7 @@ func TestCache(t *testing.T) {
c, cr := cacheRunner(size, ttl)
cr(func(v string) {
c.set(v, &settings.Bundle{Id: v})
c.set(v, &settingsmsg.Bundle{Id: v})
})
assert.Equal(t, "50", c.get("50").Id, "it returns the right bundle")

View File

@@ -4,14 +4,15 @@ import (
"context"
"github.com/owncloud/ocis/ocis-pkg/log"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
settingsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/settings/v0"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
)
// Manager manages a cache of roles by fetching unknown roles from the settings.RoleService.
type Manager struct {
logger log.Logger
cache cache
roleService settings.RoleService
roleService settingssvc.RoleService
}
// NewManager returns a new instance of Manager.
@@ -25,9 +26,9 @@ func NewManager(o ...Option) Manager {
}
// List returns all roles that match the given roleIDs.
func (m *Manager) List(ctx context.Context, roleIDs []string) []*settings.Bundle {
func (m *Manager) List(ctx context.Context, roleIDs []string) []*settingsmsg.Bundle {
// get from cache
result := make([]*settings.Bundle, 0)
result := make([]*settingsmsg.Bundle, 0)
lookup := make([]string, 0)
for _, roleID := range roleIDs {
if hit := m.cache.get(roleID); hit == nil {
@@ -39,7 +40,7 @@ func (m *Manager) List(ctx context.Context, roleIDs []string) []*settings.Bundle
// if there are roles missing, fetch them from the RoleService
if len(lookup) > 0 {
request := &settings.ListBundlesRequest{
request := &settingssvc.ListBundlesRequest{
BundleIds: lookup,
}
res, err := m.roleService.ListRoles(ctx, request)
@@ -56,7 +57,7 @@ func (m *Manager) List(ctx context.Context, roleIDs []string) []*settings.Bundle
}
// FindPermissionByID searches for a permission-setting by the permissionID, but limited to the given roleIDs
func (m *Manager) FindPermissionByID(ctx context.Context, roleIDs []string, permissionID string) *settings.Setting {
func (m *Manager) FindPermissionByID(ctx context.Context, roleIDs []string, permissionID string) *settingsmsg.Setting {
for _, role := range m.List(ctx, roleIDs) {
for _, setting := range role.Settings {
if setting.Id == permissionID {
@@ -66,4 +67,3 @@ func (m *Manager) FindPermissionByID(ctx context.Context, roleIDs []string, perm
}
return nil
}

View File

@@ -4,7 +4,7 @@ import (
"time"
"github.com/owncloud/ocis/ocis-pkg/log"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
)
// Options are all the possible options.
@@ -12,7 +12,7 @@ type Options struct {
size int
ttl time.Duration
logger log.Logger
roleService settings.RoleService
roleService settingssvc.RoleService
}
// Option mutates option
@@ -40,7 +40,7 @@ func Logger(logger log.Logger) Option {
}
// RoleService provides endpoints for fetching roles.
func RoleService(rs settings.RoleService) Option {
func RoleService(rs settingssvc.RoleService) Option {
return func(o *Options) {
o.roleService = rs
}

View File

@@ -22,13 +22,15 @@ import (
"github.com/golang/protobuf/ptypes/empty"
accountsCfg "github.com/owncloud/ocis/accounts/pkg/config"
accountsLogging "github.com/owncloud/ocis/accounts/pkg/logging"
accountsProto "github.com/owncloud/ocis/accounts/pkg/proto/v0"
accountsSvc "github.com/owncloud/ocis/accounts/pkg/service/v0"
accountsServiceExt "github.com/owncloud/ocis/accounts/pkg/service/v0"
ocisLog "github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
"github.com/owncloud/ocis/ocs/pkg/config"
svc "github.com/owncloud/ocis/ocs/pkg/service/v0"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
settingsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/settings/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
ssvc "github.com/owncloud/ocis/settings/pkg/service/v0"
"github.com/stretchr/testify/assert"
"go-micro.dev/v4/client"
@@ -480,10 +482,10 @@ func assertUsersSame(t *testing.T, expected, actual User, quotaAvailable bool) {
}
}
func findAccount(t *testing.T, username string) (*accountsProto.Account, error) {
cl := accountsProto.NewAccountsService("com.owncloud.api.accounts", service.Client())
func findAccount(t *testing.T, username string) (*accountsmsg.Account, error) {
cl := accountssvc.NewAccountsService("com.owncloud.api.accounts", service.Client())
req := &accountsProto.ListAccountsRequest{
req := &accountssvc.ListAccountsRequest{
Query: "preferred_name eq '" + username + "'",
}
res, err := cl.ListAccounts(context.Background(), req)
@@ -497,48 +499,48 @@ func findAccount(t *testing.T, username string) (*accountsProto.Account, error)
}
func deleteAccount(t *testing.T, id string) (*empty.Empty, error) {
cl := accountsProto.NewAccountsService("com.owncloud.api.accounts", service.Client())
cl := accountssvc.NewAccountsService("com.owncloud.api.accounts", service.Client())
req := &accountsProto.DeleteAccountRequest{Id: id}
req := &accountssvc.DeleteAccountRequest{Id: id}
res, err := cl.DeleteAccount(context.Background(), req)
return res, err
}
func deleteGroup(t *testing.T, id string) (*empty.Empty, error) {
cl := accountsProto.NewGroupsService("com.owncloud.api.accounts", service.Client())
cl := accountssvc.NewGroupsService("com.owncloud.api.accounts", service.Client())
req := &accountsProto.DeleteGroupRequest{Id: id}
req := &accountssvc.DeleteGroupRequest{Id: id}
res, err := cl.DeleteGroup(context.Background(), req)
return res, err
}
func buildRoleServiceMock() settings.RoleService {
return settings.MockRoleService{
AssignRoleToUserFunc: func(ctx context.Context, req *settings.AssignRoleToUserRequest, opts ...client.CallOption) (res *settings.AssignRoleToUserResponse, err error) {
func buildRoleServiceMock() settingssvc.RoleService {
return settingssvc.MockRoleService{
AssignRoleToUserFunc: func(ctx context.Context, req *settingssvc.AssignRoleToUserRequest, opts ...client.CallOption) (res *settingssvc.AssignRoleToUserResponse, err error) {
mockedRoleAssignment[req.AccountUuid] = req.RoleId
return &settings.AssignRoleToUserResponse{
Assignment: &settings.UserRoleAssignment{
return &settingssvc.AssignRoleToUserResponse{
Assignment: &settingsmsg.UserRoleAssignment{
AccountUuid: req.AccountUuid,
RoleId: req.RoleId,
},
}, nil
},
ListRolesFunc: func(ctx context.Context, req *settings.ListBundlesRequest, opts ...client.CallOption) (*settings.ListBundlesResponse, error) {
return &settings.ListBundlesResponse{
Bundles: []*settings.Bundle{
ListRolesFunc: func(ctx context.Context, req *settingssvc.ListBundlesRequest, opts ...client.CallOption) (*settingssvc.ListBundlesResponse, error) {
return &settingssvc.ListBundlesResponse{
Bundles: []*settingsmsg.Bundle{
{
Id: ssvc.BundleUUIDRoleAdmin,
Settings: []*settings.Setting{
Settings: []*settingsmsg.Setting{
{
Id: accountsSvc.AccountManagementPermissionID,
Id: accountsServiceExt.AccountManagementPermissionID,
},
},
},
{
Id: ssvc.BundleUUIDRoleUser,
Settings: []*settings.Setting{
Settings: []*settingsmsg.Setting{
{
Id: accountsSvc.SelfManagementPermissionID,
Id: accountsServiceExt.SelfManagementPermissionID,
},
},
},
@@ -570,22 +572,22 @@ func init() {
},
}
var hdlr *accountsSvc.Service
var hdlr *accountsServiceExt.Service
var err error
if hdlr, err = accountsSvc.New(
accountsSvc.Logger(accountsLogging.Configure("accounts", c.Log)),
accountsSvc.Config(c),
accountsSvc.RoleService(buildRoleServiceMock()),
if hdlr, err = accountsServiceExt.New(
accountsServiceExt.Logger(accountsLogging.Configure("accounts", c.Log)),
accountsServiceExt.Config(c),
accountsServiceExt.RoleService(buildRoleServiceMock()),
); err != nil {
log.Fatalf("Could not create new service")
}
err = accountsProto.RegisterAccountsServiceHandler(service.Server(), hdlr)
err = accountssvc.RegisterAccountsServiceHandler(service.Server(), hdlr)
if err != nil {
log.Fatal("could not register the Accounts handler")
}
err = accountsProto.RegisterGroupsServiceHandler(service.Server(), hdlr)
err = accountssvc.RegisterGroupsServiceHandler(service.Server(), hdlr)
if err != nil {
log.Fatal("could not register the Groups handler")
}

View File

@@ -9,9 +9,11 @@ import (
"regexp"
"strconv"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
revactx "github.com/cs3org/reva/pkg/ctx"
"github.com/go-chi/chi/v5"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocs/pkg/service/v0/data"
"github.com/owncloud/ocis/ocs/pkg/service/v0/response"
ocstracing "github.com/owncloud/ocis/ocs/pkg/tracing"
@@ -26,7 +28,7 @@ func (o Ocs) ListUserGroups(w http.ResponseWriter, r *http.Request) {
if err != nil {
o.mustRender(w, r, response.ErrRender(data.MetaServerError.StatusCode, err.Error()))
}
var account *accounts.Account
var account *accountsmsg.Account
// short circuit if there is a user already in the context
if u, ok := revactx.ContextGetUser(r.Context()); ok {
@@ -50,7 +52,7 @@ func (o Ocs) ListUserGroups(w http.ResponseWriter, r *http.Request) {
}
if isValidUUID(userid) {
account, err = o.getAccountService().GetAccount(r.Context(), &accounts.GetAccountRequest{
account, err = o.getAccountService().GetAccount(r.Context(), &accountssvc.GetAccountRequest{
Id: userid,
})
} else {
@@ -73,7 +75,7 @@ func (o Ocs) ListUserGroups(w http.ResponseWriter, r *http.Request) {
if account.MemberOf[i].OnPremisesSamAccountName == "" {
o.logger.Warn().Str("groupid", account.MemberOf[i].Id).Msg("group on_premises_sam_account_name is empty, trying to lookup by id")
// we can try to look up the name
group, err := o.getGroupsService().GetGroup(r.Context(), &accounts.GetGroupRequest{
group, err := o.getGroupsService().GetGroup(r.Context(), &accountssvc.GetGroupRequest{
Id: account.MemberOf[i].Id,
})
@@ -139,7 +141,7 @@ func (o Ocs) AddToGroup(w http.ResponseWriter, r *http.Request) {
return
}
_, err = o.getGroupsService().AddMember(r.Context(), &accounts.AddMemberRequest{
_, err = o.getGroupsService().AddMember(r.Context(), &accountssvc.AddMemberRequest{
AccountId: account.Id,
GroupId: group.Id,
})
@@ -192,10 +194,10 @@ func (o Ocs) RemoveFromGroup(w http.ResponseWriter, r *http.Request) {
return
}
var account *accounts.Account
var account *accountsmsg.Account
if isValidUUID(userid) {
account, _ = o.getAccountService().GetAccount(r.Context(), &accounts.GetAccountRequest{
account, _ = o.getAccountService().GetAccount(r.Context(), &accountssvc.GetAccountRequest{
Id: userid,
})
} else {
@@ -225,7 +227,7 @@ func (o Ocs) RemoveFromGroup(w http.ResponseWriter, r *http.Request) {
return
}
_, err = o.getGroupsService().RemoveMember(r.Context(), &accounts.RemoveMemberRequest{
_, err = o.getGroupsService().RemoveMember(r.Context(), &accountssvc.RemoveMemberRequest{
AccountId: account.Id,
GroupId: group.Id,
})
@@ -253,7 +255,7 @@ func (o Ocs) ListGroups(w http.ResponseWriter, r *http.Request) {
query = fmt.Sprintf("id eq '%s' or on_premises_sam_account_name eq '%s'", escapeValue(search), escapeValue(search))
}
res, err := o.getGroupsService().ListGroups(r.Context(), &accounts.ListGroupsRequest{
res, err := o.getGroupsService().ListGroups(r.Context(), &accountssvc.ListGroupsRequest{
Query: query,
})
@@ -312,13 +314,13 @@ func (o Ocs) AddGroup(w http.ResponseWriter, r *http.Request) {
}
}
newGroup := &accounts.Group{
newGroup := &accountsmsg.Group{
Id: groupid,
DisplayName: displayname,
OnPremisesSamAccountName: groupid,
GidNumber: gidNumber,
}
group, err := o.getGroupsService().CreateGroup(r.Context(), &accounts.CreateGroupRequest{
group, err := o.getGroupsService().CreateGroup(r.Context(), &accountssvc.CreateGroupRequest{
Group: newGroup,
})
if err != nil {
@@ -366,7 +368,7 @@ func (o Ocs) DeleteGroup(w http.ResponseWriter, r *http.Request) {
return
}
_, err = o.getGroupsService().DeleteGroup(r.Context(), &accounts.DeleteGroupRequest{
_, err = o.getGroupsService().DeleteGroup(r.Context(), &accountssvc.DeleteGroupRequest{
Id: group.Id,
})
@@ -406,7 +408,7 @@ func (o Ocs) GetGroupMembers(w http.ResponseWriter, r *http.Request) {
return
}
res, err := o.getGroupsService().ListMembers(r.Context(), &accounts.ListMembersRequest{Id: group.Id})
res, err := o.getGroupsService().ListMembers(r.Context(), &accountssvc.ListMembersRequest{Id: group.Id})
if err != nil {
merr := merrors.FromError(err)
@@ -433,9 +435,9 @@ func isValidUUID(uuid string) bool {
return r.MatchString(uuid)
}
func (o Ocs) fetchGroupByName(ctx context.Context, name string) (*accounts.Group, error) {
var res *accounts.ListGroupsResponse
res, err := o.getGroupsService().ListGroups(ctx, &accounts.ListGroupsRequest{
func (o Ocs) fetchGroupByName(ctx context.Context, name string) (*accountsmsg.Group, error) {
var res *accountssvc.ListGroupsResponse
res, err := o.getGroupsService().ListGroups(ctx, &accountssvc.ListGroupsRequest{
Query: fmt.Sprintf("on_premises_sam_account_name eq '%v'", escapeValue(name)),
})
if err != nil {

View File

@@ -6,7 +6,7 @@ import (
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/ocis-pkg/roles"
"github.com/owncloud/ocis/ocs/pkg/config"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
)
// Option defines a single option function.
@@ -17,7 +17,7 @@ type Options struct {
Logger log.Logger
Config *config.Config
Middleware []func(http.Handler) http.Handler
RoleService settings.RoleService
RoleService settingssvc.RoleService
RoleManager *roles.Manager
}
@@ -54,7 +54,7 @@ func Middleware(val ...func(http.Handler) http.Handler) Option {
}
// RoleService provides a function to set the RoleService option.
func RoleService(val settings.RoleService) Option {
func RoleService(val settingssvc.RoleService) Option {
return func(o *Options) {
o.RoleService = val
}

View File

@@ -11,7 +11,8 @@ import (
"github.com/go-chi/chi/v5/middleware"
"github.com/go-chi/render"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/owncloud/ocis/ocis-pkg/account"
"github.com/owncloud/ocis/ocis-pkg/log"
opkgm "github.com/owncloud/ocis/ocis-pkg/middleware"
@@ -20,8 +21,8 @@ import (
ocsm "github.com/owncloud/ocis/ocs/pkg/middleware"
"github.com/owncloud/ocis/ocs/pkg/service/v0/data"
"github.com/owncloud/ocis/ocs/pkg/service/v0/response"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
"github.com/owncloud/ocis/proxy/pkg/user/backend"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
)
// Service defines the extension handlers.
@@ -39,7 +40,7 @@ func NewService(opts ...Option) Service {
roleService := options.RoleService
if roleService == nil {
roleService = settings.NewRoleService("com.owncloud.api.settings", grpc.DefaultClient)
roleService = settingssvc.NewRoleService("com.owncloud.api.settings", grpc.DefaultClient)
}
roleManager := options.RoleManager
if roleManager == nil {
@@ -143,7 +144,7 @@ func NewService(opts ...Option) Service {
type Ocs struct {
config *config.Config
logger log.Logger
RoleService settings.RoleService
RoleService settingssvc.RoleService
RoleManager *roles.Manager
mux *chi.Mux
}
@@ -158,8 +159,8 @@ func (o Ocs) NotFound(w http.ResponseWriter, r *http.Request) {
o.mustRender(w, r, response.ErrRender(data.MetaNotFound.StatusCode, "not found"))
}
func (o Ocs) getAccountService() accounts.AccountsService {
return accounts.NewAccountsService("com.owncloud.api.accounts", grpc.DefaultClient)
func (o Ocs) getAccountService() accountssvc.AccountsService {
return accountssvc.NewAccountsService("com.owncloud.api.accounts", grpc.DefaultClient)
}
func (o Ocs) getCS3Backend() backend.UserBackend {
@@ -170,8 +171,8 @@ func (o Ocs) getCS3Backend() backend.UserBackend {
return backend.NewCS3UserBackend(nil, revaClient, o.config.MachineAuthAPIKey, o.logger)
}
func (o Ocs) getGroupsService() accounts.GroupsService {
return accounts.NewGroupsService("com.owncloud.api.accounts", grpc.DefaultClient)
func (o Ocs) getGroupsService() accountssvc.GroupsService {
return accountssvc.NewGroupsService("com.owncloud.api.accounts", grpc.DefaultClient)
}
// NotImplementedStub returns a not implemented error

View File

@@ -10,6 +10,12 @@ import (
"strconv"
"strings"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
storemsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/store/v0"
storesvc "github.com/owncloud/ocis/protogen/gen/ocis/services/store/v0"
"github.com/asim/go-micro/plugins/client/grpc/v4"
revauser "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
rpcv1beta1 "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
@@ -21,11 +27,9 @@ import (
"github.com/cs3org/reva/pkg/token/manager/jwt"
"github.com/go-chi/chi/v5"
"github.com/google/uuid"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocs/pkg/service/v0/data"
"github.com/owncloud/ocis/ocs/pkg/service/v0/response"
ocstracing "github.com/owncloud/ocis/ocs/pkg/tracing"
storepb "github.com/owncloud/ocis/store/pkg/proto/v0"
"github.com/pkg/errors"
merrors "go-micro.dev/v4/errors"
"google.golang.org/genproto/protobuf/field_mask"
@@ -35,7 +39,7 @@ import (
// GetSelf returns the currently logged in user
func (o Ocs) GetSelf(w http.ResponseWriter, r *http.Request) {
var account *accounts.Account
var account *accountsmsg.Account
var err error
u, ok := revactx.ContextGetUser(r.Context())
if !ok || u.Id == nil || u.Id.OpaqueId == "" {
@@ -43,7 +47,7 @@ func (o Ocs) GetSelf(w http.ResponseWriter, r *http.Request) {
return
}
account, err = o.getAccountService().GetAccount(r.Context(), &accounts.GetAccountRequest{
account, err = o.getAccountService().GetAccount(r.Context(), &accountssvc.GetAccountRequest{
Id: u.Id.OpaqueId,
})
@@ -92,7 +96,7 @@ func (o Ocs) GetUser(w http.ResponseWriter, r *http.Request) {
if err != nil {
o.mustRender(w, r, response.ErrRender(data.MetaServerError.StatusCode, err.Error()))
}
var account *accounts.Account
var account *accountsmsg.Account
switch {
case userid == "":
@@ -198,12 +202,12 @@ func (o Ocs) AddUser(w http.ResponseWriter, r *http.Request) {
displayname = userid
}
newAccount := &accounts.Account{
newAccount := &accountsmsg.Account{
Id: uuid.New().String(),
DisplayName: displayname,
PreferredName: userid,
OnPremisesSamAccountName: userid,
PasswordProfile: &accounts.PasswordProfile{
PasswordProfile: &accountsmsg.PasswordProfile{
Password: password,
},
Mail: email,
@@ -218,11 +222,11 @@ func (o Ocs) AddUser(w http.ResponseWriter, r *http.Request) {
newAccount.GidNumber = gidNumber
}
var account *accounts.Account
var account *accountsmsg.Account
switch o.config.AccountBackend {
case "accounts":
account, err = o.getAccountService().CreateAccount(r.Context(), &accounts.CreateAccountRequest{
account, err = o.getAccountService().CreateAccount(r.Context(), &accountssvc.CreateAccountRequest{
Account: newAccount,
})
case "cs3":
@@ -284,7 +288,7 @@ func (o Ocs) EditUser(w http.ResponseWriter, r *http.Request) {
o.mustRender(w, r, response.ErrRender(data.MetaServerError.StatusCode, err.Error()))
}
var account *accounts.Account
var account *accountsmsg.Account
switch o.config.AccountBackend {
case "accounts":
account, err = o.fetchAccountByUsername(r.Context(), userid)
@@ -305,8 +309,8 @@ func (o Ocs) EditUser(w http.ResponseWriter, r *http.Request) {
return
}
req := accounts.UpdateAccountRequest{
Account: &accounts.Account{
req := accountssvc.UpdateAccountRequest{
Account: &accountsmsg.Account{
Id: account.Id,
},
}
@@ -322,7 +326,7 @@ func (o Ocs) EditUser(w http.ResponseWriter, r *http.Request) {
req.Account.OnPremisesSamAccountName = value
req.UpdateMask = &fieldmaskpb.FieldMask{Paths: []string{"PreferredName", "OnPremisesSamAccountName"}}
case "password":
req.Account.PasswordProfile = &accounts.PasswordProfile{
req.Account.PasswordProfile = &accountsmsg.PasswordProfile{
Password: value,
}
req.UpdateMask = &fieldmaskpb.FieldMask{Paths: []string{"PasswordProfile.Password"}}
@@ -365,7 +369,7 @@ func (o Ocs) DeleteUser(w http.ResponseWriter, r *http.Request) {
o.mustRender(w, r, response.ErrRender(data.MetaServerError.StatusCode, err.Error()))
}
var account *accounts.Account
var account *accountsmsg.Account
switch o.config.AccountBackend {
case "accounts":
account, err = o.fetchAccountByUsername(r.Context(), userid)
@@ -486,7 +490,7 @@ func (o Ocs) DeleteUser(w http.ResponseWriter, r *http.Request) {
}
}
req := accounts.DeleteAccountRequest{
req := accountssvc.DeleteAccountRequest{
Id: account.Id,
}
@@ -507,7 +511,7 @@ func (o Ocs) DeleteUser(w http.ResponseWriter, r *http.Request) {
}
// TODO(refs) this to ocis-pkg ... we are minting tokens all over the place ... or use a service? ... like reva?
func (o Ocs) mintTokenForUser(ctx context.Context, account *accounts.Account) (string, error) {
func (o Ocs) mintTokenForUser(ctx context.Context, account *accountsmsg.Account) (string, error) {
tm, _ := jwt.New(map[string]interface{}{
"secret": o.config.TokenManager.JWTSecret,
"expires": int64(24 * 60 * 60),
@@ -537,7 +541,7 @@ func (o Ocs) EnableUser(w http.ResponseWriter, r *http.Request) {
o.mustRender(w, r, response.ErrRender(data.MetaServerError.StatusCode, err.Error()))
}
var account *accounts.Account
var account *accountsmsg.Account
switch o.config.AccountBackend {
case "accounts":
account, err = o.fetchAccountByUsername(r.Context(), userid)
@@ -560,7 +564,7 @@ func (o Ocs) EnableUser(w http.ResponseWriter, r *http.Request) {
account.AccountEnabled = true
req := accounts.UpdateAccountRequest{
req := accountssvc.UpdateAccountRequest{
Account: account,
UpdateMask: &field_mask.FieldMask{
Paths: []string{"AccountEnabled"},
@@ -591,7 +595,7 @@ func (o Ocs) DisableUser(w http.ResponseWriter, r *http.Request) {
o.mustRender(w, r, response.ErrRender(data.MetaServerError.StatusCode, err.Error()))
}
var account *accounts.Account
var account *accountsmsg.Account
switch o.config.AccountBackend {
case "accounts":
account, err = o.fetchAccountByUsername(r.Context(), userid)
@@ -614,7 +618,7 @@ func (o Ocs) DisableUser(w http.ResponseWriter, r *http.Request) {
account.AccountEnabled = false
req := accounts.UpdateAccountRequest{
req := accountssvc.UpdateAccountRequest{
Account: account,
UpdateMask: &field_mask.FieldMask{
Paths: []string{"AccountEnabled"},
@@ -651,9 +655,9 @@ func (o Ocs) GetSigningKey(w http.ResponseWriter, r *http.Request) {
// use the user's UUID
userID := u.Id.OpaqueId
c := storepb.NewStoreService("com.owncloud.api.store", grpc.NewClient())
res, err := c.Read(r.Context(), &storepb.ReadRequest{
Options: &storepb.ReadOptions{
c := storesvc.NewStoreService("com.owncloud.api.store", grpc.NewClient())
res, err := c.Read(r.Context(), &storesvc.ReadRequest{
Options: &storemsg.ReadOptions{
Database: "proxy",
Table: "signing-keys",
},
@@ -685,12 +689,12 @@ func (o Ocs) GetSigningKey(w http.ResponseWriter, r *http.Request) {
}
signingKey := hex.EncodeToString(key)
_, err = c.Write(r.Context(), &storepb.WriteRequest{
Options: &storepb.WriteOptions{
_, err = c.Write(r.Context(), &storesvc.WriteRequest{
Options: &storemsg.WriteOptions{
Database: "proxy",
Table: "signing-keys",
},
Record: &storepb.Record{
Record: &storemsg.Record{
Key: userID,
Value: []byte(signingKey),
// TODO Expiry?
@@ -717,11 +721,11 @@ func (o Ocs) ListUsers(w http.ResponseWriter, r *http.Request) {
query = fmt.Sprintf("on_premises_sam_account_name eq '%s'", escapeValue(search))
}
var res *accounts.ListAccountsResponse
var res *accountssvc.ListAccountsResponse
var err error
switch o.config.AccountBackend {
case "accounts":
res, err = o.getAccountService().ListAccounts(r.Context(), &accounts.ListAccountsRequest{
res, err = o.getAccountService().ListAccounts(r.Context(), &accountssvc.ListAccountsRequest{
Query: query,
})
case "cs3":
@@ -750,9 +754,9 @@ func escapeValue(value string) string {
return strings.ReplaceAll(value, "'", "''")
}
func (o Ocs) fetchAccountByUsername(ctx context.Context, name string) (*accounts.Account, error) {
var res *accounts.ListAccountsResponse
res, err := o.getAccountService().ListAccounts(ctx, &accounts.ListAccountsRequest{
func (o Ocs) fetchAccountByUsername(ctx context.Context, name string) (*accountsmsg.Account, error) {
var res *accountssvc.ListAccountsResponse
res, err := o.getAccountService().ListAccounts(ctx, &accountssvc.ListAccountsRequest{
Query: fmt.Sprintf("on_premises_sam_account_name eq '%v'", escapeValue(name)),
})
if err != nil {
@@ -764,13 +768,13 @@ func (o Ocs) fetchAccountByUsername(ctx context.Context, name string) (*accounts
return nil, merrors.NotFound("", data.MessageUserNotFound)
}
func (o Ocs) fetchAccountFromCS3Backend(ctx context.Context, name string) (*accounts.Account, error) {
func (o Ocs) fetchAccountFromCS3Backend(ctx context.Context, name string) (*accountsmsg.Account, error) {
backend := o.getCS3Backend()
u, _, err := backend.GetUserByClaims(ctx, "username", name, false)
if err != nil {
return nil, err
}
return &accounts.Account{
return &accountsmsg.Account{
OnPremisesSamAccountName: u.Username,
DisplayName: u.DisplayName,
Mail: u.Mail,

95
protogen/docs/GRPC.tmpl Normal file
View File

@@ -0,0 +1,95 @@
---
{{- $package := (index .Files 0).Package }}
title: "{{ $package }}"
url: /grpc_apis/{{ $package }}
date: {{ now | date "2006-01-02T15:04:05Z07:00" }}
weight: 50
geekdocRepo: https://github.com/owncloud/ocis
---
{{`{{< toc >}}`}}
{{ range .Files -}}
{{ $filename := .Name }}
{{ $filenameParts := splitList "/" $filename }}
## {{ .Name }}
{{ .Description }}
{{- range .Messages -}}
{{- /* remove newline */}}### {{ .LongName }}
{{ .Description }}
{{ if .HasFields -}}
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
{{ range .Fields -}}
{{- $loca := printf "#%s" (.LongType | lower | replace "." "") -}}
{{- if and (hasPrefix "ocis." .LongType) (ge (len $filenameParts) 3) -}}
{{- $ltypeSpl := .LongType | splitList "." -}}
{{- $ltypePkg := slice $ltypeSpl 0 (sub (len $ltypeSpl) 1) | join "." -}}
{{- $loca = printf "/grpc_apis/%s/#%s" $ltypePkg (.Type | lower) -}}
{{- end -}}
| {{.Name}} | [{{.LongType}}]({{ $loca }}) | {{.Label}} | {{ .Description | replace "\n" "<br>" }}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end }} |
{{ end -}}
{{ end }}
{{ if .HasExtensions -}}
| Extension | Type | Base | Number | Description |
| --------- | ---- | ---- | ------ | ----------- |
{{ range .Extensions -}}
| {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{ .Description | replace "\n" "<br>" }}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end}} |
{{ end -}}
{{ end -}}
{{ end -}}
{{- range .Enums -}}
### {{ .LongName }}
{{ .Description }}
| Name | Number | Description |
| ---- | ------ | ----------- |
{{range .Values -}}
| {{.Name}} | {{.Number}} | {{ .Description | replace "\n" "<br>" }} |
{{ end -}}
{{ end -}}
{{ if .HasExtensions }}
### File-level Extensions
| Extension | Type | Base | Number | Description |
| --------- | ---- | ---- | ------ | ----------- |
{{ range .Extensions -}}
| {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{ .Description | replace "\n" "<br>" }}{{if .DefaultValue}} Default: `{{.DefaultValue}}`{{end}} |
{{ end -}}
{{ end -}}
{{- range .Services }}
### {{ .Name }}
{{ .Description }}
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
{{ range .Methods -}}
{{- $reqLoca := printf "#%s" (.RequestLongType | lower | replace "." "") -}}
{{- $respLoca := printf "#%s" (.ResponseLongType | lower | replace "." "") -}}
{{- if and (hasPrefix ".ocis." .RequestLongType) (ge (len $filenameParts) 3) }}
{{- $ltypeSpl := .RequestLongType | substr 1 -1 | splitList "." -}}
{{- $ltypePkg := slice $ltypeSpl 0 (sub (len $ltypeSpl) 1) | join "." -}}
{{- $reqLoca = printf "/grpc_apis/%s/#%s" $ltypePkg (.RequestType | lower) -}}
{{- end -}}
{{- if and (hasPrefix ".ocis." .ResponseLongType) (ge (len $filenameParts) 3) }}
{{- $ltypeSpl := .ResponseLongType | substr 1 -1 | splitList "." -}}
{{- $ltypePkg := slice $ltypeSpl 0 (sub (len $ltypeSpl) 1) | join "." -}}
{{- $respLoca = printf "/grpc_apis/%s/#%s" $ltypePkg (.ResponseType | lower) -}}
{{- end -}}
| {{.Name}} | [{{.RequestLongType}}]({{ $reqLoca }}){{if .RequestStreaming}} stream{{end}} | [{{.ResponseLongType}}]({{ $respLoca }}){{if .ResponseStreaming}} stream{{end}} | {{ .Description | replace "\n" "<br>" }} |
{{ end -}}
{{ end -}}
{{ end }}
## Scalar Value Types
| .proto Type | Notes | C++ | Java |
| ----------- | ----- | --- | ---- |
{{ range .Scalars -}}
| {{`{{< div id="`}}{{.ProtoType}}{{`" content="`}}{{.ProtoType}}{{`" >}}`}} | {{.Notes}} | {{.CppType}} | {{.JavaType}} |
{{ end }}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,16 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: ocis/messages/accounts/v0/accounts.proto
package v0
import (
fmt "fmt"
proto "google.golang.org/protobuf/proto"
_ "google.golang.org/protobuf/types/known/timestamppb"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

View File

@@ -0,0 +1,191 @@
// Code generated by protoc-gen-microweb. DO NOT EDIT.
// source: v0.proto
package v0
import (
"bytes"
"encoding/json"
"github.com/golang/protobuf/jsonpb"
)
// AccountJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Account. This struct is safe to replace or modify but
// should not be done so concurrently.
var AccountJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Account) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := AccountJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Account)(nil)
// AccountJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Account. This struct is safe to replace or modify but
// should not be done so concurrently.
var AccountJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Account) UnmarshalJSON(b []byte) error {
return AccountJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Account)(nil)
// IdentitiesJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Identities. This struct is safe to replace or modify but
// should not be done so concurrently.
var IdentitiesJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Identities) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := IdentitiesJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Identities)(nil)
// IdentitiesJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Identities. This struct is safe to replace or modify but
// should not be done so concurrently.
var IdentitiesJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Identities) UnmarshalJSON(b []byte) error {
return IdentitiesJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Identities)(nil)
// PasswordProfileJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of PasswordProfile. This struct is safe to replace or modify but
// should not be done so concurrently.
var PasswordProfileJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *PasswordProfile) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := PasswordProfileJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*PasswordProfile)(nil)
// PasswordProfileJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of PasswordProfile. This struct is safe to replace or modify but
// should not be done so concurrently.
var PasswordProfileJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *PasswordProfile) UnmarshalJSON(b []byte) error {
return PasswordProfileJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*PasswordProfile)(nil)
// GroupJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Group. This struct is safe to replace or modify but
// should not be done so concurrently.
var GroupJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Group) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := GroupJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Group)(nil)
// GroupJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Group. This struct is safe to replace or modify but
// should not be done so concurrently.
var GroupJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Group) UnmarshalJSON(b []byte) error {
return GroupJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Group)(nil)
// OnPremisesProvisioningErrorJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of OnPremisesProvisioningError. This struct is safe to replace or modify but
// should not be done so concurrently.
var OnPremisesProvisioningErrorJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *OnPremisesProvisioningError) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := OnPremisesProvisioningErrorJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*OnPremisesProvisioningError)(nil)
// OnPremisesProvisioningErrorJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of OnPremisesProvisioningError. This struct is safe to replace or modify but
// should not be done so concurrently.
var OnPremisesProvisioningErrorJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *OnPremisesProvisioningError) UnmarshalJSON(b []byte) error {
return OnPremisesProvisioningErrorJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*OnPremisesProvisioningError)(nil)

View File

@@ -0,0 +1,43 @@
{
"swagger": "2.0",
"info": {
"title": "ocis/messages/accounts/v0/accounts.proto",
"version": "version not set"
},
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: ocis/messages/settings/v0/settings.proto
package v0
import (
fmt "fmt"
proto "google.golang.org/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

View File

@@ -0,0 +1,587 @@
// Code generated by protoc-gen-microweb. DO NOT EDIT.
// source: v0.proto
package v0
import (
"bytes"
"encoding/json"
"github.com/golang/protobuf/jsonpb"
)
// ValueWithIdentifierJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of ValueWithIdentifier. This struct is safe to replace or modify but
// should not be done so concurrently.
var ValueWithIdentifierJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *ValueWithIdentifier) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := ValueWithIdentifierJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*ValueWithIdentifier)(nil)
// ValueWithIdentifierJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of ValueWithIdentifier. This struct is safe to replace or modify but
// should not be done so concurrently.
var ValueWithIdentifierJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *ValueWithIdentifier) UnmarshalJSON(b []byte) error {
return ValueWithIdentifierJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*ValueWithIdentifier)(nil)
// IdentifierJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Identifier. This struct is safe to replace or modify but
// should not be done so concurrently.
var IdentifierJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Identifier) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := IdentifierJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Identifier)(nil)
// IdentifierJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Identifier. This struct is safe to replace or modify but
// should not be done so concurrently.
var IdentifierJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Identifier) UnmarshalJSON(b []byte) error {
return IdentifierJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Identifier)(nil)
// UserRoleAssignmentJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of UserRoleAssignment. This struct is safe to replace or modify but
// should not be done so concurrently.
var UserRoleAssignmentJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *UserRoleAssignment) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := UserRoleAssignmentJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*UserRoleAssignment)(nil)
// UserRoleAssignmentJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of UserRoleAssignment. This struct is safe to replace or modify but
// should not be done so concurrently.
var UserRoleAssignmentJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *UserRoleAssignment) UnmarshalJSON(b []byte) error {
return UserRoleAssignmentJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*UserRoleAssignment)(nil)
// ResourceJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Resource. This struct is safe to replace or modify but
// should not be done so concurrently.
var ResourceJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Resource) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := ResourceJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Resource)(nil)
// ResourceJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Resource. This struct is safe to replace or modify but
// should not be done so concurrently.
var ResourceJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Resource) UnmarshalJSON(b []byte) error {
return ResourceJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Resource)(nil)
// BundleJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Bundle. This struct is safe to replace or modify but
// should not be done so concurrently.
var BundleJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Bundle) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := BundleJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Bundle)(nil)
// BundleJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Bundle. This struct is safe to replace or modify but
// should not be done so concurrently.
var BundleJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Bundle) UnmarshalJSON(b []byte) error {
return BundleJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Bundle)(nil)
// SettingJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Setting. This struct is safe to replace or modify but
// should not be done so concurrently.
var SettingJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Setting) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := SettingJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Setting)(nil)
// SettingJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Setting. This struct is safe to replace or modify but
// should not be done so concurrently.
var SettingJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Setting) UnmarshalJSON(b []byte) error {
return SettingJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Setting)(nil)
// IntJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Int. This struct is safe to replace or modify but
// should not be done so concurrently.
var IntJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Int) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := IntJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Int)(nil)
// IntJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Int. This struct is safe to replace or modify but
// should not be done so concurrently.
var IntJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Int) UnmarshalJSON(b []byte) error {
return IntJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Int)(nil)
// StringJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of String. This struct is safe to replace or modify but
// should not be done so concurrently.
var StringJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *String) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := StringJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*String)(nil)
// StringJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of String. This struct is safe to replace or modify but
// should not be done so concurrently.
var StringJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *String) UnmarshalJSON(b []byte) error {
return StringJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*String)(nil)
// BoolJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Bool. This struct is safe to replace or modify but
// should not be done so concurrently.
var BoolJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Bool) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := BoolJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Bool)(nil)
// BoolJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Bool. This struct is safe to replace or modify but
// should not be done so concurrently.
var BoolJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Bool) UnmarshalJSON(b []byte) error {
return BoolJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Bool)(nil)
// SingleChoiceListJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of SingleChoiceList. This struct is safe to replace or modify but
// should not be done so concurrently.
var SingleChoiceListJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *SingleChoiceList) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := SingleChoiceListJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*SingleChoiceList)(nil)
// SingleChoiceListJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of SingleChoiceList. This struct is safe to replace or modify but
// should not be done so concurrently.
var SingleChoiceListJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *SingleChoiceList) UnmarshalJSON(b []byte) error {
return SingleChoiceListJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*SingleChoiceList)(nil)
// MultiChoiceListJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of MultiChoiceList. This struct is safe to replace or modify but
// should not be done so concurrently.
var MultiChoiceListJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *MultiChoiceList) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := MultiChoiceListJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*MultiChoiceList)(nil)
// MultiChoiceListJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of MultiChoiceList. This struct is safe to replace or modify but
// should not be done so concurrently.
var MultiChoiceListJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *MultiChoiceList) UnmarshalJSON(b []byte) error {
return MultiChoiceListJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*MultiChoiceList)(nil)
// ListOptionJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of ListOption. This struct is safe to replace or modify but
// should not be done so concurrently.
var ListOptionJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *ListOption) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := ListOptionJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*ListOption)(nil)
// ListOptionJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of ListOption. This struct is safe to replace or modify but
// should not be done so concurrently.
var ListOptionJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *ListOption) UnmarshalJSON(b []byte) error {
return ListOptionJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*ListOption)(nil)
// PermissionJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Permission. This struct is safe to replace or modify but
// should not be done so concurrently.
var PermissionJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Permission) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := PermissionJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Permission)(nil)
// PermissionJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Permission. This struct is safe to replace or modify but
// should not be done so concurrently.
var PermissionJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Permission) UnmarshalJSON(b []byte) error {
return PermissionJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Permission)(nil)
// ValueJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Value. This struct is safe to replace or modify but
// should not be done so concurrently.
var ValueJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Value) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := ValueJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Value)(nil)
// ValueJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Value. This struct is safe to replace or modify but
// should not be done so concurrently.
var ValueJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Value) UnmarshalJSON(b []byte) error {
return ValueJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Value)(nil)
// ListValueJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of ListValue. This struct is safe to replace or modify but
// should not be done so concurrently.
var ListValueJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *ListValue) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := ListValueJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*ListValue)(nil)
// ListValueJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of ListValue. This struct is safe to replace or modify but
// should not be done so concurrently.
var ListValueJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *ListValue) UnmarshalJSON(b []byte) error {
return ListValueJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*ListValue)(nil)
// ListOptionValueJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of ListOptionValue. This struct is safe to replace or modify but
// should not be done so concurrently.
var ListOptionValueJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *ListOptionValue) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := ListOptionValueJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*ListOptionValue)(nil)
// ListOptionValueJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of ListOptionValue. This struct is safe to replace or modify but
// should not be done so concurrently.
var ListOptionValueJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *ListOptionValue) UnmarshalJSON(b []byte) error {
return ListOptionValueJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*ListOptionValue)(nil)

View File

@@ -0,0 +1,43 @@
{
"swagger": "2.0",
"info": {
"title": "ocis/messages/settings/v0/settings.proto",
"version": "version not set"
},
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
}
}
}
}
}

View File

@@ -0,0 +1,670 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc v3.17.3
// source: ocis/messages/store/v0/store.proto
package v0
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Field struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// type of value e.g string, int, int64, bool, float64
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
// the actual value
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}
func (x *Field) Reset() {
*x = Field{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_messages_store_v0_store_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Field) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Field) ProtoMessage() {}
func (x *Field) ProtoReflect() protoreflect.Message {
mi := &file_ocis_messages_store_v0_store_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Field.ProtoReflect.Descriptor instead.
func (*Field) Descriptor() ([]byte, []int) {
return file_ocis_messages_store_v0_store_proto_rawDescGZIP(), []int{0}
}
func (x *Field) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *Field) GetValue() string {
if x != nil {
return x.Value
}
return ""
}
type Record struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// key of the recorda
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
// value in the record
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
// time.Duration (signed int64 nanoseconds)
Expiry int64 `protobuf:"varint,3,opt,name=expiry,proto3" json:"expiry,omitempty"`
// the associated metadata
Metadata map[string]*Field `protobuf:"bytes,4,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
func (x *Record) Reset() {
*x = Record{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_messages_store_v0_store_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Record) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Record) ProtoMessage() {}
func (x *Record) ProtoReflect() protoreflect.Message {
mi := &file_ocis_messages_store_v0_store_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Record.ProtoReflect.Descriptor instead.
func (*Record) Descriptor() ([]byte, []int) {
return file_ocis_messages_store_v0_store_proto_rawDescGZIP(), []int{1}
}
func (x *Record) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
func (x *Record) GetValue() []byte {
if x != nil {
return x.Value
}
return nil
}
func (x *Record) GetExpiry() int64 {
if x != nil {
return x.Expiry
}
return 0
}
func (x *Record) GetMetadata() map[string]*Field {
if x != nil {
return x.Metadata
}
return nil
}
type ReadOptions struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Database string `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"`
Table string `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"`
Prefix bool `protobuf:"varint,3,opt,name=prefix,proto3" json:"prefix,omitempty"`
Suffix bool `protobuf:"varint,4,opt,name=suffix,proto3" json:"suffix,omitempty"`
Limit uint64 `protobuf:"varint,5,opt,name=limit,proto3" json:"limit,omitempty"`
Offset uint64 `protobuf:"varint,6,opt,name=offset,proto3" json:"offset,omitempty"`
Where map[string]*Field `protobuf:"bytes,7,rep,name=where,proto3" json:"where,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
func (x *ReadOptions) Reset() {
*x = ReadOptions{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_messages_store_v0_store_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ReadOptions) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReadOptions) ProtoMessage() {}
func (x *ReadOptions) ProtoReflect() protoreflect.Message {
mi := &file_ocis_messages_store_v0_store_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ReadOptions.ProtoReflect.Descriptor instead.
func (*ReadOptions) Descriptor() ([]byte, []int) {
return file_ocis_messages_store_v0_store_proto_rawDescGZIP(), []int{2}
}
func (x *ReadOptions) GetDatabase() string {
if x != nil {
return x.Database
}
return ""
}
func (x *ReadOptions) GetTable() string {
if x != nil {
return x.Table
}
return ""
}
func (x *ReadOptions) GetPrefix() bool {
if x != nil {
return x.Prefix
}
return false
}
func (x *ReadOptions) GetSuffix() bool {
if x != nil {
return x.Suffix
}
return false
}
func (x *ReadOptions) GetLimit() uint64 {
if x != nil {
return x.Limit
}
return 0
}
func (x *ReadOptions) GetOffset() uint64 {
if x != nil {
return x.Offset
}
return 0
}
func (x *ReadOptions) GetWhere() map[string]*Field {
if x != nil {
return x.Where
}
return nil
}
type WriteOptions struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Database string `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"`
Table string `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"`
// time.Time
Expiry int64 `protobuf:"varint,3,opt,name=expiry,proto3" json:"expiry,omitempty"`
// time.Duration
Ttl int64 `protobuf:"varint,4,opt,name=ttl,proto3" json:"ttl,omitempty"`
}
func (x *WriteOptions) Reset() {
*x = WriteOptions{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_messages_store_v0_store_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *WriteOptions) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WriteOptions) ProtoMessage() {}
func (x *WriteOptions) ProtoReflect() protoreflect.Message {
mi := &file_ocis_messages_store_v0_store_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use WriteOptions.ProtoReflect.Descriptor instead.
func (*WriteOptions) Descriptor() ([]byte, []int) {
return file_ocis_messages_store_v0_store_proto_rawDescGZIP(), []int{3}
}
func (x *WriteOptions) GetDatabase() string {
if x != nil {
return x.Database
}
return ""
}
func (x *WriteOptions) GetTable() string {
if x != nil {
return x.Table
}
return ""
}
func (x *WriteOptions) GetExpiry() int64 {
if x != nil {
return x.Expiry
}
return 0
}
func (x *WriteOptions) GetTtl() int64 {
if x != nil {
return x.Ttl
}
return 0
}
type DeleteOptions struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Database string `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"`
Table string `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"`
}
func (x *DeleteOptions) Reset() {
*x = DeleteOptions{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_messages_store_v0_store_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteOptions) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteOptions) ProtoMessage() {}
func (x *DeleteOptions) ProtoReflect() protoreflect.Message {
mi := &file_ocis_messages_store_v0_store_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeleteOptions.ProtoReflect.Descriptor instead.
func (*DeleteOptions) Descriptor() ([]byte, []int) {
return file_ocis_messages_store_v0_store_proto_rawDescGZIP(), []int{4}
}
func (x *DeleteOptions) GetDatabase() string {
if x != nil {
return x.Database
}
return ""
}
func (x *DeleteOptions) GetTable() string {
if x != nil {
return x.Table
}
return ""
}
type ListOptions struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Database string `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"`
Table string `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"`
Prefix string `protobuf:"bytes,3,opt,name=prefix,proto3" json:"prefix,omitempty"`
Suffix string `protobuf:"bytes,4,opt,name=suffix,proto3" json:"suffix,omitempty"`
Limit uint64 `protobuf:"varint,5,opt,name=limit,proto3" json:"limit,omitempty"`
Offset uint64 `protobuf:"varint,6,opt,name=offset,proto3" json:"offset,omitempty"`
}
func (x *ListOptions) Reset() {
*x = ListOptions{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_messages_store_v0_store_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListOptions) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListOptions) ProtoMessage() {}
func (x *ListOptions) ProtoReflect() protoreflect.Message {
mi := &file_ocis_messages_store_v0_store_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListOptions.ProtoReflect.Descriptor instead.
func (*ListOptions) Descriptor() ([]byte, []int) {
return file_ocis_messages_store_v0_store_proto_rawDescGZIP(), []int{5}
}
func (x *ListOptions) GetDatabase() string {
if x != nil {
return x.Database
}
return ""
}
func (x *ListOptions) GetTable() string {
if x != nil {
return x.Table
}
return ""
}
func (x *ListOptions) GetPrefix() string {
if x != nil {
return x.Prefix
}
return ""
}
func (x *ListOptions) GetSuffix() string {
if x != nil {
return x.Suffix
}
return ""
}
func (x *ListOptions) GetLimit() uint64 {
if x != nil {
return x.Limit
}
return 0
}
func (x *ListOptions) GetOffset() uint64 {
if x != nil {
return x.Offset
}
return 0
}
var File_ocis_messages_store_v0_store_proto protoreflect.FileDescriptor
var file_ocis_messages_store_v0_store_proto_rawDesc = []byte{
0x0a, 0x22, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2f,
0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x22, 0x31, 0x0a, 0x05,
0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22,
0xee, 0x01, 0x0a, 0x06, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01,
0x28, 0x03, 0x52, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x12, 0x48, 0x0a, 0x08, 0x6d, 0x65,
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f,
0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f,
0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x4d, 0x65, 0x74,
0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61,
0x64, 0x61, 0x74, 0x61, 0x1a, 0x5a, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x33, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e,
0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
0x22, 0xbc, 0x02, 0x0a, 0x0b, 0x52, 0x65, 0x61, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x12, 0x1a, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05,
0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x61, 0x62,
0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x03, 0x20, 0x01,
0x28, 0x08, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x75,
0x66, 0x66, 0x69, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x73, 0x75, 0x66, 0x66,
0x69, 0x78, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28,
0x04, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73,
0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74,
0x12, 0x44, 0x0a, 0x05, 0x77, 0x68, 0x65, 0x72, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x2e, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e,
0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x4f, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x57, 0x68, 0x65, 0x72, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,
0x05, 0x77, 0x68, 0x65, 0x72, 0x65, 0x1a, 0x57, 0x0a, 0x0a, 0x57, 0x68, 0x65, 0x72, 0x65, 0x45,
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x33, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x46,
0x69, 0x65, 0x6c, 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22,
0x6a, 0x0a, 0x0c, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12,
0x1a, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74,
0x61, 0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c,
0x65, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28,
0x03, 0x52, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c,
0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x22, 0x41, 0x0a, 0x0d, 0x44,
0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x0a, 0x08,
0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x9d,
0x01, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a,
0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x61,
0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65,
0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x75, 0x66, 0x66,
0x69, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78,
0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52,
0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74,
0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x3e,
0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e,
0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x67, 0x65, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x6d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x30, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_ocis_messages_store_v0_store_proto_rawDescOnce sync.Once
file_ocis_messages_store_v0_store_proto_rawDescData = file_ocis_messages_store_v0_store_proto_rawDesc
)
func file_ocis_messages_store_v0_store_proto_rawDescGZIP() []byte {
file_ocis_messages_store_v0_store_proto_rawDescOnce.Do(func() {
file_ocis_messages_store_v0_store_proto_rawDescData = protoimpl.X.CompressGZIP(file_ocis_messages_store_v0_store_proto_rawDescData)
})
return file_ocis_messages_store_v0_store_proto_rawDescData
}
var file_ocis_messages_store_v0_store_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_ocis_messages_store_v0_store_proto_goTypes = []interface{}{
(*Field)(nil), // 0: ocis.messages.store.v0.Field
(*Record)(nil), // 1: ocis.messages.store.v0.Record
(*ReadOptions)(nil), // 2: ocis.messages.store.v0.ReadOptions
(*WriteOptions)(nil), // 3: ocis.messages.store.v0.WriteOptions
(*DeleteOptions)(nil), // 4: ocis.messages.store.v0.DeleteOptions
(*ListOptions)(nil), // 5: ocis.messages.store.v0.ListOptions
nil, // 6: ocis.messages.store.v0.Record.MetadataEntry
nil, // 7: ocis.messages.store.v0.ReadOptions.WhereEntry
}
var file_ocis_messages_store_v0_store_proto_depIdxs = []int32{
6, // 0: ocis.messages.store.v0.Record.metadata:type_name -> ocis.messages.store.v0.Record.MetadataEntry
7, // 1: ocis.messages.store.v0.ReadOptions.where:type_name -> ocis.messages.store.v0.ReadOptions.WhereEntry
0, // 2: ocis.messages.store.v0.Record.MetadataEntry.value:type_name -> ocis.messages.store.v0.Field
0, // 3: ocis.messages.store.v0.ReadOptions.WhereEntry.value:type_name -> ocis.messages.store.v0.Field
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_ocis_messages_store_v0_store_proto_init() }
func file_ocis_messages_store_v0_store_proto_init() {
if File_ocis_messages_store_v0_store_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_ocis_messages_store_v0_store_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Field); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_messages_store_v0_store_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Record); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_messages_store_v0_store_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReadOptions); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_messages_store_v0_store_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WriteOptions); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_messages_store_v0_store_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteOptions); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_messages_store_v0_store_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListOptions); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_ocis_messages_store_v0_store_proto_rawDesc,
NumEnums: 0,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_ocis_messages_store_v0_store_proto_goTypes,
DependencyIndexes: file_ocis_messages_store_v0_store_proto_depIdxs,
MessageInfos: file_ocis_messages_store_v0_store_proto_msgTypes,
}.Build()
File_ocis_messages_store_v0_store_proto = out.File
file_ocis_messages_store_v0_store_proto_rawDesc = nil
file_ocis_messages_store_v0_store_proto_goTypes = nil
file_ocis_messages_store_v0_store_proto_depIdxs = nil
}

View File

@@ -0,0 +1,15 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: ocis/messages/store/v0/store.proto
package v0
import (
fmt "fmt"
proto "google.golang.org/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

View File

@@ -0,0 +1,43 @@
{
"swagger": "2.0",
"info": {
"title": "ocis/messages/store/v0/store.proto",
"version": "version not set"
},
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
}
}
}
}
}

View File

@@ -0,0 +1,269 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc v3.17.3
// source: ocis/messages/thumbnails/v0/thumbnails.proto
package v0
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type WebdavSource struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// REQUIRED.
Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
// REQUIRED.
IsPublicLink bool `protobuf:"varint,2,opt,name=is_public_link,json=isPublicLink,proto3" json:"is_public_link,omitempty"`
// OPTIONAL.
WebdavAuthorization string `protobuf:"bytes,3,opt,name=webdav_authorization,json=webdavAuthorization,proto3" json:"webdav_authorization,omitempty"`
// OPTIONAL.
RevaAuthorization string `protobuf:"bytes,4,opt,name=reva_authorization,json=revaAuthorization,proto3" json:"reva_authorization,omitempty"`
// OPTIONAL.
PublicLinkToken string `protobuf:"bytes,5,opt,name=public_link_token,json=publicLinkToken,proto3" json:"public_link_token,omitempty"`
}
func (x *WebdavSource) Reset() {
*x = WebdavSource{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_messages_thumbnails_v0_thumbnails_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *WebdavSource) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WebdavSource) ProtoMessage() {}
func (x *WebdavSource) ProtoReflect() protoreflect.Message {
mi := &file_ocis_messages_thumbnails_v0_thumbnails_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use WebdavSource.ProtoReflect.Descriptor instead.
func (*WebdavSource) Descriptor() ([]byte, []int) {
return file_ocis_messages_thumbnails_v0_thumbnails_proto_rawDescGZIP(), []int{0}
}
func (x *WebdavSource) GetUrl() string {
if x != nil {
return x.Url
}
return ""
}
func (x *WebdavSource) GetIsPublicLink() bool {
if x != nil {
return x.IsPublicLink
}
return false
}
func (x *WebdavSource) GetWebdavAuthorization() string {
if x != nil {
return x.WebdavAuthorization
}
return ""
}
func (x *WebdavSource) GetRevaAuthorization() string {
if x != nil {
return x.RevaAuthorization
}
return ""
}
func (x *WebdavSource) GetPublicLinkToken() string {
if x != nil {
return x.PublicLinkToken
}
return ""
}
type CS3Source struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
Authorization string `protobuf:"bytes,2,opt,name=authorization,proto3" json:"authorization,omitempty"`
}
func (x *CS3Source) Reset() {
*x = CS3Source{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_messages_thumbnails_v0_thumbnails_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CS3Source) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CS3Source) ProtoMessage() {}
func (x *CS3Source) ProtoReflect() protoreflect.Message {
mi := &file_ocis_messages_thumbnails_v0_thumbnails_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CS3Source.ProtoReflect.Descriptor instead.
func (*CS3Source) Descriptor() ([]byte, []int) {
return file_ocis_messages_thumbnails_v0_thumbnails_proto_rawDescGZIP(), []int{1}
}
func (x *CS3Source) GetPath() string {
if x != nil {
return x.Path
}
return ""
}
func (x *CS3Source) GetAuthorization() string {
if x != nil {
return x.Authorization
}
return ""
}
var File_ocis_messages_thumbnails_v0_thumbnails_proto protoreflect.FileDescriptor
var file_ocis_messages_thumbnails_v0_thumbnails_proto_rawDesc = []byte{
0x0a, 0x2c, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2f,
0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x73, 0x2f, 0x76, 0x30, 0x2f, 0x74, 0x68,
0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b,
0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x74, 0x68,
0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x76, 0x30, 0x22, 0xd4, 0x01, 0x0a, 0x0c,
0x57, 0x65, 0x62, 0x64, 0x61, 0x76, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03,
0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x24,
0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6c, 0x69, 0x6e, 0x6b,
0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63,
0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x31, 0x0a, 0x14, 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x5f, 0x61,
0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x13, 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72,
0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x12, 0x72, 0x65, 0x76, 0x61, 0x5f,
0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x52, 0x11, 0x72, 0x65, 0x76, 0x61, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69,
0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x11, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63,
0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4c, 0x69, 0x6e, 0x6b, 0x54, 0x6f, 0x6b,
0x65, 0x6e, 0x22, 0x45, 0x0a, 0x09, 0x43, 0x53, 0x33, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12,
0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70,
0x61, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x75, 0x74, 0x68,
0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64,
0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x67,
0x65, 0x6e, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73,
0x2f, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x73, 0x2f, 0x76, 0x30, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_ocis_messages_thumbnails_v0_thumbnails_proto_rawDescOnce sync.Once
file_ocis_messages_thumbnails_v0_thumbnails_proto_rawDescData = file_ocis_messages_thumbnails_v0_thumbnails_proto_rawDesc
)
func file_ocis_messages_thumbnails_v0_thumbnails_proto_rawDescGZIP() []byte {
file_ocis_messages_thumbnails_v0_thumbnails_proto_rawDescOnce.Do(func() {
file_ocis_messages_thumbnails_v0_thumbnails_proto_rawDescData = protoimpl.X.CompressGZIP(file_ocis_messages_thumbnails_v0_thumbnails_proto_rawDescData)
})
return file_ocis_messages_thumbnails_v0_thumbnails_proto_rawDescData
}
var file_ocis_messages_thumbnails_v0_thumbnails_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_ocis_messages_thumbnails_v0_thumbnails_proto_goTypes = []interface{}{
(*WebdavSource)(nil), // 0: ocis.messages.thumbnails.v0.WebdavSource
(*CS3Source)(nil), // 1: ocis.messages.thumbnails.v0.CS3Source
}
var file_ocis_messages_thumbnails_v0_thumbnails_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_ocis_messages_thumbnails_v0_thumbnails_proto_init() }
func file_ocis_messages_thumbnails_v0_thumbnails_proto_init() {
if File_ocis_messages_thumbnails_v0_thumbnails_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_ocis_messages_thumbnails_v0_thumbnails_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WebdavSource); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_messages_thumbnails_v0_thumbnails_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CS3Source); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_ocis_messages_thumbnails_v0_thumbnails_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_ocis_messages_thumbnails_v0_thumbnails_proto_goTypes,
DependencyIndexes: file_ocis_messages_thumbnails_v0_thumbnails_proto_depIdxs,
MessageInfos: file_ocis_messages_thumbnails_v0_thumbnails_proto_msgTypes,
}.Build()
File_ocis_messages_thumbnails_v0_thumbnails_proto = out.File
file_ocis_messages_thumbnails_v0_thumbnails_proto_rawDesc = nil
file_ocis_messages_thumbnails_v0_thumbnails_proto_goTypes = nil
file_ocis_messages_thumbnails_v0_thumbnails_proto_depIdxs = nil
}

View File

@@ -0,0 +1,15 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: ocis/messages/thumbnails/v0/thumbnails.proto
package v0
import (
fmt "fmt"
proto "google.golang.org/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

View File

@@ -0,0 +1,43 @@
{
"swagger": "2.0",
"info": {
"title": "ocis/messages/thumbnails/v0/thumbnails.proto",
"version": "version not set"
},
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
}
}
}
}
}

View File

@@ -1,8 +1,9 @@
package proto
package v0
import (
context "context"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
client "go-micro.dev/v4/client"
empty "google.golang.org/protobuf/types/known/emptypb"
)
@@ -37,9 +38,9 @@ func mockAccSvc(retErr bool) proto.AccountsService {
*/
type MockAccountsService struct {
ListFunc func(ctx context.Context, in *ListAccountsRequest, opts ...client.CallOption) (*ListAccountsResponse, error)
GetFunc func(ctx context.Context, in *GetAccountRequest, opts ...client.CallOption) (*Account, error)
CreateFunc func(ctx context.Context, in *CreateAccountRequest, opts ...client.CallOption) (*Account, error)
UpdateFunc func(ctx context.Context, in *UpdateAccountRequest, opts ...client.CallOption) (*Account, error)
GetFunc func(ctx context.Context, in *GetAccountRequest, opts ...client.CallOption) (*accountsmsg.Account, error)
CreateFunc func(ctx context.Context, in *CreateAccountRequest, opts ...client.CallOption) (*accountsmsg.Account, error)
UpdateFunc func(ctx context.Context, in *UpdateAccountRequest, opts ...client.CallOption) (*accountsmsg.Account, error)
DeleteFunc func(ctx context.Context, in *DeleteAccountRequest, opts ...client.CallOption) (*empty.Empty, error)
}
@@ -53,7 +54,7 @@ func (m MockAccountsService) ListAccounts(ctx context.Context, in *ListAccountsR
}
// GetAccount will panic if the function has been called, but not mocked
func (m MockAccountsService) GetAccount(ctx context.Context, in *GetAccountRequest, opts ...client.CallOption) (*Account, error) {
func (m MockAccountsService) GetAccount(ctx context.Context, in *GetAccountRequest, opts ...client.CallOption) (*accountsmsg.Account, error) {
if m.GetFunc != nil {
return m.GetFunc(ctx, in, opts...)
}
@@ -62,7 +63,7 @@ func (m MockAccountsService) GetAccount(ctx context.Context, in *GetAccountReque
}
// CreateAccount will panic if the function has been called, but not mocked
func (m MockAccountsService) CreateAccount(ctx context.Context, in *CreateAccountRequest, opts ...client.CallOption) (*Account, error) {
func (m MockAccountsService) CreateAccount(ctx context.Context, in *CreateAccountRequest, opts ...client.CallOption) (*accountsmsg.Account, error) {
if m.CreateFunc != nil {
return m.CreateFunc(ctx, in, opts...)
}
@@ -71,7 +72,7 @@ func (m MockAccountsService) CreateAccount(ctx context.Context, in *CreateAccoun
}
// UpdateAccount will panic if the function has been called, but not mocked
func (m MockAccountsService) UpdateAccount(ctx context.Context, in *UpdateAccountRequest, opts ...client.CallOption) (*Account, error) {
func (m MockAccountsService) UpdateAccount(ctx context.Context, in *UpdateAccountRequest, opts ...client.CallOption) (*accountsmsg.Account, error) {
if m.UpdateFunc != nil {
return m.UpdateFunc(ctx, in, opts...)
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +1,16 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/v0/accounts.proto
// source: ocis/services/accounts/v0/accounts.proto
package proto
package v0
import (
fmt "fmt"
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
v0 "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
_ "google.golang.org/genproto/googleapis/api/annotations"
proto "google.golang.org/protobuf/proto"
emptypb "google.golang.org/protobuf/types/known/emptypb"
_ "google.golang.org/protobuf/types/known/fieldmaskpb"
_ "google.golang.org/protobuf/types/known/timestamppb"
math "math"
)
@@ -80,11 +80,11 @@ type AccountsService interface {
// Lists accounts
ListAccounts(ctx context.Context, in *ListAccountsRequest, opts ...client.CallOption) (*ListAccountsResponse, error)
// Gets an account
GetAccount(ctx context.Context, in *GetAccountRequest, opts ...client.CallOption) (*Account, error)
GetAccount(ctx context.Context, in *GetAccountRequest, opts ...client.CallOption) (*v0.Account, error)
// Creates an account
CreateAccount(ctx context.Context, in *CreateAccountRequest, opts ...client.CallOption) (*Account, error)
CreateAccount(ctx context.Context, in *CreateAccountRequest, opts ...client.CallOption) (*v0.Account, error)
// Updates an account
UpdateAccount(ctx context.Context, in *UpdateAccountRequest, opts ...client.CallOption) (*Account, error)
UpdateAccount(ctx context.Context, in *UpdateAccountRequest, opts ...client.CallOption) (*v0.Account, error)
// Deletes an account
DeleteAccount(ctx context.Context, in *DeleteAccountRequest, opts ...client.CallOption) (*emptypb.Empty, error)
}
@@ -111,9 +111,9 @@ func (c *accountsService) ListAccounts(ctx context.Context, in *ListAccountsRequ
return out, nil
}
func (c *accountsService) GetAccount(ctx context.Context, in *GetAccountRequest, opts ...client.CallOption) (*Account, error) {
func (c *accountsService) GetAccount(ctx context.Context, in *GetAccountRequest, opts ...client.CallOption) (*v0.Account, error) {
req := c.c.NewRequest(c.name, "AccountsService.GetAccount", in)
out := new(Account)
out := new(v0.Account)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
@@ -121,9 +121,9 @@ func (c *accountsService) GetAccount(ctx context.Context, in *GetAccountRequest,
return out, nil
}
func (c *accountsService) CreateAccount(ctx context.Context, in *CreateAccountRequest, opts ...client.CallOption) (*Account, error) {
func (c *accountsService) CreateAccount(ctx context.Context, in *CreateAccountRequest, opts ...client.CallOption) (*v0.Account, error) {
req := c.c.NewRequest(c.name, "AccountsService.CreateAccount", in)
out := new(Account)
out := new(v0.Account)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
@@ -131,9 +131,9 @@ func (c *accountsService) CreateAccount(ctx context.Context, in *CreateAccountRe
return out, nil
}
func (c *accountsService) UpdateAccount(ctx context.Context, in *UpdateAccountRequest, opts ...client.CallOption) (*Account, error) {
func (c *accountsService) UpdateAccount(ctx context.Context, in *UpdateAccountRequest, opts ...client.CallOption) (*v0.Account, error) {
req := c.c.NewRequest(c.name, "AccountsService.UpdateAccount", in)
out := new(Account)
out := new(v0.Account)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
@@ -157,11 +157,11 @@ type AccountsServiceHandler interface {
// Lists accounts
ListAccounts(context.Context, *ListAccountsRequest, *ListAccountsResponse) error
// Gets an account
GetAccount(context.Context, *GetAccountRequest, *Account) error
GetAccount(context.Context, *GetAccountRequest, *v0.Account) error
// Creates an account
CreateAccount(context.Context, *CreateAccountRequest, *Account) error
CreateAccount(context.Context, *CreateAccountRequest, *v0.Account) error
// Updates an account
UpdateAccount(context.Context, *UpdateAccountRequest, *Account) error
UpdateAccount(context.Context, *UpdateAccountRequest, *v0.Account) error
// Deletes an account
DeleteAccount(context.Context, *DeleteAccountRequest, *emptypb.Empty) error
}
@@ -169,9 +169,9 @@ type AccountsServiceHandler interface {
func RegisterAccountsServiceHandler(s server.Server, hdlr AccountsServiceHandler, opts ...server.HandlerOption) error {
type accountsService interface {
ListAccounts(ctx context.Context, in *ListAccountsRequest, out *ListAccountsResponse) error
GetAccount(ctx context.Context, in *GetAccountRequest, out *Account) error
CreateAccount(ctx context.Context, in *CreateAccountRequest, out *Account) error
UpdateAccount(ctx context.Context, in *UpdateAccountRequest, out *Account) error
GetAccount(ctx context.Context, in *GetAccountRequest, out *v0.Account) error
CreateAccount(ctx context.Context, in *CreateAccountRequest, out *v0.Account) error
UpdateAccount(ctx context.Context, in *UpdateAccountRequest, out *v0.Account) error
DeleteAccount(ctx context.Context, in *DeleteAccountRequest, out *emptypb.Empty) error
}
type AccountsService struct {
@@ -224,15 +224,15 @@ func (h *accountsServiceHandler) ListAccounts(ctx context.Context, in *ListAccou
return h.AccountsServiceHandler.ListAccounts(ctx, in, out)
}
func (h *accountsServiceHandler) GetAccount(ctx context.Context, in *GetAccountRequest, out *Account) error {
func (h *accountsServiceHandler) GetAccount(ctx context.Context, in *GetAccountRequest, out *v0.Account) error {
return h.AccountsServiceHandler.GetAccount(ctx, in, out)
}
func (h *accountsServiceHandler) CreateAccount(ctx context.Context, in *CreateAccountRequest, out *Account) error {
func (h *accountsServiceHandler) CreateAccount(ctx context.Context, in *CreateAccountRequest, out *v0.Account) error {
return h.AccountsServiceHandler.CreateAccount(ctx, in, out)
}
func (h *accountsServiceHandler) UpdateAccount(ctx context.Context, in *UpdateAccountRequest, out *Account) error {
func (h *accountsServiceHandler) UpdateAccount(ctx context.Context, in *UpdateAccountRequest, out *v0.Account) error {
return h.AccountsServiceHandler.UpdateAccount(ctx, in, out)
}
@@ -309,17 +309,17 @@ type GroupsService interface {
// Lists groups
ListGroups(ctx context.Context, in *ListGroupsRequest, opts ...client.CallOption) (*ListGroupsResponse, error)
// Gets an groups
GetGroup(ctx context.Context, in *GetGroupRequest, opts ...client.CallOption) (*Group, error)
GetGroup(ctx context.Context, in *GetGroupRequest, opts ...client.CallOption) (*v0.Group, error)
// Creates a group
CreateGroup(ctx context.Context, in *CreateGroupRequest, opts ...client.CallOption) (*Group, error)
CreateGroup(ctx context.Context, in *CreateGroupRequest, opts ...client.CallOption) (*v0.Group, error)
// Updates a group
UpdateGroup(ctx context.Context, in *UpdateGroupRequest, opts ...client.CallOption) (*Group, error)
UpdateGroup(ctx context.Context, in *UpdateGroupRequest, opts ...client.CallOption) (*v0.Group, error)
// Deletes a group
DeleteGroup(ctx context.Context, in *DeleteGroupRequest, opts ...client.CallOption) (*emptypb.Empty, error)
// group:addmember https://docs.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-1.0&tabs=http
AddMember(ctx context.Context, in *AddMemberRequest, opts ...client.CallOption) (*Group, error)
AddMember(ctx context.Context, in *AddMemberRequest, opts ...client.CallOption) (*v0.Group, error)
// group:removemember https://docs.microsoft.com/en-us/graph/api/group-delete-members?view=graph-rest-1.0
RemoveMember(ctx context.Context, in *RemoveMemberRequest, opts ...client.CallOption) (*Group, error)
RemoveMember(ctx context.Context, in *RemoveMemberRequest, opts ...client.CallOption) (*v0.Group, error)
// group:listmembers https://docs.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0
ListMembers(ctx context.Context, in *ListMembersRequest, opts ...client.CallOption) (*ListMembersResponse, error)
}
@@ -346,9 +346,9 @@ func (c *groupsService) ListGroups(ctx context.Context, in *ListGroupsRequest, o
return out, nil
}
func (c *groupsService) GetGroup(ctx context.Context, in *GetGroupRequest, opts ...client.CallOption) (*Group, error) {
func (c *groupsService) GetGroup(ctx context.Context, in *GetGroupRequest, opts ...client.CallOption) (*v0.Group, error) {
req := c.c.NewRequest(c.name, "GroupsService.GetGroup", in)
out := new(Group)
out := new(v0.Group)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
@@ -356,9 +356,9 @@ func (c *groupsService) GetGroup(ctx context.Context, in *GetGroupRequest, opts
return out, nil
}
func (c *groupsService) CreateGroup(ctx context.Context, in *CreateGroupRequest, opts ...client.CallOption) (*Group, error) {
func (c *groupsService) CreateGroup(ctx context.Context, in *CreateGroupRequest, opts ...client.CallOption) (*v0.Group, error) {
req := c.c.NewRequest(c.name, "GroupsService.CreateGroup", in)
out := new(Group)
out := new(v0.Group)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
@@ -366,9 +366,9 @@ func (c *groupsService) CreateGroup(ctx context.Context, in *CreateGroupRequest,
return out, nil
}
func (c *groupsService) UpdateGroup(ctx context.Context, in *UpdateGroupRequest, opts ...client.CallOption) (*Group, error) {
func (c *groupsService) UpdateGroup(ctx context.Context, in *UpdateGroupRequest, opts ...client.CallOption) (*v0.Group, error) {
req := c.c.NewRequest(c.name, "GroupsService.UpdateGroup", in)
out := new(Group)
out := new(v0.Group)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
@@ -386,9 +386,9 @@ func (c *groupsService) DeleteGroup(ctx context.Context, in *DeleteGroupRequest,
return out, nil
}
func (c *groupsService) AddMember(ctx context.Context, in *AddMemberRequest, opts ...client.CallOption) (*Group, error) {
func (c *groupsService) AddMember(ctx context.Context, in *AddMemberRequest, opts ...client.CallOption) (*v0.Group, error) {
req := c.c.NewRequest(c.name, "GroupsService.AddMember", in)
out := new(Group)
out := new(v0.Group)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
@@ -396,9 +396,9 @@ func (c *groupsService) AddMember(ctx context.Context, in *AddMemberRequest, opt
return out, nil
}
func (c *groupsService) RemoveMember(ctx context.Context, in *RemoveMemberRequest, opts ...client.CallOption) (*Group, error) {
func (c *groupsService) RemoveMember(ctx context.Context, in *RemoveMemberRequest, opts ...client.CallOption) (*v0.Group, error) {
req := c.c.NewRequest(c.name, "GroupsService.RemoveMember", in)
out := new(Group)
out := new(v0.Group)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
@@ -422,17 +422,17 @@ type GroupsServiceHandler interface {
// Lists groups
ListGroups(context.Context, *ListGroupsRequest, *ListGroupsResponse) error
// Gets an groups
GetGroup(context.Context, *GetGroupRequest, *Group) error
GetGroup(context.Context, *GetGroupRequest, *v0.Group) error
// Creates a group
CreateGroup(context.Context, *CreateGroupRequest, *Group) error
CreateGroup(context.Context, *CreateGroupRequest, *v0.Group) error
// Updates a group
UpdateGroup(context.Context, *UpdateGroupRequest, *Group) error
UpdateGroup(context.Context, *UpdateGroupRequest, *v0.Group) error
// Deletes a group
DeleteGroup(context.Context, *DeleteGroupRequest, *emptypb.Empty) error
// group:addmember https://docs.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-1.0&tabs=http
AddMember(context.Context, *AddMemberRequest, *Group) error
AddMember(context.Context, *AddMemberRequest, *v0.Group) error
// group:removemember https://docs.microsoft.com/en-us/graph/api/group-delete-members?view=graph-rest-1.0
RemoveMember(context.Context, *RemoveMemberRequest, *Group) error
RemoveMember(context.Context, *RemoveMemberRequest, *v0.Group) error
// group:listmembers https://docs.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0
ListMembers(context.Context, *ListMembersRequest, *ListMembersResponse) error
}
@@ -440,12 +440,12 @@ type GroupsServiceHandler interface {
func RegisterGroupsServiceHandler(s server.Server, hdlr GroupsServiceHandler, opts ...server.HandlerOption) error {
type groupsService interface {
ListGroups(ctx context.Context, in *ListGroupsRequest, out *ListGroupsResponse) error
GetGroup(ctx context.Context, in *GetGroupRequest, out *Group) error
CreateGroup(ctx context.Context, in *CreateGroupRequest, out *Group) error
UpdateGroup(ctx context.Context, in *UpdateGroupRequest, out *Group) error
GetGroup(ctx context.Context, in *GetGroupRequest, out *v0.Group) error
CreateGroup(ctx context.Context, in *CreateGroupRequest, out *v0.Group) error
UpdateGroup(ctx context.Context, in *UpdateGroupRequest, out *v0.Group) error
DeleteGroup(ctx context.Context, in *DeleteGroupRequest, out *emptypb.Empty) error
AddMember(ctx context.Context, in *AddMemberRequest, out *Group) error
RemoveMember(ctx context.Context, in *RemoveMemberRequest, out *Group) error
AddMember(ctx context.Context, in *AddMemberRequest, out *v0.Group) error
RemoveMember(ctx context.Context, in *RemoveMemberRequest, out *v0.Group) error
ListMembers(ctx context.Context, in *ListMembersRequest, out *ListMembersResponse) error
}
type GroupsService struct {
@@ -519,15 +519,15 @@ func (h *groupsServiceHandler) ListGroups(ctx context.Context, in *ListGroupsReq
return h.GroupsServiceHandler.ListGroups(ctx, in, out)
}
func (h *groupsServiceHandler) GetGroup(ctx context.Context, in *GetGroupRequest, out *Group) error {
func (h *groupsServiceHandler) GetGroup(ctx context.Context, in *GetGroupRequest, out *v0.Group) error {
return h.GroupsServiceHandler.GetGroup(ctx, in, out)
}
func (h *groupsServiceHandler) CreateGroup(ctx context.Context, in *CreateGroupRequest, out *Group) error {
func (h *groupsServiceHandler) CreateGroup(ctx context.Context, in *CreateGroupRequest, out *v0.Group) error {
return h.GroupsServiceHandler.CreateGroup(ctx, in, out)
}
func (h *groupsServiceHandler) UpdateGroup(ctx context.Context, in *UpdateGroupRequest, out *Group) error {
func (h *groupsServiceHandler) UpdateGroup(ctx context.Context, in *UpdateGroupRequest, out *v0.Group) error {
return h.GroupsServiceHandler.UpdateGroup(ctx, in, out)
}
@@ -535,11 +535,11 @@ func (h *groupsServiceHandler) DeleteGroup(ctx context.Context, in *DeleteGroupR
return h.GroupsServiceHandler.DeleteGroup(ctx, in, out)
}
func (h *groupsServiceHandler) AddMember(ctx context.Context, in *AddMemberRequest, out *Group) error {
func (h *groupsServiceHandler) AddMember(ctx context.Context, in *AddMemberRequest, out *v0.Group) error {
return h.GroupsServiceHandler.AddMember(ctx, in, out)
}
func (h *groupsServiceHandler) RemoveMember(ctx context.Context, in *RemoveMemberRequest, out *Group) error {
func (h *groupsServiceHandler) RemoveMember(ctx context.Context, in *RemoveMemberRequest, out *v0.Group) error {
return h.GroupsServiceHandler.RemoveMember(ctx, in, out)
}

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-microweb. DO NOT EDIT.
// source: proto.proto
// source: v0.proto
package proto
package v0
import (
"bytes"
@@ -13,6 +13,7 @@ import (
"github.com/golang/protobuf/jsonpb"
ptypesempty "github.com/golang/protobuf/ptypes/empty"
accountsv0 "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
)
type webAccountsServiceHandler struct {
@@ -48,7 +49,7 @@ func (h *webAccountsServiceHandler) ListAccounts(w http.ResponseWriter, r *http.
func (h *webAccountsServiceHandler) GetAccount(w http.ResponseWriter, r *http.Request) {
req := &GetAccountRequest{}
resp := &Account{}
resp := &accountsv0.Account{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
http.Error(w, err.Error(), http.StatusPreconditionFailed)
@@ -70,7 +71,7 @@ func (h *webAccountsServiceHandler) GetAccount(w http.ResponseWriter, r *http.Re
func (h *webAccountsServiceHandler) CreateAccount(w http.ResponseWriter, r *http.Request) {
req := &CreateAccountRequest{}
resp := &Account{}
resp := &accountsv0.Account{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
http.Error(w, err.Error(), http.StatusPreconditionFailed)
@@ -92,7 +93,7 @@ func (h *webAccountsServiceHandler) CreateAccount(w http.ResponseWriter, r *http
func (h *webAccountsServiceHandler) UpdateAccount(w http.ResponseWriter, r *http.Request) {
req := &UpdateAccountRequest{}
resp := &Account{}
resp := &accountsv0.Account{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
http.Error(w, err.Error(), http.StatusPreconditionFailed)
@@ -180,7 +181,7 @@ func (h *webGroupsServiceHandler) ListGroups(w http.ResponseWriter, r *http.Requ
func (h *webGroupsServiceHandler) GetGroup(w http.ResponseWriter, r *http.Request) {
req := &GetGroupRequest{}
resp := &Group{}
resp := &accountsv0.Group{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
http.Error(w, err.Error(), http.StatusPreconditionFailed)
@@ -202,7 +203,7 @@ func (h *webGroupsServiceHandler) GetGroup(w http.ResponseWriter, r *http.Reques
func (h *webGroupsServiceHandler) CreateGroup(w http.ResponseWriter, r *http.Request) {
req := &CreateGroupRequest{}
resp := &Group{}
resp := &accountsv0.Group{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
http.Error(w, err.Error(), http.StatusPreconditionFailed)
@@ -224,7 +225,7 @@ func (h *webGroupsServiceHandler) CreateGroup(w http.ResponseWriter, r *http.Req
func (h *webGroupsServiceHandler) UpdateGroup(w http.ResponseWriter, r *http.Request) {
req := &UpdateGroupRequest{}
resp := &Group{}
resp := &accountsv0.Group{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
http.Error(w, err.Error(), http.StatusPreconditionFailed)
@@ -268,7 +269,7 @@ func (h *webGroupsServiceHandler) DeleteGroup(w http.ResponseWriter, r *http.Req
func (h *webGroupsServiceHandler) AddMember(w http.ResponseWriter, r *http.Request) {
req := &AddMemberRequest{}
resp := &Group{}
resp := &accountsv0.Group{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
http.Error(w, err.Error(), http.StatusPreconditionFailed)
@@ -290,7 +291,7 @@ func (h *webGroupsServiceHandler) AddMember(w http.ResponseWriter, r *http.Reque
func (h *webGroupsServiceHandler) RemoveMember(w http.ResponseWriter, r *http.Request) {
req := &RemoveMemberRequest{}
resp := &Group{}
resp := &accountsv0.Group{}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
http.Error(w, err.Error(), http.StatusPreconditionFailed)
@@ -676,114 +677,6 @@ func (m *DeleteAccountRequest) UnmarshalJSON(b []byte) error {
var _ json.Unmarshaler = (*DeleteAccountRequest)(nil)
// AccountJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Account. This struct is safe to replace or modify but
// should not be done so concurrently.
var AccountJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Account) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := AccountJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Account)(nil)
// AccountJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Account. This struct is safe to replace or modify but
// should not be done so concurrently.
var AccountJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Account) UnmarshalJSON(b []byte) error {
return AccountJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Account)(nil)
// IdentitiesJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Identities. This struct is safe to replace or modify but
// should not be done so concurrently.
var IdentitiesJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Identities) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := IdentitiesJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Identities)(nil)
// IdentitiesJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Identities. This struct is safe to replace or modify but
// should not be done so concurrently.
var IdentitiesJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Identities) UnmarshalJSON(b []byte) error {
return IdentitiesJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Identities)(nil)
// PasswordProfileJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of PasswordProfile. This struct is safe to replace or modify but
// should not be done so concurrently.
var PasswordProfileJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *PasswordProfile) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := PasswordProfileJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*PasswordProfile)(nil)
// PasswordProfileJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of PasswordProfile. This struct is safe to replace or modify but
// should not be done so concurrently.
var PasswordProfileJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *PasswordProfile) UnmarshalJSON(b []byte) error {
return PasswordProfileJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*PasswordProfile)(nil)
// ListGroupsRequestJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of ListGroupsRequest. This struct is safe to replace or modify but
// should not be done so concurrently.
@@ -1143,75 +1036,3 @@ func (m *ListMembersResponse) UnmarshalJSON(b []byte) error {
}
var _ json.Unmarshaler = (*ListMembersResponse)(nil)
// GroupJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Group. This struct is safe to replace or modify but
// should not be done so concurrently.
var GroupJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Group) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := GroupJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Group)(nil)
// GroupJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Group. This struct is safe to replace or modify but
// should not be done so concurrently.
var GroupJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Group) UnmarshalJSON(b []byte) error {
return GroupJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Group)(nil)
// OnPremisesProvisioningErrorJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of OnPremisesProvisioningError. This struct is safe to replace or modify but
// should not be done so concurrently.
var OnPremisesProvisioningErrorJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *OnPremisesProvisioningError) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := OnPremisesProvisioningErrorJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*OnPremisesProvisioningError)(nil)
// OnPremisesProvisioningErrorJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of OnPremisesProvisioningError. This struct is safe to replace or modify but
// should not be done so concurrently.
var OnPremisesProvisioningErrorJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *OnPremisesProvisioningError) UnmarshalJSON(b []byte) error {
return OnPremisesProvisioningErrorJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*OnPremisesProvisioningError)(nil)

View File

@@ -590,11 +590,11 @@
},
"accountEnabled": {
"type": "boolean",
"description": "*true* if the account is enabled; otherwise, *false*. This property is required when a user is created. Supports $filter."
"description": "`true` if the account is enabled; otherwise, `false`. This property is required when a user is created. Supports $filter."
},
"isResourceAccount": {
"type": "boolean",
"description": "A resource account is also known as a /disabled user object/ in Azure AD, and can be used to represent resources in general.\nIn Exchange it might be used to represent conference rooms, for example, and allow them to have a phone number.\nYou could give printers or machines with a sync client resource accounts as well.\nA resource account can be homed in Microsoft 365 or on premises using Skype for Business Server 2019.\n*true* if the user is a resource account; otherwise, *false*. Null value should be considered false."
"description": "A resource account is also known as a /disabled user object/ in Azure AD, and can be used to represent resources in general.\nIn Exchange it might be used to represent conference rooms, for example, and allow them to have a phone number.\nYou could give printers or machines with a sync client resource accounts as well.\nA resource account can be homed in Microsoft 365 or on premises using Skype for Business Server 2019.\n`true` if the user is a resource account; otherwise, `false`. Null value should be considered false."
},
"creationType": {
"type": "string",
@@ -618,7 +618,7 @@
"uidNumber": {
"type": "string",
"format": "int64",
"title": "TODO rename to on_premise_? or move to extension? see https://docs.microsoft.com/en-us/graph/extensibility-open-users\nused for exposing the user using ldap\nposixaccount MUST uidnumber"
"title": "used for exposing the user using ldap\nposixaccount MUST uidnumber"
},
"gidNumber": {
"type": "string",
@@ -656,7 +656,7 @@
},
"onPremisesSyncEnabled": {
"type": "boolean",
"title": "*true* if this object is synced from an on-premises directory;\n*false* if this object was originally synced from an on-premises directory but is no longer synced;\nnull if this object has never been synced from an on-premises directory (default). Read-only"
"title": "`true` if this object is synced from an on-premises directory;\n`false` if this object was originally synced from an on-premises directory but is no longer synced;\nnull if this object has never been synced from an on-premises directory (default). Read-only"
},
"onPremisesImmutableId": {
"type": "string",
@@ -782,7 +782,7 @@
"items": {
"$ref": "#/definitions/v0Account"
},
"title": "Users, contacts, and groups that are members of this group. HTTP Methods: GET (supported for all groups), POST (supported for security groups and mail-enabled security groups), DELETE (supported only for security groups) Read-only. Nullable.\nTODO accounts (users) only for now, we can add groups with the dedicated message using oneof construct later"
"description": "Users, contacts, and groups that are members of this group. HTTP Methods: GET (supported for all groups), POST (supported for security groups and mail-enabled security groups), DELETE (supported only for security groups) Read-only. Nullable."
},
"owners": {
"type": "array",
@@ -825,7 +825,7 @@
},
"onPremisesSyncEnabled": {
"type": "boolean",
"description": "*true* if this group is synced from an on-premises directory;\n*false* if this group was originally synced from an on-premises directory but is no longer synced;\nnull if this object has never been synced from an on-premises directory (default).\nReturned by default. Read-only. Supports $filter."
"description": "`true` if this group is synced from an on-premises directory;\n`false` if this group was originally synced from an on-premises directory but is no longer synced;\nnull if this object has never been synced from an on-premises directory (default).\nReturned by default. Read-only. Supports $filter."
},
"onPremisesImmutableId": {
"type": "string",
@@ -877,7 +877,7 @@
},
"issuerAssignedId": {
"type": "string",
"description": "Specifies the unique identifier assigned to the user by the issuer. The combination of *issuer* and *issuerAssignedId* must be unique within the organization. Represents the sign-in name for the user, when signInType is set to emailAddress or userName (also known as local accounts).\nWhen *signInType* is set to:\n* `emailAddress`, (or starts with `emailAddress` like `emailAddress1`) *issuerAssignedId* must be a valid email address\n* `userName`, issuer_assigned_id must be a valid local part of an email address\nSupports $filter. 512 character limit."
"description": "Specifies the unique identifier assigned to the user by the issuer. The combination of *issuer* and *issuerAssignedId* must be unique within the organization. Represents the sign-in name for the user, when signInType is set to emailAddress or userName (also known as local accounts).\nWhen *signInType* is set to:\n* `emailAddress`, (or starts with `emailAddress` like `emailAddress1`) `issuerAssignedId` must be a valid email address\n* `userName`, issuer_assigned_id must be a valid local part of an email address\nSupports $filter. 512 character limit."
}
},
"description": "Identities Represents an identity used to sign in to a user account.\nAn identity can be provided by oCIS, by organizations, or by social identity providers such as Facebook, Google, or Microsoft, that are tied to a user account.\nThis enables the user to sign in to the user account with any of those associated identities.\nThey are also used to keep a history of old usernames."
@@ -1019,11 +1019,11 @@
},
"forceChangePasswordNextSignIn": {
"type": "boolean",
"description": "*true* if the user must change her password on the next login; otherwise false."
"description": "`true` if the user must change her password on the next login; otherwise false."
},
"forceChangePasswordNextSignInWithMfa": {
"type": "boolean",
"description": "If *true*, at next sign-in, the user must perform a multi-factor authentication (MFA) before being forced to change their password. The behavior is identical to forceChangePasswordNextSignIn except that the user is required to first perform a multi-factor authentication before password change. After a password change, this property will be automatically reset to false. If not set, default is false."
"description": "If `true`, at next sign-in, the user must perform a multi-factor authentication (MFA) before being forced to change their password. The behavior is identical to forceChangePasswordNextSignIn except that the user is required to first perform a multi-factor authentication before password change. After a password change, this property will be automatically reset to false. If not set, default is false."
}
}
},

View File

@@ -1,4 +1,4 @@
package proto
package v0
import (
"context"

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,12 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/v0/settings.proto
// source: ocis/services/settings/v0/settings.proto
package proto
package v0
import (
fmt "fmt"
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
_ "github.com/owncloud/ocis/protogen/gen/ocis/messages/settings/v0"
_ "google.golang.org/genproto/googleapis/api/annotations"
proto "google.golang.org/protobuf/proto"
emptypb "google.golang.org/protobuf/types/known/emptypb"

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-microweb. DO NOT EDIT.
// source: proto.proto
// source: v0.proto
package proto
package v0
import (
"bytes"
@@ -1004,78 +1004,6 @@ func (m *GetValueByUniqueIdentifiersRequest) UnmarshalJSON(b []byte) error {
var _ json.Unmarshaler = (*GetValueByUniqueIdentifiersRequest)(nil)
// ValueWithIdentifierJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of ValueWithIdentifier. This struct is safe to replace or modify but
// should not be done so concurrently.
var ValueWithIdentifierJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *ValueWithIdentifier) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := ValueWithIdentifierJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*ValueWithIdentifier)(nil)
// ValueWithIdentifierJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of ValueWithIdentifier. This struct is safe to replace or modify but
// should not be done so concurrently.
var ValueWithIdentifierJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *ValueWithIdentifier) UnmarshalJSON(b []byte) error {
return ValueWithIdentifierJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*ValueWithIdentifier)(nil)
// IdentifierJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Identifier. This struct is safe to replace or modify but
// should not be done so concurrently.
var IdentifierJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Identifier) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := IdentifierJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Identifier)(nil)
// IdentifierJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Identifier. This struct is safe to replace or modify but
// should not be done so concurrently.
var IdentifierJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Identifier) UnmarshalJSON(b []byte) error {
return IdentifierJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Identifier)(nil)
// ListRoleAssignmentsRequestJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of ListRoleAssignmentsRequest. This struct is safe to replace or modify but
// should not be done so concurrently.
@@ -1256,42 +1184,6 @@ func (m *RemoveRoleFromUserRequest) UnmarshalJSON(b []byte) error {
var _ json.Unmarshaler = (*RemoveRoleFromUserRequest)(nil)
// UserRoleAssignmentJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of UserRoleAssignment. This struct is safe to replace or modify but
// should not be done so concurrently.
var UserRoleAssignmentJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *UserRoleAssignment) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := UserRoleAssignmentJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*UserRoleAssignment)(nil)
// UserRoleAssignmentJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of UserRoleAssignment. This struct is safe to replace or modify but
// should not be done so concurrently.
var UserRoleAssignmentJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *UserRoleAssignment) UnmarshalJSON(b []byte) error {
return UserRoleAssignmentJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*UserRoleAssignment)(nil)
// ListPermissionsByResourceRequestJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of ListPermissionsByResourceRequest. This struct is safe to replace or modify but
// should not be done so concurrently.
@@ -1435,471 +1327,3 @@ func (m *GetPermissionByIDResponse) UnmarshalJSON(b []byte) error {
}
var _ json.Unmarshaler = (*GetPermissionByIDResponse)(nil)
// ResourceJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Resource. This struct is safe to replace or modify but
// should not be done so concurrently.
var ResourceJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Resource) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := ResourceJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Resource)(nil)
// ResourceJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Resource. This struct is safe to replace or modify but
// should not be done so concurrently.
var ResourceJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Resource) UnmarshalJSON(b []byte) error {
return ResourceJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Resource)(nil)
// BundleJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Bundle. This struct is safe to replace or modify but
// should not be done so concurrently.
var BundleJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Bundle) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := BundleJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Bundle)(nil)
// BundleJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Bundle. This struct is safe to replace or modify but
// should not be done so concurrently.
var BundleJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Bundle) UnmarshalJSON(b []byte) error {
return BundleJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Bundle)(nil)
// SettingJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Setting. This struct is safe to replace or modify but
// should not be done so concurrently.
var SettingJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Setting) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := SettingJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Setting)(nil)
// SettingJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Setting. This struct is safe to replace or modify but
// should not be done so concurrently.
var SettingJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Setting) UnmarshalJSON(b []byte) error {
return SettingJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Setting)(nil)
// IntJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Int. This struct is safe to replace or modify but
// should not be done so concurrently.
var IntJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Int) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := IntJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Int)(nil)
// IntJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Int. This struct is safe to replace or modify but
// should not be done so concurrently.
var IntJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Int) UnmarshalJSON(b []byte) error {
return IntJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Int)(nil)
// StringJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of String. This struct is safe to replace or modify but
// should not be done so concurrently.
var StringJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *String) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := StringJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*String)(nil)
// StringJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of String. This struct is safe to replace or modify but
// should not be done so concurrently.
var StringJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *String) UnmarshalJSON(b []byte) error {
return StringJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*String)(nil)
// BoolJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Bool. This struct is safe to replace or modify but
// should not be done so concurrently.
var BoolJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Bool) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := BoolJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Bool)(nil)
// BoolJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Bool. This struct is safe to replace or modify but
// should not be done so concurrently.
var BoolJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Bool) UnmarshalJSON(b []byte) error {
return BoolJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Bool)(nil)
// SingleChoiceListJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of SingleChoiceList. This struct is safe to replace or modify but
// should not be done so concurrently.
var SingleChoiceListJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *SingleChoiceList) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := SingleChoiceListJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*SingleChoiceList)(nil)
// SingleChoiceListJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of SingleChoiceList. This struct is safe to replace or modify but
// should not be done so concurrently.
var SingleChoiceListJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *SingleChoiceList) UnmarshalJSON(b []byte) error {
return SingleChoiceListJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*SingleChoiceList)(nil)
// MultiChoiceListJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of MultiChoiceList. This struct is safe to replace or modify but
// should not be done so concurrently.
var MultiChoiceListJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *MultiChoiceList) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := MultiChoiceListJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*MultiChoiceList)(nil)
// MultiChoiceListJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of MultiChoiceList. This struct is safe to replace or modify but
// should not be done so concurrently.
var MultiChoiceListJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *MultiChoiceList) UnmarshalJSON(b []byte) error {
return MultiChoiceListJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*MultiChoiceList)(nil)
// ListOptionJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of ListOption. This struct is safe to replace or modify but
// should not be done so concurrently.
var ListOptionJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *ListOption) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := ListOptionJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*ListOption)(nil)
// ListOptionJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of ListOption. This struct is safe to replace or modify but
// should not be done so concurrently.
var ListOptionJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *ListOption) UnmarshalJSON(b []byte) error {
return ListOptionJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*ListOption)(nil)
// PermissionJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Permission. This struct is safe to replace or modify but
// should not be done so concurrently.
var PermissionJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Permission) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := PermissionJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Permission)(nil)
// PermissionJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Permission. This struct is safe to replace or modify but
// should not be done so concurrently.
var PermissionJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Permission) UnmarshalJSON(b []byte) error {
return PermissionJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Permission)(nil)
// ValueJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Value. This struct is safe to replace or modify but
// should not be done so concurrently.
var ValueJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Value) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := ValueJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Value)(nil)
// ValueJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Value. This struct is safe to replace or modify but
// should not be done so concurrently.
var ValueJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Value) UnmarshalJSON(b []byte) error {
return ValueJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Value)(nil)
// ListValueJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of ListValue. This struct is safe to replace or modify but
// should not be done so concurrently.
var ListValueJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *ListValue) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := ListValueJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*ListValue)(nil)
// ListValueJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of ListValue. This struct is safe to replace or modify but
// should not be done so concurrently.
var ListValueJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *ListValue) UnmarshalJSON(b []byte) error {
return ListValueJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*ListValue)(nil)
// ListOptionValueJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of ListOptionValue. This struct is safe to replace or modify but
// should not be done so concurrently.
var ListOptionValueJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *ListOptionValue) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := ListOptionValueJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*ListOptionValue)(nil)
// ListOptionValueJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of ListOptionValue. This struct is safe to replace or modify but
// should not be done so concurrently.
var ListOptionValueJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *ListOptionValue) UnmarshalJSON(b []byte) error {
return ListOptionValueJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*ListOptionValue)(nil)

View File

@@ -0,0 +1,929 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc v3.17.3
// source: ocis/services/store/v0/store.proto
package v0
import (
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
v0 "github.com/owncloud/ocis/protogen/gen/ocis/messages/store/v0"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ReadRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Options *v0.ReadOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"`
}
func (x *ReadRequest) Reset() {
*x = ReadRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ReadRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReadRequest) ProtoMessage() {}
func (x *ReadRequest) ProtoReflect() protoreflect.Message {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead.
func (*ReadRequest) Descriptor() ([]byte, []int) {
return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{0}
}
func (x *ReadRequest) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
func (x *ReadRequest) GetOptions() *v0.ReadOptions {
if x != nil {
return x.Options
}
return nil
}
type ReadResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Records []*v0.Record `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"`
}
func (x *ReadResponse) Reset() {
*x = ReadResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ReadResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReadResponse) ProtoMessage() {}
func (x *ReadResponse) ProtoReflect() protoreflect.Message {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead.
func (*ReadResponse) Descriptor() ([]byte, []int) {
return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{1}
}
func (x *ReadResponse) GetRecords() []*v0.Record {
if x != nil {
return x.Records
}
return nil
}
type WriteRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Record *v0.Record `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"`
Options *v0.WriteOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"`
}
func (x *WriteRequest) Reset() {
*x = WriteRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *WriteRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WriteRequest) ProtoMessage() {}
func (x *WriteRequest) ProtoReflect() protoreflect.Message {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use WriteRequest.ProtoReflect.Descriptor instead.
func (*WriteRequest) Descriptor() ([]byte, []int) {
return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{2}
}
func (x *WriteRequest) GetRecord() *v0.Record {
if x != nil {
return x.Record
}
return nil
}
func (x *WriteRequest) GetOptions() *v0.WriteOptions {
if x != nil {
return x.Options
}
return nil
}
type WriteResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *WriteResponse) Reset() {
*x = WriteResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *WriteResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WriteResponse) ProtoMessage() {}
func (x *WriteResponse) ProtoReflect() protoreflect.Message {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use WriteResponse.ProtoReflect.Descriptor instead.
func (*WriteResponse) Descriptor() ([]byte, []int) {
return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{3}
}
type DeleteRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Options *v0.DeleteOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"`
}
func (x *DeleteRequest) Reset() {
*x = DeleteRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteRequest) ProtoMessage() {}
func (x *DeleteRequest) ProtoReflect() protoreflect.Message {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.
func (*DeleteRequest) Descriptor() ([]byte, []int) {
return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{4}
}
func (x *DeleteRequest) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
func (x *DeleteRequest) GetOptions() *v0.DeleteOptions {
if x != nil {
return x.Options
}
return nil
}
type DeleteResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DeleteResponse) Reset() {
*x = DeleteResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteResponse) ProtoMessage() {}
func (x *DeleteResponse) ProtoReflect() protoreflect.Message {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.
func (*DeleteResponse) Descriptor() ([]byte, []int) {
return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{5}
}
type ListRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Options *v0.ListOptions `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"`
}
func (x *ListRequest) Reset() {
*x = ListRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListRequest) ProtoMessage() {}
func (x *ListRequest) ProtoReflect() protoreflect.Message {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListRequest.ProtoReflect.Descriptor instead.
func (*ListRequest) Descriptor() ([]byte, []int) {
return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{6}
}
func (x *ListRequest) GetOptions() *v0.ListOptions {
if x != nil {
return x.Options
}
return nil
}
type ListResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Keys []string `protobuf:"bytes,2,rep,name=keys,proto3" json:"keys,omitempty"`
}
func (x *ListResponse) Reset() {
*x = ListResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListResponse) ProtoMessage() {}
func (x *ListResponse) ProtoReflect() protoreflect.Message {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListResponse.ProtoReflect.Descriptor instead.
func (*ListResponse) Descriptor() ([]byte, []int) {
return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{7}
}
func (x *ListResponse) GetKeys() []string {
if x != nil {
return x.Keys
}
return nil
}
type DatabasesRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DatabasesRequest) Reset() {
*x = DatabasesRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DatabasesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DatabasesRequest) ProtoMessage() {}
func (x *DatabasesRequest) ProtoReflect() protoreflect.Message {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DatabasesRequest.ProtoReflect.Descriptor instead.
func (*DatabasesRequest) Descriptor() ([]byte, []int) {
return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{8}
}
type DatabasesResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Databases []string `protobuf:"bytes,1,rep,name=databases,proto3" json:"databases,omitempty"`
}
func (x *DatabasesResponse) Reset() {
*x = DatabasesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DatabasesResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DatabasesResponse) ProtoMessage() {}
func (x *DatabasesResponse) ProtoReflect() protoreflect.Message {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DatabasesResponse.ProtoReflect.Descriptor instead.
func (*DatabasesResponse) Descriptor() ([]byte, []int) {
return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{9}
}
func (x *DatabasesResponse) GetDatabases() []string {
if x != nil {
return x.Databases
}
return nil
}
type TablesRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Database string `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"`
}
func (x *TablesRequest) Reset() {
*x = TablesRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TablesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TablesRequest) ProtoMessage() {}
func (x *TablesRequest) ProtoReflect() protoreflect.Message {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TablesRequest.ProtoReflect.Descriptor instead.
func (*TablesRequest) Descriptor() ([]byte, []int) {
return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{10}
}
func (x *TablesRequest) GetDatabase() string {
if x != nil {
return x.Database
}
return ""
}
type TablesResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Tables []string `protobuf:"bytes,1,rep,name=tables,proto3" json:"tables,omitempty"`
}
func (x *TablesResponse) Reset() {
*x = TablesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TablesResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TablesResponse) ProtoMessage() {}
func (x *TablesResponse) ProtoReflect() protoreflect.Message {
mi := &file_ocis_services_store_v0_store_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TablesResponse.ProtoReflect.Descriptor instead.
func (*TablesResponse) Descriptor() ([]byte, []int) {
return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{11}
}
func (x *TablesResponse) GetTables() []string {
if x != nil {
return x.Tables
}
return nil
}
var File_ocis_services_store_v0_store_proto protoreflect.FileDescriptor
var file_ocis_services_store_v0_store_proto_rawDesc = []byte{
0x0a, 0x22, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f,
0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x1a, 0x22, 0x6f, 0x63,
0x69, 0x73, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x73, 0x74, 0x6f, 0x72,
0x65, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65,
0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61,
0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x22, 0x5e, 0x0a, 0x0b, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65,
0x79, 0x12, 0x3d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x61, 0x64,
0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x22, 0x48, 0x0a, 0x0c, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x38, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72,
0x64, 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x86, 0x01, 0x0a, 0x0c, 0x57,
0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x06, 0x72,
0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x63,
0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72,
0x65, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63,
0x6f, 0x72, 0x64, 0x12, 0x3e, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x57, 0x72,
0x69, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x62, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3f, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e,
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76,
0x30, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52,
0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65,
0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4c, 0x0a, 0x0b, 0x4c, 0x69,
0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x07, 0x6f, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x63, 0x69,
0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65,
0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52,
0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x28, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73,
0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x4a, 0x04, 0x08, 0x01,
0x10, 0x02, 0x22, 0x12, 0x0a, 0x10, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x31, 0x0a, 0x11, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61,
0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x64,
0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09,
0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x22, 0x2b, 0x0a, 0x0d, 0x54, 0x61, 0x62,
0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x61,
0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x61,
0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x22, 0x28, 0x0a, 0x0e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x62, 0x6c,
0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73,
0x32, 0xa5, 0x04, 0x0a, 0x05, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x53, 0x0a, 0x04, 0x52, 0x65,
0x61, 0x64, 0x12, 0x23, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x61, 0x64,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30,
0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
0x56, 0x0a, 0x05, 0x57, 0x72, 0x69, 0x74, 0x65, 0x12, 0x24, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e,
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76,
0x30, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25,
0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73,
0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x59, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74,
0x65, 0x12, 0x25, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74,
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e,
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76,
0x30, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x00, 0x12, 0x55, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x23, 0x2e, 0x6f, 0x63, 0x69,
0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65,
0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x24, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e,
0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x62, 0x0a, 0x09, 0x44, 0x61, 0x74,
0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x12, 0x28, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e,
0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x29, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73,
0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61,
0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x59, 0x0a,
0x06, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x25, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30,
0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26,
0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73,
0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xdb, 0x02, 0x5a, 0x3b, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64,
0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x67,
0x65, 0x6e, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f,
0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x30, 0x92, 0x41, 0x9a, 0x02, 0x12, 0xb3, 0x01, 0x0a,
0x1d, 0x6f, 0x77, 0x6e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x20, 0x49, 0x6e, 0x66, 0x69, 0x6e, 0x69,
0x74, 0x65, 0x20, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x47,
0x0a, 0x0d, 0x6f, 0x77, 0x6e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x20, 0x47, 0x6d, 0x62, 0x48, 0x12,
0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x6f, 0x63, 0x69,
0x73, 0x1a, 0x14, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x40, 0x6f, 0x77, 0x6e, 0x63, 0x6c,
0x6f, 0x75, 0x64, 0x2e, 0x63, 0x6f, 0x6d, 0x2a, 0x42, 0x0a, 0x0a, 0x41, 0x70, 0x61, 0x63, 0x68,
0x65, 0x2d, 0x32, 0x2e, 0x30, 0x12, 0x34, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67,
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f,
0x75, 0x64, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x2f, 0x6d, 0x61, 0x73,
0x74, 0x65, 0x72, 0x2f, 0x4c, 0x49, 0x43, 0x45, 0x4e, 0x53, 0x45, 0x32, 0x05, 0x31, 0x2e, 0x30,
0x2e, 0x30, 0x2a, 0x02, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x72, 0x3a, 0x0a, 0x10, 0x44, 0x65,
0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x12, 0x26,
0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64,
0x2e, 0x64, 0x65, 0x76, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f,
0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_ocis_services_store_v0_store_proto_rawDescOnce sync.Once
file_ocis_services_store_v0_store_proto_rawDescData = file_ocis_services_store_v0_store_proto_rawDesc
)
func file_ocis_services_store_v0_store_proto_rawDescGZIP() []byte {
file_ocis_services_store_v0_store_proto_rawDescOnce.Do(func() {
file_ocis_services_store_v0_store_proto_rawDescData = protoimpl.X.CompressGZIP(file_ocis_services_store_v0_store_proto_rawDescData)
})
return file_ocis_services_store_v0_store_proto_rawDescData
}
var file_ocis_services_store_v0_store_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
var file_ocis_services_store_v0_store_proto_goTypes = []interface{}{
(*ReadRequest)(nil), // 0: ocis.services.store.v0.ReadRequest
(*ReadResponse)(nil), // 1: ocis.services.store.v0.ReadResponse
(*WriteRequest)(nil), // 2: ocis.services.store.v0.WriteRequest
(*WriteResponse)(nil), // 3: ocis.services.store.v0.WriteResponse
(*DeleteRequest)(nil), // 4: ocis.services.store.v0.DeleteRequest
(*DeleteResponse)(nil), // 5: ocis.services.store.v0.DeleteResponse
(*ListRequest)(nil), // 6: ocis.services.store.v0.ListRequest
(*ListResponse)(nil), // 7: ocis.services.store.v0.ListResponse
(*DatabasesRequest)(nil), // 8: ocis.services.store.v0.DatabasesRequest
(*DatabasesResponse)(nil), // 9: ocis.services.store.v0.DatabasesResponse
(*TablesRequest)(nil), // 10: ocis.services.store.v0.TablesRequest
(*TablesResponse)(nil), // 11: ocis.services.store.v0.TablesResponse
(*v0.ReadOptions)(nil), // 12: ocis.messages.store.v0.ReadOptions
(*v0.Record)(nil), // 13: ocis.messages.store.v0.Record
(*v0.WriteOptions)(nil), // 14: ocis.messages.store.v0.WriteOptions
(*v0.DeleteOptions)(nil), // 15: ocis.messages.store.v0.DeleteOptions
(*v0.ListOptions)(nil), // 16: ocis.messages.store.v0.ListOptions
}
var file_ocis_services_store_v0_store_proto_depIdxs = []int32{
12, // 0: ocis.services.store.v0.ReadRequest.options:type_name -> ocis.messages.store.v0.ReadOptions
13, // 1: ocis.services.store.v0.ReadResponse.records:type_name -> ocis.messages.store.v0.Record
13, // 2: ocis.services.store.v0.WriteRequest.record:type_name -> ocis.messages.store.v0.Record
14, // 3: ocis.services.store.v0.WriteRequest.options:type_name -> ocis.messages.store.v0.WriteOptions
15, // 4: ocis.services.store.v0.DeleteRequest.options:type_name -> ocis.messages.store.v0.DeleteOptions
16, // 5: ocis.services.store.v0.ListRequest.options:type_name -> ocis.messages.store.v0.ListOptions
0, // 6: ocis.services.store.v0.Store.Read:input_type -> ocis.services.store.v0.ReadRequest
2, // 7: ocis.services.store.v0.Store.Write:input_type -> ocis.services.store.v0.WriteRequest
4, // 8: ocis.services.store.v0.Store.Delete:input_type -> ocis.services.store.v0.DeleteRequest
6, // 9: ocis.services.store.v0.Store.List:input_type -> ocis.services.store.v0.ListRequest
8, // 10: ocis.services.store.v0.Store.Databases:input_type -> ocis.services.store.v0.DatabasesRequest
10, // 11: ocis.services.store.v0.Store.Tables:input_type -> ocis.services.store.v0.TablesRequest
1, // 12: ocis.services.store.v0.Store.Read:output_type -> ocis.services.store.v0.ReadResponse
3, // 13: ocis.services.store.v0.Store.Write:output_type -> ocis.services.store.v0.WriteResponse
5, // 14: ocis.services.store.v0.Store.Delete:output_type -> ocis.services.store.v0.DeleteResponse
7, // 15: ocis.services.store.v0.Store.List:output_type -> ocis.services.store.v0.ListResponse
9, // 16: ocis.services.store.v0.Store.Databases:output_type -> ocis.services.store.v0.DatabasesResponse
11, // 17: ocis.services.store.v0.Store.Tables:output_type -> ocis.services.store.v0.TablesResponse
12, // [12:18] is the sub-list for method output_type
6, // [6:12] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
}
func init() { file_ocis_services_store_v0_store_proto_init() }
func file_ocis_services_store_v0_store_proto_init() {
if File_ocis_services_store_v0_store_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_ocis_services_store_v0_store_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReadRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_services_store_v0_store_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReadResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_services_store_v0_store_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WriteRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_services_store_v0_store_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WriteResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_services_store_v0_store_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_services_store_v0_store_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_services_store_v0_store_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_services_store_v0_store_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_services_store_v0_store_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DatabasesRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_services_store_v0_store_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DatabasesResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_services_store_v0_store_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TablesRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_services_store_v0_store_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TablesResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_ocis_services_store_v0_store_proto_rawDesc,
NumEnums: 0,
NumMessages: 12,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_ocis_services_store_v0_store_proto_goTypes,
DependencyIndexes: file_ocis_services_store_v0_store_proto_depIdxs,
MessageInfos: file_ocis_services_store_v0_store_proto_msgTypes,
}.Build()
File_ocis_services_store_v0_store_proto = out.File
file_ocis_services_store_v0_store_proto_rawDesc = nil
file_ocis_services_store_v0_store_proto_goTypes = nil
file_ocis_services_store_v0_store_proto_depIdxs = nil
}

View File

@@ -1,11 +1,12 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/v0/store.proto
// source: ocis/services/store/v0/store.proto
package proto
package v0
import (
fmt "fmt"
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
_ "github.com/owncloud/ocis/protogen/gen/ocis/messages/store/v0"
proto "google.golang.org/protobuf/proto"
math "math"
)

View File

@@ -0,0 +1,413 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc v3.17.3
// source: ocis/services/thumbnails/v0/thumbnails.proto
package v0
import (
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
v0 "github.com/owncloud/ocis/protogen/gen/ocis/messages/thumbnails/v0"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// The file types to which the thumbnail can get encoded to.
type GetThumbnailRequest_ThumbnailType int32
const (
GetThumbnailRequest_PNG GetThumbnailRequest_ThumbnailType = 0 // Represents PNG type
GetThumbnailRequest_JPG GetThumbnailRequest_ThumbnailType = 1 // Represents JPG type
)
// Enum value maps for GetThumbnailRequest_ThumbnailType.
var (
GetThumbnailRequest_ThumbnailType_name = map[int32]string{
0: "PNG",
1: "JPG",
}
GetThumbnailRequest_ThumbnailType_value = map[string]int32{
"PNG": 0,
"JPG": 1,
}
)
func (x GetThumbnailRequest_ThumbnailType) Enum() *GetThumbnailRequest_ThumbnailType {
p := new(GetThumbnailRequest_ThumbnailType)
*p = x
return p
}
func (x GetThumbnailRequest_ThumbnailType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (GetThumbnailRequest_ThumbnailType) Descriptor() protoreflect.EnumDescriptor {
return file_ocis_services_thumbnails_v0_thumbnails_proto_enumTypes[0].Descriptor()
}
func (GetThumbnailRequest_ThumbnailType) Type() protoreflect.EnumType {
return &file_ocis_services_thumbnails_v0_thumbnails_proto_enumTypes[0]
}
func (x GetThumbnailRequest_ThumbnailType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use GetThumbnailRequest_ThumbnailType.Descriptor instead.
func (GetThumbnailRequest_ThumbnailType) EnumDescriptor() ([]byte, []int) {
return file_ocis_services_thumbnails_v0_thumbnails_proto_rawDescGZIP(), []int{0, 0}
}
// A request to retrieve a thumbnail
type GetThumbnailRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// The path to the source image
Filepath string `protobuf:"bytes,1,opt,name=filepath,proto3" json:"filepath,omitempty"`
// The type to which the thumbnail should get encoded to.
ThumbnailType GetThumbnailRequest_ThumbnailType `protobuf:"varint,2,opt,name=thumbnail_type,json=thumbnailType,proto3,enum=ocis.services.thumbnails.v0.GetThumbnailRequest_ThumbnailType" json:"thumbnail_type,omitempty"`
// The width of the thumbnail
Width int32 `protobuf:"varint,3,opt,name=width,proto3" json:"width,omitempty"`
// The height of the thumbnail
Height int32 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"`
// Types that are assignable to Source:
// *GetThumbnailRequest_WebdavSource
// *GetThumbnailRequest_Cs3Source
Source isGetThumbnailRequest_Source `protobuf_oneof:"source"`
}
func (x *GetThumbnailRequest) Reset() {
*x = GetThumbnailRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_services_thumbnails_v0_thumbnails_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetThumbnailRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetThumbnailRequest) ProtoMessage() {}
func (x *GetThumbnailRequest) ProtoReflect() protoreflect.Message {
mi := &file_ocis_services_thumbnails_v0_thumbnails_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetThumbnailRequest.ProtoReflect.Descriptor instead.
func (*GetThumbnailRequest) Descriptor() ([]byte, []int) {
return file_ocis_services_thumbnails_v0_thumbnails_proto_rawDescGZIP(), []int{0}
}
func (x *GetThumbnailRequest) GetFilepath() string {
if x != nil {
return x.Filepath
}
return ""
}
func (x *GetThumbnailRequest) GetThumbnailType() GetThumbnailRequest_ThumbnailType {
if x != nil {
return x.ThumbnailType
}
return GetThumbnailRequest_PNG
}
func (x *GetThumbnailRequest) GetWidth() int32 {
if x != nil {
return x.Width
}
return 0
}
func (x *GetThumbnailRequest) GetHeight() int32 {
if x != nil {
return x.Height
}
return 0
}
func (m *GetThumbnailRequest) GetSource() isGetThumbnailRequest_Source {
if m != nil {
return m.Source
}
return nil
}
func (x *GetThumbnailRequest) GetWebdavSource() *v0.WebdavSource {
if x, ok := x.GetSource().(*GetThumbnailRequest_WebdavSource); ok {
return x.WebdavSource
}
return nil
}
func (x *GetThumbnailRequest) GetCs3Source() *v0.CS3Source {
if x, ok := x.GetSource().(*GetThumbnailRequest_Cs3Source); ok {
return x.Cs3Source
}
return nil
}
type isGetThumbnailRequest_Source interface {
isGetThumbnailRequest_Source()
}
type GetThumbnailRequest_WebdavSource struct {
WebdavSource *v0.WebdavSource `protobuf:"bytes,5,opt,name=webdav_source,json=webdavSource,proto3,oneof"`
}
type GetThumbnailRequest_Cs3Source struct {
Cs3Source *v0.CS3Source `protobuf:"bytes,6,opt,name=cs3_source,json=cs3Source,proto3,oneof"`
}
func (*GetThumbnailRequest_WebdavSource) isGetThumbnailRequest_Source() {}
func (*GetThumbnailRequest_Cs3Source) isGetThumbnailRequest_Source() {}
// The service response
type GetThumbnailResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// The thumbnail as a binary
Thumbnail []byte `protobuf:"bytes,1,opt,name=thumbnail,proto3" json:"thumbnail,omitempty"`
// The mimetype of the thumbnail
Mimetype string `protobuf:"bytes,2,opt,name=mimetype,proto3" json:"mimetype,omitempty"`
}
func (x *GetThumbnailResponse) Reset() {
*x = GetThumbnailResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_ocis_services_thumbnails_v0_thumbnails_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetThumbnailResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetThumbnailResponse) ProtoMessage() {}
func (x *GetThumbnailResponse) ProtoReflect() protoreflect.Message {
mi := &file_ocis_services_thumbnails_v0_thumbnails_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetThumbnailResponse.ProtoReflect.Descriptor instead.
func (*GetThumbnailResponse) Descriptor() ([]byte, []int) {
return file_ocis_services_thumbnails_v0_thumbnails_proto_rawDescGZIP(), []int{1}
}
func (x *GetThumbnailResponse) GetThumbnail() []byte {
if x != nil {
return x.Thumbnail
}
return nil
}
func (x *GetThumbnailResponse) GetMimetype() string {
if x != nil {
return x.Mimetype
}
return ""
}
var File_ocis_services_thumbnails_v0_thumbnails_proto protoreflect.FileDescriptor
var file_ocis_services_thumbnails_v0_thumbnails_proto_rawDesc = []byte{
0x0a, 0x2c, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f,
0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x73, 0x2f, 0x76, 0x30, 0x2f, 0x74, 0x68,
0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b,
0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x74, 0x68,
0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x76, 0x30, 0x1a, 0x2c, 0x6f, 0x63, 0x69,
0x73, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x74, 0x68, 0x75, 0x6d, 0x62,
0x6e, 0x61, 0x69, 0x6c, 0x73, 0x2f, 0x76, 0x30, 0x2f, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61,
0x69, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f,
0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8e, 0x03, 0x0a, 0x13, 0x47, 0x65,
0x74, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x70, 0x61, 0x74, 0x68, 0x12, 0x65, 0x0a,
0x0e, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3e, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x73,
0x2e, 0x76, 0x30, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69,
0x6c, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0d, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c,
0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x03, 0x20,
0x01, 0x28, 0x05, 0x52, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65,
0x69, 0x67, 0x68, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67,
0x68, 0x74, 0x12, 0x50, 0x0a, 0x0d, 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x5f, 0x73, 0x6f, 0x75,
0x72, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x63, 0x69, 0x73,
0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e,
0x61, 0x69, 0x6c, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x57, 0x65, 0x62, 0x64, 0x61, 0x76, 0x53, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0c, 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x53, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x63, 0x73, 0x33, 0x5f, 0x73, 0x6f, 0x75, 0x72,
0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e,
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61,
0x69, 0x6c, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x43, 0x53, 0x33, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x48, 0x00, 0x52, 0x09, 0x63, 0x73, 0x33, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x21, 0x0a,
0x0d, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07,
0x0a, 0x03, 0x50, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4a, 0x50, 0x47, 0x10, 0x01,
0x42, 0x08, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x50, 0x0a, 0x14, 0x47, 0x65,
0x74, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c,
0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x69, 0x6d, 0x65, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x08, 0x6d, 0x69, 0x6d, 0x65, 0x74, 0x79, 0x70, 0x65, 0x32, 0x87, 0x01, 0x0a,
0x10, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x12, 0x73, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69,
0x6c, 0x12, 0x30, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x73, 0x2e, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x76, 0x30, 0x2e,
0x47, 0x65, 0x74, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x73, 0x2e, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x76,
0x30, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xeb, 0x02, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x6f,
0x63, 0x69, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x65, 0x6e,
0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x74,
0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x73, 0x2f, 0x76, 0x30, 0x92, 0x41, 0xa4, 0x02,
0x12, 0xb8, 0x01, 0x0a, 0x22, 0x6f, 0x77, 0x6e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x20, 0x49, 0x6e,
0x66, 0x69, 0x6e, 0x69, 0x74, 0x65, 0x20, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x20, 0x74, 0x68, 0x75,
0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x73, 0x22, 0x47, 0x0a, 0x0d, 0x6f, 0x77, 0x6e, 0x43, 0x6c,
0x6f, 0x75, 0x64, 0x20, 0x47, 0x6d, 0x62, 0x48, 0x12, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a,
0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e,
0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x1a, 0x14, 0x73, 0x75, 0x70, 0x70,
0x6f, 0x72, 0x74, 0x40, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x63, 0x6f, 0x6d,
0x2a, 0x42, 0x0a, 0x0a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2d, 0x32, 0x2e, 0x30, 0x12, 0x34,
0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x6f, 0x63, 0x69, 0x73,
0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x2f, 0x4c, 0x49, 0x43,
0x45, 0x4e, 0x53, 0x45, 0x32, 0x05, 0x31, 0x2e, 0x30, 0x2e, 0x30, 0x2a, 0x02, 0x01, 0x02, 0x32,
0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f,
0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a,
0x73, 0x6f, 0x6e, 0x72, 0x3f, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72,
0x20, 0x4d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x12, 0x2b, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f,
0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x65, 0x78,
0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61,
0x69, 0x6c, 0x73, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_ocis_services_thumbnails_v0_thumbnails_proto_rawDescOnce sync.Once
file_ocis_services_thumbnails_v0_thumbnails_proto_rawDescData = file_ocis_services_thumbnails_v0_thumbnails_proto_rawDesc
)
func file_ocis_services_thumbnails_v0_thumbnails_proto_rawDescGZIP() []byte {
file_ocis_services_thumbnails_v0_thumbnails_proto_rawDescOnce.Do(func() {
file_ocis_services_thumbnails_v0_thumbnails_proto_rawDescData = protoimpl.X.CompressGZIP(file_ocis_services_thumbnails_v0_thumbnails_proto_rawDescData)
})
return file_ocis_services_thumbnails_v0_thumbnails_proto_rawDescData
}
var file_ocis_services_thumbnails_v0_thumbnails_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_ocis_services_thumbnails_v0_thumbnails_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_ocis_services_thumbnails_v0_thumbnails_proto_goTypes = []interface{}{
(GetThumbnailRequest_ThumbnailType)(0), // 0: ocis.services.thumbnails.v0.GetThumbnailRequest.ThumbnailType
(*GetThumbnailRequest)(nil), // 1: ocis.services.thumbnails.v0.GetThumbnailRequest
(*GetThumbnailResponse)(nil), // 2: ocis.services.thumbnails.v0.GetThumbnailResponse
(*v0.WebdavSource)(nil), // 3: ocis.messages.thumbnails.v0.WebdavSource
(*v0.CS3Source)(nil), // 4: ocis.messages.thumbnails.v0.CS3Source
}
var file_ocis_services_thumbnails_v0_thumbnails_proto_depIdxs = []int32{
0, // 0: ocis.services.thumbnails.v0.GetThumbnailRequest.thumbnail_type:type_name -> ocis.services.thumbnails.v0.GetThumbnailRequest.ThumbnailType
3, // 1: ocis.services.thumbnails.v0.GetThumbnailRequest.webdav_source:type_name -> ocis.messages.thumbnails.v0.WebdavSource
4, // 2: ocis.services.thumbnails.v0.GetThumbnailRequest.cs3_source:type_name -> ocis.messages.thumbnails.v0.CS3Source
1, // 3: ocis.services.thumbnails.v0.ThumbnailService.GetThumbnail:input_type -> ocis.services.thumbnails.v0.GetThumbnailRequest
2, // 4: ocis.services.thumbnails.v0.ThumbnailService.GetThumbnail:output_type -> ocis.services.thumbnails.v0.GetThumbnailResponse
4, // [4:5] is the sub-list for method output_type
3, // [3:4] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_ocis_services_thumbnails_v0_thumbnails_proto_init() }
func file_ocis_services_thumbnails_v0_thumbnails_proto_init() {
if File_ocis_services_thumbnails_v0_thumbnails_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_ocis_services_thumbnails_v0_thumbnails_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetThumbnailRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ocis_services_thumbnails_v0_thumbnails_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetThumbnailResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_ocis_services_thumbnails_v0_thumbnails_proto_msgTypes[0].OneofWrappers = []interface{}{
(*GetThumbnailRequest_WebdavSource)(nil),
(*GetThumbnailRequest_Cs3Source)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_ocis_services_thumbnails_v0_thumbnails_proto_rawDesc,
NumEnums: 1,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_ocis_services_thumbnails_v0_thumbnails_proto_goTypes,
DependencyIndexes: file_ocis_services_thumbnails_v0_thumbnails_proto_depIdxs,
EnumInfos: file_ocis_services_thumbnails_v0_thumbnails_proto_enumTypes,
MessageInfos: file_ocis_services_thumbnails_v0_thumbnails_proto_msgTypes,
}.Build()
File_ocis_services_thumbnails_v0_thumbnails_proto = out.File
file_ocis_services_thumbnails_v0_thumbnails_proto_rawDesc = nil
file_ocis_services_thumbnails_v0_thumbnails_proto_goTypes = nil
file_ocis_services_thumbnails_v0_thumbnails_proto_depIdxs = nil
}

View File

@@ -1,11 +1,12 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/v0/thumbnails.proto
// source: ocis/services/thumbnails/v0/thumbnails.proto
package proto
package v0
import (
fmt "fmt"
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
_ "github.com/owncloud/ocis/protogen/gen/ocis/messages/thumbnails/v0"
proto "google.golang.org/protobuf/proto"
math "math"
)

View File

@@ -0,0 +1,34 @@
version: v1
plugins:
- name: go
path: ../../.bingo/protoc-gen-go
out: ../gen/
opt:
- paths=source_relative
- name: micro
path: ../../.bingo/protoc-gen-micro
out: ../gen/
opt:
- paths=source_relative
- name: microweb
path: ../../.bingo/protoc-gen-microweb
out: ../gen/
opt:
- paths=source_relative
- "ignore_packages=\
ocis.services.thumbnails.v0;\
ocis.messages.thumbnails.v0;\
ocis.services.store.v0;\
ocis.messages.store.v0"
- name: openapiv2
path: ../../.bingo/protoc-gen-openapiv2
out: ../gen/
- name: doc
path: ../../.bingo/protoc-gen-doc
out: ../../docs/grpc_apis
opt:
- ../docs/GRPC.tmpl,grpc.md,source_relative

17
protogen/proto/buf.lock Normal file
View File

@@ -0,0 +1,17 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: googleapis
repository: googleapis
branch: main
commit: 5860854adf6a48c39b19d54342b68385
digest: b1-WayFxGJKhSLbpMCQ-VZ5-3R5Gj9iRFYsMG7o57lgqog=
create_time: 2021-12-14T15:10:38.563007Z
- remote: buf.build
owner: grpc-ecosystem
repository: grpc-gateway
branch: main
commit: ff83506eb9cc4cf8972f49ce87e6ed3e
digest: b1-iLPHgLaoeWWinMiXXqPnxqE4BThtY3eSbswVGh9GOGI=
create_time: 2021-10-23T16:26:52.283938Z

View File

@@ -1,252 +1,10 @@
syntax = "proto3";
package com.owncloud.ocis.accounts.v0;
package ocis.messages.accounts.v0;
option go_package = "github.com/owncloud/ocis/accounts/pkg/proto/v0;proto";
option go_package = "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0";
import "google/api/field_behavior.proto";
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "ownCloud Infinite Scale accounts";
version: "1.0.0";
contact: {
name: "ownCloud GmbH";
url: "https://github.com/owncloud/ocis";
email: "support@owncloud.com";
};
license: {
name: "Apache-2.0";
url: "https://github.com/owncloud/ocis/blob/master/LICENSE";
};
};
schemes: HTTP;
schemes: HTTPS;
consumes: "application/json";
produces: "application/json";
external_docs: {
description: "Developer Manual";
url: "https://owncloud.dev/extensions/accounts/";
};
};
// Follow recommended Methods for rpc APIs https://cloud.google.com/apis/design/resources?hl=de#methods
// https://cloud.google.com/apis/design/standard_methods?hl=de#list
// https://cloud.google.com/apis/design/naming_convention?hl=de
service AccountsService {
// Lists accounts
rpc ListAccounts(ListAccountsRequest) returns (ListAccountsResponse) {
// List method maps to HTTP GET
option (google.api.http) = {
post: "/api/v0/accounts/accounts-list",
body: "*"
};
}
// Gets an account
rpc GetAccount(GetAccountRequest) returns (Account) {
option (google.api.http) = {
post: "/api/v0/accounts/accounts-get",
body: "*"
};
}
// Creates an account
rpc CreateAccount(CreateAccountRequest) returns (Account) {
// Create maps to HTTP POST. URL path as the collection name.
// HTTP request body contains the resource
option (google.api.http) = {
post: "/api/v0/accounts/accounts-create"
body: "*"
};
}
// Updates an account
rpc UpdateAccount(UpdateAccountRequest) returns (Account) {
// Update maps to HTTP PATCH. Resource name is mapped to a URL path.
// Resource is contained in the HTTP request body
option (google.api.http) = {
post: "/api/v0/accounts/accounts-update"
body: "*"
};
};
// Deletes an account
rpc DeleteAccount(DeleteAccountRequest) returns (google.protobuf.Empty) {
// Delete maps to HTTP DELETE. Resource name maps to the URL path.
// There is no request body
option (google.api.http) = {
post: "/api/v0/accounts/accounts-delete",
body: "*"
};
}
}
service GroupsService {
// Lists groups
rpc ListGroups(ListGroupsRequest) returns (ListGroupsResponse) {
// List method maps to HTTP GET
option (google.api.http) = {
post: "/api/v0/accounts/groups-list",
body: "*"
};
}
// Gets an groups
rpc GetGroup(GetGroupRequest) returns (Group) {
option (google.api.http) = {
post: "/api/v0/accounts/groups-get",
body: "*"
};
}
// Creates a group
rpc CreateGroup(CreateGroupRequest) returns (Group) {
// Create maps to HTTP POST. URL path as the collection name.
// HTTP request body contains the resource
option (google.api.http) = {
post: "/api/v0/accounts/groups-create"
body: "*"
};
}
// Updates a group
rpc UpdateGroup(UpdateGroupRequest) returns (Group) {
// Update maps to HTTP PATCH. Resource name is mapped to a URL path.
// Resource is contained in the HTTP request body
option (google.api.http) = {
post: "/api/v0/accounts/groups-update"
body: "*"
};
};
// Deletes a group
rpc DeleteGroup(DeleteGroupRequest) returns (google.protobuf.Empty) {
// Delete maps to HTTP DELETE. Resource name maps to the URL path.
// There is no request body
option (google.api.http) = {
post: "/api/v0/accounts/groups-delete",
body: "*"
};
}
// additional group methods: https://docs.microsoft.com/en-us/graph/api/resources/group?view=graph-rest-1.0#methods
// references are accessed using $ref, see http://docs.oasis-open.org/odata/odata/v4.0/cs01/part2-url-conventions/odata-v4.0-cs01-part2-url-conventions.html#_Toc365046422
// or the stack overflow question https://stackoverflow.com/questions/49362894/why-is-the-microsoft-graph-api-using-ref-in-the-uri
// group:addmember https://docs.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-1.0&tabs=http
rpc AddMember(AddMemberRequest) returns (Group) {
// All request parameters go into body.
option (google.api.http) = {
post: "/api/v0/groups/{group_id=*}/members/$ref"
body: "*"
};
}
// group:removemember https://docs.microsoft.com/en-us/graph/api/group-delete-members?view=graph-rest-1.0
rpc RemoveMember(RemoveMemberRequest) returns (Group) {
// All request parameters go into body.
option (google.api.http) = {
// URLs are broken
post: "/api/v0/groups/{group_id=*}/members/{account_id}/$ref"
body: "*"
};
}
// group:listmembers https://docs.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0
rpc ListMembers(ListMembersRequest) returns (ListMembersResponse) {
// All request parameters go into body.
option (google.api.http) = {
// URLs are broken
post: "/api/v0/groups/{id=*}/members/$ref"
body: "*"
};
}
}
service IndexService {
rpc RebuildIndex(RebuildIndexRequest) returns (RebuildIndexResponse) {
// All request parameters go into body.
option (google.api.http) = {
// URLs are broken
post: "/api/v0/index/rebuild"
body: "*"
};
}
}
message RebuildIndexRequest {
}
message RebuildIndexResponse {
}
message ListAccountsRequest {
// Optional. The maximum number of accounts to return in the response
int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
// Optional. A pagination token returned from a previous call to `Get`
// that indicates from where search should continue
string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
// Optional. Used to specify a subset of fields that should be
// returned by a get operation or modified by an update operation.
google.protobuf.FieldMask field_mask = 3;
// Optional. Search criteria used to select the accounts to return.
// If no search criteria is specified then all accounts will be
// returned
//
// TODO update query language
// Query expressions can be used to restrict results based upon
// the account properties where the operators `=`, `NOT`, `AND` and `OR`
// can be used along with the suffix wildcard symbol `*`.
//
// The string properties in a query expression should use escaped quotes
// for values that include whitespace to prevent unexpected behavior.
//
// Some example queries are:
//
// * Query `display_name=Th*` returns accounts whose display_name
// starts with "Th"
// * Query `email=foo@example.com` returns accounts with
// `email` set to `foo@example.com`
// * Query `display_name=\\"Test String\\"` returns accounts with
// display names that include both "Test" and "String"
string query = 4 [(google.api.field_behavior) = OPTIONAL];
}
message ListAccountsResponse {
// The field name should match the noun "accounts" in the method name. There
// will be a maximum number of items returned based on the page_size field
// in the request
repeated Account accounts = 1;
// Token to retrieve the next page of results, or empty if there are no
// more results in the list
string next_page_token = 2;
}
message GetAccountRequest {
string id = 1;
}
message CreateAccountRequest {
// The account resource to create
Account account = 1;
}
message UpdateAccountRequest {
// The account resource which replaces the resource on the server
Account account = 1;
// The update mask applies to the resource. For the `FieldMask` definition,
// see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
google.protobuf.FieldMask update_mask = 2;
}
message DeleteAccountRequest {
string id = 1;
}
// Account follows the properties of the ms graph api user resource.
// See https://docs.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0#properties
message Account {
@@ -256,14 +14,14 @@ message Account {
// The unique identifier for the user. Key. Not nullable. Non reassignable. Read-only.
string id = 1;
// *true* if the account is enabled; otherwise, *false*. This property is required when a user is created. Supports $filter.
// `true` if the account is enabled; otherwise, `false`. This property is required when a user is created. Supports $filter.
bool account_enabled = 2;
// A resource account is also known as a /disabled user object/ in Azure AD, and can be used to represent resources in general.
// In Exchange it might be used to represent conference rooms, for example, and allow them to have a phone number.
// You could give printers or machines with a sync client resource accounts as well.
// A resource account can be homed in Microsoft 365 or on premises using Skype for Business Server 2019.
// *true* if the user is a resource account; otherwise, *false*. Null value should be considered false.
// `true` if the user is a resource account; otherwise, `false`. Null value should be considered false.
bool is_resource_account = 3;
// Indicates whether the account was created as
@@ -292,6 +50,7 @@ message Account {
string preferred_name = 7;
// TODO rename to on_premise_? or move to extension? see https://docs.microsoft.com/en-us/graph/extensibility-open-users
// used for exposing the user using ldap
// posixaccount MUST uidnumber
int64 uid_number = 8;
@@ -342,8 +101,8 @@ message Account {
// properties for sync
// *true* if this object is synced from an on-premises directory;
// *false* if this object was originally synced from an on-premises directory but is no longer synced;
// `true` if this object is synced from an on-premises directory;
// `false` if this object was originally synced from an on-premises directory but is no longer synced;
// null if this object has never been synced from an on-premises directory (default). Read-only
bool on_premises_sync_enabled = 20;
@@ -428,7 +187,7 @@ message Identities {
// Specifies the unique identifier assigned to the user by the issuer. The combination of *issuer* and *issuerAssignedId* must be unique within the organization. Represents the sign-in name for the user, when signInType is set to emailAddress or userName (also known as local accounts).
// When *signInType* is set to:
// * `emailAddress`, (or starts with `emailAddress` like `emailAddress1`) *issuerAssignedId* must be a valid email address
// * `emailAddress`, (or starts with `emailAddress` like `emailAddress1`) `issuerAssignedId` must be a valid email address
// * `userName`, issuer_assigned_id must be a valid local part of an email address
// Supports $filter. 512 character limit.
string issuer_assigned_id = 3;
@@ -447,139 +206,13 @@ message PasswordProfile {
// DisablePasswordExpiration can also be specified.
repeated string password_policies = 3;
// *true* if the user must change her password on the next login; otherwise false.
// `true` if the user must change her password on the next login; otherwise false.
bool force_change_password_next_sign_in = 4;
// If *true*, at next sign-in, the user must perform a multi-factor authentication (MFA) before being forced to change their password. The behavior is identical to forceChangePasswordNextSignIn except that the user is required to first perform a multi-factor authentication before password change. After a password change, this property will be automatically reset to false. If not set, default is false.
// If `true`, at next sign-in, the user must perform a multi-factor authentication (MFA) before being forced to change their password. The behavior is identical to forceChangePasswordNextSignIn except that the user is required to first perform a multi-factor authentication before password change. After a password change, this property will be automatically reset to false. If not set, default is false.
bool force_change_password_next_sign_in_with_mfa = 5;
}
message ListGroupsRequest {
// Optional. The maximum number of groups to return in the response
int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
// Optional. A pagination token returned from a previous call to `Get`
// that indicates from where search should continue
string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
// Optional. Used to specify a subset of fields that should be
// returned by a get operation or modified by an update operation.
google.protobuf.FieldMask field_mask = 3;
// Optional. Search criteria used to select the groups to return.
// If no search criteria is specified then all groups will be
// returned
//
// TODO update query language
// Query expressions can be used to restrict results based upon
// the account properties where the operators `=`, `NOT`, `AND` and `OR`
// can be used along with the suffix wildcard symbol `*`.
//
// The string properties in a query expression should use escaped quotes
// for values that include whitespace to prevent unexpected behavior.
//
// Some example queries are:
//
// * Query `display_name=Th*` returns accounts whose display_name
// starts with "Th"
// * Query `display_name=\\"Test String\\"` returns groups with
// display names that include both "Test" and "String"
string query = 4 [(google.api.field_behavior) = OPTIONAL];
}
message ListGroupsResponse {
// The field name should match the noun "group" in the method name. There
// will be a maximum number of items returned based on the page_size field
// in the request
repeated Group groups = 1;
// Token to retrieve the next page of results, or empty if there are no
// more results in the list
string next_page_token = 2;
}
message GetGroupRequest {
string id = 1;
}
message CreateGroupRequest {
// The account resource to create
Group group = 1;
}
message UpdateGroupRequest {
// The group resource which replaces the resource on the server
Group group = 1;
// The update mask applies to the resource. For the `FieldMask` definition,
// see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
google.protobuf.FieldMask update_mask = 2;
}
message DeleteGroupRequest {
string id = 1;
}
message AddMemberRequest {
// The id of the group to add a member to
string group_id = 1;
// The account id to add
string account_id = 2;
}
message RemoveMemberRequest {
// The id of the group to remove a member from
string group_id = 1;
// The account id to remove
string account_id = 2;
}
message ListMembersRequest {
int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
// Optional. A pagination token returned from a previous call to `Get`
// that indicates from where search should continue
string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
// Optional. Used to specify a subset of fields that should be
// returned by a get operation or modified by an update operation.
google.protobuf.FieldMask field_mask = 3;
// Optional. Search criteria used to select the groups to return.
// If no search criteria is specified then all groups will be
// returned
//
// TODO update query language
// Query expressions can be used to restrict results based upon
// the account properties where the operators `=`, `NOT`, `AND` and `OR`
// can be used along with the suffix wildcard symbol `*`.
//
// The string properties in a query expression should use escaped quotes
// for values that include whitespace to prevent unexpected behavior.
//
// Some example queries are:
//
// * Query `display_name=Th*` returns accounts whose display_name
// starts with "Th"
// * Query `display_name=\\"Test String\\"` returns groups with
// display names that include both "Test" and "String"
string query = 4 [(google.api.field_behavior) = OPTIONAL];
// The id of the group to list members from
string id = 5;
}
message ListMembersResponse {
// The field name should match the noun "members" in the method name. There
// will be a maximum number of items returned based on the page_size field
// in the request
repeated Account members = 1;
// Token to retrieve the next page of results, or empty if there are no
// more results in the list
string next_page_token = 2;
}
message Group {
// The unique identifier for the group.
@@ -594,8 +227,9 @@ message Group {
string display_name = 2;
// groupofnames MUST/MAY member
// Users, contacts, and groups that are members of this group. HTTP Methods: GET (supported for all groups), POST (supported for security groups and mail-enabled security groups), DELETE (supported only for security groups) Read-only. Nullable.
// TODO accounts (users) only for now, we can add groups with the dedicated message using oneof construct later
// Users, contacts, and groups that are members of this group. HTTP Methods: GET (supported for all groups), POST (supported for security groups and mail-enabled security groups), DELETE (supported only for security groups) Read-only. Nullable.
repeated Account members = 3;
// groupofnames MAY businessCategory
@@ -647,8 +281,8 @@ message Group {
// properties for sync
// *true* if this group is synced from an on-premises directory;
// *false* if this group was originally synced from an on-premises directory but is no longer synced;
// `true` if this group is synced from an on-premises directory;
// `false` if this group was originally synced from an on-premises directory but is no longer synced;
// null if this object has never been synced from an on-premises directory (default).
// Returned by default. Read-only. Supports $filter.
bool on_premises_sync_enabled = 20;

View File

@@ -0,0 +1,172 @@
syntax = "proto3";
package ocis.messages.settings.v0;
option go_package = "github.com/owncloud/ocis/protogen/gen/ocis/messages/settings/v0";
// ---
// messages for settings values
// ---
message ValueWithIdentifier {
Identifier identifier = 1;
Value value = 2;
}
message Identifier {
string extension = 1;
string bundle = 2;
string setting = 3;
}
// ---
// messages for role assignment
// ---
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;
}
// ---
// 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;
}
}

View File

@@ -0,0 +1,56 @@
syntax = "proto3";
package ocis.messages.store.v0;
option go_package = "github.com/owncloud/ocis/protogen/gen/ocis/messages/store/v0";
message Field {
// type of value e.g string, int, int64, bool, float64
string type = 1;
// the actual value
string value = 2;
}
message Record {
// key of the recorda
string key = 1;
// value in the record
bytes value = 2;
// time.Duration (signed int64 nanoseconds)
int64 expiry = 3;
// the associated metadata
map<string,Field> metadata = 4;
}
message ReadOptions {
string database = 1;
string table = 2;
bool prefix = 3;
bool suffix = 4;
uint64 limit = 5;
uint64 offset = 6;
map<string,Field> where = 7;
}
message WriteOptions {
string database = 1;
string table = 2;
// time.Time
int64 expiry = 3;
// time.Duration
int64 ttl = 4;
}
message DeleteOptions {
string database = 1;
string table = 2;
}
message ListOptions {
string database = 1;
string table = 2;
string prefix = 3;
string suffix = 4;
uint64 limit = 5;
uint64 offset = 6;
}

View File

@@ -0,0 +1,23 @@
syntax = "proto3";
package ocis.messages.thumbnails.v0;
option go_package = "github.com/owncloud/ocis/protogen/gen/ocis/messages/thumbnails/v0";
message WebdavSource {
// REQUIRED.
string url = 1;
// REQUIRED.
bool is_public_link = 2;
// OPTIONAL.
string webdav_authorization = 3;
// OPTIONAL.
string reva_authorization = 4;
// OPTIONAL.
string public_link_token = 5;
}
message CS3Source {
string path = 1;
string authorization = 2;
}

View File

@@ -0,0 +1,373 @@
syntax = "proto3";
package ocis.services.accounts.v0;
option go_package = "github.com/jvillafanez/prototest001/gen/ocis/services/accounts/v0";
import "ocis/messages/accounts/v0/accounts.proto";
import "google/api/field_behavior.proto";
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "ownCloud Infinite Scale accounts";
version: "1.0.0";
contact: {
name: "ownCloud GmbH";
url: "https://github.com/owncloud/ocis";
email: "support@owncloud.com";
};
license: {
name: "Apache-2.0";
url: "https://github.com/owncloud/ocis/blob/master/LICENSE";
};
};
schemes: HTTP;
schemes: HTTPS;
consumes: "application/json";
produces: "application/json";
external_docs: {
description: "Developer Manual";
url: "https://owncloud.dev/extensions/accounts/";
};
};
// Follow recommended Methods for rpc APIs https://cloud.google.com/apis/design/resources?hl=de#methods
// https://cloud.google.com/apis/design/standard_methods?hl=de#list
// https://cloud.google.com/apis/design/naming_convention?hl=de
service AccountsService {
// Lists accounts
rpc ListAccounts(ListAccountsRequest) returns (ListAccountsResponse) {
// List method maps to HTTP GET
option (google.api.http) = {
post: "/api/v0/accounts/accounts-list",
body: "*"
};
}
// Gets an account
rpc GetAccount(GetAccountRequest) returns (ocis.messages.accounts.v0.Account) {
option (google.api.http) = {
post: "/api/v0/accounts/accounts-get",
body: "*"
};
}
// Creates an account
rpc CreateAccount(CreateAccountRequest) returns (ocis.messages.accounts.v0.Account) {
// Create maps to HTTP POST. URL path as the collection name.
// HTTP request body contains the resource
option (google.api.http) = {
post: "/api/v0/accounts/accounts-create"
body: "*"
};
}
// Updates an account
rpc UpdateAccount(UpdateAccountRequest) returns (ocis.messages.accounts.v0.Account) {
// Update maps to HTTP PATCH. Resource name is mapped to a URL path.
// Resource is contained in the HTTP request body
option (google.api.http) = {
post: "/api/v0/accounts/accounts-update"
body: "*"
};
};
// Deletes an account
rpc DeleteAccount(DeleteAccountRequest) returns (google.protobuf.Empty) {
// Delete maps to HTTP DELETE. Resource name maps to the URL path.
// There is no request body
option (google.api.http) = {
post: "/api/v0/accounts/accounts-delete",
body: "*"
};
}
}
service GroupsService {
// Lists groups
rpc ListGroups(ListGroupsRequest) returns (ListGroupsResponse) {
// List method maps to HTTP GET
option (google.api.http) = {
post: "/api/v0/accounts/groups-list",
body: "*"
};
}
// Gets an groups
rpc GetGroup(GetGroupRequest) returns (ocis.messages.accounts.v0.Group) {
option (google.api.http) = {
post: "/api/v0/accounts/groups-get",
body: "*"
};
}
// Creates a group
rpc CreateGroup(CreateGroupRequest) returns (ocis.messages.accounts.v0.Group) {
// Create maps to HTTP POST. URL path as the collection name.
// HTTP request body contains the resource
option (google.api.http) = {
post: "/api/v0/accounts/groups-create"
body: "*"
};
}
// Updates a group
rpc UpdateGroup(UpdateGroupRequest) returns (ocis.messages.accounts.v0.Group) {
// Update maps to HTTP PATCH. Resource name is mapped to a URL path.
// Resource is contained in the HTTP request body
option (google.api.http) = {
post: "/api/v0/accounts/groups-update"
body: "*"
};
};
// Deletes a group
rpc DeleteGroup(DeleteGroupRequest) returns (google.protobuf.Empty) {
// Delete maps to HTTP DELETE. Resource name maps to the URL path.
// There is no request body
option (google.api.http) = {
post: "/api/v0/accounts/groups-delete",
body: "*"
};
}
// additional group methods: https://docs.microsoft.com/en-us/graph/api/resources/group?view=graph-rest-1.0#methods
// references are accessed using $ref, see http://docs.oasis-open.org/odata/odata/v4.0/cs01/part2-url-conventions/odata-v4.0-cs01-part2-url-conventions.html#_Toc365046422
// or the stack overflow question https://stackoverflow.com/questions/49362894/why-is-the-microsoft-graph-api-using-ref-in-the-uri
// group:addmember https://docs.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-1.0&tabs=http
rpc AddMember(AddMemberRequest) returns (ocis.messages.accounts.v0.Group) {
// All request parameters go into body.
option (google.api.http) = {
post: "/api/v0/groups/{group_id=*}/members/$ref"
body: "*"
};
}
// group:removemember https://docs.microsoft.com/en-us/graph/api/group-delete-members?view=graph-rest-1.0
rpc RemoveMember(RemoveMemberRequest) returns (ocis.messages.accounts.v0.Group) {
// All request parameters go into body.
option (google.api.http) = {
// URLs are broken
post: "/api/v0/groups/{group_id=*}/members/{account_id}/$ref"
body: "*"
};
}
// group:listmembers https://docs.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0
rpc ListMembers(ListMembersRequest) returns (ListMembersResponse) {
// All request parameters go into body.
option (google.api.http) = {
// URLs are broken
post: "/api/v0/groups/{id=*}/members/$ref"
body: "*"
};
}
}
service IndexService {
rpc RebuildIndex(RebuildIndexRequest) returns (RebuildIndexResponse) {
// All request parameters go into body.
option (google.api.http) = {
// URLs are broken
post: "/api/v0/index/rebuild"
body: "*"
};
}
}
message RebuildIndexRequest {
}
message RebuildIndexResponse {
}
message ListAccountsRequest {
// Optional. The maximum number of accounts to return in the response
int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
// Optional. A pagination token returned from a previous call to `Get`
// that indicates from where search should continue
string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
// Optional. Used to specify a subset of fields that should be
// returned by a get operation or modified by an update operation.
google.protobuf.FieldMask field_mask = 3;
// Optional. Search criteria used to select the accounts to return.
// If no search criteria is specified then all accounts will be
// returned
//
// TODO update query language
// Query expressions can be used to restrict results based upon
// the account properties where the operators `=`, `NOT`, `AND` and `OR`
// can be used along with the suffix wildcard symbol `*`.
//
// The string properties in a query expression should use escaped quotes
// for values that include whitespace to prevent unexpected behavior.
//
// Some example queries are:
//
// * Query `display_name=Th*` returns accounts whose display_name
// starts with "Th"
// * Query `email=foo@example.com` returns accounts with
// `email` set to `foo@example.com`
// * Query `display_name=\\"Test String\\"` returns accounts with
// display names that include both "Test" and "String"
string query = 4 [(google.api.field_behavior) = OPTIONAL];
}
message ListAccountsResponse {
// The field name should match the noun "accounts" in the method name. There
// will be a maximum number of items returned based on the page_size field
// in the request
repeated ocis.messages.accounts.v0.Account accounts = 1;
// Token to retrieve the next page of results, or empty if there are no
// more results in the list
string next_page_token = 2;
}
message GetAccountRequest {
string id = 1;
}
message CreateAccountRequest {
// The account resource to create
ocis.messages.accounts.v0.Account account = 1;
}
message UpdateAccountRequest {
// The account resource which replaces the resource on the server
ocis.messages.accounts.v0.Account account = 1;
// The update mask applies to the resource. For the `FieldMask` definition,
// see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
google.protobuf.FieldMask update_mask = 2;
}
message DeleteAccountRequest {
string id = 1;
}
message ListGroupsRequest {
// Optional. The maximum number of groups to return in the response
int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
// Optional. A pagination token returned from a previous call to `Get`
// that indicates from where search should continue
string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
// Optional. Used to specify a subset of fields that should be
// returned by a get operation or modified by an update operation.
google.protobuf.FieldMask field_mask = 3;
// Optional. Search criteria used to select the groups to return.
// If no search criteria is specified then all groups will be
// returned
//
// TODO update query language
// Query expressions can be used to restrict results based upon
// the account properties where the operators `=`, `NOT`, `AND` and `OR`
// can be used along with the suffix wildcard symbol `*`.
//
// The string properties in a query expression should use escaped quotes
// for values that include whitespace to prevent unexpected behavior.
//
// Some example queries are:
//
// * Query `display_name=Th*` returns accounts whose display_name
// starts with "Th"
// * Query `display_name=\\"Test String\\"` returns groups with
// display names that include both "Test" and "String"
string query = 4 [(google.api.field_behavior) = OPTIONAL];
}
message ListGroupsResponse {
// The field name should match the noun "group" in the method name. There
// will be a maximum number of items returned based on the page_size field
// in the request
repeated ocis.messages.accounts.v0.Group groups = 1;
// Token to retrieve the next page of results, or empty if there are no
// more results in the list
string next_page_token = 2;
}
message GetGroupRequest {
string id = 1;
}
message CreateGroupRequest {
// The account resource to create
ocis.messages.accounts.v0.Group group = 1;
}
message UpdateGroupRequest {
// The group resource which replaces the resource on the server
ocis.messages.accounts.v0.Group group = 1;
// The update mask applies to the resource. For the `FieldMask` definition,
// see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
google.protobuf.FieldMask update_mask = 2;
}
message DeleteGroupRequest {
string id = 1;
}
message AddMemberRequest {
// The id of the group to add a member to
string group_id = 1;
// The account id to add
string account_id = 2;
}
message RemoveMemberRequest {
// The id of the group to remove a member from
string group_id = 1;
// The account id to remove
string account_id = 2;
}
message ListMembersRequest {
int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
// Optional. A pagination token returned from a previous call to `Get`
// that indicates from where search should continue
string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
// Optional. Used to specify a subset of fields that should be
// returned by a get operation or modified by an update operation.
google.protobuf.FieldMask field_mask = 3;
// Optional. Search criteria used to select the groups to return.
// If no search criteria is specified then all groups will be
// returned
//
// TODO update query language
// Query expressions can be used to restrict results based upon
// the account properties where the operators `=`, `NOT`, `AND` and `OR`
// can be used along with the suffix wildcard symbol `*`.
//
// The string properties in a query expression should use escaped quotes
// for values that include whitespace to prevent unexpected behavior.
//
// Some example queries are:
//
// * Query `display_name=Th*` returns accounts whose display_name
// starts with "Th"
// * Query `display_name=\\"Test String\\"` returns groups with
// display names that include both "Test" and "String"
string query = 4 [(google.api.field_behavior) = OPTIONAL];
// The id of the group to list members from
string id = 5;
}
message ListMembersResponse {
// The field name should match the noun "members" in the method name. There
// will be a maximum number of items returned based on the page_size field
// in the request
repeated ocis.messages.accounts.v0.Account members = 1;
// Token to retrieve the next page of results, or empty if there are no
// more results in the list
string next_page_token = 2;
}

View File

@@ -1,12 +1,12 @@
syntax = "proto3";
package com.owncloud.ocis.settings.v0;
package ocis.services.settings.v0;
option go_package = "github.com/owncloud/ocis/settings/pkg/proto/v0;proto";
option go_package = "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0";
import "ocis/messages/settings/v0/settings.proto";
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
@@ -139,11 +139,11 @@ service PermissionService {
// requests and responses for settings bundles
// ---
message SaveBundleRequest {
Bundle bundle = 1;
ocis.messages.settings.v0.Bundle bundle = 1;
}
message SaveBundleResponse {
Bundle bundle = 1;
ocis.messages.settings.v0.Bundle bundle = 1;
}
message GetBundleRequest {
@@ -151,7 +151,7 @@ message GetBundleRequest {
}
message GetBundleResponse {
Bundle bundle = 1;
ocis.messages.settings.v0.Bundle bundle = 1;
}
message ListBundlesRequest {
@@ -159,16 +159,16 @@ message ListBundlesRequest {
}
message ListBundlesResponse {
repeated Bundle bundles = 1;
repeated ocis.messages.settings.v0.Bundle bundles = 1;
}
message AddSettingToBundleRequest {
string bundle_id = 1;
Setting setting = 2;
ocis.messages.settings.v0.Setting setting = 2;
}
message AddSettingToBundleResponse {
Setting setting = 1;
ocis.messages.settings.v0.Setting setting = 1;
}
message RemoveSettingFromBundleRequest {
@@ -181,11 +181,11 @@ message RemoveSettingFromBundleRequest {
// ---
message SaveValueRequest {
Value value = 1;
ocis.messages.settings.v0.Value value = 1;
}
message SaveValueResponse {
ValueWithIdentifier value = 1;
ocis.messages.settings.v0.ValueWithIdentifier value = 1;
}
message GetValueRequest {
@@ -193,7 +193,7 @@ message GetValueRequest {
}
message GetValueResponse {
ValueWithIdentifier value = 1;
ocis.messages.settings.v0.ValueWithIdentifier value = 1;
}
message ListValuesRequest {
@@ -202,7 +202,7 @@ message ListValuesRequest {
}
message ListValuesResponse {
repeated ValueWithIdentifier values = 1;
repeated ocis.messages.settings.v0.ValueWithIdentifier values = 1;
}
message GetValueByUniqueIdentifiersRequest{
@@ -210,17 +210,6 @@ message GetValueByUniqueIdentifiersRequest{
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
// ---
@@ -230,7 +219,7 @@ message ListRoleAssignmentsRequest {
}
message ListRoleAssignmentsResponse {
repeated UserRoleAssignment assignments = 1;
repeated ocis.messages.settings.v0.UserRoleAssignment assignments = 1;
}
message AssignRoleToUserRequest {
@@ -240,31 +229,23 @@ message AssignRoleToUserRequest {
}
message AssignRoleToUserResponse {
UserRoleAssignment assignment = 1;
ocis.messages.settings.v0.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;
ocis.messages.settings.v0.Resource resource = 1;
}
message ListPermissionsByResourceResponse {
repeated Permission permissions = 1;
repeated ocis.messages.settings.v0.Permission permissions = 1;
}
message GetPermissionByIDRequest {
@@ -272,145 +253,5 @@ message GetPermissionByIDRequest {
}
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;
}
ocis.messages.settings.v0.Permission permission = 1;
}

View File

@@ -1,9 +1,10 @@
syntax = "proto3";
package com.owncloud.ocis.store.v0;
option go_package = "github.com/owncloud/ocis/store/pkg/proto/v0;proto";
package ocis.services.store.v0;
option go_package = "github.com/owncloud/ocis/protogen/gen/ocis/service/store/v0";
import "ocis/messages/store/v0/store.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
@@ -39,83 +40,31 @@ service Store {
rpc Tables(TablesRequest) returns (TablesResponse) {};
}
message Field {
// type of value e.g string, int, int64, bool, float64
string type = 1;
// the actual value
string value = 2;
}
message Record {
// key of the recorda
string key = 1;
// value in the record
bytes value = 2;
// time.Duration (signed int64 nanoseconds)
int64 expiry = 3;
// the associated metadata
map<string,Field> metadata = 4;
}
message ReadOptions {
string database = 1;
string table = 2;
bool prefix = 3;
bool suffix = 4;
uint64 limit = 5;
uint64 offset = 6;
map<string,Field> where = 7;
}
message ReadRequest {
string key = 1;
ReadOptions options = 2;
string key = 1;
ocis.messages.store.v0.ReadOptions options = 2;
}
message ReadResponse {
repeated Record records = 1;
}
message WriteOptions {
string database = 1;
string table = 2;
// time.Time
int64 expiry = 3;
// time.Duration
int64 ttl = 4;
repeated ocis.messages.store.v0.Record records = 1;
}
message WriteRequest {
Record record = 1;
WriteOptions options = 2;
ocis.messages.store.v0.Record record = 1;
ocis.messages.store.v0.WriteOptions options = 2;
}
message WriteResponse {}
message DeleteOptions {
string database = 1;
string table = 2;
}
message DeleteRequest {
string key = 1;
DeleteOptions options = 2;
string key = 1;
ocis.messages.store.v0.DeleteOptions options = 2;
}
message DeleteResponse {}
message ListOptions {
string database = 1;
string table = 2;
string prefix = 3;
string suffix = 4;
uint64 limit = 5;
uint64 offset = 6;
}
message ListRequest {
ListOptions options = 1;
ocis.messages.store.v0.ListOptions options = 1;
}
message ListResponse {

View File

@@ -1,9 +1,10 @@
syntax = "proto3";
package com.owncloud.ocis.thumbnails.v0;
package ocis.services.thumbnails.v0;
option go_package = "github.com/owncloud/ocis/thumbnails/pkg/proto/v0;proto";
option go_package = "github.com/owncloud/ocis/protogen/gen/ocis/services/thumbnails/v0";
import "ocis/messages/thumbnails/v0/thumbnails.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
@@ -52,29 +53,11 @@ message GetThumbnailRequest {
// The height of the thumbnail
int32 height = 4;
oneof source {
WebdavSource webdav_source = 5;
CS3Source cs3_source = 6;
ocis.messages.thumbnails.v0.WebdavSource webdav_source = 5;
ocis.messages.thumbnails.v0.CS3Source cs3_source = 6;
}
}
message WebdavSource {
// REQUIRED.
string url = 1;
// REQUIRED.
bool is_public_link = 2;
// OPTIONAL.
string webdav_authorization = 3;
// OPTIONAL.
string reva_authorization = 4;
// OPTIONAL.
string public_link_token = 5;
}
message CS3Source {
string path = 1;
string authorization = 2;
}
// The service response
message GetThumbnailResponse {
// The thumbnail as a binary

View File

@@ -7,16 +7,20 @@ import (
"net/http"
"time"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
storesvc "github.com/owncloud/ocis/protogen/gen/ocis/services/store/v0"
"github.com/coreos/go-oidc/v3/oidc"
"github.com/cs3org/reva/pkg/token/manager/jwt"
chimiddleware "github.com/go-chi/chi/v5/middleware"
"github.com/justinas/alice"
"github.com/oklog/run"
acc "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocis-pkg/log"
pkgmiddleware "github.com/owncloud/ocis/ocis-pkg/middleware"
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
"github.com/owncloud/ocis/ocis-pkg/version"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
"github.com/owncloud/ocis/proxy/pkg/config"
"github.com/owncloud/ocis/proxy/pkg/config/parser"
"github.com/owncloud/ocis/proxy/pkg/cs3"
@@ -28,8 +32,6 @@ import (
proxyHTTP "github.com/owncloud/ocis/proxy/pkg/server/http"
"github.com/owncloud/ocis/proxy/pkg/tracing"
"github.com/owncloud/ocis/proxy/pkg/user/backend"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
storepb "github.com/owncloud/ocis/store/pkg/proto/v0"
"github.com/urfave/cli/v2"
"golang.org/x/oauth2"
)
@@ -125,7 +127,7 @@ func Server(cfg *config.Config) *cli.Command {
}
func loadMiddlewares(ctx context.Context, logger log.Logger, cfg *config.Config) alice.Chain {
rolesClient := settings.NewRoleService("com.owncloud.api.settings", grpc.DefaultClient)
rolesClient := settingssvc.NewRoleService("com.owncloud.api.settings", grpc.DefaultClient)
revaClient, err := cs3.GetGatewayServiceClient(cfg.Reva.Address)
var userProvider backend.UserBackend
switch cfg.AccountBackend {
@@ -139,7 +141,7 @@ func loadMiddlewares(ctx context.Context, logger log.Logger, cfg *config.Config)
Msg("Failed to create token manager")
}
userProvider = backend.NewAccountsServiceUserBackend(
acc.NewAccountsService("com.owncloud.api.accounts", grpc.DefaultClient),
accountssvc.NewAccountsService("com.owncloud.api.accounts", grpc.DefaultClient),
rolesClient,
cfg.OIDC.Issuer,
tokenManager,
@@ -151,7 +153,7 @@ func loadMiddlewares(ctx context.Context, logger log.Logger, cfg *config.Config)
logger.Fatal().Msgf("Invalid accounts backend type '%s'", cfg.AccountBackend)
}
storeClient := storepb.NewStoreService("com.owncloud.api.store", grpc.DefaultClient)
storeClient := storesvc.NewStoreService("com.owncloud.api.store", grpc.DefaultClient)
if err != nil {
logger.Error().Err(err).
Str("gateway", cfg.Reva.Address).

View File

@@ -6,13 +6,13 @@ import (
"github.com/owncloud/ocis/proxy/pkg/user/backend"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
storesvc "github.com/owncloud/ocis/protogen/gen/ocis/services/store/v0"
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
acc "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/proxy/pkg/config"
storepb "github.com/owncloud/ocis/store/pkg/proto/v0"
)
// Option defines a single option function.
@@ -29,11 +29,11 @@ type Options struct {
// HTTPClient to use for communication with the oidcAuth provider
HTTPClient *http.Client
// AccountsClient for resolving accounts
AccountsClient acc.AccountsService
AccountsClient accountssvc.AccountsService
// UP
UserProvider backend.UserBackend
// SettingsRoleService for the roles API in settings
SettingsRoleService settings.RoleService
SettingsRoleService settingssvc.RoleService
// OIDCProviderFunc to lazily initialize an oidc provider, must be set for the oidc_auth middleware
OIDCProviderFunc func() (OIDCProvider, error)
// OIDCIss is the oidcAuth-issuer
@@ -41,7 +41,7 @@ type Options struct {
// RevaGatewayClient to send requests to the reva gateway
RevaGatewayClient gateway.GatewayAPIClient
// Store for persisting data
Store storepb.StoreService
Store storesvc.StoreService
// PreSignedURLConfig to configure the middleware
PreSignedURLConfig config.PreSignedURL
// UserOIDCClaim to read from the oidc claims
@@ -100,14 +100,14 @@ func HTTPClient(c *http.Client) Option {
}
// AccountsClient provides a function to set the accounts client config option.
func AccountsClient(ac acc.AccountsService) Option {
func AccountsClient(ac accountssvc.AccountsService) Option {
return func(o *Options) {
o.AccountsClient = ac
}
}
// SettingsRoleService provides a function to set the role service option.
func SettingsRoleService(rc settings.RoleService) Option {
func SettingsRoleService(rc settingssvc.RoleService) Option {
return func(o *Options) {
o.SettingsRoleService = rc
}
@@ -142,7 +142,7 @@ func RevaGatewayClient(gc gateway.GatewayAPIClient) Option {
}
// Store provides a function to set the store option.
func Store(sc storepb.StoreService) Option {
func Store(sc storesvc.StoreService) Option {
return func(o *Options) {
o.Store = sc
}

View File

@@ -13,9 +13,10 @@ import (
revactx "github.com/cs3org/reva/pkg/ctx"
"github.com/owncloud/ocis/ocis-pkg/log"
storemsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/store/v0"
storesvc "github.com/owncloud/ocis/protogen/gen/ocis/services/store/v0"
"github.com/owncloud/ocis/proxy/pkg/config"
"github.com/owncloud/ocis/proxy/pkg/user/backend"
store "github.com/owncloud/ocis/store/pkg/proto/v0"
"golang.org/x/crypto/pbkdf2"
)
@@ -39,7 +40,7 @@ type signedURLAuth struct {
logger log.Logger
preSignedURLConfig config.PreSignedURL
userProvider backend.UserBackend
store store.StoreService
store storesvc.StoreService
}
func (m signedURLAuth) ServeHTTP(w http.ResponseWriter, req *http.Request) {
@@ -197,8 +198,8 @@ func (m signedURLAuth) createSignature(url string, signingKey []byte) string {
}
func (m signedURLAuth) getSigningKey(ctx context.Context, ocisID string) ([]byte, error) {
res, err := m.store.Read(ctx, &store.ReadRequest{
Options: &store.ReadOptions{
res, err := m.store.Read(ctx, &storesvc.ReadRequest{
Options: &storemsg.ReadOptions{
Database: "proxy",
Table: "signing-keys",
},

View File

@@ -6,9 +6,10 @@ import (
"regexp"
"sort"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/asim/go-micro/plugins/client/grpc/v4"
revactx "github.com/cs3org/reva/pkg/ctx"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocis-pkg/oidc"
"github.com/owncloud/ocis/proxy/pkg/config"
)
@@ -84,7 +85,7 @@ func LoadSelector(cfg *config.PolicySelector) (Selector, error) {
if cfg.Migration != nil {
return NewMigrationSelector(
cfg.Migration,
accounts.NewAccountsService("com.owncloud.accounts", grpc.NewClient())), nil
accountssvc.NewAccountsService("com.owncloud.accounts", grpc.NewClient())), nil
}
if cfg.Claims != nil {
@@ -129,7 +130,7 @@ func NewStaticSelector(cfg *config.StaticSelectorConf) Selector {
//
// This selector can be used in migration-scenarios where some users have already migrated from ownCloud10 to OCIS and
// thus have an entry in ocis-accounts. All users without accounts entry are routed to the legacy ownCloud10 instance.
func NewMigrationSelector(cfg *config.MigrationSelectorConf, ss accounts.AccountsService) Selector {
func NewMigrationSelector(cfg *config.MigrationSelectorConf, ss accountssvc.AccountsService) Selector {
var acc = ss
return func(r *http.Request) (s string, err error) {
var claims map[string]interface{}
@@ -144,7 +145,7 @@ func NewMigrationSelector(cfg *config.MigrationSelectorConf, ss accounts.Account
return cfg.AccNotFoundPolicy, nil
}
if _, err := acc.GetAccount(r.Context(), &accounts.GetAccountRequest{Id: userID}); err != nil {
if _, err := acc.GetAccount(r.Context(), &accountssvc.GetAccountRequest{Id: userID}); err != nil {
return cfg.AccNotFoundPolicy, nil
}
return cfg.AccFoundPolicy, nil

View File

@@ -9,8 +9,9 @@ import (
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
revactx "github.com/cs3org/reva/pkg/ctx"
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocis-pkg/oidc"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
"github.com/owncloud/ocis/proxy/pkg/config"
"go-micro.dev/v4/client"
)
@@ -110,18 +111,18 @@ func TestMigrationSelector(t *testing.T) {
}
}
func mockAccSvc(retErr bool) proto.AccountsService {
func mockAccSvc(retErr bool) accountssvc.AccountsService {
if retErr {
return &proto.MockAccountsService{
GetFunc: func(ctx context.Context, in *proto.GetAccountRequest, opts ...client.CallOption) (record *proto.Account, err error) {
return &accountssvc.MockAccountsService{
GetFunc: func(ctx context.Context, in *accountssvc.GetAccountRequest, opts ...client.CallOption) (record *accountsmsg.Account, err error) {
return nil, fmt.Errorf("error returned by mockAccountsService GET")
},
}
}
return &proto.MockAccountsService{
GetFunc: func(ctx context.Context, in *proto.GetAccountRequest, opts ...client.CallOption) (record *proto.Account, err error) {
return &proto.Account{}, nil
return &accountssvc.MockAccountsService{
GetFunc: func(ctx context.Context, in *accountssvc.GetAccountRequest, opts ...client.CallOption) (record *accountsmsg.Account, err error) {
return &accountsmsg.Account{}, nil
},
}

View File

@@ -6,18 +6,20 @@ import (
"net/http"
"strings"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
cs3 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
"github.com/cs3org/reva/pkg/auth/scope"
"github.com/cs3org/reva/pkg/token"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/ocis-pkg/oidc"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
)
// NewAccountsServiceUserBackend creates a user-provider which fetches users from the ocis accounts-service
func NewAccountsServiceUserBackend(ac accounts.AccountsService, rs settings.RoleService, oidcISS string, tokenManager token.Manager, logger log.Logger) UserBackend {
func NewAccountsServiceUserBackend(ac accountssvc.AccountsService, rs settingssvc.RoleService, oidcISS string, tokenManager token.Manager, logger log.Logger) UserBackend {
return &accountsServiceBackend{
accountsClient: ac,
settingsRoleService: rs,
@@ -28,15 +30,15 @@ func NewAccountsServiceUserBackend(ac accounts.AccountsService, rs settings.Role
}
type accountsServiceBackend struct {
accountsClient accounts.AccountsService
settingsRoleService settings.RoleService
accountsClient accountssvc.AccountsService
settingsRoleService settingssvc.RoleService
OIDCIss string
logger log.Logger
tokenManager token.Manager
}
func (a accountsServiceBackend) GetUserByClaims(ctx context.Context, claim, value string, withRoles bool) (*cs3.User, string, error) {
var account *accounts.Account
var account *accountsmsg.Account
var status int
var query string
@@ -109,8 +111,8 @@ func (a *accountsServiceBackend) Authenticate(ctx context.Context, username stri
}
func (a accountsServiceBackend) CreateUserFromClaims(ctx context.Context, claims map[string]interface{}) (*cs3.User, error) {
req := &accounts.CreateAccountRequest{
Account: &accounts.Account{
req := &accountssvc.CreateAccountRequest{
Account: &accountsmsg.Account{
CreationType: "LocalAccount",
AccountEnabled: true,
},
@@ -155,7 +157,7 @@ func (a accountsServiceBackend) GetUserGroups(ctx context.Context, userID string
// accountToUser converts an owncloud account struct to a reva user struct. In the proxy
// we work with the reva struct as a token can be minted from it.
func (a *accountsServiceBackend) accountToUser(account *accounts.Account) *cs3.User {
func (a *accountsServiceBackend) accountToUser(account *accountsmsg.Account) *cs3.User {
user := &cs3.User{
Id: &cs3.UserId{
OpaqueId: account.Id,
@@ -173,8 +175,8 @@ func (a *accountsServiceBackend) accountToUser(account *accounts.Account) *cs3.U
return user
}
func (a *accountsServiceBackend) getAccount(ctx context.Context, query string) (account *accounts.Account, status int) {
resp, err := a.accountsClient.ListAccounts(ctx, &accounts.ListAccountsRequest{
func (a *accountsServiceBackend) getAccount(ctx context.Context, query string) (account *accountsmsg.Account, status int) {
resp, err := a.accountsClient.ListAccounts(ctx, &accountssvc.ListAccountsRequest{
Query: query,
PageSize: 2,
})
@@ -216,7 +218,7 @@ func (a *accountsServiceBackend) generateToken(ctx context.Context, u *cs3.User)
return token, nil
}
func expandGroups(account *accounts.Account) []string {
func expandGroups(account *accountsmsg.Account) []string {
groups := make([]string, len(account.MemberOf))
for i := range account.MemberOf {
// reva needs the unix group name
@@ -226,7 +228,7 @@ func expandGroups(account *accounts.Account) []string {
}
// injectRoles adds roles from the roles-service to the user-struct by mutating an existing struct
func injectRoles(ctx context.Context, u *cs3.User, ss settings.RoleService) error {
func injectRoles(ctx context.Context, u *cs3.User, ss settingssvc.RoleService) error {
roleIDs, err := loadRolesIDs(ctx, u.Id.OpaqueId, ss)
if err != nil {
return err

View File

@@ -6,16 +6,18 @@ import (
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
"github.com/cs3org/reva/pkg/token/manager/jwt"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/ocis-pkg/oidc"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v0"
settingsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/settings/v0"
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v0"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"go-micro.dev/v4/client"
)
var mockAccResp = []*accounts.Account{
var mockAccResp = []*accountsmsg.Account{
{
Id: "1234",
AccountEnabled: true,
@@ -25,14 +27,14 @@ var mockAccResp = []*accounts.Account{
GidNumber: 2,
Mail: "foo@example.org",
OnPremisesSamAccountName: "samaccount",
MemberOf: []*accounts.Group{
MemberOf: []*accountsmsg.Group{
{OnPremisesSamAccountName: "g1"},
{OnPremisesSamAccountName: "g2"},
},
},
}
var expectedRoles = []*settings.UserRoleAssignment{
var expectedRoles = []*settingsmsg.UserRoleAssignment{
{Id: "abc", AccountUuid: "1234", RoleId: "a"},
{Id: "def", AccountUuid: "1234", RoleId: "b"},
}
@@ -63,7 +65,7 @@ func TestGetUserByClaimsFound(t *testing.T) {
}
func TestGetUserByClaimsNotFound(t *testing.T) {
accBackend := newAccountsBackend([]*accounts.Account{}, expectedRoles)
accBackend := newAccountsBackend([]*accountsmsg.Account{}, expectedRoles)
u, _, err := accBackend.GetUserByClaims(context.Background(), "mail", "foo@example.com", true)
@@ -73,7 +75,7 @@ func TestGetUserByClaimsNotFound(t *testing.T) {
}
func TestGetUserByClaimsInvalidClaim(t *testing.T) {
accBackend := newAccountsBackend([]*accounts.Account{}, expectedRoles)
accBackend := newAccountsBackend([]*accountsmsg.Account{}, expectedRoles)
u, _, err := accBackend.GetUserByClaims(context.Background(), "invalidClaimName", "efwfwfwfe", true)
assert.Nil(t, u)
@@ -81,7 +83,7 @@ func TestGetUserByClaimsInvalidClaim(t *testing.T) {
}
func TestGetUserByClaimsDisabledAccount(t *testing.T) {
accBackend := newAccountsBackend([]*accounts.Account{{AccountEnabled: false}}, expectedRoles)
accBackend := newAccountsBackend([]*accountsmsg.Account{{AccountEnabled: false}}, expectedRoles)
u, _, err := accBackend.GetUserByClaims(context.Background(), "mail", "foo@example.com", true)
assert.Nil(t, u)
@@ -99,7 +101,7 @@ func TestAuthenticate(t *testing.T) {
}
func TestAuthenticateFailed(t *testing.T) {
accBackend := newAccountsBackend([]*accounts.Account{}, expectedRoles)
accBackend := newAccountsBackend([]*accountsmsg.Account{}, expectedRoles)
u, _, err := accBackend.Authenticate(context.Background(), "foo", "secret")
assert.Nil(t, u)
@@ -108,7 +110,7 @@ func TestAuthenticateFailed(t *testing.T) {
func TestCreateUserFromClaims(t *testing.T) {
exp := mockAccResp[0]
accBackend := newAccountsBackend([]*accounts.Account{}, expectedRoles)
accBackend := newAccountsBackend([]*accountsmsg.Account{}, expectedRoles)
act, _ := accBackend.CreateUserFromClaims(context.Background(), map[string]interface{}{
oidc.Name: mockAccResp[0].DisplayName,
oidc.PreferredUsername: mockAccResp[0].OnPremisesSamAccountName,
@@ -126,11 +128,11 @@ func TestCreateUserFromClaims(t *testing.T) {
}
func TestGetUserGroupsUnimplemented(t *testing.T) {
accBackend := newAccountsBackend([]*accounts.Account{}, expectedRoles)
accBackend := newAccountsBackend([]*accountsmsg.Account{}, expectedRoles)
assert.Panics(t, func() { accBackend.GetUserGroups(context.Background(), "foo") })
}
func assertUserMatchesAccount(t *testing.T, exp *accounts.Account, act *userv1beta1.User) {
func assertUserMatchesAccount(t *testing.T, exp *accountsmsg.Account, act *userv1beta1.User) {
// User
assert.NotNil(t, act.Id)
assert.Equal(t, exp.Id, act.Id.OpaqueId)
@@ -150,7 +152,7 @@ func assertUserMatchesAccount(t *testing.T, exp *accounts.Account, act *userv1be
assert.Equal(t, int64(2), act.GidNumber)
}
func newAccountsBackend(mockAccounts []*accounts.Account, mockRoles []*settings.UserRoleAssignment) UserBackend {
func newAccountsBackend(mockAccounts []*accountsmsg.Account, mockRoles []*settingsmsg.UserRoleAssignment) UserBackend {
accSvc, roleSvc := getAccountService(mockAccounts, nil), getRoleService(mockRoles, nil)
tokenManager, _ := jwt.New(map[string]interface{}{
"secret": "change-me",
@@ -161,12 +163,12 @@ func newAccountsBackend(mockAccounts []*accounts.Account, mockRoles []*settings.
return accBackend
}
func getAccountService(expectedResponse []*accounts.Account, err error) *accounts.MockAccountsService {
return &accounts.MockAccountsService{
ListFunc: func(ctx context.Context, in *accounts.ListAccountsRequest, opts ...client.CallOption) (*accounts.ListAccountsResponse, error) {
return &accounts.ListAccountsResponse{Accounts: expectedResponse}, err
func getAccountService(expectedResponse []*accountsmsg.Account, err error) *accountssvc.MockAccountsService {
return &accountssvc.MockAccountsService{
ListFunc: func(ctx context.Context, in *accountssvc.ListAccountsRequest, opts ...client.CallOption) (*accountssvc.ListAccountsResponse, error) {
return &accountssvc.ListAccountsResponse{Accounts: expectedResponse}, err
},
CreateFunc: func(ctx context.Context, in *accounts.CreateAccountRequest, opts ...client.CallOption) (*accounts.Account, error) {
CreateFunc: func(ctx context.Context, in *accountssvc.CreateAccountRequest, opts ...client.CallOption) (*accountsmsg.Account, error) {
a := in.Account
a.Id = "1234"
return a, nil
@@ -174,10 +176,10 @@ func getAccountService(expectedResponse []*accounts.Account, err error) *account
}
}
func getRoleService(expectedResponse []*settings.UserRoleAssignment, err error) *settings.MockRoleService {
return &settings.MockRoleService{
ListRoleAssignmentsFunc: func(ctx context.Context, req *settings.ListRoleAssignmentsRequest, opts ...client.CallOption) (*settings.ListRoleAssignmentsResponse, error) {
return &settings.ListRoleAssignmentsResponse{Assignments: expectedResponse}, err
func getRoleService(expectedResponse []*settingsmsg.UserRoleAssignment, err error) *settingssvc.MockRoleService {
return &settingssvc.MockRoleService{
ListRoleAssignmentsFunc: func(ctx context.Context, req *settingssvc.ListRoleAssignmentsRequest, opts ...client.CallOption) (*settingssvc.ListRoleAssignmentsResponse, error) {
return &settingssvc.ListRoleAssignmentsResponse{Assignments: expectedResponse}, err
},
}

View File

@@ -8,7 +8,7 @@ import (
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
cs3 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
"google.golang.org/grpc"
)
@@ -35,8 +35,8 @@ type RevaAuthenticator interface {
}
// loadRolesIDs returns the role-ids assigned to an user
func loadRolesIDs(ctx context.Context, opaqueUserID string, rs settings.RoleService) ([]string, error) {
req := &settings.ListRoleAssignmentsRequest{AccountUuid: opaqueUserID}
func loadRolesIDs(ctx context.Context, opaqueUserID string, rs settingssvc.RoleService) ([]string, error) {
req := &settingssvc.ListRoleAssignmentsRequest{AccountUuid: opaqueUserID}
assignmentResponse, err := rs.ListRoleAssignments(ctx, req)
if err != nil {

View File

@@ -9,19 +9,19 @@ import (
rpcv1beta1 "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
"github.com/owncloud/ocis/ocis-pkg/log"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
settingsSvc "github.com/owncloud/ocis/settings/pkg/service/v0"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0"
settingsService "github.com/owncloud/ocis/settings/pkg/service/v0"
)
type cs3backend struct {
settingsRoleService settings.RoleService
settingsRoleService settingssvc.RoleService
authProvider RevaAuthenticator
machineAuthAPIKey string
logger log.Logger
}
// NewCS3UserBackend creates a user-provider which fetches users from a CS3 UserBackend
func NewCS3UserBackend(rs settings.RoleService, ap RevaAuthenticator, machineAuthAPIKey string, logger log.Logger) UserBackend {
func NewCS3UserBackend(rs settingssvc.RoleService, ap RevaAuthenticator, machineAuthAPIKey string, logger log.Logger) UserBackend {
return &cs3backend{
settingsRoleService: rs,
authProvider: ap,
@@ -62,7 +62,7 @@ func (c *cs3backend) GetUserByClaims(ctx context.Context, claim, value string, w
}
if len(roleIDs) == 0 {
roleIDs = append(roleIDs, settingsSvc.BundleUUIDRoleUser, settingsSvc.SelfManagementPermissionID)
roleIDs = append(roleIDs, settingsService.BundleUUIDRoleUser, settingsService.SelfManagementPermissionID)
// if roles are empty, assume we haven't seen the user before and assign a default user role. At least until
// proper roles are provided. See https://github.com/owncloud/ocis/issues/1825 for more context.
//return user, nil

View File

@@ -50,9 +50,6 @@ node_modules:
yarn install --immutable
############ protobuf ############
PROTO_VERSION := v0
PROTO_SRC := pkg/proto/$(PROTO_VERSION)
include ../.make/protobuf.mk
.PHONY: protobuf

View File

@@ -1,29 +0,0 @@
version: v1
plugins:
- name: go
path: ../.bingo/protoc-gen-go
out: pkg/
opt:
- paths=source_relative
- name: micro
path: ../.bingo/protoc-gen-micro
out: pkg/
opt:
- paths=source_relative
- name: microweb
path: ../.bingo/protoc-gen-microweb
out: pkg/
opt:
- paths=source_relative
- name: openapiv2
path: ../.bingo/protoc-gen-openapiv2
out: pkg/
- name: doc
path: ../.bingo/protoc-gen-doc
out: ../docs/extensions/settings
opt:
- ./templates/GRPC.tmpl,grpc.md

View File

@@ -1,17 +0,0 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: googleapis
repository: googleapis
branch: main
commit: ca45b9d9c51849e898845743a28b0eb0
digest: b1--B2JdvzLV2KI5pYMG9AHJHFGznqXfZKjKwcqBuXhGgw=
create_time: 2021-10-14T15:09:30.598677Z
- remote: buf.build
owner: grpc-ecosystem
repository: grpc-gateway
branch: main
commit: 462ede5f3dee45569df6317bda220b1b
digest: b1-4FNKWjnS2yafyeOdqW8u-s7w1pJBHjz0Z6CbOL-Ipk0=
create_time: 2021-10-14T01:55:03.476639Z

Some files were not shown because too many files have changed in this diff Show More