diff --git a/central/resourcecollection/datastore/datastore.go b/central/resourcecollection/datastore/datastore.go index c138412922ee4..b99640708ae29 100644 --- a/central/resourcecollection/datastore/datastore.go +++ b/central/resourcecollection/datastore/datastore.go @@ -32,6 +32,7 @@ type DataStore interface { AddCollection(ctx context.Context, collection *storage.ResourceCollection) error DeleteCollection(ctx context.Context, id string) error DryRunAddCollection(ctx context.Context, collection *storage.ResourceCollection) error + // UpdateCollection updates the given collection object, and preserves createdAt and createdBy fields from stored collection UpdateCollection(ctx context.Context, collection *storage.ResourceCollection) error // autocomplete workflow, maybe SearchResults? TODO ROX-12616 } diff --git a/central/resourcecollection/datastore/datastore_impl.go b/central/resourcecollection/datastore/datastore_impl.go index fb5bbe2baf5fd..df816e22568ee 100644 --- a/central/resourcecollection/datastore/datastore_impl.go +++ b/central/resourcecollection/datastore/datastore_impl.go @@ -347,6 +347,9 @@ func (ds *datastoreImpl) updateCollectionWorkflow(ctx context.Context, collectio return err } + collection.CreatedBy = storedCollection.GetCreatedBy() + collection.CreatedAt = storedCollection.GetCreatedAt() + // if this is a dryrun we don't want to make changes to the datastore or tracking objects if dryrun { return nil diff --git a/central/resourcecollection/datastore/datastore_impl_test.go b/central/resourcecollection/datastore/datastore_impl_test.go index 90e2e264254ea..bb7e604277e07 100644 --- a/central/resourcecollection/datastore/datastore_impl_test.go +++ b/central/resourcecollection/datastore/datastore_impl_test.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "testing" + "time" "github.com/heimdalr/dag" "github.com/jackc/pgx/v4/pgxpool" @@ -14,6 +15,7 @@ import ( "github.com/stackrox/rox/generated/storage" "github.com/stackrox/rox/pkg/env" "github.com/stackrox/rox/pkg/postgres/pgtest" + "github.com/stackrox/rox/pkg/protoconv" "github.com/stackrox/rox/pkg/sac" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" @@ -270,10 +272,28 @@ func (s *CollectionPostgresDataStoreTestSuite) TestCollectionWorkflows() { assert.True(s.T(), ok) assert.Equal(s.T(), objB, obj) + // successful updates preserve createdAt and createdBy + objC := getTestCollection("c", nil) + objC.CreatedAt = protoconv.ConvertTimeToTimestamp(time.Now()) + objC.CreatedBy = &storage.SlimUser{ + Id: "uid", + Name: "uname", + } + err = s.datastore.AddCollection(ctx, objC) + assert.NoError(s.T(), err) + objC.Name = "C" + err = s.datastore.UpdateCollection(ctx, objC) + assert.NoError(s.T(), err) + obj, ok, err = s.datastore.Get(ctx, objC.GetId()) + assert.NoError(s.T(), err) + assert.True(s.T(), ok) + assert.Equal(s.T(), objC, obj) + // clean up testing data and verify the datastore is empty assert.NoError(s.T(), s.datastore.DeleteCollection(ctx, objB.GetId())) assert.NoError(s.T(), s.datastore.DeleteCollection(ctx, objE.GetId())) assert.NoError(s.T(), s.datastore.DeleteCollection(ctx, objA.GetId())) + assert.NoError(s.T(), s.datastore.DeleteCollection(ctx, objC.GetId())) count, err = s.datastore.Count(ctx, nil) assert.NoError(s.T(), err) assert.Equal(s.T(), 0, count) diff --git a/central/resourcecollection/service/service_impl.go b/central/resourcecollection/service/service_impl.go index 6e426d297b581..788273ca0a97a 100644 --- a/central/resourcecollection/service/service_impl.go +++ b/central/resourcecollection/service/service_impl.go @@ -32,7 +32,7 @@ var ( authorizer = or.SensorOrAuthorizer(perrpc.FromMap(map[authz.Authorizer][]string{ user.With(permissions.View(resources.WorkflowAdministration)): { "/v1.CollectionService/GetCollection", - // "/v1.CollectionService/GetCollectionCount", TODO ROX-12625 + "/v1.CollectionService/GetCollectionCount", "/v1.CollectionService/ListCollections", // "/v1.CollectionService/ListCollectionSelectors", TODO ROX-12612 }, @@ -41,7 +41,7 @@ var ( "/v1.CollectionService/CreateCollection", "/v1.CollectionService/DeleteCollection", // "/v1.CollectionService/DryRunCollection", TODO ROX-13031 - // "/v1.CollectionService/UpdateCollection", TODO ROX-13032 + "/v1.CollectionService/UpdateCollection", }, })) ) @@ -78,7 +78,7 @@ func (s *serviceImpl) AuthFuncOverride(ctx context.Context, fullMethodName strin // GetCollection returns a collection for the given request func (s *serviceImpl) GetCollection(ctx context.Context, request *v1.GetCollectionRequest) (*v1.GetCollectionResponse, error) { if !features.ObjectCollections.Enabled() { - return nil, errors.New("Resource collections is not enabled") + return nil, errors.Errorf("%s env var is not enabled", features.ObjectCollections.EnvVar()) } if request.GetId() == "" { return nil, errors.Wrap(errox.InvalidArgs, "Id field should be set when requesting a collection") @@ -101,10 +101,29 @@ func (s *serviceImpl) getCollection(ctx context.Context, id string) (*v1.GetColl }, nil } +// GetCollectionCount returns count of collections matching the query in the request +func (s *serviceImpl) GetCollectionCount(ctx context.Context, request *v1.GetCollectionCountRequest) (*v1.GetCollectionCountResponse, error) { + if !features.ObjectCollections.Enabled() { + return nil, errors.Errorf("%s env var is not enabled", features.ObjectCollections.EnvVar()) + } + + // parse query + parsedQuery, err := search.ParseQuery(request.GetQuery().GetQuery(), search.MatchAllIfEmpty()) + if err != nil { + return nil, errors.Wrap(errox.InvalidArgs, err.Error()) + } + + count, err := s.datastore.Count(ctx, parsedQuery) + if err != nil { + return nil, err + } + return &v1.GetCollectionCountResponse{Count: int32(count)}, nil +} + // DeleteCollection deletes the collection with the given ID func (s *serviceImpl) DeleteCollection(ctx context.Context, request *v1.ResourceByID) (*v1.Empty, error) { if !features.ObjectCollections.Enabled() { - return nil, errors.New("Support for resource collections is not enabled") + return nil, errors.Errorf("%s env var is not enabled", features.ObjectCollections.EnvVar()) } if request.GetId() == "" { return nil, errors.Wrap(errox.InvalidArgs, "Non empty collection id must be specified to delete a collection") @@ -118,10 +137,10 @@ func (s *serviceImpl) DeleteCollection(ctx context.Context, request *v1.Resource // CreateCollection creates a new collection from the given request func (s *serviceImpl) CreateCollection(ctx context.Context, request *v1.CreateCollectionRequest) (*v1.CreateCollectionResponse, error) { if !features.ObjectCollections.Enabled() { - return nil, errors.New("Support for resource collections is not enabled") + return nil, errors.Errorf("%s env var is not enabled", features.ObjectCollections.EnvVar()) } - collection, err := collectionRequestToCollection(ctx, request, true) + collection, err := collectionRequestToCollection(ctx, request, "") if err != nil { return nil, err } @@ -134,7 +153,29 @@ func (s *serviceImpl) CreateCollection(ctx context.Context, request *v1.CreateCo return &v1.CreateCollectionResponse{Collection: collection}, nil } -func collectionRequestToCollection(ctx context.Context, request collectionRequest, isCreate bool) (*storage.ResourceCollection, error) { +func (s *serviceImpl) UpdateCollection(ctx context.Context, request *v1.UpdateCollectionRequest) (*v1.UpdateCollectionResponse, error) { + if !features.ObjectCollections.Enabled() { + return nil, errors.Errorf("%s env var is not enabled", features.ObjectCollections.EnvVar()) + } + + if request.GetId() == "" { + return nil, errors.Wrap(errox.InvalidArgs, "Non empty collection id must be specified to update a collection") + } + + collection, err := collectionRequestToCollection(ctx, request, request.GetId()) + if err != nil { + return nil, err + } + + err = s.datastore.UpdateCollection(ctx, collection) + if err != nil { + return nil, err + } + + return &v1.UpdateCollectionResponse{Collection: collection}, nil +} + +func collectionRequestToCollection(ctx context.Context, request collectionRequest, id string) (*storage.ResourceCollection, error) { if request.GetName() == "" { return nil, errors.Wrap(errox.InvalidArgs, "Collection name should not be empty") } @@ -151,6 +192,7 @@ func collectionRequestToCollection(ctx context.Context, request collectionReques timeNow := protoconv.ConvertTimeToTimestamp(time.Now()) collection := &storage.ResourceCollection{ + Id: id, Name: request.GetName(), Description: request.GetDescription(), LastUpdated: timeNow, @@ -158,7 +200,8 @@ func collectionRequestToCollection(ctx context.Context, request collectionReques ResourceSelectors: request.GetResourceSelectors(), } - if isCreate { + if id == "" { + // new collection collection.CreatedBy = slimUser collection.CreatedAt = timeNow } @@ -176,7 +219,7 @@ func collectionRequestToCollection(ctx context.Context, request collectionReques func (s *serviceImpl) ListCollections(ctx context.Context, request *v1.ListCollectionsRequest) (*v1.ListCollectionsResponse, error) { if !features.ObjectCollections.Enabled() { - return nil, errors.New("Resource collections is not enabled") + return nil, errors.Errorf("%s env var is not enabled", features.ObjectCollections.EnvVar()) } // parse query diff --git a/central/resourcecollection/service/service_impl_test.go b/central/resourcecollection/service/service_impl_test.go index 81ab98cfe4fda..53d5a1d2a5fb6 100644 --- a/central/resourcecollection/service/service_impl_test.go +++ b/central/resourcecollection/service/service_impl_test.go @@ -87,6 +87,32 @@ func (suite *CollectionServiceTestSuite) TestGetCollection() { suite.Nil(result) } +func (suite *CollectionServiceTestSuite) TestGetCollectionCount() { + if !features.ObjectCollections.Enabled() { + suite.T().Skip("skipping because env var is not set") + } + + allAccessCtx := sac.WithAllAccess(context.Background()) + request := &v1.GetCollectionCountRequest{ + Query: &v1.RawQuery{}, + } + + parsedQuery, err := search.ParseQuery(request.GetQuery().GetQuery(), search.MatchAllIfEmpty()) + suite.NoError(err) + + suite.dataStore.EXPECT().Count(allAccessCtx, parsedQuery).Times(1).Return(10, nil) + resp, err := suite.collectionService.GetCollectionCount(allAccessCtx, request) + suite.NoError(err) + suite.NotNil(resp) + suite.Equal(int32(10), resp.GetCount()) + + // test error + suite.dataStore.EXPECT().Count(allAccessCtx, parsedQuery).Times(1).Return(0, errors.New("test error")) + resp, err = suite.collectionService.GetCollectionCount(allAccessCtx, request) + suite.Error(err) + suite.Nil(resp) +} + func (suite *CollectionServiceTestSuite) TestCreateCollection() { if !features.ObjectCollections.Enabled() { suite.T().Skip("skipping because env var is not set") @@ -164,6 +190,94 @@ func (suite *CollectionServiceTestSuite) TestCreateCollection() { suite.NotNil(resp.GetCollection().GetLastUpdated()) } +func (suite *CollectionServiceTestSuite) TestUpdateCollection() { + if !features.ObjectCollections.Enabled() { + suite.T().Skip("skipping because env var is not set") + } + allAccessCtx := sac.WithAllAccess(context.Background()) + + // test error when collection Id is empty + request := &v1.UpdateCollectionRequest{ + Id: "", + } + resp, err := suite.collectionService.UpdateCollection(allAccessCtx, request) + suite.NotNil(err) + suite.Nil(resp) + + // test error when collection name is empty + request = &v1.UpdateCollectionRequest{ + Id: "id1", + Name: "", + } + resp, err = suite.collectionService.UpdateCollection(allAccessCtx, request) + suite.NotNil(err) + suite.Nil(resp) + + // test error on context without identity + request = &v1.UpdateCollectionRequest{ + Id: "id2", + Name: "b", + } + resp, err = suite.collectionService.UpdateCollection(allAccessCtx, request) + suite.NotNil(err) + suite.Nil(resp) + + // test error on empty/nil resource selectors + request = &v1.UpdateCollectionRequest{ + Id: "id3", + Name: "c", + } + mockID := mockIdentity.NewMockIdentity(suite.mockCtrl) + mockID.EXPECT().UID().Return("uid").Times(1) + mockID.EXPECT().FullName().Return("name").Times(1) + mockID.EXPECT().FriendlyName().Return("name").Times(1) + ctx := authn.ContextWithIdentity(allAccessCtx, mockID, suite.T()) + resp, err = suite.collectionService.UpdateCollection(ctx, request) + suite.NotNil(err) + suite.Nil(resp) + + // test successful update + request = &v1.UpdateCollectionRequest{ + Id: "id4", + Name: "d", + Description: "description", + ResourceSelectors: []*storage.ResourceSelector{ + { + Rules: []*storage.SelectorRule{ + { + FieldName: search.DeploymentName.String(), + Operator: storage.BooleanOperator_OR, + Values: []*storage.RuleValue{ + { + Value: "deployment", + }, + }, + }, + }, + }, + }, + EmbeddedCollectionIds: []string{"id1", "id2"}, + } + + mockID.EXPECT().UID().Return("uid").Times(1) + mockID.EXPECT().FullName().Return("name").Times(1) + mockID.EXPECT().FriendlyName().Return("name").Times(1) + ctx = authn.ContextWithIdentity(allAccessCtx, mockID, suite.T()) + + suite.dataStore.EXPECT().UpdateCollection(ctx, gomock.Any()).Times(1).Return(nil) + resp, err = suite.collectionService.UpdateCollection(ctx, request) + suite.NoError(err) + suite.NotNil(resp.GetCollection()) + suite.Equal(request.GetId(), resp.GetCollection().GetId()) + suite.Equal(request.Name, resp.GetCollection().GetName()) + suite.Equal(request.GetDescription(), resp.GetCollection().GetDescription()) + suite.Equal(request.GetResourceSelectors(), resp.GetCollection().GetResourceSelectors()) + suite.Equal(request.GetEmbeddedCollectionIds(), suite.embeddedCollectionsToIds(resp.GetCollection().GetEmbeddedCollections())) + suite.Equal("uid", resp.GetCollection().GetUpdatedBy().GetId()) + suite.Equal("name", resp.GetCollection().GetUpdatedBy().GetName()) + suite.NotNil(resp.GetCollection().GetLastUpdated()) +} + func (suite *CollectionServiceTestSuite) TestDeleteCollection() { if !features.ObjectCollections.Enabled() { suite.T().Skip("skipping because env var is not set") diff --git a/generated/api/v1/resource_collection_service.pb.go b/generated/api/v1/resource_collection_service.pb.go index d84ccc912887a..0e69220032f54 100644 --- a/generated/api/v1/resource_collection_service.pb.go +++ b/generated/api/v1/resource_collection_service.pb.go @@ -231,6 +231,127 @@ func (m *GetCollectionResponse) Clone() *GetCollectionResponse { return cloned } +type GetCollectionCountRequest struct { + Query *RawQuery `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetCollectionCountRequest) Reset() { *m = GetCollectionCountRequest{} } +func (m *GetCollectionCountRequest) String() string { return proto.CompactTextString(m) } +func (*GetCollectionCountRequest) ProtoMessage() {} +func (*GetCollectionCountRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_21a4b2c7d805c182, []int{2} +} +func (m *GetCollectionCountRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetCollectionCountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetCollectionCountRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetCollectionCountRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetCollectionCountRequest.Merge(m, src) +} +func (m *GetCollectionCountRequest) XXX_Size() int { + return m.Size() +} +func (m *GetCollectionCountRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetCollectionCountRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetCollectionCountRequest proto.InternalMessageInfo + +func (m *GetCollectionCountRequest) GetQuery() *RawQuery { + if m != nil { + return m.Query + } + return nil +} + +func (m *GetCollectionCountRequest) MessageClone() proto.Message { + return m.Clone() +} +func (m *GetCollectionCountRequest) Clone() *GetCollectionCountRequest { + if m == nil { + return nil + } + cloned := new(GetCollectionCountRequest) + *cloned = *m + + cloned.Query = m.Query.Clone() + return cloned +} + +type GetCollectionCountResponse struct { + Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetCollectionCountResponse) Reset() { *m = GetCollectionCountResponse{} } +func (m *GetCollectionCountResponse) String() string { return proto.CompactTextString(m) } +func (*GetCollectionCountResponse) ProtoMessage() {} +func (*GetCollectionCountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_21a4b2c7d805c182, []int{3} +} +func (m *GetCollectionCountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetCollectionCountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetCollectionCountResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetCollectionCountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetCollectionCountResponse.Merge(m, src) +} +func (m *GetCollectionCountResponse) XXX_Size() int { + return m.Size() +} +func (m *GetCollectionCountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetCollectionCountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetCollectionCountResponse proto.InternalMessageInfo + +func (m *GetCollectionCountResponse) GetCount() int32 { + if m != nil { + return m.Count + } + return 0 +} + +func (m *GetCollectionCountResponse) MessageClone() proto.Message { + return m.Clone() +} +func (m *GetCollectionCountResponse) Clone() *GetCollectionCountResponse { + if m == nil { + return nil + } + cloned := new(GetCollectionCountResponse) + *cloned = *m + + return cloned +} + type CreateCollectionRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` @@ -245,7 +366,7 @@ func (m *CreateCollectionRequest) Reset() { *m = CreateCollectionRequest func (m *CreateCollectionRequest) String() string { return proto.CompactTextString(m) } func (*CreateCollectionRequest) ProtoMessage() {} func (*CreateCollectionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_21a4b2c7d805c182, []int{2} + return fileDescriptor_21a4b2c7d805c182, []int{4} } func (m *CreateCollectionRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -336,7 +457,7 @@ func (m *CreateCollectionResponse) Reset() { *m = CreateCollectionRespon func (m *CreateCollectionResponse) String() string { return proto.CompactTextString(m) } func (*CreateCollectionResponse) ProtoMessage() {} func (*CreateCollectionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_21a4b2c7d805c182, []int{3} + return fileDescriptor_21a4b2c7d805c182, []int{5} } func (m *CreateCollectionResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -386,6 +507,169 @@ func (m *CreateCollectionResponse) Clone() *CreateCollectionResponse { return cloned } +type UpdateCollectionRequest struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + ResourceSelectors []*storage.ResourceSelector `protobuf:"bytes,4,rep,name=resource_selectors,json=resourceSelectors,proto3" json:"resource_selectors,omitempty"` + EmbeddedCollectionIds []string `protobuf:"bytes,5,rep,name=embedded_collection_ids,json=embeddedCollectionIds,proto3" json:"embedded_collection_ids,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UpdateCollectionRequest) Reset() { *m = UpdateCollectionRequest{} } +func (m *UpdateCollectionRequest) String() string { return proto.CompactTextString(m) } +func (*UpdateCollectionRequest) ProtoMessage() {} +func (*UpdateCollectionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_21a4b2c7d805c182, []int{6} +} +func (m *UpdateCollectionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpdateCollectionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpdateCollectionRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *UpdateCollectionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdateCollectionRequest.Merge(m, src) +} +func (m *UpdateCollectionRequest) XXX_Size() int { + return m.Size() +} +func (m *UpdateCollectionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_UpdateCollectionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdateCollectionRequest proto.InternalMessageInfo + +func (m *UpdateCollectionRequest) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *UpdateCollectionRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *UpdateCollectionRequest) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *UpdateCollectionRequest) GetResourceSelectors() []*storage.ResourceSelector { + if m != nil { + return m.ResourceSelectors + } + return nil +} + +func (m *UpdateCollectionRequest) GetEmbeddedCollectionIds() []string { + if m != nil { + return m.EmbeddedCollectionIds + } + return nil +} + +func (m *UpdateCollectionRequest) MessageClone() proto.Message { + return m.Clone() +} +func (m *UpdateCollectionRequest) Clone() *UpdateCollectionRequest { + if m == nil { + return nil + } + cloned := new(UpdateCollectionRequest) + *cloned = *m + + if m.ResourceSelectors != nil { + cloned.ResourceSelectors = make([]*storage.ResourceSelector, len(m.ResourceSelectors)) + for idx, v := range m.ResourceSelectors { + cloned.ResourceSelectors[idx] = v.Clone() + } + } + if m.EmbeddedCollectionIds != nil { + cloned.EmbeddedCollectionIds = make([]string, len(m.EmbeddedCollectionIds)) + copy(cloned.EmbeddedCollectionIds, m.EmbeddedCollectionIds) + } + return cloned +} + +type UpdateCollectionResponse struct { + Collection *storage.ResourceCollection `protobuf:"bytes,1,opt,name=collection,proto3" json:"collection,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UpdateCollectionResponse) Reset() { *m = UpdateCollectionResponse{} } +func (m *UpdateCollectionResponse) String() string { return proto.CompactTextString(m) } +func (*UpdateCollectionResponse) ProtoMessage() {} +func (*UpdateCollectionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_21a4b2c7d805c182, []int{7} +} +func (m *UpdateCollectionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpdateCollectionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpdateCollectionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *UpdateCollectionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdateCollectionResponse.Merge(m, src) +} +func (m *UpdateCollectionResponse) XXX_Size() int { + return m.Size() +} +func (m *UpdateCollectionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_UpdateCollectionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdateCollectionResponse proto.InternalMessageInfo + +func (m *UpdateCollectionResponse) GetCollection() *storage.ResourceCollection { + if m != nil { + return m.Collection + } + return nil +} + +func (m *UpdateCollectionResponse) MessageClone() proto.Message { + return m.Clone() +} +func (m *UpdateCollectionResponse) Clone() *UpdateCollectionResponse { + if m == nil { + return nil + } + cloned := new(UpdateCollectionResponse) + *cloned = *m + + cloned.Collection = m.Collection.Clone() + return cloned +} + type ListCollectionsRequest struct { Query *RawQuery `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -397,7 +681,7 @@ func (m *ListCollectionsRequest) Reset() { *m = ListCollectionsRequest{} func (m *ListCollectionsRequest) String() string { return proto.CompactTextString(m) } func (*ListCollectionsRequest) ProtoMessage() {} func (*ListCollectionsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_21a4b2c7d805c182, []int{4} + return fileDescriptor_21a4b2c7d805c182, []int{8} } func (m *ListCollectionsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -458,7 +742,7 @@ func (m *ListCollectionsResponse) Reset() { *m = ListCollectionsResponse func (m *ListCollectionsResponse) String() string { return proto.CompactTextString(m) } func (*ListCollectionsResponse) ProtoMessage() {} func (*ListCollectionsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_21a4b2c7d805c182, []int{5} + return fileDescriptor_21a4b2c7d805c182, []int{9} } func (m *ListCollectionsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -517,8 +801,12 @@ func init() { proto.RegisterType((*GetCollectionRequest)(nil), "v1.GetCollectionRequest") proto.RegisterType((*GetCollectionRequest_Options)(nil), "v1.GetCollectionRequest.Options") proto.RegisterType((*GetCollectionResponse)(nil), "v1.GetCollectionResponse") + proto.RegisterType((*GetCollectionCountRequest)(nil), "v1.GetCollectionCountRequest") + proto.RegisterType((*GetCollectionCountResponse)(nil), "v1.GetCollectionCountResponse") proto.RegisterType((*CreateCollectionRequest)(nil), "v1.CreateCollectionRequest") proto.RegisterType((*CreateCollectionResponse)(nil), "v1.CreateCollectionResponse") + proto.RegisterType((*UpdateCollectionRequest)(nil), "v1.UpdateCollectionRequest") + proto.RegisterType((*UpdateCollectionResponse)(nil), "v1.UpdateCollectionResponse") proto.RegisterType((*ListCollectionsRequest)(nil), "v1.ListCollectionsRequest") proto.RegisterType((*ListCollectionsResponse)(nil), "v1.ListCollectionsResponse") } @@ -528,47 +816,54 @@ func init() { } var fileDescriptor_21a4b2c7d805c182 = []byte{ - // 631 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x41, 0x6f, 0xd3, 0x4c, - 0x10, 0xad, 0x93, 0x7e, 0x5f, 0xc9, 0xa4, 0xd0, 0x76, 0x69, 0x1b, 0xd7, 0xa9, 0xa2, 0xd4, 0xa7, - 0xa8, 0x42, 0x8e, 0x12, 0x24, 0x24, 0x0a, 0x5c, 0xda, 0x22, 0xa8, 0x44, 0x85, 0x70, 0x0f, 0x54, - 0x5c, 0x2a, 0xd7, 0x1e, 0xb5, 0x2b, 0x62, 0xaf, 0xbb, 0xbb, 0x4d, 0x89, 0x10, 0x17, 0xfe, 0x00, - 0x48, 0x48, 0x88, 0x9f, 0xc4, 0x11, 0xc4, 0x1f, 0x40, 0x85, 0x1f, 0x82, 0xd6, 0xde, 0xc4, 0xae, - 0xe3, 0x8a, 0x0b, 0xb7, 0xe8, 0xbd, 0x37, 0xf3, 0x66, 0xde, 0x4e, 0x0c, 0x1d, 0x2f, 0xa6, 0xdd, - 0x61, 0xaf, 0xcb, 0x51, 0xb0, 0x73, 0xee, 0xe3, 0x91, 0xcf, 0x06, 0x03, 0xf4, 0x25, 0x65, 0xd1, - 0x91, 0x40, 0x3e, 0xa4, 0x3e, 0x3a, 0x31, 0x67, 0x92, 0x91, 0xca, 0xb0, 0x67, 0xad, 0x9f, 0x30, - 0x76, 0x32, 0xc0, 0xae, 0x2a, 0xf2, 0xa2, 0x88, 0x49, 0x4f, 0x09, 0x45, 0xaa, 0xb0, 0x6e, 0xeb, - 0x5e, 0x3e, 0x0b, 0x43, 0x16, 0x69, 0x90, 0x68, 0x10, 0xc3, 0x58, 0x8e, 0x34, 0xb6, 0x21, 0x24, - 0xe3, 0xde, 0x09, 0x96, 0xb9, 0x6a, 0x89, 0x39, 0x96, 0x04, 0x18, 0x0f, 0xd8, 0x28, 0xc4, 0x48, - 0x6a, 0xa6, 0xa9, 0x1b, 0x0a, 0xf4, 0xb8, 0x7f, 0x7a, 0x75, 0x48, 0xfb, 0xa3, 0x01, 0xcb, 0x4f, - 0x50, 0xee, 0x4c, 0xda, 0xb9, 0x78, 0x76, 0x8e, 0x42, 0x92, 0x5b, 0x50, 0xa1, 0x81, 0x69, 0xb4, - 0x8d, 0x4e, 0xcd, 0xad, 0xd0, 0x80, 0x6c, 0xc1, 0x1c, 0x8b, 0x93, 0xe1, 0xcd, 0x4a, 0xdb, 0xe8, - 0xd4, 0xfb, 0x6d, 0x67, 0xd8, 0x73, 0xca, 0x4a, 0x9d, 0xe7, 0xa9, 0xce, 0x1d, 0x17, 0x58, 0x77, - 0x60, 0x4e, 0x63, 0x64, 0x03, 0xe6, 0x2f, 0xa8, 0x3c, 0x3d, 0x0a, 0x3d, 0xe9, 0x9f, 0xa2, 0x48, - 0x0c, 0x6e, 0xb8, 0x75, 0x85, 0xed, 0xa7, 0x90, 0xfd, 0xc1, 0x80, 0x95, 0x42, 0x5f, 0x11, 0xb3, - 0x48, 0x20, 0x79, 0x00, 0x90, 0xed, 0x9d, 0x94, 0xd6, 0xfb, 0x4d, 0x47, 0x2f, 0xee, 0xb8, 0x3a, - 0x9b, 0x5c, 0x61, 0x4e, 0x4e, 0xee, 0x43, 0x3d, 0x8b, 0x46, 0x2d, 0x51, 0xed, 0xd4, 0xfb, 0x8d, - 0x49, 0xf5, 0x33, 0x2a, 0xe4, 0xee, 0x84, 0x77, 0xf3, 0x5a, 0xfb, 0xbb, 0x01, 0x8d, 0x1d, 0x8e, - 0x9e, 0xc4, 0xe9, 0x9c, 0x08, 0xcc, 0x46, 0x5e, 0x88, 0x3a, 0xa9, 0xe4, 0x37, 0x69, 0x2b, 0x2b, - 0xe1, 0x73, 0x9a, 0x2c, 0x9d, 0xe4, 0x55, 0x73, 0xf3, 0x10, 0x79, 0x0a, 0x64, 0xf2, 0x94, 0x02, - 0x55, 0x4b, 0xc6, 0x85, 0x59, 0x4d, 0x66, 0x5a, 0x9b, 0xda, 0xe8, 0x40, 0x2b, 0xdc, 0x25, 0x5e, - 0x40, 0x04, 0xb9, 0x07, 0x0d, 0x0c, 0x8f, 0x31, 0x08, 0x30, 0xc8, 0x9f, 0x22, 0x0d, 0x84, 0x39, - 0xdb, 0xae, 0x76, 0x6a, 0xee, 0xca, 0x98, 0xce, 0x66, 0xdf, 0x0b, 0x84, 0xfd, 0x12, 0xcc, 0xe9, - 0x95, 0xfe, 0x41, 0xce, 0xf6, 0x43, 0x58, 0x55, 0x59, 0x66, 0xac, 0x18, 0x47, 0x65, 0xc3, 0x7f, - 0x67, 0xe7, 0xc8, 0x47, 0xba, 0xe3, 0xbc, 0x3a, 0x20, 0xd7, 0xbb, 0x78, 0xa1, 0x30, 0x37, 0xa5, - 0xec, 0x43, 0x68, 0x4c, 0x55, 0xeb, 0xa9, 0x1e, 0x41, 0x3d, 0xb3, 0x51, 0x97, 0x53, 0xfd, 0xdb, - 0x58, 0x79, 0x7d, 0xff, 0x73, 0x15, 0x96, 0x32, 0xee, 0x20, 0xfd, 0x17, 0x90, 0x63, 0xb8, 0x79, - 0xe5, 0xd6, 0x88, 0x79, 0xdd, 0x59, 0x5b, 0x6b, 0x25, 0x4c, 0x3a, 0x9a, 0xbd, 0xfe, 0xfe, 0xc7, - 0xef, 0x4f, 0x95, 0x55, 0xb2, 0x9c, 0xfe, 0x9b, 0x27, 0xa6, 0xdd, 0xb7, 0x34, 0x78, 0x47, 0x28, - 0x2c, 0x16, 0xa3, 0x26, 0x4d, 0xd5, 0xec, 0x9a, 0x9b, 0xb2, 0xd6, 0xcb, 0x49, 0x6d, 0x66, 0x25, - 0x66, 0xcb, 0xf6, 0x42, 0xc1, 0x6c, 0xcb, 0xd8, 0x24, 0x3e, 0x2c, 0x14, 0xe2, 0x23, 0x96, 0x6a, - 0x56, 0xfe, 0x22, 0x56, 0xb3, 0x94, 0xd3, 0x3e, 0x8d, 0xc4, 0x67, 0x89, 0x14, 0x7d, 0xc8, 0x3e, - 0x2c, 0xee, 0xe2, 0x00, 0xaf, 0xec, 0xb3, 0x98, 0x3c, 0xa6, 0x7e, 0x82, 0xed, 0xd1, 0xde, 0xae, - 0x55, 0x53, 0xc8, 0x63, 0xf5, 0x11, 0x1b, 0xc7, 0xb3, 0x59, 0x1a, 0xcf, 0xb6, 0xf3, 0xf5, 0xb2, - 0x65, 0x7c, 0xbb, 0x6c, 0x19, 0x3f, 0x2f, 0x5b, 0xc6, 0x97, 0x5f, 0xad, 0x19, 0x30, 0x29, 0x73, - 0x84, 0xf4, 0xfc, 0xd7, 0x9c, 0xbd, 0x49, 0xbf, 0x53, 0x8e, 0x17, 0x53, 0x67, 0xd8, 0x7b, 0x55, - 0x19, 0xf6, 0x0e, 0x67, 0x8e, 0xff, 0x4f, 0xb0, 0xbb, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x09, - 0x5b, 0xa6, 0x1c, 0x8c, 0x05, 0x00, 0x00, + // 746 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcb, 0x6e, 0xd3, 0x40, + 0x14, 0xad, 0xf3, 0xa0, 0xe4, 0xa6, 0xd0, 0x74, 0x48, 0x1b, 0xc7, 0x69, 0x43, 0xea, 0x55, 0x54, + 0x21, 0x47, 0x09, 0x12, 0x12, 0x05, 0x84, 0xd4, 0x16, 0x41, 0x25, 0x2a, 0x84, 0x2b, 0x44, 0xc5, + 0xa6, 0x72, 0xed, 0x51, 0x6b, 0x91, 0x78, 0x5c, 0xcf, 0x24, 0x25, 0x42, 0x6c, 0xf8, 0x01, 0x90, + 0xd8, 0xf0, 0x49, 0x2c, 0x41, 0xfc, 0x00, 0x14, 0xbe, 0x82, 0x15, 0x9a, 0xf1, 0x24, 0x71, 0x6c, + 0x47, 0x05, 0xa9, 0xbb, 0xe4, 0xdc, 0xc7, 0xb9, 0xf7, 0xcc, 0x99, 0x31, 0x34, 0x2d, 0xdf, 0x6d, + 0x0d, 0xda, 0xad, 0x00, 0x53, 0xd2, 0x0f, 0x6c, 0x7c, 0x68, 0x93, 0x6e, 0x17, 0xdb, 0xcc, 0x25, + 0xde, 0x21, 0xc5, 0xc1, 0xc0, 0xb5, 0xb1, 0xe1, 0x07, 0x84, 0x11, 0x94, 0x19, 0xb4, 0xb5, 0xd5, + 0x63, 0x42, 0x8e, 0xbb, 0xb8, 0xc5, 0x8b, 0x2c, 0xcf, 0x23, 0xcc, 0xe2, 0x89, 0x34, 0xcc, 0xd0, + 0x6e, 0xc8, 0x5e, 0x36, 0xe9, 0xf5, 0x88, 0x27, 0x41, 0x24, 0x41, 0xdc, 0xf3, 0xd9, 0x50, 0x62, + 0xeb, 0x94, 0x91, 0xc0, 0x3a, 0xc6, 0x69, 0xac, 0x32, 0x45, 0x1d, 0xa5, 0x38, 0xd8, 0xef, 0x92, + 0x61, 0x0f, 0x7b, 0x4c, 0x46, 0x6a, 0xb2, 0x21, 0xc5, 0x56, 0x60, 0x9f, 0x4c, 0x0f, 0xa9, 0x7f, + 0x54, 0xa0, 0xfc, 0x18, 0xb3, 0xed, 0x71, 0x3b, 0x13, 0x9f, 0xf6, 0x31, 0x65, 0xe8, 0x3a, 0x64, + 0x5c, 0x47, 0x55, 0x1a, 0x4a, 0xb3, 0x60, 0x66, 0x5c, 0x07, 0x6d, 0xc2, 0x3c, 0xf1, 0xc5, 0xf0, + 0x6a, 0xa6, 0xa1, 0x34, 0x8b, 0x9d, 0x86, 0x31, 0x68, 0x1b, 0x69, 0xa5, 0xc6, 0xb3, 0x30, 0xcf, + 0x1c, 0x15, 0x68, 0xb7, 0x60, 0x5e, 0x62, 0x68, 0x1d, 0x16, 0xce, 0x5c, 0x76, 0x72, 0xd8, 0xb3, + 0x98, 0x7d, 0x82, 0xa9, 0x20, 0xb8, 0x6a, 0x16, 0x39, 0xb6, 0x17, 0x42, 0xfa, 0x07, 0x05, 0x96, + 0x63, 0x7d, 0xa9, 0x4f, 0x3c, 0x8a, 0xd1, 0x3d, 0x80, 0xc9, 0xde, 0xa2, 0xb4, 0xd8, 0xa9, 0x19, + 0x72, 0x71, 0xc3, 0x94, 0xda, 0x44, 0x0a, 0x23, 0xe9, 0xe8, 0x2e, 0x14, 0x27, 0xd2, 0xf0, 0x25, + 0xb2, 0xcd, 0x62, 0xa7, 0x32, 0xae, 0x7e, 0xea, 0x52, 0xb6, 0x33, 0x8e, 0x9b, 0xd1, 0x5c, 0xfd, + 0x21, 0x54, 0xa7, 0x06, 0xda, 0x26, 0x7d, 0x8f, 0x8d, 0x84, 0xd2, 0x21, 0x7f, 0xda, 0xc7, 0xc1, + 0x50, 0xce, 0xb3, 0xc0, 0x65, 0x31, 0xad, 0xb3, 0xe7, 0x1c, 0x33, 0xc3, 0x90, 0xde, 0x01, 0x2d, + 0xad, 0x81, 0x5c, 0xab, 0x0c, 0x79, 0x9b, 0x03, 0xa2, 0x43, 0xde, 0x0c, 0xff, 0xe8, 0xdf, 0x14, + 0xa8, 0x6c, 0x07, 0xd8, 0x62, 0x38, 0x79, 0x38, 0x08, 0x72, 0x9e, 0xd5, 0xc3, 0xf2, 0x78, 0xc4, + 0x6f, 0xd4, 0xe0, 0xfb, 0x51, 0x3b, 0x70, 0x85, 0xd2, 0xe2, 0x90, 0x0a, 0x66, 0x14, 0x42, 0x4f, + 0x00, 0x8d, 0xfd, 0x43, 0x31, 0x6f, 0x49, 0x02, 0xaa, 0x66, 0x85, 0x10, 0xd5, 0x84, 0x8c, 0xfb, + 0x32, 0xc3, 0x5c, 0x0a, 0x62, 0x08, 0x45, 0x77, 0xa0, 0x82, 0x7b, 0x47, 0xd8, 0x71, 0xb0, 0x13, + 0xf5, 0xbf, 0xeb, 0x50, 0x35, 0xd7, 0xc8, 0x36, 0x0b, 0xe6, 0xf2, 0x28, 0x3c, 0x99, 0x7d, 0xd7, + 0xa1, 0xfa, 0x4b, 0x50, 0x93, 0x2b, 0x5d, 0xc2, 0xe1, 0xea, 0x3f, 0x15, 0xa8, 0xbc, 0xf0, 0x9d, + 0x54, 0xb1, 0xe2, 0x4e, 0x1e, 0x89, 0x97, 0x99, 0x2d, 0x5e, 0xf6, 0x5f, 0xc5, 0xcb, 0x5d, 0xae, + 0x78, 0xf9, 0x0b, 0xc4, 0x4b, 0xae, 0x78, 0x19, 0xe2, 0xdd, 0x87, 0x15, 0xee, 0xfe, 0x49, 0x94, + 0xfe, 0x8f, 0xb7, 0x0f, 0xa0, 0x92, 0xa8, 0x96, 0x53, 0x3d, 0x80, 0xe2, 0x84, 0x86, 0xdf, 0xf5, + 0xec, 0x45, 0x63, 0x45, 0xf3, 0x3b, 0x7f, 0x72, 0xb0, 0x34, 0x89, 0xed, 0x87, 0xef, 0x16, 0x3a, + 0x82, 0x6b, 0x53, 0x77, 0x09, 0xa9, 0xb3, 0x1e, 0x22, 0xad, 0x9a, 0x12, 0x09, 0x47, 0xd3, 0x57, + 0xdf, 0x7f, 0xff, 0xfd, 0x29, 0xb3, 0x82, 0xca, 0xe1, 0xfb, 0x3b, 0x26, 0x6d, 0xbd, 0x75, 0x9d, + 0x77, 0x28, 0x00, 0x94, 0xbc, 0xaf, 0x68, 0x2d, 0xd1, 0x2e, 0xfa, 0x10, 0x68, 0xf5, 0x59, 0x61, + 0x49, 0xb9, 0x26, 0x28, 0x2b, 0x68, 0x39, 0x4e, 0x29, 0xee, 0x3b, 0x72, 0xa1, 0x14, 0xbf, 0x1b, + 0xa8, 0xc6, 0x5b, 0xce, 0x78, 0x04, 0xb4, 0xd5, 0xf4, 0xa0, 0x64, 0xd3, 0x04, 0x5b, 0x59, 0x5f, + 0x8c, 0xb1, 0x6d, 0x2a, 0x1b, 0xc8, 0x83, 0x52, 0xdc, 0x49, 0x21, 0xd5, 0x8c, 0x2b, 0x14, 0x52, + 0xcd, 0x32, 0x9f, 0x7e, 0x53, 0x50, 0x55, 0xf5, 0x54, 0x2d, 0x39, 0x9f, 0x0d, 0x8b, 0x31, 0x8b, + 0x20, 0x8d, 0x77, 0x4c, 0x77, 0x9d, 0x56, 0x4b, 0x8d, 0x49, 0xb2, 0x8a, 0x20, 0x5b, 0x42, 0xf1, + 0xbd, 0xd0, 0x1e, 0x94, 0x76, 0x70, 0x17, 0x4f, 0x2d, 0x55, 0x12, 0x86, 0x95, 0x36, 0xdb, 0x1a, + 0xee, 0xee, 0x68, 0x05, 0x8e, 0x3c, 0xe2, 0x9f, 0xd6, 0x91, 0x05, 0x36, 0x52, 0xc7, 0xde, 0x32, + 0xbe, 0x9c, 0xd7, 0x95, 0xaf, 0xe7, 0x75, 0xe5, 0xc7, 0x79, 0x5d, 0xf9, 0xfc, 0xab, 0x3e, 0x07, + 0xaa, 0x4b, 0x0c, 0xca, 0x2c, 0xfb, 0x75, 0x40, 0xde, 0x84, 0x5f, 0x4f, 0xc3, 0xf2, 0x5d, 0x63, + 0xd0, 0x7e, 0x95, 0x19, 0xb4, 0x0f, 0xe6, 0x8e, 0xae, 0x08, 0xec, 0xf6, 0xdf, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x5c, 0xe1, 0x6b, 0x14, 0x22, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -584,7 +879,9 @@ const _ = grpc.SupportPackageIsVersion6 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConnInterface.NewStream. type CollectionServiceClient interface { GetCollection(ctx context.Context, in *GetCollectionRequest, opts ...grpc.CallOption) (*GetCollectionResponse, error) + GetCollectionCount(ctx context.Context, in *GetCollectionCountRequest, opts ...grpc.CallOption) (*GetCollectionCountResponse, error) CreateCollection(ctx context.Context, in *CreateCollectionRequest, opts ...grpc.CallOption) (*CreateCollectionResponse, error) + UpdateCollection(ctx context.Context, in *UpdateCollectionRequest, opts ...grpc.CallOption) (*UpdateCollectionResponse, error) ListCollections(ctx context.Context, in *ListCollectionsRequest, opts ...grpc.CallOption) (*ListCollectionsResponse, error) DeleteCollection(ctx context.Context, in *ResourceByID, opts ...grpc.CallOption) (*Empty, error) } @@ -606,6 +903,15 @@ func (c *collectionServiceClient) GetCollection(ctx context.Context, in *GetColl return out, nil } +func (c *collectionServiceClient) GetCollectionCount(ctx context.Context, in *GetCollectionCountRequest, opts ...grpc.CallOption) (*GetCollectionCountResponse, error) { + out := new(GetCollectionCountResponse) + err := c.cc.Invoke(ctx, "/v1.CollectionService/GetCollectionCount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *collectionServiceClient) CreateCollection(ctx context.Context, in *CreateCollectionRequest, opts ...grpc.CallOption) (*CreateCollectionResponse, error) { out := new(CreateCollectionResponse) err := c.cc.Invoke(ctx, "/v1.CollectionService/CreateCollection", in, out, opts...) @@ -615,6 +921,15 @@ func (c *collectionServiceClient) CreateCollection(ctx context.Context, in *Crea return out, nil } +func (c *collectionServiceClient) UpdateCollection(ctx context.Context, in *UpdateCollectionRequest, opts ...grpc.CallOption) (*UpdateCollectionResponse, error) { + out := new(UpdateCollectionResponse) + err := c.cc.Invoke(ctx, "/v1.CollectionService/UpdateCollection", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *collectionServiceClient) ListCollections(ctx context.Context, in *ListCollectionsRequest, opts ...grpc.CallOption) (*ListCollectionsResponse, error) { out := new(ListCollectionsResponse) err := c.cc.Invoke(ctx, "/v1.CollectionService/ListCollections", in, out, opts...) @@ -636,7 +951,9 @@ func (c *collectionServiceClient) DeleteCollection(ctx context.Context, in *Reso // CollectionServiceServer is the server API for CollectionService service. type CollectionServiceServer interface { GetCollection(context.Context, *GetCollectionRequest) (*GetCollectionResponse, error) + GetCollectionCount(context.Context, *GetCollectionCountRequest) (*GetCollectionCountResponse, error) CreateCollection(context.Context, *CreateCollectionRequest) (*CreateCollectionResponse, error) + UpdateCollection(context.Context, *UpdateCollectionRequest) (*UpdateCollectionResponse, error) ListCollections(context.Context, *ListCollectionsRequest) (*ListCollectionsResponse, error) DeleteCollection(context.Context, *ResourceByID) (*Empty, error) } @@ -648,9 +965,15 @@ type UnimplementedCollectionServiceServer struct { func (*UnimplementedCollectionServiceServer) GetCollection(ctx context.Context, req *GetCollectionRequest) (*GetCollectionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetCollection not implemented") } +func (*UnimplementedCollectionServiceServer) GetCollectionCount(ctx context.Context, req *GetCollectionCountRequest) (*GetCollectionCountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCollectionCount not implemented") +} func (*UnimplementedCollectionServiceServer) CreateCollection(ctx context.Context, req *CreateCollectionRequest) (*CreateCollectionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateCollection not implemented") } +func (*UnimplementedCollectionServiceServer) UpdateCollection(ctx context.Context, req *UpdateCollectionRequest) (*UpdateCollectionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateCollection not implemented") +} func (*UnimplementedCollectionServiceServer) ListCollections(ctx context.Context, req *ListCollectionsRequest) (*ListCollectionsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListCollections not implemented") } @@ -680,6 +1003,24 @@ func _CollectionService_GetCollection_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } +func _CollectionService_GetCollectionCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCollectionCountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CollectionServiceServer).GetCollectionCount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/v1.CollectionService/GetCollectionCount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CollectionServiceServer).GetCollectionCount(ctx, req.(*GetCollectionCountRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _CollectionService_CreateCollection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CreateCollectionRequest) if err := dec(in); err != nil { @@ -698,6 +1039,24 @@ func _CollectionService_CreateCollection_Handler(srv interface{}, ctx context.Co return interceptor(ctx, in, info, handler) } +func _CollectionService_UpdateCollection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateCollectionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CollectionServiceServer).UpdateCollection(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/v1.CollectionService/UpdateCollection", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CollectionServiceServer).UpdateCollection(ctx, req.(*UpdateCollectionRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _CollectionService_ListCollections_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListCollectionsRequest) if err := dec(in); err != nil { @@ -742,10 +1101,18 @@ var _CollectionService_serviceDesc = grpc.ServiceDesc{ MethodName: "GetCollection", Handler: _CollectionService_GetCollection_Handler, }, + { + MethodName: "GetCollectionCount", + Handler: _CollectionService_GetCollectionCount_Handler, + }, { MethodName: "CreateCollection", Handler: _CollectionService_CreateCollection_Handler, }, + { + MethodName: "UpdateCollection", + Handler: _CollectionService_UpdateCollection_Handler, + }, { MethodName: "ListCollections", Handler: _CollectionService_ListCollections_Handler, @@ -895,7 +1262,7 @@ func (m *GetCollectionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *CreateCollectionRequest) Marshal() (dAtA []byte, err error) { +func (m *GetCollectionCountRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -905,12 +1272,12 @@ func (m *CreateCollectionRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *CreateCollectionRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *GetCollectionCountRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *CreateCollectionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *GetCollectionCountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -919,11 +1286,82 @@ func (m *CreateCollectionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.EmbeddedCollectionIds) > 0 { - for iNdEx := len(m.EmbeddedCollectionIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.EmbeddedCollectionIds[iNdEx]) - copy(dAtA[i:], m.EmbeddedCollectionIds[iNdEx]) - i = encodeVarintResourceCollectionService(dAtA, i, uint64(len(m.EmbeddedCollectionIds[iNdEx]))) + if m.Query != nil { + { + size, err := m.Query.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintResourceCollectionService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetCollectionCountResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetCollectionCountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetCollectionCountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Count != 0 { + i = encodeVarintResourceCollectionService(dAtA, i, uint64(m.Count)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *CreateCollectionRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateCollectionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CreateCollectionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.EmbeddedCollectionIds) > 0 { + for iNdEx := len(m.EmbeddedCollectionIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.EmbeddedCollectionIds[iNdEx]) + copy(dAtA[i:], m.EmbeddedCollectionIds[iNdEx]) + i = encodeVarintResourceCollectionService(dAtA, i, uint64(len(m.EmbeddedCollectionIds[iNdEx]))) i-- dAtA[i] = 0x22 } @@ -998,6 +1436,116 @@ func (m *CreateCollectionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *UpdateCollectionRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UpdateCollectionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UpdateCollectionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.EmbeddedCollectionIds) > 0 { + for iNdEx := len(m.EmbeddedCollectionIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.EmbeddedCollectionIds[iNdEx]) + copy(dAtA[i:], m.EmbeddedCollectionIds[iNdEx]) + i = encodeVarintResourceCollectionService(dAtA, i, uint64(len(m.EmbeddedCollectionIds[iNdEx]))) + i-- + dAtA[i] = 0x2a + } + } + if len(m.ResourceSelectors) > 0 { + for iNdEx := len(m.ResourceSelectors) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourceSelectors[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintResourceCollectionService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintResourceCollectionService(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintResourceCollectionService(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintResourceCollectionService(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UpdateCollectionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UpdateCollectionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UpdateCollectionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Collection != nil { + { + size, err := m.Collection.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintResourceCollectionService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *ListCollectionsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1146,6 +1694,37 @@ func (m *GetCollectionResponse) Size() (n int) { return n } +func (m *GetCollectionCountRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Query != nil { + l = m.Query.Size() + n += 1 + l + sovResourceCollectionService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetCollectionCountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Count != 0 { + n += 1 + sovResourceCollectionService(uint64(m.Count)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func (m *CreateCollectionRequest) Size() (n int) { if m == nil { return 0 @@ -1194,6 +1773,58 @@ func (m *CreateCollectionResponse) Size() (n int) { return n } +func (m *UpdateCollectionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovResourceCollectionService(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovResourceCollectionService(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovResourceCollectionService(uint64(l)) + } + if len(m.ResourceSelectors) > 0 { + for _, e := range m.ResourceSelectors { + l = e.Size() + n += 1 + l + sovResourceCollectionService(uint64(l)) + } + } + if len(m.EmbeddedCollectionIds) > 0 { + for _, s := range m.EmbeddedCollectionIds { + l = len(s) + n += 1 + l + sovResourceCollectionService(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *UpdateCollectionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Collection != nil { + l = m.Collection.Size() + n += 1 + l + sovResourceCollectionService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func (m *ListCollectionsRequest) Size() (n int) { if m == nil { return 0 @@ -1545,7 +2176,7 @@ func (m *GetCollectionResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *CreateCollectionRequest) Unmarshal(dAtA []byte) error { +func (m *GetCollectionCountRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1568,17 +2199,174 @@ func (m *CreateCollectionRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CreateCollectionRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetCollectionCountRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CreateCollectionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetCollectionCountRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) } - var stringLen uint64 + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResourceCollectionService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthResourceCollectionService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthResourceCollectionService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Query == nil { + m.Query = &RawQuery{} + } + if err := m.Query.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipResourceCollectionService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthResourceCollectionService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetCollectionCountResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResourceCollectionService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetCollectionCountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetCollectionCountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) + } + m.Count = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResourceCollectionService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Count |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipResourceCollectionService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthResourceCollectionService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateCollectionRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResourceCollectionService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateCollectionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateCollectionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowResourceCollectionService @@ -1813,6 +2601,306 @@ func (m *CreateCollectionResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *UpdateCollectionRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResourceCollectionService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UpdateCollectionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdateCollectionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResourceCollectionService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthResourceCollectionService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthResourceCollectionService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResourceCollectionService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthResourceCollectionService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthResourceCollectionService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResourceCollectionService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthResourceCollectionService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthResourceCollectionService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceSelectors", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResourceCollectionService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthResourceCollectionService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthResourceCollectionService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceSelectors = append(m.ResourceSelectors, &storage.ResourceSelector{}) + if err := m.ResourceSelectors[len(m.ResourceSelectors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EmbeddedCollectionIds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResourceCollectionService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthResourceCollectionService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthResourceCollectionService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EmbeddedCollectionIds = append(m.EmbeddedCollectionIds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipResourceCollectionService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthResourceCollectionService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UpdateCollectionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResourceCollectionService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UpdateCollectionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdateCollectionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Collection", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResourceCollectionService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthResourceCollectionService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthResourceCollectionService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Collection == nil { + m.Collection = &storage.ResourceCollection{} + } + if err := m.Collection.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipResourceCollectionService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthResourceCollectionService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ListCollectionsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/generated/api/v1/resource_collection_service.pb.gw.go b/generated/api/v1/resource_collection_service.pb.gw.go index bc4d87a704e9a..9cbdab1fff1a4 100644 --- a/generated/api/v1/resource_collection_service.pb.gw.go +++ b/generated/api/v1/resource_collection_service.pb.gw.go @@ -105,6 +105,42 @@ func local_request_CollectionService_GetCollection_0(ctx context.Context, marsha } +var ( + filter_CollectionService_GetCollectionCount_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_CollectionService_GetCollectionCount_0(ctx context.Context, marshaler runtime.Marshaler, client CollectionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetCollectionCountRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CollectionService_GetCollectionCount_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetCollectionCount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_CollectionService_GetCollectionCount_0(ctx context.Context, marshaler runtime.Marshaler, server CollectionServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetCollectionCountRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CollectionService_GetCollectionCount_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetCollectionCount(ctx, &protoReq) + return msg, metadata, err + +} + func request_CollectionService_CreateCollection_0(ctx context.Context, marshaler runtime.Marshaler, client CollectionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq CreateCollectionRequest var metadata runtime.ServerMetadata @@ -139,6 +175,76 @@ func local_request_CollectionService_CreateCollection_0(ctx context.Context, mar } +func request_CollectionService_UpdateCollection_0(ctx context.Context, marshaler runtime.Marshaler, client CollectionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateCollectionRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := client.UpdateCollection(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_CollectionService_UpdateCollection_0(ctx context.Context, marshaler runtime.Marshaler, server CollectionServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateCollectionRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := server.UpdateCollection(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_CollectionService_ListCollections_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) @@ -258,6 +364,29 @@ func RegisterCollectionServiceHandlerServer(ctx context.Context, mux *runtime.Se }) + mux.Handle("GET", pattern_CollectionService_GetCollectionCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_CollectionService_GetCollectionCount_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_CollectionService_GetCollectionCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("POST", pattern_CollectionService_CreateCollection_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -281,6 +410,29 @@ func RegisterCollectionServiceHandlerServer(ctx context.Context, mux *runtime.Se }) + mux.Handle("POST", pattern_CollectionService_UpdateCollection_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_CollectionService_UpdateCollection_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_CollectionService_UpdateCollection_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_CollectionService_ListCollections_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -388,6 +540,26 @@ func RegisterCollectionServiceHandlerClient(ctx context.Context, mux *runtime.Se }) + mux.Handle("GET", pattern_CollectionService_GetCollectionCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_CollectionService_GetCollectionCount_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_CollectionService_GetCollectionCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("POST", pattern_CollectionService_CreateCollection_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -408,6 +580,26 @@ func RegisterCollectionServiceHandlerClient(ctx context.Context, mux *runtime.Se }) + mux.Handle("POST", pattern_CollectionService_UpdateCollection_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_CollectionService_UpdateCollection_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_CollectionService_UpdateCollection_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_CollectionService_ListCollections_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -454,8 +646,12 @@ func RegisterCollectionServiceHandlerClient(ctx context.Context, mux *runtime.Se var ( pattern_CollectionService_GetCollection_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "collections", "id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_CollectionService_GetCollectionCount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "collections", "count"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_CollectionService_CreateCollection_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "collections"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_CollectionService_UpdateCollection_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "collections", "id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_CollectionService_ListCollections_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "collections"}, "", runtime.AssumeColonVerbOpt(false))) pattern_CollectionService_DeleteCollection_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "collections", "id"}, "", runtime.AssumeColonVerbOpt(false))) @@ -464,8 +660,12 @@ var ( var ( forward_CollectionService_GetCollection_0 = runtime.ForwardResponseMessage + forward_CollectionService_GetCollectionCount_0 = runtime.ForwardResponseMessage + forward_CollectionService_CreateCollection_0 = runtime.ForwardResponseMessage + forward_CollectionService_UpdateCollection_0 = runtime.ForwardResponseMessage + forward_CollectionService_ListCollections_0 = runtime.ForwardResponseMessage forward_CollectionService_DeleteCollection_0 = runtime.ForwardResponseMessage diff --git a/generated/api/v1/resource_collection_service.swagger.json b/generated/api/v1/resource_collection_service.swagger.json index 7ae43faa337c2..e063e94a23b07 100644 --- a/generated/api/v1/resource_collection_service.swagger.json +++ b/generated/api/v1/resource_collection_service.swagger.json @@ -97,6 +97,62 @@ ] } }, + "/v1/collections/count": { + "get": { + "operationId": "CollectionService_GetCollectionCount", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetCollectionCountResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "query.query", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "query.pagination.limit", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "query.pagination.offset", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "query.pagination.sortOption.field", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "query.pagination.sortOption.reversed", + "in": "query", + "required": false, + "type": "boolean" + } + ], + "tags": [ + "CollectionService" + ] + } + }, "/v1/collections/{id}": { "get": { "operationId": "CollectionService_GetCollection", @@ -159,6 +215,42 @@ "tags": [ "CollectionService" ] + }, + "post": { + "operationId": "CollectionService_UpdateCollection", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1UpdateCollectionResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1UpdateCollectionRequest" + } + } + ], + "tags": [ + "CollectionService" + ] } } }, @@ -375,6 +467,15 @@ "v1Empty": { "type": "object" }, + "v1GetCollectionCountResponse": { + "type": "object", + "properties": { + "count": { + "type": "integer", + "format": "int32" + } + } + }, "v1GetCollectionRequestOptions": { "type": "object", "properties": { @@ -446,6 +547,40 @@ "type": "boolean" } } + }, + "v1UpdateCollectionRequest": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "resourceSelectors": { + "type": "array", + "items": { + "$ref": "#/definitions/storageResourceSelector" + } + }, + "embeddedCollectionIds": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "v1UpdateCollectionResponse": { + "type": "object", + "properties": { + "collection": { + "$ref": "#/definitions/storageResourceCollection" + } + } } } } diff --git a/proto/api/v1/resource_collection_service.proto b/proto/api/v1/resource_collection_service.proto index 50c4735ea3460..19872fedc28e4 100644 --- a/proto/api/v1/resource_collection_service.proto +++ b/proto/api/v1/resource_collection_service.proto @@ -26,6 +26,14 @@ message GetCollectionResponse { repeated storage.ListDeployment deployments = 2; } +message GetCollectionCountRequest { + RawQuery query = 1; +} + +message GetCollectionCountResponse { + int32 count = 1; +} + message CreateCollectionRequest { string name = 1; string description = 2; @@ -37,6 +45,18 @@ message CreateCollectionResponse { storage.ResourceCollection collection = 1; } +message UpdateCollectionRequest { + string id = 1; + string name = 2; + string description = 3; + repeated storage.ResourceSelector resource_selectors = 4; + repeated string embedded_collection_ids = 5; +} + +message UpdateCollectionResponse { + storage.ResourceCollection collection = 1; +} + message ListCollectionsRequest { RawQuery query = 1; } @@ -53,6 +73,12 @@ service CollectionService { }; } + rpc GetCollectionCount (GetCollectionCountRequest) returns (GetCollectionCountResponse) { + option (google.api.http) = { + get: "/v1/collections/count" + }; + } + rpc CreateCollection (CreateCollectionRequest) returns (CreateCollectionResponse) { option (google.api.http) = { post: "/v1/collections" @@ -60,6 +86,13 @@ service CollectionService { }; } + rpc UpdateCollection (UpdateCollectionRequest) returns (UpdateCollectionResponse) { + option (google.api.http) = { + post: "/v1/collections/{id}" + body: "*" + }; + } + rpc ListCollections (ListCollectionsRequest) returns (ListCollectionsResponse) { option (google.api.http) = { get: "/v1/collections"