diff --git a/perxis-proto b/perxis-proto index 59b21fcd765d2a6208f65dccdd04a63e55a0016e..ecd756865a06583ce52bff6265c0fd5e159d93b9 160000 --- a/perxis-proto +++ b/perxis-proto @@ -1 +1 @@ -Subproject commit 59b21fcd765d2a6208f65dccdd04a63e55a0016e +Subproject commit ecd756865a06583ce52bff6265c0fd5e159d93b9 diff --git a/pkg/clients/transport/grpc/protobuf_type_converters.microgen.go b/pkg/clients/transport/grpc/protobuf_type_converters.microgen.go index 5212c0b5d2dc9c96533f5f64aee9ed58ab241b41..bad21c1b4d45655d872771d3ea3656c09ff36b29 100644 --- a/pkg/clients/transport/grpc/protobuf_type_converters.microgen.go +++ b/pkg/clients/transport/grpc/protobuf_type_converters.microgen.go @@ -136,10 +136,12 @@ func PtrPermissionRuleToProto(rule *permission.Rule) (*commonpb.Rule, error) { Actions: actions, Access: commonpb.Access(rule.Access), HiddenFields: rule.HiddenFields, - ReadonlyFields: rule.ReadonlyFields, - WriteonlyFields: rule.WriteonlyFields, + ReadonlyFields: rule.DenyWriteFields, + WriteonlyFields: rule.DenyReadFields, ReadFilter: rule.ReadFilter, WriteFilter: rule.WriteFilter, + DenyReadFields: rule.DenyReadFields, + DenyWriteFields: rule.DenyWriteFields, }, nil } @@ -151,14 +153,21 @@ func ProtoToPtrPermissionRule(protoRule *commonpb.Rule) (*permission.Rule, error for _, a := range protoRule.Actions { actions = append(actions, permission.Action(a)) } - return &permission.Rule{ + r := &permission.Rule{ CollectionID: protoRule.CollectionId, Actions: actions, Access: permission.Access(protoRule.Access), HiddenFields: protoRule.HiddenFields, - ReadonlyFields: protoRule.ReadonlyFields, - WriteonlyFields: protoRule.WriteonlyFields, + DenyReadFields: protoRule.DenyReadFields, + DenyWriteFields: protoRule.DenyWriteFields, ReadFilter: protoRule.ReadFilter, WriteFilter: protoRule.WriteFilter, - }, nil + } + if len(r.DenyReadFields) == 0 { + r.DenyReadFields = protoRule.WriteonlyFields + } + if len(r.DenyWriteFields) == 0 { + r.DenyWriteFields = protoRule.ReadonlyFields + } + return r, nil } diff --git a/pkg/collections/collection.go b/pkg/collections/collection.go index 7af47c90b809bcc307e4f364a1d24ca5837e0043..85ab01999816f8ab986c69495d737ce3f1e8160e 100644 --- a/pkg/collections/collection.go +++ b/pkg/collections/collection.go @@ -20,8 +20,8 @@ type Config struct { type Access struct { Actions []permission.Action // Список разрешенных действия с элементами коллекции HiddenFields []string // Поля не отображаемые в интерфейсе и не возвращаемые API - ReadonlyFields []string // Поля недоступные для редактирования и не обновляемые через API - WriteonlyFields []string // Поля отображаемые в интерфейсе, но не возвращаемые в API + DenyReadFields []string // Поля недоступные для редактирования и не обновляемые через API + DenyWriteFields []string // Поля отображаемые в интерфейсе, но не возвращаемые в API } func (a Access) Clone() *Access { @@ -29,14 +29,14 @@ func (a Access) Clone() *Access { clone := &Access{ Actions: make([]permission.Action, len(a.Actions)), HiddenFields: make([]string, len(a.HiddenFields)), - ReadonlyFields: make([]string, len(a.ReadonlyFields)), - WriteonlyFields: make([]string, len(a.WriteonlyFields)), + DenyReadFields: make([]string, len(a.DenyReadFields)), + DenyWriteFields: make([]string, len(a.DenyWriteFields)), } copy(clone.Actions, a.Actions) copy(clone.HiddenFields, a.HiddenFields) - copy(clone.ReadonlyFields, a.ReadonlyFields) - copy(clone.WriteonlyFields, a.WriteonlyFields) + copy(clone.DenyReadFields, a.DenyReadFields) + copy(clone.DenyWriteFields, a.DenyWriteFields) return clone } diff --git a/pkg/collections/transport/grpc/protobuf_type_converters.microgen.go b/pkg/collections/transport/grpc/protobuf_type_converters.microgen.go index d19bee8b078380d6af962eac8e7738ba0170cd98..0072506b7658a5591b09f914780706fcef88d034 100644 --- a/pkg/collections/transport/grpc/protobuf_type_converters.microgen.go +++ b/pkg/collections/transport/grpc/protobuf_type_converters.microgen.go @@ -54,8 +54,10 @@ func PtrCollectionToProto(coll *service.Collection) (*pb.Collection, error) { access = &pb.Access{ Actions: actions, HiddenFields: coll.Access.HiddenFields, - ReadonlyFields: coll.Access.ReadonlyFields, - WriteonlyFields: coll.Access.WriteonlyFields, + ReadonlyFields: coll.Access.DenyReadFields, + WriteonlyFields: coll.Access.DenyWriteFields, + DenyReadFields: coll.Access.DenyReadFields, + DenyWriteFields: coll.Access.DenyWriteFields, } } protoCollection := &pb.Collection{ @@ -112,8 +114,14 @@ func ProtoToPtrCollection(protoCollection *pb.Collection) (*service.Collection, access = &service.Access{ Actions: actions, HiddenFields: protoCollection.Access.HiddenFields, - ReadonlyFields: protoCollection.Access.ReadonlyFields, - WriteonlyFields: protoCollection.Access.WriteonlyFields, + DenyReadFields: protoCollection.Access.DenyReadFields, + DenyWriteFields: protoCollection.Access.DenyWriteFields, + } + if len(access.DenyReadFields) == 0 { + access.DenyReadFields = protoCollection.Access.WriteonlyFields + } + if len(access.DenyWriteFields) == 0 { + access.DenyWriteFields = protoCollection.Access.ReadonlyFields } } collection := &service.Collection{ diff --git a/pkg/permission/ruleset.go b/pkg/permission/ruleset.go index 0843afc79922be9a20c06009d4084a281b3cd68f..e1a02d269cd3951f782cf8aec9d661e2c8f0ceef 100644 --- a/pkg/permission/ruleset.go +++ b/pkg/permission/ruleset.go @@ -22,10 +22,10 @@ type Rule struct { Access Access `json:"access" bson:"access,omitempty"` // Поля не передаются API клиенту HiddenFields []string `json:"hiddenFields,omitempty" bson:"hiddenFields,omitempty"` - // Клиент не может сохранять данные поля - ReadonlyFields []string `json:"readonlyFields,omitempty" bson:"readonlyFields,omitempty"` // Клиент может сохранить данные поля, но поля не передаются в API - WriteonlyFields []string `json:"writeonlyFields,omitempty" bson:"writeonlyFields,omitempty"` + DenyReadFields []string `json:"denyReadFields,omitempty" bson:"denyReadFields,omitempty"` + // Клиент не может сохранять данные поля + DenyWriteFields []string `json:"denyWriteFields,omitempty" bson:"denyWriteFields,omitempty"` // Дополнительный фильтр ReadFilter string `json:"readFilter,omitempty" bson:"readFilter,omitempty"` WriteFilter string `json:"writeFilter,omitempty" bson:"writeFilter,omitempty"` @@ -44,8 +44,8 @@ func (r Rule) Clone() *Rule { Actions: append([]Action(nil), r.Actions...), Access: r.Access, HiddenFields: append([]string(nil), r.HiddenFields...), - ReadonlyFields: append([]string(nil), r.ReadonlyFields...), - WriteonlyFields: append([]string(nil), r.WriteonlyFields...), + DenyReadFields: append([]string(nil), r.DenyReadFields...), + DenyWriteFields: append([]string(nil), r.DenyWriteFields...), ReadFilter: r.ReadFilter, WriteFilter: r.WriteFilter, } @@ -57,8 +57,8 @@ func (r Rule) WithReadFilter(f string) *Rule { Actions: append([]Action(nil), r.Actions...), Access: r.Access, HiddenFields: append([]string(nil), r.HiddenFields...), - ReadonlyFields: append([]string(nil), r.ReadonlyFields...), - WriteonlyFields: append([]string(nil), r.WriteonlyFields...), + DenyReadFields: append([]string(nil), r.DenyReadFields...), + DenyWriteFields: append([]string(nil), r.DenyWriteFields...), ReadFilter: f, WriteFilter: r.WriteFilter, } @@ -70,8 +70,8 @@ func (r Rule) WithWriteFilter(f string) *Rule { Actions: append([]Action(nil), r.Actions...), Access: r.Access, HiddenFields: append([]string(nil), r.HiddenFields...), - ReadonlyFields: append([]string(nil), r.ReadonlyFields...), - WriteonlyFields: append([]string(nil), r.WriteonlyFields...), + DenyReadFields: append([]string(nil), r.DenyReadFields...), + DenyWriteFields: append([]string(nil), r.DenyWriteFields...), ReadFilter: r.ReadFilter, WriteFilter: f, } @@ -83,8 +83,8 @@ func (r Rule) WithReadWriteFilter(f string) *Rule { Actions: append([]Action(nil), r.Actions...), Access: r.Access, HiddenFields: append([]string(nil), r.HiddenFields...), - ReadonlyFields: append([]string(nil), r.ReadonlyFields...), - WriteonlyFields: append([]string(nil), r.WriteonlyFields...), + DenyReadFields: append([]string(nil), r.DenyReadFields...), + DenyWriteFields: append([]string(nil), r.DenyWriteFields...), ReadFilter: f, WriteFilter: f, } @@ -96,8 +96,8 @@ func (r Rule) WithReadonlyFields(ff ...string) *Rule { Actions: append([]Action(nil), r.Actions...), Access: r.Access, HiddenFields: append([]string(nil), r.HiddenFields...), - ReadonlyFields: append(ff, r.ReadonlyFields...), - WriteonlyFields: append([]string(nil), r.WriteonlyFields...), + DenyWriteFields: append(ff, r.DenyWriteFields...), + DenyReadFields: append([]string(nil), r.DenyReadFields...), ReadFilter: r.ReadFilter, WriteFilter: r.WriteFilter, } @@ -109,8 +109,8 @@ func (r Rule) WithHiddenFields(ff ...string) *Rule { Actions: append([]Action(nil), r.Actions...), Access: r.Access, HiddenFields: append(ff, r.HiddenFields...), - ReadonlyFields: append([]string(nil), r.ReadonlyFields...), - WriteonlyFields: append([]string(nil), r.WriteonlyFields...), + DenyReadFields: append([]string(nil), r.DenyReadFields...), + DenyWriteFields: append([]string(nil), r.DenyWriteFields...), ReadFilter: r.ReadFilter, WriteFilter: r.WriteFilter, } @@ -127,10 +127,10 @@ func (r Rule) GetPermission(action Action) *Permission { case ActionRead: p.Filter = r.ReadFilter p.UnallowedFields = append(p.UnallowedFields, r.HiddenFields...) - p.UnallowedFields = append(p.UnallowedFields, r.WriteonlyFields...) + p.UnallowedFields = append(p.UnallowedFields, r.DenyReadFields...) case ActionCreate, ActionUpdate, ActionDelete: p.Filter = r.WriteFilter - p.UnallowedFields = append(p.UnallowedFields, r.ReadonlyFields...) + p.UnallowedFields = append(p.UnallowedFields, r.DenyWriteFields...) } p.UnallowedFields = data.SetFromSlice(p.UnallowedFields) @@ -216,8 +216,8 @@ func MergeRule(rules ...*Rule) *Rule { result.Actions = data.GetIntersection(result.Actions, r.Actions) result.HiddenFields = data.SetFromSlice(append(result.HiddenFields, r.HiddenFields...)) - result.ReadonlyFields = data.SetFromSlice(append(result.ReadonlyFields, r.ReadonlyFields...)) - result.WriteonlyFields = data.SetFromSlice(append(result.WriteonlyFields, r.WriteonlyFields...)) + result.DenyReadFields = data.SetFromSlice(append(result.DenyReadFields, r.DenyReadFields...)) + result.DenyWriteFields = data.SetFromSlice(append(result.DenyWriteFields, r.DenyWriteFields...)) if r.WriteFilter != "" { writeFilter = append(writeFilter, r.WriteFilter) } @@ -246,8 +246,8 @@ func (r PrivilegedRuleset) GetRule(collectionID string) *Rule { CollectionID: collectionID, Actions: []Action{ActionRead, ActionCreate, ActionUpdate, ActionDelete}, HiddenFields: []string{}, - ReadonlyFields: []string{}, - WriteonlyFields: []string{}, + DenyReadFields: []string{}, + DenyWriteFields: []string{}, } } diff --git a/pkg/permission/ruleset_test.go b/pkg/permission/ruleset_test.go index 175c36261152afcf2b2c585382588f97b5465591..47cb622f1e6efb7f82a9ab7a1f1ed20d57073cfa 100644 --- a/pkg/permission/ruleset_test.go +++ b/pkg/permission/ruleset_test.go @@ -18,21 +18,21 @@ func TestMerge(t *testing.T) { }{ { name: "simple", - first: &Rule{Actions: []Action{ActionUpdate, ActionCreate}, CollectionID: col1, HiddenFields: []string{"1", "2"}, WriteonlyFields: []string{"7"}, ReadonlyFields: []string{"4"}, ReadFilter: "3 != 'test'", WriteFilter: "4 == '0_0'"}, - second: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, CollectionID: col2, HiddenFields: []string{"3", "2"}, WriteonlyFields: []string{}, ReadonlyFields: []string{"5"}, ReadFilter: "5 != 'dev'", WriteFilter: "4 == '0_0'"}, - expect: &Rule{Actions: []Action{ActionUpdate}, HiddenFields: []string{"1", "2", "3"}, WriteonlyFields: []string{"7"}, ReadonlyFields: []string{"4", "5"}, ReadFilter: "3 != 'test' && 5 != 'dev'", WriteFilter: "4 == '0_0'"}, + first: &Rule{Actions: []Action{ActionUpdate, ActionCreate}, CollectionID: col1, HiddenFields: []string{"1", "2"}, DenyWriteFields: []string{"7"}, DenyReadFields: []string{"4"}, ReadFilter: "3 != 'test'", WriteFilter: "4 == '0_0'"}, + second: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, CollectionID: col2, HiddenFields: []string{"3", "2"}, DenyWriteFields: []string{}, DenyReadFields: []string{"5"}, ReadFilter: "5 != 'dev'", WriteFilter: "4 == '0_0'"}, + expect: &Rule{Actions: []Action{ActionUpdate}, HiddenFields: []string{"1", "2", "3"}, DenyWriteFields: []string{"7"}, DenyReadFields: []string{"4", "5"}, ReadFilter: "3 != 'test' && 5 != 'dev'", WriteFilter: "4 == '0_0'"}, }, { name: "first is privileged", first: PrivilegedRuleset{}.GetRule(col1), second: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, CollectionID: col2, WriteFilter: "test"}, - expect: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, WriteFilter: "test", ReadFilter: "", HiddenFields: []string{}, WriteonlyFields: []string{}, ReadonlyFields: []string{}}, + expect: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, WriteFilter: "test", ReadFilter: "", HiddenFields: []string{}, DenyWriteFields: []string{}, DenyReadFields: []string{}}, }, { name: "second is privileged", first: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, CollectionID: col1, WriteFilter: "test"}, second: PrivilegedRuleset{}.GetRule(col2), - expect: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, WriteFilter: "test", ReadFilter: "", HiddenFields: []string{}, WriteonlyFields: []string{}, ReadonlyFields: []string{}}, + expect: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, WriteFilter: "test", ReadFilter: "", HiddenFields: []string{}, DenyWriteFields: []string{}, DenyReadFields: []string{}}, }, { name: "both is privileged", @@ -61,25 +61,25 @@ func TestRule_GetPermission(t *testing.T) { { name: "ActionRead", action: ActionRead, - rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, ReadonlyFields: []string{"f1"}, HiddenFields: []string{"f2"}, WriteonlyFields: []string{"f3"}}, + rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, DenyWriteFields: []string{"f1"}, HiddenFields: []string{"f2"}, DenyReadFields: []string{"f3"}}, unallowedFields: []string{"f2", "f3"}, }, { name: "ActionRead readonly&writeonly", action: ActionRead, - rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, ReadonlyFields: []string{"f1"}, HiddenFields: []string{"f2"}, WriteonlyFields: []string{"f1"}}, + rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, DenyWriteFields: []string{"f1"}, HiddenFields: []string{"f2"}, DenyReadFields: []string{"f1"}}, unallowedFields: []string{"f1", "f2"}, }, { name: "ActionUpdate", action: ActionUpdate, - rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, ReadonlyFields: []string{"f1"}, HiddenFields: []string{"f2"}, WriteonlyFields: []string{"f3"}}, + rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, DenyWriteFields: []string{"f1"}, HiddenFields: []string{"f2"}, DenyReadFields: []string{"f3"}}, unallowedFields: []string{"f1"}, }, { name: "ActionUpdate readonly&writeonly", action: ActionUpdate, - rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, ReadonlyFields: []string{"f1"}, HiddenFields: []string{"f2"}, WriteonlyFields: []string{"f1"}}, + rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, DenyWriteFields: []string{"f1"}, HiddenFields: []string{"f2"}, DenyReadFields: []string{"f1"}}, unallowedFields: []string{"f1"}, }, } diff --git a/pkg/roles/transport/grpc/protobuf_type_converters.microgen.go b/pkg/roles/transport/grpc/protobuf_type_converters.microgen.go index 10f207e5ebf3e07804009bf0bbb62401e0bdbf9a..4dca1e282e3bfd93fa287cc8df3495fb0931444e 100644 --- a/pkg/roles/transport/grpc/protobuf_type_converters.microgen.go +++ b/pkg/roles/transport/grpc/protobuf_type_converters.microgen.go @@ -82,10 +82,12 @@ func PtrPermissionRuleToProto(rule *permission.Rule) (*commonpb.Rule, error) { Actions: actions, Access: commonpb.Access(rule.Access), HiddenFields: rule.HiddenFields, - ReadonlyFields: rule.ReadonlyFields, - WriteonlyFields: rule.WriteonlyFields, + ReadonlyFields: rule.DenyWriteFields, + WriteonlyFields: rule.DenyReadFields, ReadFilter: rule.ReadFilter, WriteFilter: rule.WriteFilter, + DenyReadFields: rule.DenyReadFields, + DenyWriteFields: rule.DenyWriteFields, }, nil } @@ -97,14 +99,21 @@ func ProtoToPtrPermissionRule(protoRule *commonpb.Rule) (*permission.Rule, error for _, a := range protoRule.Actions { actions = append(actions, permission.Action(a)) } - return &permission.Rule{ + r := &permission.Rule{ CollectionID: protoRule.CollectionId, Actions: actions, Access: permission.Access(protoRule.Access), HiddenFields: protoRule.HiddenFields, - ReadonlyFields: protoRule.ReadonlyFields, - WriteonlyFields: protoRule.WriteonlyFields, + DenyReadFields: protoRule.DenyReadFields, + DenyWriteFields: protoRule.DenyWriteFields, ReadFilter: protoRule.ReadFilter, WriteFilter: protoRule.WriteFilter, - }, nil + } + if len(r.DenyReadFields) == 0 { + r.DenyReadFields = protoRule.WriteonlyFields + } + if len(r.DenyWriteFields) == 0 { + r.DenyWriteFields = protoRule.ReadonlyFields + } + return r, nil } diff --git a/pkg/setup/setup.go b/pkg/setup/setup.go index 6101e1db13f40027706977dad4b710261d82439d..b087337fcb57e3cb1a76cad1e3354291b944bdb0 100644 --- a/pkg/setup/setup.go +++ b/pkg/setup/setup.go @@ -2,13 +2,14 @@ package setup import ( "context" - "git.perx.ru/perxis/perxis-go/pkg/errors" "git.perx.ru/perxis/perxis-go/pkg/clients" "git.perx.ru/perxis/perxis-go/pkg/collections" "git.perx.ru/perxis/perxis-go/pkg/content" + "git.perx.ru/perxis/perxis-go/pkg/errors" "git.perx.ru/perxis/perxis-go/pkg/items" "git.perx.ru/perxis/perxis-go/pkg/roles" + "git.perx.ru/perxis/perxis-go/pkg/spaces" "go.uber.org/zap" ) @@ -32,6 +33,10 @@ type Setup struct { force bool remove bool + waitSpaceAvailable bool + //attempts uint + //delay time.Duration + errors []error logger *zap.Logger } @@ -44,10 +49,11 @@ func NewSetup(content *content.Content, spaceID, environmentID string, logger *z logger = logger.With(zap.String("Space", spaceID), zap.String("Environment", environmentID)) return &Setup{ - SpaceID: spaceID, - EnvironmentID: environmentID, - content: content, - logger: logger, + SpaceID: spaceID, + EnvironmentID: environmentID, + content: content, + logger: logger, + waitSpaceAvailable: true, } } @@ -71,6 +77,12 @@ func (s *Setup) IsRemove() bool { return s.remove } +func (s *Setup) WithoutWaitSpace() *Setup { + setup := *s + setup.waitSpaceAvailable = false + return &setup +} + func (s *Setup) HasErrors() bool { return len(s.errors) > 0 } @@ -146,6 +158,11 @@ func (s *Setup) AddItem(item *items.Item, opt ...ItemsOption) *Setup { // Install выполняет установку необходимых требований func (s *Setup) Install(ctx context.Context) error { + if s.waitSpaceAvailable { + if err := spaces.WaitSpaceAvailable(ctx, s.content.Spaces, s.SpaceID); err != nil { + return err + } + } if err := s.InstallRoles(ctx); err != nil { return err } @@ -163,6 +180,11 @@ func (s *Setup) Install(ctx context.Context) error { // Check выполняет проверку требований func (s *Setup) Check(ctx context.Context) error { + if s.waitSpaceAvailable { + if err := spaces.WaitSpaceReadable(ctx, s.content.Spaces, s.SpaceID); err != nil { + return err + } + } if err := s.CheckRoles(ctx); err != nil { return err } @@ -180,6 +202,11 @@ func (s *Setup) Check(ctx context.Context) error { // Uninstall выполняет удаление установленных раннее требований func (s *Setup) Uninstall(ctx context.Context) error { + if s.waitSpaceAvailable { + if err := spaces.WaitSpaceAvailable(ctx, s.content.Spaces, s.SpaceID); err != nil { + return err + } + } // В случае если необходимо удалить данные удаляем все что создано при установке расширения if err := s.UninstallClients(ctx); err != nil { return err diff --git a/pkg/setup/setup_test.go b/pkg/setup/setup_test.go index 681158887cb53e81582615146b30e68cb2cdef67..604c2f6b29bae32756e2149ca572ce3b54920936 100644 --- a/pkg/setup/setup_test.go +++ b/pkg/setup/setup_test.go @@ -17,6 +17,8 @@ import ( "git.perx.ru/perxis/perxis-go/pkg/roles" rolesMock "git.perx.ru/perxis/perxis-go/pkg/roles/mocks" "git.perx.ru/perxis/perxis-go/pkg/schema" + "git.perx.ru/perxis/perxis-go/pkg/spaces" + "git.perx.ru/perxis/perxis-go/pkg/spaces/mocks" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -77,7 +79,6 @@ func getActions() []*items.Item { func newSetup(content *content.Content, t *testing.T) *Setup { logger := zaptest.NewLogger(t, zaptest.WrapOptions()) - setup := NewSetup(content, spaceID, envID, logger) setup.AddCollections(getCollections()) setup.AddRoles(getRoles()) @@ -88,14 +89,22 @@ func newSetup(content *content.Content, t *testing.T) *Setup { } func TestSetupInstall(t *testing.T) { + sps := &spaces.Space{ + ID: spaceID, + OrgID: "org", + StateInfo: &spaces.StateInfo{State: spaces.StateReady}, + } + t.Run("Success, nothing to install", func(t *testing.T) { logger := zaptest.NewLogger(t, zaptest.WrapOptions()) - - setup := NewSetup(nil, spaceID, envID, logger) - + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := NewSetup(&content.Content{Spaces: spcMock}, spaceID, envID, logger) err := setup.Install(context.Background()) require.NoError(t, err) + spcMock.AssertExpectations(t) + }) t.Run("Success, no force", func(t *testing.T) { @@ -155,12 +164,16 @@ func TestSetupInstall(t *testing.T) { Once() } + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Collections: collsMock, Clients: clMock, Roles: rMock, Items: itmMock, Environments: envMocks, + Spaces: spcMock, }, t) err := setup.Install(context.Background()) @@ -173,6 +186,7 @@ func TestSetupInstall(t *testing.T) { clMock.AssertExpectations(t) itmMock.AssertExpectations(t) envMocks.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Success, update existing records", func(t *testing.T) { @@ -216,12 +230,16 @@ func TestSetupInstall(t *testing.T) { Return(nil). Times(len(itms)) + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Collections: collsMock, Clients: clMock, Roles: rMock, Items: itmMock, Environments: envMocks, + Spaces: spcMock, }, t) err := setup.Install(context.Background()) @@ -234,6 +252,7 @@ func TestSetupInstall(t *testing.T) { clMock.AssertExpectations(t) itmMock.AssertExpectations(t) envMocks.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Success, with force", func(t *testing.T) { @@ -270,11 +289,15 @@ func TestSetupInstall(t *testing.T) { Once() } + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Collections: collsMock, Clients: clMock, Roles: rMock, Items: itmMock, + Spaces: spcMock, }, t) setup = setup.WithForce(true) @@ -287,6 +310,7 @@ func TestSetupInstall(t *testing.T) { collsMock.AssertExpectations(t) clMock.AssertExpectations(t) itmMock.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Can't install role, storage returns error", func(t *testing.T) { @@ -295,8 +319,12 @@ func TestSetupInstall(t *testing.T) { Return(nil, errors.New("can't get role")). Once() + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ - Roles: rMock, + Roles: rMock, + Spaces: spcMock, }, t) err := setup.Install(context.Background()) @@ -305,6 +333,7 @@ func TestSetupInstall(t *testing.T) { assert.ErrorContains(t, err, "failed to install role") rMock.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Can't install client, storage returns error", func(t *testing.T) { @@ -326,9 +355,13 @@ func TestSetupInstall(t *testing.T) { Once() } + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Clients: clMock, Roles: rMock, + Spaces: spcMock, }, t) err := setup.Install(context.Background()) @@ -338,6 +371,7 @@ func TestSetupInstall(t *testing.T) { rMock.AssertExpectations(t) clMock.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Can't get collection, storage returns error", func(t *testing.T) { @@ -370,10 +404,14 @@ func TestSetupInstall(t *testing.T) { Once() } + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Collections: collsMock, Clients: clMock, Roles: rMock, + Spaces: spcMock, }, t) err := setup.Install(context.Background()) @@ -384,6 +422,7 @@ func TestSetupInstall(t *testing.T) { rMock.AssertExpectations(t) collsMock.AssertExpectations(t) clMock.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Can't create collection, storage returns error", func(t *testing.T) { @@ -420,10 +459,14 @@ func TestSetupInstall(t *testing.T) { Once() } + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Collections: collsMock, Clients: clMock, Roles: rMock, + Spaces: spcMock, }, t) err := setup.Install(context.Background()) @@ -434,6 +477,7 @@ func TestSetupInstall(t *testing.T) { rMock.AssertExpectations(t) collsMock.AssertExpectations(t) clMock.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Can't update collection, storage returns error", func(t *testing.T) { @@ -463,10 +507,14 @@ func TestSetupInstall(t *testing.T) { Once() } + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Collections: collsMock, Clients: clMock, Roles: rMock, + Spaces: spcMock, }, t) err := setup.Install(context.Background()) @@ -477,6 +525,7 @@ func TestSetupInstall(t *testing.T) { rMock.AssertExpectations(t) collsMock.AssertExpectations(t) clMock.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Can't set schema, storage returns error", func(t *testing.T) { @@ -517,10 +566,14 @@ func TestSetupInstall(t *testing.T) { Once() } + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Collections: collsMock, Clients: clMock, Roles: rMock, + Spaces: spcMock, }, t) err := setup.Install(context.Background()) @@ -531,6 +584,7 @@ func TestSetupInstall(t *testing.T) { rMock.AssertExpectations(t) collsMock.AssertExpectations(t) clMock.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Can't migrate, storage returns error", func(t *testing.T) { @@ -576,11 +630,15 @@ func TestSetupInstall(t *testing.T) { Once() } + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Collections: collsMock, Clients: clMock, Roles: rMock, Environments: envMocks, + Spaces: spcMock, }, t) err := setup.Install(context.Background()) @@ -591,6 +649,7 @@ func TestSetupInstall(t *testing.T) { rMock.AssertExpectations(t) collsMock.AssertExpectations(t) clMock.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Can't find action, storage returns error", func(t *testing.T) { @@ -638,12 +697,16 @@ func TestSetupInstall(t *testing.T) { Return(nil, errors.New("can't create item")). Once() + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Collections: collsMock, Clients: clMock, Roles: rMock, Items: itmMock, Environments: envMocks, + Spaces: spcMock, }, t) setup = setup.WithForce(true) @@ -657,6 +720,42 @@ func TestSetupInstall(t *testing.T) { clMock.AssertExpectations(t) itmMock.AssertExpectations(t) envMocks.AssertExpectations(t) + spcMock.AssertExpectations(t) + }) + + t.Run("Success on retry when space not available", func(t *testing.T) { + logger := zaptest.NewLogger(t, zaptest.WrapOptions()) + sp := &mocks.Spaces{} + sp.On("Get", mock.Anything, mock.Anything).Return(&spaces.Space{ID: spaceID, OrgID: "org", StateInfo: &spaces.StateInfo{State: spaces.StateMigration}}, nil).Twice() + sp.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := NewSetup(&content.Content{Spaces: sp}, spaceID, envID, logger) + + err := setup.Install(context.Background()) + + require.NoError(t, err) + + sp.AssertExpectations(t) + }) + + t.Run("Error on retry", func(t *testing.T) { + logger := zaptest.NewLogger(t, zaptest.WrapOptions()) + sp := &mocks.Spaces{} + sp.On("Get", mock.Anything, mock.Anything).Return(&spaces.Space{ID: spaceID, OrgID: "org", StateInfo: &spaces.StateInfo{State: spaces.StateMigration}}, nil).Twice() + sp.On("Get", mock.Anything, mock.Anything).Return(nil, errors.New("some error")).Once() + setup := NewSetup(&content.Content{Spaces: sp}, spaceID, envID, logger) + err := setup.Install(context.Background()) + + require.Error(t, err, "в момент выполнения пришла ошибка отличная от 'space not available'") + + sp.AssertExpectations(t) + }) + + t.Run("WithoutWaitSpace", func(t *testing.T) { + logger := zaptest.NewLogger(t, zaptest.WrapOptions()) + setup := NewSetup(nil, spaceID, envID, logger) + err := setup.WithoutWaitSpace().Install(context.Background()) + + require.NoError(t, err) }) //t.Run("Can't find task configs, storage returns error", func(t *testing.T) { @@ -738,14 +837,24 @@ func TestSetupInstall(t *testing.T) { } func TestSetupUninstall(t *testing.T) { + sps := &spaces.Space{ + ID: spaceID, + OrgID: "org", + StateInfo: &spaces.StateInfo{State: spaces.StateReady}, + } + t.Run("Success, nothing to uninstall", func(t *testing.T) { logger := zaptest.NewLogger(t, zaptest.WrapOptions()) - setup := NewSetup(nil, spaceID, envID, logger) + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := NewSetup(&content.Content{Spaces: spcMock}, spaceID, envID, logger) err := setup.Uninstall(context.Background()) require.NoError(t, err) + spcMock.AssertExpectations(t) + }) t.Run("Remove", func(t *testing.T) { @@ -781,11 +890,15 @@ func TestSetupUninstall(t *testing.T) { Once() } + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Collections: collsMock, Clients: clMock, Roles: rMock, Items: itmMock, + Spaces: spcMock, }, t) setup = setup.WithRemove(true) @@ -798,6 +911,7 @@ func TestSetupUninstall(t *testing.T) { collsMock.AssertExpectations(t) clMock.AssertExpectations(t) itmMock.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Remove, with clients NotFound error", func(t *testing.T) { @@ -833,11 +947,15 @@ func TestSetupUninstall(t *testing.T) { Once() } + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Collections: collsMock, Clients: clMock, Roles: rMock, Items: itmMock, + Spaces: spcMock, }, t) setup = setup.WithRemove(true) @@ -850,6 +968,7 @@ func TestSetupUninstall(t *testing.T) { collsMock.AssertExpectations(t) clMock.AssertExpectations(t) itmMock.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Can't uninstall clients, storage returns error", func(t *testing.T) { @@ -867,10 +986,14 @@ func TestSetupUninstall(t *testing.T) { Once() } + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Clients: clMock, Roles: rMock, Items: itmMock, + Spaces: spcMock, }, t) setup = setup.WithRemove(true) @@ -881,6 +1004,8 @@ func TestSetupUninstall(t *testing.T) { rMock.AssertExpectations(t) clMock.AssertExpectations(t) + spcMock.AssertExpectations(t) + }) t.Run("Can't uninstall role, storage returns error", func(t *testing.T) { @@ -901,10 +1026,14 @@ func TestSetupUninstall(t *testing.T) { Once() } + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Roles: rMock, Clients: clMock, Items: itmMock, + Spaces: spcMock, }, t) setup = setup.WithRemove(true) @@ -914,6 +1043,7 @@ func TestSetupUninstall(t *testing.T) { assert.ErrorContains(t, err, "failed to uninstall role") rMock.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Can't uninstall collections, storage returns error", func(t *testing.T) { @@ -941,11 +1071,15 @@ func TestSetupUninstall(t *testing.T) { Once() } + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Collections: collsMock, Clients: clMock, Roles: rMock, Items: itmMock, + Spaces: spcMock, }, t) setup = setup.WithRemove(true) @@ -957,6 +1091,7 @@ func TestSetupUninstall(t *testing.T) { rMock.AssertExpectations(t) collsMock.AssertExpectations(t) clMock.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Can't uninstall actions, storage returns error", func(t *testing.T) { @@ -990,11 +1125,15 @@ func TestSetupUninstall(t *testing.T) { Once() } + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Collections: collsMock, Clients: clMock, Roles: rMock, Items: itmMock, + Spaces: spcMock, }, t) setup = setup.WithRemove(true) @@ -1004,18 +1143,69 @@ func TestSetupUninstall(t *testing.T) { assert.ErrorContains(t, err, "failed to uninstall item") itmMock.AssertExpectations(t) + spcMock.AssertExpectations(t) + }) + + t.Run("Success on retry when space not available", func(t *testing.T) { + logger := zaptest.NewLogger(t, zaptest.WrapOptions()) + + sp := &mocks.Spaces{} + sp.On("Get", mock.Anything, mock.Anything).Return(&spaces.Space{ID: spaceID, OrgID: "org", StateInfo: &spaces.StateInfo{State: spaces.StateMigration}}, nil).Twice() + sp.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + + setup := NewSetup(&content.Content{Spaces: sp}, spaceID, envID, logger) + + err := setup.Uninstall(context.Background()) + + require.NoError(t, err) + + sp.AssertExpectations(t) + }) + + t.Run("Error on retry", func(t *testing.T) { + logger := zaptest.NewLogger(t, zaptest.WrapOptions()) + + sp := &mocks.Spaces{} + sp.On("Get", mock.Anything, mock.Anything).Return(&spaces.Space{ID: spaceID, OrgID: "org", StateInfo: &spaces.StateInfo{State: spaces.StateMigration}}, nil).Twice() + sp.On("Get", mock.Anything, mock.Anything).Return(nil, errors.New("some error")).Once() + + setup := NewSetup(&content.Content{Spaces: sp}, spaceID, envID, logger) + + err := setup.Uninstall(context.Background()) + + require.Error(t, err, "в момент выполнения пришла ошибка отличная от 'space not available'") + }) + + t.Run("WithoutWaitSpace", func(t *testing.T) { + logger := zaptest.NewLogger(t, zaptest.WrapOptions()) + + setup := NewSetup(nil, spaceID, envID, logger) + + err := setup.WithoutWaitSpace().Uninstall(context.Background()) + + require.NoError(t, err) }) } func TestSetupCheck(t *testing.T) { + sps := &spaces.Space{ + ID: spaceID, + OrgID: "org", + StateInfo: &spaces.StateInfo{State: spaces.StateReady}, + } + t.Run("Success, nothing to check", func(t *testing.T) { logger := zaptest.NewLogger(t, zaptest.WrapOptions()) - setup := NewSetup(nil, spaceID, envID, logger) + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + + setup := NewSetup(&content.Content{Spaces: spcMock}, spaceID, envID, logger) err := setup.Check(context.Background()) require.NoError(t, err) + spcMock.AssertExpectations(t) }) t.Run("Success", func(t *testing.T) { @@ -1051,11 +1241,15 @@ func TestSetupCheck(t *testing.T) { mock.MatchedBy(func(opt *items.FindOptions) bool { return opt.Regular && opt.Hidden && opt.Templates }), ).Return(getActions(), 0, nil).Once() + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Collections: collsMock, Clients: clMock, Roles: rMock, Items: itmMock, + Spaces: spcMock, }, t) err := setup.Check(context.Background()) @@ -1067,6 +1261,7 @@ func TestSetupCheck(t *testing.T) { collsMock.AssertExpectations(t) clMock.AssertExpectations(t) itmMock.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Can't get role, storage returns error", func(t *testing.T) { @@ -1075,8 +1270,12 @@ func TestSetupCheck(t *testing.T) { Return(nil, errors.New("can't get role")). Once() + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ - Roles: rMock, + Roles: rMock, + Spaces: spcMock, }, t) err := setup.Check(context.Background()) @@ -1085,6 +1284,7 @@ func TestSetupCheck(t *testing.T) { assert.ErrorContains(t, err, "role check error") rMock.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Can't get client, storage returns error", func(t *testing.T) { @@ -1100,9 +1300,13 @@ func TestSetupCheck(t *testing.T) { Return(nil, errors.New("can't get client")). Once() + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Roles: rMock, Clients: clMock, + Spaces: spcMock, }, t) err := setup.Check(context.Background()) @@ -1112,6 +1316,7 @@ func TestSetupCheck(t *testing.T) { rMock.AssertExpectations(t) clMock.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Can't get collection, storage returns error", func(t *testing.T) { @@ -1134,10 +1339,14 @@ func TestSetupCheck(t *testing.T) { Once() } + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Roles: rMock, Clients: clMock, Collections: collsMock, + Spaces: spcMock, }, t) err := setup.Check(context.Background()) @@ -1148,6 +1357,7 @@ func TestSetupCheck(t *testing.T) { rMock.AssertExpectations(t) clMock.AssertExpectations(t) collsMock.AssertExpectations(t) + spcMock.AssertExpectations(t) }) t.Run("Can't get action, storage returns error", func(t *testing.T) { @@ -1177,11 +1387,15 @@ func TestSetupCheck(t *testing.T) { Return(nil, 0, nil). Once() + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + setup := newSetup(&content.Content{ Roles: rMock, Clients: clMock, Collections: collsMock, Items: itmMock, + Spaces: spcMock, }, t) err := setup.Check(context.Background()) @@ -1192,6 +1406,47 @@ func TestSetupCheck(t *testing.T) { rMock.AssertExpectations(t) clMock.AssertExpectations(t) collsMock.AssertExpectations(t) + spcMock.AssertExpectations(t) + }) + + t.Run("Success on retry when space is preparing", func(t *testing.T) { + logger := zaptest.NewLogger(t, zaptest.WrapOptions()) + + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(&spaces.Space{ID: spaceID, OrgID: "org", StateInfo: &spaces.StateInfo{State: spaces.StatePreparing}}, nil).Twice() + spcMock.On("Get", mock.Anything, mock.Anything).Return(sps, nil).Once() + + setup := NewSetup(&content.Content{Spaces: spcMock}, spaceID, envID, logger) + + err := setup.Check(context.Background()) + + require.NoError(t, err) + + spcMock.AssertExpectations(t) + }) + + t.Run("Error on retry", func(t *testing.T) { + logger := zaptest.NewLogger(t, zaptest.WrapOptions()) + + spcMock := &mocks.Spaces{} + spcMock.On("Get", mock.Anything, mock.Anything).Return(&spaces.Space{ID: spaceID, OrgID: "org", StateInfo: &spaces.StateInfo{State: spaces.StatePreparing}}, nil).Twice() + spcMock.On("Get", mock.Anything, mock.Anything).Return(nil, errors.New("some error")).Once() + + setup := NewSetup(&content.Content{Spaces: spcMock}, spaceID, envID, logger) + + err := setup.Check(context.Background()) + + require.Error(t, err, "в момент выполнения пришла ошибка отличная от 'Space is migrating'") + }) + + t.Run("WithoutWaitSpace", func(t *testing.T) { + logger := zaptest.NewLogger(t, zaptest.WrapOptions()) + + setup := NewSetup(nil, spaceID, envID, logger) + + err := setup.WithoutWaitSpace().Check(context.Background()) + + require.NoError(t, err) }) //t.Run("Can't get task config, storage returns error", func(t *testing.T) { diff --git a/pkg/spaces/service.go b/pkg/spaces/service.go index c75dab18e60f2e37d6dae9007de7563d7ca8b751..40c6bd9ebf7a16f694bec40388dd4a7dd8208473 100644 --- a/pkg/spaces/service.go +++ b/pkg/spaces/service.go @@ -2,8 +2,10 @@ package spaces import ( "context" + "time" - "github.com/pkg/errors" + "git.perx.ru/perxis/perxis-go/pkg/errors" + "github.com/avast/retry-go/v4" ) // @microgen grpc @@ -50,16 +52,57 @@ type Spaces interface { Move(ctx context.Context, spaceID, orgID string) (err error) } -func IsSpaceAvailable(ctx context.Context, spcs Spaces, spaceId string) error { - spc, err := spcs.Get(ctx, spaceId) +const ( + delay = 500 * time.Millisecond + attempts = 1800 +) + +var ( + ErrSpaceNotAvailable = errors.New("space not available") +) +func IsSpaceAvailable(ctx context.Context, svc Spaces, spaceID string) error { + sp, err := svc.Get(ctx, spaceID) if err != nil { - return errors.Wrap(err, "space not available") + return errors.Wrap(err, "fail to get space") } + if sp.StateInfo == nil || sp.StateInfo != nil && (sp.StateInfo.State == StateNew || sp.StateInfo.State == StateReady) { + return nil + } + return ErrSpaceNotAvailable +} - if spc.StateInfo != nil && spc.StateInfo.State != StateReady { - return errors.New("space not available") +func IsSpaceReadable(ctx context.Context, svc Spaces, spaceID string) error { + sp, err := svc.Get(ctx, spaceID) + if err != nil { + return errors.Wrap(err, "fail to get space") + } + if sp.StateInfo == nil || sp.StateInfo != nil && sp.StateInfo.State == StateNew || sp.StateInfo.State == StateReady || sp.StateInfo.State == StateMigration { + return nil } + return errors.WithContext(ErrSpaceNotAvailable, "state", sp.StateInfo.State) +} + +func WaitSpaceAvailable(ctx context.Context, svc Spaces, spaceID string) error { + return retry.Do( + func() error { + return IsSpaceAvailable(ctx, svc, spaceID) + }, + retry.RetryIf(func(err error) bool { return errors.Is(err, ErrSpaceNotAvailable) }), + retry.Delay(delay), + retry.Attempts(attempts), + retry.Context(ctx), + ) +} - return nil +func WaitSpaceReadable(ctx context.Context, svc Spaces, spaceID string) error { + return retry.Do( + func() error { + return IsSpaceReadable(ctx, svc, spaceID) + }, + retry.RetryIf(func(err error) bool { return errors.Is(err, ErrSpaceNotAvailable) }), + retry.Delay(delay), + retry.Attempts(attempts), + retry.Context(ctx), + ) } diff --git a/pkg/spaces/service_test.go b/pkg/spaces/service_test.go index 30594bcea39f8ae5a7e3dc85a1bd2cdd35da2054..7f339e16a97c74b3da4d0bb613d490900c6cb2bc 100644 --- a/pkg/spaces/service_test.go +++ b/pkg/spaces/service_test.go @@ -50,3 +50,40 @@ func TestIsSpaceAvailable(t *testing.T) { }) } } + +func TestIsSpaceReadable(t *testing.T) { + tests := []struct { + name string + space *Space + wantErr bool + }{ + { + "Space has nil StateInfo: available", + &Space{ID: "space", OrgID: "org", Name: "test-space"}, + false, + }, + { + "Space state is StateReady: available", + &Space{ID: "space", OrgID: "org", Name: "test-space", StateInfo: &StateInfo{State: StateReady}}, + false, + }, + { + "Space state is StatePreparing: not available", + &Space{ID: "space", OrgID: "org", Name: "test-space", StateInfo: &StateInfo{State: StatePreparing}}, + true, + }, + { + "Space state is StateMigration: not available", + &Space{ID: "space", OrgID: "org", Name: "test-space", StateInfo: &StateInfo{State: StateMigration}}, + false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + spaces := &dummySpaces{space: tt.space} + if err := IsSpaceReadable(context.Background(), spaces, "space"); (err != nil) != tt.wantErr { + t.Errorf("IsSpaceReadable() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/proto/collections/collections.pb.go b/proto/collections/collections.pb.go index 225e67abf5eb63d4fd92fbe1593ebb6d645f6280..164a8644d7fe74966f55b22880c97cfe05587d8b 100644 --- a/proto/collections/collections.pb.go +++ b/proto/collections/collections.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.24.3 +// protoc v4.25.1 // source: collections/collections.proto package collections @@ -83,10 +83,13 @@ type Access struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Actions []common.Action `protobuf:"varint,1,rep,packed,name=actions,proto3,enum=common.Action" json:"actions,omitempty"` - HiddenFields []string `protobuf:"bytes,5,rep,name=hidden_fields,json=hiddenFields,proto3" json:"hidden_fields,omitempty"` - ReadonlyFields []string `protobuf:"bytes,6,rep,name=readonly_fields,json=readonlyFields,proto3" json:"readonly_fields,omitempty"` - WriteonlyFields []string `protobuf:"bytes,7,rep,name=writeonly_fields,json=writeonlyFields,proto3" json:"writeonly_fields,omitempty"` + Actions []common.Action `protobuf:"varint,1,rep,packed,name=actions,proto3,enum=common.Action" json:"actions,omitempty"` + HiddenFields []string `protobuf:"bytes,5,rep,name=hidden_fields,json=hiddenFields,proto3" json:"hidden_fields,omitempty"` + // Deprecated + ReadonlyFields []string `protobuf:"bytes,6,rep,name=readonly_fields,json=readonlyFields,proto3" json:"readonly_fields,omitempty"` + WriteonlyFields []string `protobuf:"bytes,7,rep,name=writeonly_fields,json=writeonlyFields,proto3" json:"writeonly_fields,omitempty"` + DenyReadFields []string `protobuf:"bytes,8,rep,name=deny_read_fields,json=denyReadFields,proto3" json:"deny_read_fields,omitempty"` + DenyWriteFields []string `protobuf:"bytes,9,rep,name=deny_write_fields,json=denyWriteFields,proto3" json:"deny_write_fields,omitempty"` } func (x *Access) Reset() { @@ -149,6 +152,20 @@ func (x *Access) GetWriteonlyFields() []string { return nil } +func (x *Access) GetDenyReadFields() []string { + if x != nil { + return x.DenyReadFields + } + return nil +} + +func (x *Access) GetDenyWriteFields() []string { + if x != nil { + return x.DenyWriteFields + } + return nil +} + type Collection struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1071,7 +1088,7 @@ var file_collections_collections_proto_rawDesc = []byte{ 0x6f, 0x1a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xab, 0x01, 0x0a, 0x06, 0x41, 0x63, 0x63, 0x65, + 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x81, 0x02, 0x0a, 0x06, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x23, 0x0a, 0x0d, @@ -1082,165 +1099,170 @@ var file_collections_collections_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x6c, 0x79, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x77, 0x72, 0x69, 0x74, 0x65, 0x6f, 0x6e, 0x6c, 0x79, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x6f, 0x6e, 0x6c, 0x79, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, 0xae, 0x06, 0x0a, 0x0a, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, - 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x76, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x65, 0x6e, 0x76, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x06, 0x73, 0x69, - 0x6e, 0x67, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x06, 0x73, 0x69, - 0x6e, 0x67, 0x6c, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x73, 0x79, 0x73, 0x74, 0x65, - 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x48, 0x01, 0x52, 0x06, 0x73, 0x79, 0x73, 0x74, 0x65, - 0x6d, 0x88, 0x01, 0x01, 0x12, 0x1c, 0x0a, 0x07, 0x6e, 0x6f, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x0c, 0x20, 0x01, 0x28, 0x08, 0x48, 0x02, 0x52, 0x06, 0x6e, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x88, - 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x69, - 0x64, 0x64, 0x65, 0x6e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x68, 0x69, 0x64, 0x64, - 0x65, 0x6e, 0x12, 0x38, 0x0a, 0x04, 0x76, 0x69, 0x65, 0x77, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x52, 0x04, 0x76, 0x69, 0x65, 0x77, 0x12, 0x48, 0x0a, 0x0a, - 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x73, 0x74, 0x61, - 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x10, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x33, 0x0a, 0x06, 0x61, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x06, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x1a, - 0x75, 0x0a, 0x04, 0x56, 0x69, 0x65, 0x77, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x76, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, 0x76, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6c, - 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, - 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x1a, 0x97, 0x01, 0x0a, 0x09, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x3b, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, - 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x39, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, - 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x41, 0x74, - 0x22, 0x42, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x4e, 0x45, 0x57, - 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x50, 0x52, 0x45, 0x50, 0x41, 0x52, 0x49, 0x4e, 0x47, 0x10, - 0x01, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, - 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x48, 0x41, 0x4e, 0x47, - 0x45, 0x44, 0x10, 0x04, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6e, - 0x6f, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x22, 0x50, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, - 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4b, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x63, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x63, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x64, 0x22, 0x44, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x73, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x73, 0x22, 0x9e, 0x01, 0x0a, 0x0a, - 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, + 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x28, 0x0a, 0x10, 0x64, 0x65, 0x6e, 0x79, 0x5f, 0x72, 0x65, + 0x61, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x0e, 0x64, 0x65, 0x6e, 0x79, 0x52, 0x65, 0x61, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, + 0x2a, 0x0a, 0x11, 0x64, 0x65, 0x6e, 0x79, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x6e, 0x79, + 0x57, 0x72, 0x69, 0x74, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, 0xae, 0x06, 0x0a, 0x0a, + 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x76, 0x5f, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, 0x76, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, - 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, - 0x64, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, - 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x4e, 0x0a, 0x0b, - 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x0a, 0x63, - 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, 0x76, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x1b, 0x0a, 0x06, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, + 0x48, 0x00, 0x52, 0x06, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, + 0x06, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x48, 0x01, 0x52, + 0x06, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x88, 0x01, 0x01, 0x12, 0x1c, 0x0a, 0x07, 0x6e, 0x6f, + 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x48, 0x02, 0x52, 0x06, 0x6e, + 0x6f, 0x44, 0x61, 0x74, 0x61, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x12, 0x16, 0x0a, 0x06, 0x68, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x06, 0x68, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x12, 0x38, 0x0a, 0x04, 0x76, 0x69, 0x65, 0x77, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6c, + 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x52, 0x04, 0x76, 0x69, + 0x65, 0x77, 0x12, 0x48, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6c, + 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x10, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, + 0x12, 0x33, 0x0a, 0x06, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x06, 0x61, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x1a, 0x75, 0x0a, 0x04, 0x56, 0x69, 0x65, 0x77, 0x12, 0x19, 0x0a, + 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x76, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, 0x76, 0x49, 0x64, 0x12, + 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x1a, 0x97, 0x01, 0x0a, + 0x09, 0x53, 0x74, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x3b, 0x0a, 0x05, 0x73, 0x74, + 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x39, 0x0a, 0x0a, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x42, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, + 0x07, 0x0a, 0x03, 0x4e, 0x45, 0x57, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x50, 0x52, 0x45, 0x50, + 0x41, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x41, 0x44, 0x59, + 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x12, 0x0b, 0x0a, + 0x07, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x44, 0x10, 0x04, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, + 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, + 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6e, 0x6f, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x22, 0x50, 0x0a, 0x0d, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, + 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4b, + 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x39, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x22, 0x44, 0x0a, 0x0a, 0x47, + 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x64, 0x69, 0x73, + 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x69, 0x6e, 0x63, 0x6c, + 0x75, 0x64, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x64, 0x69, 0x73, 0x61, + 0x62, 0x6c, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, + 0x73, 0x22, 0x9e, 0x01, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x65, + 0x6e, 0x76, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, 0x76, + 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, + 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x22, 0x4e, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x3f, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, + 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x22, 0xa5, 0x02, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x15, 0x0a, + 0x06, 0x65, 0x6e, 0x76, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, + 0x6e, 0x76, 0x49, 0x64, 0x12, 0x3f, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, + 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x1a, 0xa2, 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, + 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x26, 0x0a, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, + 0x64, 0x65, 0x5f, 0x6e, 0x6f, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x12, + 0x25, 0x0a, 0x0e, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x68, 0x69, 0x64, 0x64, 0x65, + 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, + 0x48, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x51, 0x0a, 0x0c, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0b, 0x63, 0x6f, + 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa5, 0x02, 0x0a, - 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x76, 0x5f, 0x69, - 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, 0x76, 0x49, 0x64, 0x12, 0x3f, - 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x1a, - 0xa2, 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x78, - 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x0d, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, - 0x6d, 0x12, 0x26, 0x0a, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x6e, 0x6f, 0x5f, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x69, 0x6e, 0x63, 0x6c, - 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x12, 0x25, 0x0a, 0x0e, 0x69, 0x6e, 0x63, - 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x68, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x48, 0x69, 0x64, 0x64, 0x65, 0x6e, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x64, 0x22, 0x51, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0b, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x52, 0x0b, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x50, 0x0a, + 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, + 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, + 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, + 0x81, 0x01, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, + 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x76, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x65, 0x6e, 0x76, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, + 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x22, 0x66, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, + 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x76, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x65, 0x6e, 0x76, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, + 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x32, 0xdb, 0x03, 0x0a, 0x0b, + 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x53, 0x0a, 0x06, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, + 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x63, 0x6f, 0x6c, 0x6c, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x50, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, - 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x81, 0x01, 0x0a, 0x10, 0x53, 0x65, - 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, - 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x76, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, 0x76, 0x49, 0x64, - 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, - 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x66, 0x0a, - 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, - 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x76, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, 0x76, 0x49, 0x64, - 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, - 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x32, 0xdb, 0x03, 0x0a, 0x0b, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x53, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, - 0x22, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, - 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x03, 0x47, 0x65, - 0x74, 0x12, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, - 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x21, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, - 0x22, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x4c, 0x0a, - 0x09, 0x53, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x53, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x06, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, - 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x4a, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, + 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x04, + 0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, + 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x06, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, + 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x22, 0x00, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x2e, 0x70, 0x65, 0x72, 0x78, 0x2e, - 0x72, 0x75, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, - 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3b, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x22, 0x00, 0x12, 0x4c, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, + 0x00, 0x12, 0x46, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, + 0x2e, 0x70, 0x65, 0x72, 0x78, 0x2e, 0x72, 0x75, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2f, + 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3b, 0x63, 0x6f, 0x6c, 0x6c, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/collections/collections_grpc.pb.go b/proto/collections/collections_grpc.pb.go index f0ccc6b2725c15048c8bfa812a5ea6f42aa8e2e4..392ef1841c36ee9ca29d6ccc3bfffd9e97ec0054 100644 --- a/proto/collections/collections_grpc.pb.go +++ b/proto/collections/collections_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.3 +// - protoc v4.25.1 // source: collections/collections.proto package collections diff --git a/proto/common/common.pb.go b/proto/common/common.pb.go index 867831c7239c004b5235ec15b844e9e171ccac9d..31926abe8e19b189bc87a67684e2476a43898811 100644 --- a/proto/common/common.pb.go +++ b/proto/common/common.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.24.3 +// protoc v4.25.1 // source: common/common.proto package common @@ -272,14 +272,17 @@ type Rule struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - CollectionId string `protobuf:"bytes,1,opt,name=collection_id,json=collectionId,proto3" json:"collection_id,omitempty"` - Actions []Action `protobuf:"varint,2,rep,packed,name=actions,proto3,enum=common.Action" json:"actions,omitempty"` - Access Access `protobuf:"varint,3,opt,name=access,proto3,enum=common.Access" json:"access,omitempty"` - HiddenFields []string `protobuf:"bytes,5,rep,name=hidden_fields,json=hiddenFields,proto3" json:"hidden_fields,omitempty"` + CollectionId string `protobuf:"bytes,1,opt,name=collection_id,json=collectionId,proto3" json:"collection_id,omitempty"` + Actions []Action `protobuf:"varint,2,rep,packed,name=actions,proto3,enum=common.Action" json:"actions,omitempty"` + Access Access `protobuf:"varint,3,opt,name=access,proto3,enum=common.Access" json:"access,omitempty"` + HiddenFields []string `protobuf:"bytes,5,rep,name=hidden_fields,json=hiddenFields,proto3" json:"hidden_fields,omitempty"` + // Deprecated ReadonlyFields []string `protobuf:"bytes,6,rep,name=readonly_fields,json=readonlyFields,proto3" json:"readonly_fields,omitempty"` WriteonlyFields []string `protobuf:"bytes,7,rep,name=writeonly_fields,json=writeonlyFields,proto3" json:"writeonly_fields,omitempty"` ReadFilter string `protobuf:"bytes,8,opt,name=read_filter,json=readFilter,proto3" json:"read_filter,omitempty"` WriteFilter string `protobuf:"bytes,9,opt,name=write_filter,json=writeFilter,proto3" json:"write_filter,omitempty"` + DenyReadFields []string `protobuf:"bytes,10,rep,name=deny_read_fields,json=denyReadFields,proto3" json:"deny_read_fields,omitempty"` + DenyWriteFields []string `protobuf:"bytes,11,rep,name=deny_write_fields,json=denyWriteFields,proto3" json:"deny_write_fields,omitempty"` } func (x *Rule) Reset() { @@ -370,6 +373,20 @@ func (x *Rule) GetWriteFilter() string { return "" } +func (x *Rule) GetDenyReadFields() []string { + if x != nil { + return x.DenyReadFields + } + return nil +} + +func (x *Rule) GetDenyWriteFields() []string { + if x != nil { + return x.DenyWriteFields + } + return nil +} + type Collaborator struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -534,7 +551,7 @@ var file_common_common_proto_rawDesc = []byte{ 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x73, 0x22, 0xba, 0x02, 0x0a, 0x04, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x23, 0x0a, + 0x65, 0x6c, 0x64, 0x73, 0x22, 0x90, 0x03, 0x0a, 0x04, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, @@ -554,33 +571,39 @@ var file_common_common_proto_rawDesc = []byte{ 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x77, 0x72, 0x69, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x22, 0x57, 0x0a, 0x0c, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, - 0x72, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, - 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, - 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x22, 0xab, 0x01, 0x0a, 0x07, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, - 0x0b, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, - 0x0a, 0x0a, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x16, 0x0a, - 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, - 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6e, - 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x62, 0x75, 0x69, - 0x6c, 0x64, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2a, 0x25, 0x0a, 0x06, 0x41, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4d, - 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x4f, 0x4c, 0x45, 0x10, 0x02, 0x2a, - 0x43, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, - 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, - 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, - 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, - 0x54, 0x45, 0x10, 0x04, 0x42, 0x32, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x2e, 0x70, 0x65, 0x72, 0x78, - 0x2e, 0x72, 0x75, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, - 0x73, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x12, 0x28, 0x0a, 0x10, 0x64, 0x65, 0x6e, 0x79, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x64, 0x65, 0x6e, + 0x79, 0x52, 0x65, 0x61, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x64, + 0x65, 0x6e, 0x79, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, + 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x6e, 0x79, 0x57, 0x72, 0x69, 0x74, + 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, 0x57, 0x0a, 0x0c, 0x43, 0x6f, 0x6c, 0x6c, 0x61, + 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, + 0x22, 0xab, 0x01, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x74, 0x69, + 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x54, + 0x69, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, + 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x0b, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2a, 0x25, + 0x0a, 0x06, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x10, + 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4d, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, + 0x4f, 0x4c, 0x45, 0x10, 0x02, 0x2a, 0x43, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, + 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x45, 0x41, 0x44, + 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x03, 0x12, 0x0a, + 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x42, 0x32, 0x5a, 0x30, 0x67, 0x69, + 0x74, 0x2e, 0x70, 0x65, 0x72, 0x78, 0x2e, 0x72, 0x75, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, + 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var (