diff --git a/.bingo/Variables.mk b/.bingo/Variables.mk index 40c7f2a99..f78ba649a 100644 --- a/.bingo/Variables.mk +++ b/.bingo/Variables.mk @@ -95,11 +95,11 @@ $(PROTOC_GEN_GO): $(BINGO_DIR)/protoc-gen-go.mod @echo "(re)installing $(GOBIN)/protoc-gen-go-v1.27.1" @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=protoc-gen-go.mod -o=$(GOBIN)/protoc-gen-go-v1.27.1 "google.golang.org/protobuf/cmd/protoc-gen-go" -PROTOC_GEN_MICRO := $(GOBIN)/protoc-gen-micro-v3.0.0-20210924081004-8c39b1e1204d +PROTOC_GEN_MICRO := $(GOBIN)/protoc-gen-micro-v3.0.0-20211012122208-f63e46a7d1e9 $(PROTOC_GEN_MICRO): $(BINGO_DIR)/protoc-gen-micro.mod @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. - @echo "(re)installing $(GOBIN)/protoc-gen-micro-v3.0.0-20210924081004-8c39b1e1204d" - @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=protoc-gen-micro.mod -o=$(GOBIN)/protoc-gen-micro-v3.0.0-20210924081004-8c39b1e1204d "github.com/asim/go-micro/cmd/protoc-gen-micro/v3" + @echo "(re)installing $(GOBIN)/protoc-gen-micro-v3.0.0-20211012122208-f63e46a7d1e9" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=protoc-gen-micro.mod -o=$(GOBIN)/protoc-gen-micro-v3.0.0-20211012122208-f63e46a7d1e9 "github.com/asim/go-micro/cmd/protoc-gen-micro/v3" PROTOC_GEN_MICROWEB := $(GOBIN)/protoc-gen-microweb-v0.0.0-20210824101557-828409dbfbf9 $(PROTOC_GEN_MICROWEB): $(BINGO_DIR)/protoc-gen-microweb.mod diff --git a/.bingo/protoc-gen-micro.mod b/.bingo/protoc-gen-micro.mod index 0d6cb3d4d..2b7880f9c 100644 --- a/.bingo/protoc-gen-micro.mod +++ b/.bingo/protoc-gen-micro.mod @@ -2,4 +2,4 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT go 1.17 -require github.com/asim/go-micro/cmd/protoc-gen-micro/v3 v3.0.0-20210924081004-8c39b1e1204d +require github.com/asim/go-micro/cmd/protoc-gen-micro/v3 v3.0.0-20211012122208-f63e46a7d1e9 diff --git a/.bingo/variables.env b/.bingo/variables.env index 9ce16567c..1628266fb 100644 --- a/.bingo/variables.env +++ b/.bingo/variables.env @@ -34,7 +34,7 @@ PROTOC_GEN_DOC="${GOBIN}/protoc-gen-doc-v1.5.0" PROTOC_GEN_GO="${GOBIN}/protoc-gen-go-v1.27.1" -PROTOC_GEN_MICRO="${GOBIN}/protoc-gen-micro-v3.0.0-20210924081004-8c39b1e1204d" +PROTOC_GEN_MICRO="${GOBIN}/protoc-gen-micro-v3.0.0-20211012122208-f63e46a7d1e9" PROTOC_GEN_MICROWEB="${GOBIN}/protoc-gen-microweb-v0.0.0-20210824101557-828409dbfbf9" diff --git a/.make/go.mk b/.make/go.mk index 9469448bd..bd3730b21 100644 --- a/.make/go.mk +++ b/.make/go.mk @@ -70,11 +70,11 @@ fmt: .PHONY: golangci-lint golangci-lint: $(GOLANGCI_LINT) - $(GOLANGCI_LINT) run -E gosec -E bodyclose -E dogsled -E durationcheck -E golint -E ifshort -E makezero -E prealloc -E predeclared --path-prefix $(NAME) + $(GOLANGCI_LINT) run -E gosec -E bodyclose -E dogsled -E durationcheck -E revive -E ifshort -E makezero -E prealloc -E predeclared --path-prefix $(NAME) .PHONY: ci-golangci-lint ci-golangci-lint: $(GOLANGCI_LINT) - $(GOLANGCI_LINT) run -E gosec -E bodyclose -E dogsled -E durationcheck -E golint -E ifshort -E makezero -E prealloc -E predeclared --path-prefix $(NAME) --timeout 10m0s --issues-exit-code 0 --out-format checkstyle > checkstyle.xml + $(GOLANGCI_LINT) run -E gosec -E bodyclose -E dogsled -E durationcheck -E revive -E ifshort -E makezero -E prealloc -E predeclared --path-prefix $(NAME) --timeout 10m0s --issues-exit-code 0 --out-format checkstyle > checkstyle.xml .PHONY: test test: diff --git a/.make/protobuf.mk b/.make/protobuf.mk index 9cfef276f..880f07ddb 100644 --- a/.make/protobuf.mk +++ b/.make/protobuf.mk @@ -3,12 +3,25 @@ protoc-gen-openapiv2: GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-openapiv2 +.PHONY: protocolbuffers-protobuf +protocolbuffers-protobuf: + GO111MODULE=off go get -v github.com/protocolbuffers/protobuf || true + +.PHONY: googleapis-protobuf +googleapis-protobuf: + GO111MODULE=off go get -v github.com/googleapis/googleapis || true + +.PHONY: gen-deps +gen-deps: protoc-gen-openapiv2 protocolbuffers-protobuf googleapis-protobuf + + .PHONY: $(PROTO_SRC)/${NAME}.pb.go -$(PROTO_SRC)/${NAME}.pb.go: $(BUF) protoc-gen-openapiv2 $(PROTOC_GEN_GO) +$(PROTO_SRC)/${NAME}.pb.go: $(BUF) gen-deps $(PROTOC_GEN_GO) @echo "$(NAME): generating $(PROTO_SRC)/${NAME}.pb.go" @$(BUF) protoc \ -I=$(PROTO_SRC)/ \ - -I=../third_party/ \ + -I=$(GOPATH)/src/github.com/protocolbuffers/protobuf/src \ + -I=$(GOPATH)/src/github.com/googleapis/googleapis \ -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway \ --plugin protoc-gen-go=$(PROTOC_GEN_GO) \ --go_out=$(PROTO_SRC) \ @@ -16,11 +29,12 @@ $(PROTO_SRC)/${NAME}.pb.go: $(BUF) protoc-gen-openapiv2 $(PROTOC_GEN_GO) $(PROTO_SRC)/${NAME}.proto .PHONY: $(PROTO_SRC)/${NAME}.pb.micro.go -$(PROTO_SRC)/${NAME}.pb.micro.go: $(BUF) protoc-gen-openapiv2 $(PROTOC_GEN_MICRO) +$(PROTO_SRC)/${NAME}.pb.micro.go: $(BUF) gen-deps $(PROTOC_GEN_MICRO) @echo "$(NAME): generating $(PROTO_SRC)/${NAME}.pb.micro.go" @$(BUF) protoc \ -I=$(PROTO_SRC)/ \ - -I=../third_party/ \ + -I=$(GOPATH)/src/github.com/protocolbuffers/protobuf/src \ + -I=$(GOPATH)/src/github.com/googleapis/googleapis \ -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway \ --plugin protoc-gen-micro=$(PROTOC_GEN_MICRO) \ --micro_out=logtostderr=true:$(PROTO_SRC) \ @@ -28,11 +42,12 @@ $(PROTO_SRC)/${NAME}.pb.micro.go: $(BUF) protoc-gen-openapiv2 $(PROTOC_GEN_MICRO $(PROTO_SRC)/${NAME}.proto .PHONY: $(PROTO_SRC)/${NAME}.pb.web.go -$(PROTO_SRC)/${NAME}.pb.web.go: $(BUF) protoc-gen-openapiv2 $(PROTOC_GEN_MICROWEB) +$(PROTO_SRC)/${NAME}.pb.web.go: $(BUF) gen-deps $(PROTOC_GEN_MICROWEB) @echo "$(NAME): generating $(PROTO_SRC)/${NAME}.pb.web.go" @$(BUF) protoc \ -I=$(PROTO_SRC)/ \ - -I=../third_party/ \ + -I=$(GOPATH)/src/github.com/protocolbuffers/protobuf/src \ + -I=$(GOPATH)/src/github.com/googleapis/googleapis \ -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway \ --plugin protoc-gen-microweb=$(PROTOC_GEN_MICROWEB) \ --microweb_out=logtostderr=true:$(PROTO_SRC) \ @@ -40,22 +55,24 @@ $(PROTO_SRC)/${NAME}.pb.web.go: $(BUF) protoc-gen-openapiv2 $(PROTOC_GEN_MICROWE $(PROTO_SRC)/${NAME}.proto .PHONY: $(PROTO_SRC)/${NAME}.swagger.json -$(PROTO_SRC)/${NAME}.swagger.json: $(BUF) protoc-gen-openapiv2 $(PROTOC_GEN_OPENAPIV2) +$(PROTO_SRC)/${NAME}.swagger.json: $(BUF) gen-deps $(PROTOC_GEN_OPENAPIV2) @echo "$(NAME): generating $(PROTO_SRC)/${NAME}.swagger.json" @$(BUF) protoc \ -I=$(PROTO_SRC)/ \ - -I=../third_party/ \ + -I=$(GOPATH)/src/github.com/protocolbuffers/protobuf/src \ + -I=$(GOPATH)/src/github.com/googleapis/googleapis \ -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway \ --plugin protoc-gen-openapiv2=$(PROTOC_GEN_OPENAPIV2) \ --openapiv2_out=logtostderr=true:$(PROTO_SRC)/ \ $(PROTO_SRC)/${NAME}.proto .PHONY: ../docs/extensions/${NAME}/grpc.md -../docs/extensions/${NAME}/grpc.md: $(BUF) protoc-gen-openapiv2 $(PROTOC_GEN_DOC) +../docs/extensions/${NAME}/grpc.md: $(BUF) gen-deps $(PROTOC_GEN_DOC) @echo "$(NAME): generating ../docs/extensions/${NAME}/grpc.md" @$(BUF) protoc \ -I=$(PROTO_SRC)/ \ - -I=../third_party/ \ + -I=$(GOPATH)/src/github.com/protocolbuffers/protobuf/src \ + -I=$(GOPATH)/src/github.com/googleapis/googleapis \ -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway \ --plugin protoc-gen-doc=$(PROTOC_GEN_DOC) \ --doc_opt=./templates/GRPC.tmpl,grpc.md \ diff --git a/CHANGELOG.md b/CHANGELOG.md index 94c321562..3b46f730c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ The following sections list the changes for unreleased. * Security - Don't expose services by default: [#2612](https://github.com/owncloud/ocis/issues/2612) * Change - Configurable default quota: [#2621](https://github.com/owncloud/ocis/issues/2621) +* Enhancement - Upgrade to go-micro v4.1.0: [#2616](https://github.com/owncloud/ocis/pull/2616) +* Enhancement - Add a middleware to authenticate public share requests: [#2536](https://github.com/owncloud/ocis/pull/2536) +* Enhancement - Report quota states: [#2628](https://github.com/owncloud/ocis/pull/2628) +* Enhancement - Update reva to v1.14.1-0.20211015144112-cddbdd4c560f: [#2536](https://github.com/owncloud/ocis/pull/2536) ## Details @@ -26,6 +30,41 @@ The following sections list the changes for unreleased. https://github.com/owncloud/ocis/issues/2621 https://jira.owncloud.com/browse/OCIS-2070 + +* Enhancement - Upgrade to go-micro v4.1.0: [#2616](https://github.com/owncloud/ocis/pull/2616) + + We've upgraded to go-micro v4.1.0 + + https://github.com/owncloud/ocis/pull/2616 + +* Enhancement - Add a middleware to authenticate public share requests: [#2536](https://github.com/owncloud/ocis/pull/2536) + + Added a new middleware to authenticate public share requests. This makes it possible to use + APIs which require an authenticated context with public shares. + + https://github.com/owncloud/ocis/issues/2479 + https://github.com/owncloud/ocis/pull/2536 + +* Enhancement - Report quota states: [#2628](https://github.com/owncloud/ocis/pull/2628) + + When listing the available spaces via the GraphAPI we now return quota states to make it easier + for the clients to add visual indicators. + + https://github.com/owncloud/ocis/pull/2628 + +* Enhancement - Update reva to v1.14.1-0.20211015144112-cddbdd4c560f: [#2536](https://github.com/owncloud/ocis/pull/2536) + + Updated reva to v1.14.1-0.20211015144112-cddbdd4c560f This update includes: * + Enhancement [cs3org/reva#2170](https://github.com/cs3org/reva/pull/2170): Handle + propfind requests for existing files * Enhancement + [cs3org/reva#2166](https://github.com/cs3org/reva/pull/2166): Allow nil quota in + decomposedfs * Enhancement + [cs3org/reva#2152](https://github.com/cs3org/reva/pull/2152): Report quota per + storage space * Enhancement + [cs3org/reva#2143](https://github.com/cs3org/reva/pull/2143): Enabling apps to work + in public shares + + https://github.com/owncloud/ocis/pull/2536 # Changelog for [1.13.0] (2021-10-13) The following sections list the changes for 1.13.0. diff --git a/accounts/pkg/command/rebuild_index.go b/accounts/pkg/command/rebuild_index.go index cffb16388..215f13c65 100644 --- a/accounts/pkg/command/rebuild_index.go +++ b/accounts/pkg/command/rebuild_index.go @@ -5,10 +5,10 @@ import ( "fmt" "github.com/asim/go-micro/plugins/client/grpc/v3" - merrors "github.com/asim/go-micro/v3/errors" "github.com/owncloud/ocis/accounts/pkg/config" index "github.com/owncloud/ocis/accounts/pkg/proto/v0" "github.com/urfave/cli/v2" + merrors "go-micro.dev/v4/errors" ) // RebuildIndex rebuilds the entire configured index. diff --git a/accounts/pkg/proto/v0/accounts.mock.go b/accounts/pkg/proto/v0/accounts.mock.go index 049e23b90..a11b49313 100644 --- a/accounts/pkg/proto/v0/accounts.mock.go +++ b/accounts/pkg/proto/v0/accounts.mock.go @@ -3,8 +3,8 @@ package proto import ( context "context" - client "github.com/asim/go-micro/v3/client" - empty "github.com/golang/protobuf/ptypes/empty" + client "go-micro.dev/v4/client" + empty "google.golang.org/protobuf/types/known/emptypb" ) // MockAccountsService can be used to write tests diff --git a/accounts/pkg/proto/v0/accounts.pb.go b/accounts/pkg/proto/v0/accounts.pb.go index e52c40e00..979d86805 100644 --- a/accounts/pkg/proto/v0/accounts.pb.go +++ b/accounts/pkg/proto/v0/accounts.pb.go @@ -7,13 +7,13 @@ package proto import ( - empty "github.com/golang/protobuf/ptypes/empty" - timestamp "github.com/golang/protobuf/ptypes/timestamp" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" _ "google.golang.org/genproto/googleapis/api/annotations" - field_mask "google.golang.org/genproto/protobuf/field_mask" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" ) @@ -113,7 +113,7 @@ type ListAccountsRequest struct { PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` // Optional. Used to specify a subset of fields that should be // returned by a get operation or modified by an update operation. - FieldMask *field_mask.FieldMask `protobuf:"bytes,3,opt,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"` + FieldMask *fieldmaskpb.FieldMask `protobuf:"bytes,3,opt,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"` // Optional. Search criteria used to select the accounts to return. // If no search criteria is specified then all accounts will be // returned @@ -183,7 +183,7 @@ func (x *ListAccountsRequest) GetPageToken() string { return "" } -func (x *ListAccountsRequest) GetFieldMask() *field_mask.FieldMask { +func (x *ListAccountsRequest) GetFieldMask() *fieldmaskpb.FieldMask { if x != nil { return x.FieldMask } @@ -361,7 +361,7 @@ type UpdateAccountRequest struct { Account *Account `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` // The update mask applies to the resource. For the `FieldMask` definition, // see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - UpdateMask *field_mask.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` } func (x *UpdateAccountRequest) Reset() { @@ -403,7 +403,7 @@ func (x *UpdateAccountRequest) GetAccount() *Account { return nil } -func (x *UpdateAccountRequest) GetUpdateMask() *field_mask.FieldMask { +func (x *UpdateAccountRequest) GetUpdateMask() *fieldmaskpb.FieldMask { if x != nil { return x.UpdateMask } @@ -516,9 +516,9 @@ type Account struct { // should we only respond with repeated strings of ids? no clients should a proper filter mask! MemberOf []*Group `protobuf:"bytes,13,rep,name=memberOf,proto3" json:"memberOf,omitempty"` // The created date of the account object. - CreatedDateTime *timestamp.Timestamp `protobuf:"bytes,16,opt,name=created_date_time,json=createdDateTime,proto3" json:"created_date_time,omitempty"` + CreatedDateTime *timestamppb.Timestamp `protobuf:"bytes,16,opt,name=created_date_time,json=createdDateTime,proto3" json:"created_date_time,omitempty"` // The date and time the user was deleted. Returned only on $select. - DeletedDateTime *timestamp.Timestamp `protobuf:"bytes,17,opt,name=deleted_date_time,json=deletedDateTime,proto3" json:"deleted_date_time,omitempty"` + DeletedDateTime *timestamppb.Timestamp `protobuf:"bytes,17,opt,name=deleted_date_time,json=deletedDateTime,proto3" json:"deleted_date_time,omitempty"` // *true* if this object is synced from an on-premises directory; // *false* if this object was originally synced from an on-premises directory but is no longer synced; // null if this object has never been synced from an on-premises directory (default). Read-only @@ -542,7 +542,7 @@ type Account struct { // The property is only populated for customers who are synchronizing their on-premises directory to ocis-accounts. Read-only. OnPremisesUserPrincipalName string `protobuf:"bytes,26,opt,name=on_premises_user_principal_name,json=onPremisesUserPrincipalName,proto3" json:"on_premises_user_principal_name,omitempty"` // Indicates the last time at which the object was synced with the on-premises directory; Read-only. - OnPremisesLastSyncDateTime *timestamp.Timestamp `protobuf:"bytes,28,opt,name=on_premises_last_sync_date_time,json=onPremisesLastSyncDateTime,proto3" json:"on_premises_last_sync_date_time,omitempty"` + OnPremisesLastSyncDateTime *timestamppb.Timestamp `protobuf:"bytes,28,opt,name=on_premises_last_sync_date_time,json=onPremisesLastSyncDateTime,proto3" json:"on_premises_last_sync_date_time,omitempty"` // Errors when using synchronization during provisioning. OnPremisesProvisioningErrors []*OnPremisesProvisioningError `protobuf:"bytes,29,rep,name=on_premises_provisioning_errors,json=onPremisesProvisioningErrors,proto3" json:"on_premises_provisioning_errors,omitempty"` // For an external user invited to the tenant using the invitation API, this property represents the invited user's invitation status. @@ -550,17 +550,17 @@ type Account struct { // Returned only on $select. Supports $filter with the supported values. For example: $filter=externalUserState eq 'PendingAcceptance'. ExternalUserState string `protobuf:"bytes,40,opt,name=external_user_state,json=externalUserState,proto3" json:"external_user_state,omitempty"` // Shows the timestamp for the latest change to the externalUserState property. Returned only on $select. - ExternalUserStateChangeDateTime *timestamp.Timestamp `protobuf:"bytes,41,opt,name=external_user_state_change_date_time,json=externalUserStateChangeDateTime,proto3" json:"external_user_state_change_date_time,omitempty"` + ExternalUserStateChangeDateTime *timestamppb.Timestamp `protobuf:"bytes,41,opt,name=external_user_state_change_date_time,json=externalUserStateChangeDateTime,proto3" json:"external_user_state_change_date_time,omitempty"` // Any refresh tokens or sessions tokens (session cookies) issued before this time are invalid, and applications will get // an error when using an invalid refresh or sessions token to acquire a delegated access token (to access APIs such as Microsoft Graph). // If this happens, the application will need to acquire a new refresh token by making a request to the authorize endpoint. // Returned only on $select. Read-only. Use invalidateAllRefreshTokens to reset. - RefreshTokensValidFromDateTime *timestamp.Timestamp `protobuf:"bytes,60,opt,name=refresh_tokens_valid_from_date_time,json=refreshTokensValidFromDateTime,proto3" json:"refresh_tokens_valid_from_date_time,omitempty"` + RefreshTokensValidFromDateTime *timestamppb.Timestamp `protobuf:"bytes,60,opt,name=refresh_tokens_valid_from_date_time,json=refreshTokensValidFromDateTime,proto3" json:"refresh_tokens_valid_from_date_time,omitempty"` // Any refresh tokens or sessions tokens (session cookies) issued before this time are invalid, and applications will get // an error when using an invalid refresh or sessions token to acquire a delegated access token (to access APIs such as Microsoft Graph). // If this happens, the application will need to acquire a new refresh token by making a request to the authorize endpoint. // Read-only. Use revokeSignInSessions to reset. - SignInSessionsValidFromDateTime *timestamp.Timestamp `protobuf:"bytes,61,opt,name=sign_in_sessions_valid_from_date_time,json=signInSessionsValidFromDateTime,proto3" json:"sign_in_sessions_valid_from_date_time,omitempty"` + SignInSessionsValidFromDateTime *timestamppb.Timestamp `protobuf:"bytes,61,opt,name=sign_in_sessions_valid_from_date_time,json=signInSessionsValidFromDateTime,proto3" json:"sign_in_sessions_valid_from_date_time,omitempty"` } func (x *Account) Reset() { @@ -686,14 +686,14 @@ func (x *Account) GetMemberOf() []*Group { return nil } -func (x *Account) GetCreatedDateTime() *timestamp.Timestamp { +func (x *Account) GetCreatedDateTime() *timestamppb.Timestamp { if x != nil { return x.CreatedDateTime } return nil } -func (x *Account) GetDeletedDateTime() *timestamp.Timestamp { +func (x *Account) GetDeletedDateTime() *timestamppb.Timestamp { if x != nil { return x.DeletedDateTime } @@ -749,7 +749,7 @@ func (x *Account) GetOnPremisesUserPrincipalName() string { return "" } -func (x *Account) GetOnPremisesLastSyncDateTime() *timestamp.Timestamp { +func (x *Account) GetOnPremisesLastSyncDateTime() *timestamppb.Timestamp { if x != nil { return x.OnPremisesLastSyncDateTime } @@ -770,21 +770,21 @@ func (x *Account) GetExternalUserState() string { return "" } -func (x *Account) GetExternalUserStateChangeDateTime() *timestamp.Timestamp { +func (x *Account) GetExternalUserStateChangeDateTime() *timestamppb.Timestamp { if x != nil { return x.ExternalUserStateChangeDateTime } return nil } -func (x *Account) GetRefreshTokensValidFromDateTime() *timestamp.Timestamp { +func (x *Account) GetRefreshTokensValidFromDateTime() *timestamppb.Timestamp { if x != nil { return x.RefreshTokensValidFromDateTime } return nil } -func (x *Account) GetSignInSessionsValidFromDateTime() *timestamp.Timestamp { +func (x *Account) GetSignInSessionsValidFromDateTime() *timestamppb.Timestamp { if x != nil { return x.SignInSessionsValidFromDateTime } @@ -883,7 +883,7 @@ type PasswordProfile struct { // The password must satisfy minimum requirements as specified by the user’s passwordPolicies property. By default, a strong password is required. Password string `protobuf:"bytes,1,opt,name=password,proto3" json:"password,omitempty"` // The time when this account last changed their password. - LastPasswordChangeDateTime *timestamp.Timestamp `protobuf:"bytes,2,opt,name=last_password_change_date_time,json=lastPasswordChangeDateTime,proto3" json:"last_password_change_date_time,omitempty"` + LastPasswordChangeDateTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=last_password_change_date_time,json=lastPasswordChangeDateTime,proto3" json:"last_password_change_date_time,omitempty"` // Specifies password policies for the user. //This value is an enumeration with one possible value being “DisableStrongPassword”, which allows weaker passwords than the default policy to be specified. // “DisablePasswordExpiration” can also be specified. @@ -933,7 +933,7 @@ func (x *PasswordProfile) GetPassword() string { return "" } -func (x *PasswordProfile) GetLastPasswordChangeDateTime() *timestamp.Timestamp { +func (x *PasswordProfile) GetLastPasswordChangeDateTime() *timestamppb.Timestamp { if x != nil { return x.LastPasswordChangeDateTime } @@ -973,7 +973,7 @@ type ListGroupsRequest struct { PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` // Optional. Used to specify a subset of fields that should be // returned by a get operation or modified by an update operation. - FieldMask *field_mask.FieldMask `protobuf:"bytes,3,opt,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"` + FieldMask *fieldmaskpb.FieldMask `protobuf:"bytes,3,opt,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"` // Optional. Search criteria used to select the groups to return. // If no search criteria is specified then all groups will be // returned @@ -1041,7 +1041,7 @@ func (x *ListGroupsRequest) GetPageToken() string { return "" } -func (x *ListGroupsRequest) GetFieldMask() *field_mask.FieldMask { +func (x *ListGroupsRequest) GetFieldMask() *fieldmaskpb.FieldMask { if x != nil { return x.FieldMask } @@ -1219,7 +1219,7 @@ type UpdateGroupRequest struct { Group *Group `protobuf:"bytes,1,opt,name=group,proto3" json:"group,omitempty"` // The update mask applies to the resource. For the `FieldMask` definition, // see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - UpdateMask *field_mask.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` } func (x *UpdateGroupRequest) Reset() { @@ -1261,7 +1261,7 @@ func (x *UpdateGroupRequest) GetGroup() *Group { return nil } -func (x *UpdateGroupRequest) GetUpdateMask() *field_mask.FieldMask { +func (x *UpdateGroupRequest) GetUpdateMask() *fieldmaskpb.FieldMask { if x != nil { return x.UpdateMask } @@ -1440,7 +1440,7 @@ type ListMembersRequest struct { PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` // Optional. Used to specify a subset of fields that should be // returned by a get operation or modified by an update operation. - FieldMask *field_mask.FieldMask `protobuf:"bytes,3,opt,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"` + FieldMask *fieldmaskpb.FieldMask `protobuf:"bytes,3,opt,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"` // Optional. Search criteria used to select the groups to return. // If no search criteria is specified then all groups will be // returned @@ -1510,7 +1510,7 @@ func (x *ListMembersRequest) GetPageToken() string { return "" } -func (x *ListMembersRequest) GetFieldMask() *field_mask.FieldMask { +func (x *ListMembersRequest) GetFieldMask() *fieldmaskpb.FieldMask { if x != nil { return x.FieldMask } @@ -1619,13 +1619,13 @@ type Group struct { GidNumber int64 `protobuf:"varint,6,opt,name=gid_number,json=gidNumber,proto3" json:"gid_number,omitempty"` // Timestamp of when the group was created. The value cannot be modified and is automatically populated when the group is created // Returned by default. Read-only. - CreatedDateTime *timestamp.Timestamp `protobuf:"bytes,7,opt,name=created_date_time,json=createdDateTime,proto3" json:"created_date_time,omitempty"` + CreatedDateTime *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=created_date_time,json=createdDateTime,proto3" json:"created_date_time,omitempty"` // For some Azure Active Directory objects (user, group, application), if the object is deleted, it is first logically deleted, and this property is updated with the date and time when the object was deleted. Otherwise this property is null. If the object is restored, this property is updated to null. // Returned by default. Read-only. - DeletedDateTime *timestamp.Timestamp `protobuf:"bytes,8,opt,name=deleted_date_time,json=deletedDateTime,proto3" json:"deleted_date_time,omitempty"` + DeletedDateTime *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=deleted_date_time,json=deletedDateTime,proto3" json:"deleted_date_time,omitempty"` // Timestamp of when the group is set to expire. The value cannot be modified and is automatically populated when the group is created. // Returned by default. Read-only. - ExpirationDateTime *timestamp.Timestamp `protobuf:"bytes,9,opt,name=expiration_date_time,json=expirationDateTime,proto3" json:"expiration_date_time,omitempty"` + ExpirationDateTime *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=expiration_date_time,json=expirationDateTime,proto3" json:"expiration_date_time,omitempty"` // True if the group is not displayed in certain parts of the Outlook user interface: // in the Address Book, in address lists for selecting message recipients, and in the Browse Groups dialog for searching groups; false otherwise. Default value is false. // Returned only on $select. @@ -1738,21 +1738,21 @@ func (x *Group) GetGidNumber() int64 { return 0 } -func (x *Group) GetCreatedDateTime() *timestamp.Timestamp { +func (x *Group) GetCreatedDateTime() *timestamppb.Timestamp { if x != nil { return x.CreatedDateTime } return nil } -func (x *Group) GetDeletedDateTime() *timestamp.Timestamp { +func (x *Group) GetDeletedDateTime() *timestamppb.Timestamp { if x != nil { return x.DeletedDateTime } return nil } -func (x *Group) GetExpirationDateTime() *timestamp.Timestamp { +func (x *Group) GetExpirationDateTime() *timestamppb.Timestamp { if x != nil { return x.ExpirationDateTime } @@ -1844,7 +1844,7 @@ type OnPremisesProvisioningError struct { // Category of the provisioning error. Note: Currently, there is only one possible value. Possible value: PropertyConflict - indicates a property value is not unique. Other objects contain the same value for the property. Category string `protobuf:"bytes,1,opt,name=category,proto3" json:"category,omitempty"` // The date and time at which the error occurred. - OccurredDateTime *timestamp.Timestamp `protobuf:"bytes,2,opt,name=occurred_date_time,json=occurredDateTime,proto3" json:"occurred_date_time,omitempty"` + OccurredDateTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=occurred_date_time,json=occurredDateTime,proto3" json:"occurred_date_time,omitempty"` // Name of the directory property causing the error. Current possible values: UserPrincipalName or ProxyAddress PropertyCausingError string `protobuf:"bytes,3,opt,name=property_causing_error,json=propertyCausingError,proto3" json:"property_causing_error,omitempty"` // Value of the property causing the error. @@ -1890,7 +1890,7 @@ func (x *OnPremisesProvisioningError) GetCategory() string { return "" } -func (x *OnPremisesProvisioningError) GetOccurredDateTime() *timestamp.Timestamp { +func (x *OnPremisesProvisioningError) GetOccurredDateTime() *timestamppb.Timestamp { if x != nil { return x.OccurredDateTime } @@ -2467,9 +2467,9 @@ var file_accounts_proto_goTypes = []interface{}{ (*ListMembersResponse)(nil), // 20: com.owncloud.ocis.accounts.v0.ListMembersResponse (*Group)(nil), // 21: com.owncloud.ocis.accounts.v0.Group (*OnPremisesProvisioningError)(nil), // 22: com.owncloud.ocis.accounts.v0.OnPremisesProvisioningError - (*field_mask.FieldMask)(nil), // 23: google.protobuf.FieldMask - (*timestamp.Timestamp)(nil), // 24: google.protobuf.Timestamp - (*empty.Empty)(nil), // 25: google.protobuf.Empty + (*fieldmaskpb.FieldMask)(nil), // 23: google.protobuf.FieldMask + (*timestamppb.Timestamp)(nil), // 24: google.protobuf.Timestamp + (*emptypb.Empty)(nil), // 25: google.protobuf.Empty } var file_accounts_proto_depIdxs = []int32{ 23, // 0: com.owncloud.ocis.accounts.v0.ListAccountsRequest.field_mask:type_name -> google.protobuf.FieldMask diff --git a/accounts/pkg/proto/v0/accounts.pb.micro.go b/accounts/pkg/proto/v0/accounts.pb.micro.go index 941ee8e4c..982966c5b 100644 --- a/accounts/pkg/proto/v0/accounts.pb.micro.go +++ b/accounts/pkg/proto/v0/accounts.pb.micro.go @@ -5,20 +5,20 @@ package proto import ( fmt "fmt" - empty "github.com/golang/protobuf/ptypes/empty" - _ "github.com/golang/protobuf/ptypes/timestamp" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" _ "google.golang.org/genproto/googleapis/api/annotations" - _ "google.golang.org/genproto/protobuf/field_mask" proto "google.golang.org/protobuf/proto" + emptypb "google.golang.org/protobuf/types/known/emptypb" + _ "google.golang.org/protobuf/types/known/fieldmaskpb" + _ "google.golang.org/protobuf/types/known/timestamppb" math "math" ) import ( context "context" - api "github.com/asim/go-micro/v3/api" - client "github.com/asim/go-micro/v3/client" - server "github.com/asim/go-micro/v3/server" + api "go-micro.dev/v4/api" + client "go-micro.dev/v4/client" + server "go-micro.dev/v4/server" ) // Reference imports to suppress errors if they are not otherwise used. @@ -86,7 +86,7 @@ type AccountsService interface { // Updates an account UpdateAccount(ctx context.Context, in *UpdateAccountRequest, opts ...client.CallOption) (*Account, error) // Deletes an account - DeleteAccount(ctx context.Context, in *DeleteAccountRequest, opts ...client.CallOption) (*empty.Empty, error) + DeleteAccount(ctx context.Context, in *DeleteAccountRequest, opts ...client.CallOption) (*emptypb.Empty, error) } type accountsService struct { @@ -141,9 +141,9 @@ func (c *accountsService) UpdateAccount(ctx context.Context, in *UpdateAccountRe return out, nil } -func (c *accountsService) DeleteAccount(ctx context.Context, in *DeleteAccountRequest, opts ...client.CallOption) (*empty.Empty, error) { +func (c *accountsService) DeleteAccount(ctx context.Context, in *DeleteAccountRequest, opts ...client.CallOption) (*emptypb.Empty, error) { req := c.c.NewRequest(c.name, "AccountsService.DeleteAccount", in) - out := new(empty.Empty) + out := new(emptypb.Empty) err := c.c.Call(ctx, req, out, opts...) if err != nil { return nil, err @@ -163,7 +163,7 @@ type AccountsServiceHandler interface { // Updates an account UpdateAccount(context.Context, *UpdateAccountRequest, *Account) error // Deletes an account - DeleteAccount(context.Context, *DeleteAccountRequest, *empty.Empty) error + DeleteAccount(context.Context, *DeleteAccountRequest, *emptypb.Empty) error } func RegisterAccountsServiceHandler(s server.Server, hdlr AccountsServiceHandler, opts ...server.HandlerOption) error { @@ -172,7 +172,7 @@ func RegisterAccountsServiceHandler(s server.Server, hdlr AccountsServiceHandler GetAccount(ctx context.Context, in *GetAccountRequest, out *Account) error CreateAccount(ctx context.Context, in *CreateAccountRequest, out *Account) error UpdateAccount(ctx context.Context, in *UpdateAccountRequest, out *Account) error - DeleteAccount(ctx context.Context, in *DeleteAccountRequest, out *empty.Empty) error + DeleteAccount(ctx context.Context, in *DeleteAccountRequest, out *emptypb.Empty) error } type AccountsService struct { accountsService @@ -236,7 +236,7 @@ func (h *accountsServiceHandler) UpdateAccount(ctx context.Context, in *UpdateAc return h.AccountsServiceHandler.UpdateAccount(ctx, in, out) } -func (h *accountsServiceHandler) DeleteAccount(ctx context.Context, in *DeleteAccountRequest, out *empty.Empty) error { +func (h *accountsServiceHandler) DeleteAccount(ctx context.Context, in *DeleteAccountRequest, out *emptypb.Empty) error { return h.AccountsServiceHandler.DeleteAccount(ctx, in, out) } @@ -315,7 +315,7 @@ type GroupsService interface { // Updates a group UpdateGroup(ctx context.Context, in *UpdateGroupRequest, opts ...client.CallOption) (*Group, error) // Deletes a group - DeleteGroup(ctx context.Context, in *DeleteGroupRequest, opts ...client.CallOption) (*empty.Empty, error) + DeleteGroup(ctx context.Context, in *DeleteGroupRequest, opts ...client.CallOption) (*emptypb.Empty, error) // group:addmember https://docs.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-1.0&tabs=http AddMember(ctx context.Context, in *AddMemberRequest, opts ...client.CallOption) (*Group, error) // group:removemember https://docs.microsoft.com/en-us/graph/api/group-delete-members?view=graph-rest-1.0 @@ -376,9 +376,9 @@ func (c *groupsService) UpdateGroup(ctx context.Context, in *UpdateGroupRequest, return out, nil } -func (c *groupsService) DeleteGroup(ctx context.Context, in *DeleteGroupRequest, opts ...client.CallOption) (*empty.Empty, error) { +func (c *groupsService) DeleteGroup(ctx context.Context, in *DeleteGroupRequest, opts ...client.CallOption) (*emptypb.Empty, error) { req := c.c.NewRequest(c.name, "GroupsService.DeleteGroup", in) - out := new(empty.Empty) + out := new(emptypb.Empty) err := c.c.Call(ctx, req, out, opts...) if err != nil { return nil, err @@ -428,7 +428,7 @@ type GroupsServiceHandler interface { // Updates a group UpdateGroup(context.Context, *UpdateGroupRequest, *Group) error // Deletes a group - DeleteGroup(context.Context, *DeleteGroupRequest, *empty.Empty) error + DeleteGroup(context.Context, *DeleteGroupRequest, *emptypb.Empty) error // group:addmember https://docs.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-1.0&tabs=http AddMember(context.Context, *AddMemberRequest, *Group) error // group:removemember https://docs.microsoft.com/en-us/graph/api/group-delete-members?view=graph-rest-1.0 @@ -443,7 +443,7 @@ func RegisterGroupsServiceHandler(s server.Server, hdlr GroupsServiceHandler, op GetGroup(ctx context.Context, in *GetGroupRequest, out *Group) error CreateGroup(ctx context.Context, in *CreateGroupRequest, out *Group) error UpdateGroup(ctx context.Context, in *UpdateGroupRequest, out *Group) error - DeleteGroup(ctx context.Context, in *DeleteGroupRequest, out *empty.Empty) error + DeleteGroup(ctx context.Context, in *DeleteGroupRequest, out *emptypb.Empty) error AddMember(ctx context.Context, in *AddMemberRequest, out *Group) error RemoveMember(ctx context.Context, in *RemoveMemberRequest, out *Group) error ListMembers(ctx context.Context, in *ListMembersRequest, out *ListMembersResponse) error @@ -531,7 +531,7 @@ func (h *groupsServiceHandler) UpdateGroup(ctx context.Context, in *UpdateGroupR return h.GroupsServiceHandler.UpdateGroup(ctx, in, out) } -func (h *groupsServiceHandler) DeleteGroup(ctx context.Context, in *DeleteGroupRequest, out *empty.Empty) error { +func (h *groupsServiceHandler) DeleteGroup(ctx context.Context, in *DeleteGroupRequest, out *emptypb.Empty) error { return h.GroupsServiceHandler.DeleteGroup(ctx, in, out) } diff --git a/accounts/pkg/proto/v0/accounts.pb.micro_test.go b/accounts/pkg/proto/v0/accounts.pb.micro_test.go index 67ea98334..96021a879 100644 --- a/accounts/pkg/proto/v0/accounts.pb.micro_test.go +++ b/accounts/pkg/proto/v0/accounts.pb.micro_test.go @@ -11,10 +11,8 @@ import ( "testing" mgrpcc "github.com/asim/go-micro/plugins/client/grpc/v3" + empty "github.com/golang/protobuf/ptypes/empty" - "github.com/asim/go-micro/v3/client" - merrors "github.com/asim/go-micro/v3/errors" - "github.com/golang/protobuf/ptypes/empty" "github.com/owncloud/ocis/accounts/pkg/command" "github.com/owncloud/ocis/accounts/pkg/config" "github.com/owncloud/ocis/accounts/pkg/proto/v0" @@ -22,6 +20,8 @@ import ( "github.com/owncloud/ocis/ocis-pkg/service/grpc" settings "github.com/owncloud/ocis/settings/pkg/proto/v0" "github.com/stretchr/testify/assert" + "go-micro.dev/v4/client" + merrors "go-micro.dev/v4/errors" "google.golang.org/genproto/protobuf/field_mask" "google.golang.org/protobuf/types/known/timestamppb" ) @@ -544,7 +544,7 @@ func TestUpdateAccount(t *testing.T) { resp, err := updateAccount(t, tt.userAccount, updateMask) if tt.expectedErrOnUpdate != nil { assert.Error(t, err) - assert.Equal(t, tt.expectedErrOnUpdate, err) + assert.Equal(t, tt.expectedErrOnUpdate.Error(), err.Error()) } else { assert.NoError(t, err) assert.IsType(t, &proto.Account{}, resp) diff --git a/accounts/pkg/server/http/server.go b/accounts/pkg/server/http/server.go index b6082c617..dc2f5e8cf 100644 --- a/accounts/pkg/server/http/server.go +++ b/accounts/pkg/server/http/server.go @@ -1,7 +1,6 @@ package http import ( - "github.com/asim/go-micro/v3" "github.com/go-chi/chi/v5" chimiddleware "github.com/go-chi/chi/v5/middleware" "github.com/owncloud/ocis/accounts/pkg/assets" @@ -10,6 +9,7 @@ import ( "github.com/owncloud/ocis/ocis-pkg/middleware" "github.com/owncloud/ocis/ocis-pkg/service/http" "github.com/owncloud/ocis/ocis-pkg/version" + "go-micro.dev/v4" ) // Server initializes the http service and server. diff --git a/accounts/pkg/service/v0/accounts.go b/accounts/pkg/service/v0/accounts.go index d15830328..37979cddf 100644 --- a/accounts/pkg/service/v0/accounts.go +++ b/accounts/pkg/service/v0/accounts.go @@ -16,8 +16,6 @@ import ( "go.opentelemetry.io/otel/attribute" - merrors "github.com/asim/go-micro/v3/errors" - "github.com/asim/go-micro/v3/metadata" "github.com/gofrs/uuid" "github.com/golang/protobuf/ptypes/empty" fieldmask_utils "github.com/mennanov/fieldmask-utils" @@ -31,6 +29,8 @@ import ( settings "github.com/owncloud/ocis/settings/pkg/proto/v0" settings_svc "github.com/owncloud/ocis/settings/pkg/service/v0" "github.com/rs/zerolog" + merrors "go-micro.dev/v4/errors" + "go-micro.dev/v4/metadata" "golang.org/x/crypto/bcrypt" "google.golang.org/genproto/protobuf/field_mask" p "google.golang.org/protobuf/proto" diff --git a/accounts/pkg/service/v0/accounts_permission_test.go b/accounts/pkg/service/v0/accounts_permission_test.go index e42bae98a..3fdc5885f 100644 --- a/accounts/pkg/service/v0/accounts_permission_test.go +++ b/accounts/pkg/service/v0/accounts_permission_test.go @@ -9,9 +9,6 @@ import ( "testing" "time" - "github.com/asim/go-micro/v3/client" - merrors "github.com/asim/go-micro/v3/errors" - "github.com/asim/go-micro/v3/metadata" "github.com/golang/protobuf/ptypes/empty" "github.com/owncloud/ocis/accounts/pkg/config" "github.com/owncloud/ocis/accounts/pkg/proto/v0" @@ -21,6 +18,9 @@ import ( settings "github.com/owncloud/ocis/settings/pkg/proto/v0" ssvc "github.com/owncloud/ocis/settings/pkg/service/v0" "github.com/stretchr/testify/assert" + "go-micro.dev/v4/client" + merrors "go-micro.dev/v4/errors" + "go-micro.dev/v4/metadata" ) const dataPath = "/var/tmp/ocis-accounts-tests" diff --git a/accounts/pkg/service/v0/groups.go b/accounts/pkg/service/v0/groups.go index 98f87212f..e69e82dc4 100644 --- a/accounts/pkg/service/v0/groups.go +++ b/accounts/pkg/service/v0/groups.go @@ -5,11 +5,11 @@ import ( "path" "strconv" - merrors "github.com/asim/go-micro/v3/errors" "github.com/gofrs/uuid" "github.com/golang/protobuf/ptypes/empty" "github.com/owncloud/ocis/accounts/pkg/proto/v0" "github.com/owncloud/ocis/accounts/pkg/storage" + merrors "go-micro.dev/v4/errors" p "google.golang.org/protobuf/proto" ) diff --git a/changelog/unreleased/go-micro-v4-1-0.md b/changelog/unreleased/go-micro-v4-1-0.md new file mode 100644 index 000000000..d4c73d8fc --- /dev/null +++ b/changelog/unreleased/go-micro-v4-1-0.md @@ -0,0 +1,5 @@ +Enhancement: Upgrade to go-micro v4.1.0 + +We've upgraded to go-micro v4.1.0 + +https://github.com/owncloud/ocis/pull/2616 diff --git a/changelog/unreleased/public-share-auth-middleware.md b/changelog/unreleased/public-share-auth-middleware.md new file mode 100644 index 000000000..566bcb845 --- /dev/null +++ b/changelog/unreleased/public-share-auth-middleware.md @@ -0,0 +1,6 @@ +Enhancement: Add a middleware to authenticate public share requests + +Added a new middleware to authenticate public share requests. This makes it possible to use APIs which require an authenticated context with public shares. + +https://github.com/owncloud/ocis/pull/2536 +https://github.com/owncloud/ocis/issues/2479 diff --git a/changelog/unreleased/report-quota-states.md b/changelog/unreleased/report-quota-states.md new file mode 100644 index 000000000..4cc6f6097 --- /dev/null +++ b/changelog/unreleased/report-quota-states.md @@ -0,0 +1,5 @@ +Enhancement: Report quota states + +When listing the available spaces via the GraphAPI we now return quota states to make it easier for the clients to add visual indicators. + +https://github.com/owncloud/ocis/pull/2628 diff --git a/changelog/unreleased/update-reva.md b/changelog/unreleased/update-reva.md new file mode 100644 index 000000000..1448f5149 --- /dev/null +++ b/changelog/unreleased/update-reva.md @@ -0,0 +1,10 @@ +Enhancement: Update reva to v1.14.1-0.20211015144112-cddbdd4c560f + +Updated reva to v1.14.1-0.20211015144112-cddbdd4c560f +This update includes: + * Enhancement [cs3org/reva#2170](https://github.com/cs3org/reva/pull/2170): Handle propfind requests for existing files + * Enhancement [cs3org/reva#2166](https://github.com/cs3org/reva/pull/2166): Allow nil quota in decomposedfs + * Enhancement [cs3org/reva#2152](https://github.com/cs3org/reva/pull/2152): Report quota per storage space + * Enhancement [cs3org/reva#2143](https://github.com/cs3org/reva/pull/2143): Enabling apps to work in public shares + +https://github.com/owncloud/ocis/pull/2536 diff --git a/glauth/pkg/server/glauth/ocis.go b/glauth/pkg/server/glauth/ocis.go index bd39717b1..4f72f618d 100644 --- a/glauth/pkg/server/glauth/ocis.go +++ b/glauth/pkg/server/glauth/ocis.go @@ -8,7 +8,6 @@ import ( "strconv" "strings" - "github.com/asim/go-micro/v3/metadata" "github.com/glauth/glauth/pkg/config" "github.com/glauth/glauth/pkg/handler" "github.com/glauth/glauth/pkg/stats" @@ -17,6 +16,7 @@ import ( accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0" "github.com/owncloud/ocis/ocis-pkg/log" "github.com/owncloud/ocis/ocis-pkg/middleware" + "go-micro.dev/v4/metadata" ) type queryType string diff --git a/go.mod b/go.mod index 8d6c719ed..b1558a79a 100644 --- a/go.mod +++ b/go.mod @@ -5,22 +5,21 @@ go 1.17 require ( github.com/CiscoM31/godata v1.0.4 github.com/GeertJohan/yubigo v0.0.0-20190917122436-175bc097e60e - github.com/asim/go-micro/plugins/client/grpc/v3 v3.0.0-20210812172626-c7195aae9817 - github.com/asim/go-micro/plugins/logger/zerolog/v3 v3.0.0-20210812172626-c7195aae9817 - github.com/asim/go-micro/plugins/registry/etcd/v3 v3.0.0-20210812172626-c7195aae9817 - github.com/asim/go-micro/plugins/registry/kubernetes/v3 v3.0.0-20210812172626-c7195aae9817 - github.com/asim/go-micro/plugins/registry/mdns/v3 v3.0.0-20210812172626-c7195aae9817 - github.com/asim/go-micro/plugins/registry/nats/v3 v3.0.0-20210812172626-c7195aae9817 - github.com/asim/go-micro/plugins/server/grpc/v3 v3.0.0-20210812172626-c7195aae9817 - github.com/asim/go-micro/plugins/server/http/v3 v3.0.0-20210812172626-c7195aae9817 - github.com/asim/go-micro/plugins/wrapper/breaker/gobreaker/v3 v3.0.0-20210812172626-c7195aae9817 - github.com/asim/go-micro/plugins/wrapper/monitoring/prometheus/v3 v3.0.0-20210812172626-c7195aae9817 - github.com/asim/go-micro/plugins/wrapper/trace/opencensus/v3 v3.0.0-20210812172626-c7195aae9817 - github.com/asim/go-micro/v3 v3.6.1-0.20210924081004-8c39b1e1204d + github.com/asim/go-micro/plugins/client/grpc/v3 v3.0.0-20211012122208-f63e46a7d1e9 + github.com/asim/go-micro/plugins/logger/zerolog/v3 v3.0.0-20211012122208-f63e46a7d1e9 + github.com/asim/go-micro/plugins/registry/etcd/v3 v3.0.0-20211012122208-f63e46a7d1e9 + github.com/asim/go-micro/plugins/registry/kubernetes/v3 v3.0.0-20211012122208-f63e46a7d1e9 + github.com/asim/go-micro/plugins/registry/mdns/v3 v3.0.0-20211012122208-f63e46a7d1e9 + github.com/asim/go-micro/plugins/registry/nats/v3 v3.0.0-20211012122208-f63e46a7d1e9 + github.com/asim/go-micro/plugins/server/grpc/v3 v3.0.0-20211012122208-f63e46a7d1e9 + github.com/asim/go-micro/plugins/server/http/v3 v3.0.0-20211012122208-f63e46a7d1e9 + github.com/asim/go-micro/plugins/wrapper/breaker/gobreaker/v3 v3.0.0-20211012122208-f63e46a7d1e9 + github.com/asim/go-micro/plugins/wrapper/monitoring/prometheus/v3 v3.0.0-20211012122208-f63e46a7d1e9 + github.com/asim/go-micro/plugins/wrapper/trace/opencensus/v3 v3.0.0-20211012122208-f63e46a7d1e9 github.com/blevesearch/bleve/v2 v2.1.0 github.com/coreos/go-oidc/v3 v3.0.0 github.com/cs3org/go-cs3apis v0.0.0-20211007101428-6d142794ec11 - github.com/cs3org/reva v1.14.1-0.20211014164014-5866f5e0f31b + github.com/cs3org/reva v1.14.1-0.20211015144112-cddbdd4c560f github.com/disintegration/imaging v1.6.2 github.com/glauth/glauth v1.1.3-0.20210729125545-b9aecdfcac31 github.com/go-chi/chi/v5 v5.0.4 @@ -57,6 +56,7 @@ require ( github.com/thejerf/suture/v4 v4.0.1 github.com/urfave/cli/v2 v2.3.0 github.com/yaegashi/msgraph.go v0.1.4 + go-micro.dev/v4 v4.1.0 go.opencensus.io v0.23.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.25.0 go.opentelemetry.io/otel v1.0.1 @@ -69,7 +69,6 @@ require ( golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84 google.golang.org/grpc v1.41.0 - google.golang.org/grpc/examples v0.0.0-20210802225658-edb9b3bc2266 // indirect google.golang.org/protobuf v1.27.1 gotest.tools/v3 v3.0.3 stash.kopano.io/kgol/rndm v1.1.1 @@ -87,6 +86,7 @@ require ( github.com/RoaringBitmap/roaring v0.7.3 // indirect github.com/acomagu/bufpipe v1.0.3 // indirect github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect + github.com/asim/go-micro/v3 v3.6.1-0.20210924081004-8c39b1e1204d // indirect github.com/aws/aws-sdk-go v1.40.46 // indirect github.com/beevik/etree v1.1.0 // indirect github.com/beorn7/perks v1.0.1 // indirect diff --git a/go.sum b/go.sum index 0a63b1ef7..c3a53fe37 100644 --- a/go.sum +++ b/go.sum @@ -128,36 +128,35 @@ github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:W github.com/asim/go-micro/plugins/broker/memory/v3 v3.0.0-20210630062103-c13bb07171bc h1:K4mquvo0DyrloQoayVZc5hfyQ8NLJCpEkYY6eB8uC5c= github.com/asim/go-micro/plugins/broker/memory/v3 v3.0.0-20210630062103-c13bb07171bc/go.mod h1:EH0EOjRcyefTt6Db72aX3My8dowi7QvTDaQc8AYqHjw= github.com/asim/go-micro/plugins/client/grpc/v3 v3.0.0-20210630062103-c13bb07171bc/go.mod h1:jXXZLUMQrZxKm4+afUcR+sH9HFuKx7SVMi6cyn+Y+OA= -github.com/asim/go-micro/plugins/client/grpc/v3 v3.0.0-20210812172626-c7195aae9817 h1:33CT4fCTFR2BwX+8Nhu9qTpPGxocgeFZVpI8R9kRanA= -github.com/asim/go-micro/plugins/client/grpc/v3 v3.0.0-20210812172626-c7195aae9817/go.mod h1:QWTqtc1jPgyOkH2CsyVyfvkut4kRbUWgvjZaw4kjpoA= -github.com/asim/go-micro/plugins/logger/zerolog/v3 v3.0.0-20210812172626-c7195aae9817 h1:eHqaQfl7sC/LkNdZHRgX7od0aMuw6HpIUpI3UzXs+Xs= -github.com/asim/go-micro/plugins/logger/zerolog/v3 v3.0.0-20210812172626-c7195aae9817/go.mod h1:ya7T2Yuv6qJHZwCb6k6hOZzRm6WbMQO+ItLxMz8zd5Q= -github.com/asim/go-micro/plugins/registry/etcd/v3 v3.0.0-20210812172626-c7195aae9817 h1:XNbCn2khMk+v8vsg4/OInTBzxvNG0Jd7r2A3qkC/T/c= -github.com/asim/go-micro/plugins/registry/etcd/v3 v3.0.0-20210812172626-c7195aae9817/go.mod h1:xenxhgwP3iAb990MTs6j50zhmkdF1+IczQn2E3TzccY= -github.com/asim/go-micro/plugins/registry/kubernetes/v3 v3.0.0-20210812172626-c7195aae9817 h1:3dY53JgFWB59A5JI9Bj+OS5dZDkIMU5meykEYx/f9Mc= -github.com/asim/go-micro/plugins/registry/kubernetes/v3 v3.0.0-20210812172626-c7195aae9817/go.mod h1:kPISqc4l6tbv9XcSvSP7Fiuo32yLSKLdsPU0e/MJGig= -github.com/asim/go-micro/plugins/registry/mdns/v3 v3.0.0-20210812172626-c7195aae9817 h1:riBkGUo8YG5L8p7yYolUS2EaWGu6tsvBclrcZQvAk/Q= -github.com/asim/go-micro/plugins/registry/mdns/v3 v3.0.0-20210812172626-c7195aae9817/go.mod h1:i1/sKiqJY/MeheoEwAKLQNl5C21i1V+Z5pCWk3Iqc2c= +github.com/asim/go-micro/plugins/client/grpc/v3 v3.0.0-20211012122208-f63e46a7d1e9 h1:0rlb2hLVDrX8QqMFUwC3RmbLaJGjMAowrdg4wcNnlyY= +github.com/asim/go-micro/plugins/client/grpc/v3 v3.0.0-20211012122208-f63e46a7d1e9/go.mod h1:ii8xtB70n5TE5GODlIuOPqb0Jqqb6JL/KPF6U4qjjtE= +github.com/asim/go-micro/plugins/logger/zerolog/v3 v3.0.0-20211012122208-f63e46a7d1e9 h1:FCIaZ2cPgRLAiBocMV4VW59UoCnnpUOJh/atTfQRoKo= +github.com/asim/go-micro/plugins/logger/zerolog/v3 v3.0.0-20211012122208-f63e46a7d1e9/go.mod h1:BlVT0y+NeKFCC39a4Tk0ekQPmGs51QFmAzKZujJrgbU= +github.com/asim/go-micro/plugins/registry/etcd/v3 v3.0.0-20211012122208-f63e46a7d1e9 h1:v7DfO7ng28RX39sZ21XlHf8r86CDVt5fYfdnn6MymrU= +github.com/asim/go-micro/plugins/registry/etcd/v3 v3.0.0-20211012122208-f63e46a7d1e9/go.mod h1:sv7OmhOfEhYl7COIqoECMMUgHiou54PqFmdW2seUlyA= +github.com/asim/go-micro/plugins/registry/kubernetes/v3 v3.0.0-20211012122208-f63e46a7d1e9 h1:0Sq9hOW5x9VOCNCuenzKccisYw0EOAK/xHPJ0Kmi1i8= +github.com/asim/go-micro/plugins/registry/kubernetes/v3 v3.0.0-20211012122208-f63e46a7d1e9/go.mod h1:hZ7FbJzElhnBom/dREeevlGTKkzRF0lP+O/czpeMOXo= +github.com/asim/go-micro/plugins/registry/mdns/v3 v3.0.0-20211012122208-f63e46a7d1e9 h1:vFRMO7ecA+9+d+atGhFuANCMw1KCP81SHKBAR6g7qR0= +github.com/asim/go-micro/plugins/registry/mdns/v3 v3.0.0-20211012122208-f63e46a7d1e9/go.mod h1:yImYTrcHuOOgcDkaiGYzLcDR8Es8Xppcl1DzD8Kzlkc= github.com/asim/go-micro/plugins/registry/memory/v3 v3.0.0-20210629124054-4929a7c16ecc/go.mod h1:Xo866hGAXEvmUgskfhtijoRspvL9OXvuzMg97n1b8qg= github.com/asim/go-micro/plugins/registry/memory/v3 v3.0.0-20210630062103-c13bb07171bc h1:tDva/ON5dAKeND5j+CSR/wr22280KdPZjOzZxUcWFL8= github.com/asim/go-micro/plugins/registry/memory/v3 v3.0.0-20210630062103-c13bb07171bc/go.mod h1:byk73o19+HiI5rX9PqFhY48v61lV8l+lnXRvRH5jlmE= -github.com/asim/go-micro/plugins/registry/nats/v3 v3.0.0-20210812172626-c7195aae9817 h1:qKOfCH4iIrZ+q2ibwmzdGf0qTuOJWsFNkg8rHvnPu9g= -github.com/asim/go-micro/plugins/registry/nats/v3 v3.0.0-20210812172626-c7195aae9817/go.mod h1:i14GDCN8JPJv00F1gD0fHssuVtOKj0LP1BWpPSBP/XE= -github.com/asim/go-micro/plugins/server/grpc/v3 v3.0.0-20210812172626-c7195aae9817 h1:BO9Rb5ZqEmDneMZMHx+WE3nez6462mrP1oLUXYbIbcA= -github.com/asim/go-micro/plugins/server/grpc/v3 v3.0.0-20210812172626-c7195aae9817/go.mod h1:E5Ogci6dKu3gz84cElAqwkxf6NW6xacGUK/cU3FCtXg= -github.com/asim/go-micro/plugins/server/http/v3 v3.0.0-20210812172626-c7195aae9817 h1:JUCV28EBwCoCMhX6Uq638g7FALpp7Mtb5nqP2J9+w2k= -github.com/asim/go-micro/plugins/server/http/v3 v3.0.0-20210812172626-c7195aae9817/go.mod h1:Q4d8FKNG51oizDCzjl84aO3pVBiA/Py3q4CEZVPaGP0= +github.com/asim/go-micro/plugins/registry/nats/v3 v3.0.0-20211012122208-f63e46a7d1e9 h1:hasnC0IkZviOhjTQr3E9zXJ2ZPvDfr8+wC5LT8ffx4g= +github.com/asim/go-micro/plugins/registry/nats/v3 v3.0.0-20211012122208-f63e46a7d1e9/go.mod h1:69LdBYNPsz1ITFC1C3PH6wcijUt5BrwJdSGY8scGbzA= +github.com/asim/go-micro/plugins/server/grpc/v3 v3.0.0-20211012122208-f63e46a7d1e9 h1:wL2U6p7dYmPE7/wcB1YnrGnW8X4Xw22KZ3Y9e2UP27k= +github.com/asim/go-micro/plugins/server/grpc/v3 v3.0.0-20211012122208-f63e46a7d1e9/go.mod h1:0Jf88ivmEEq9bu+XePGsPe0skQQndk7+p8VMm4VHTe4= +github.com/asim/go-micro/plugins/server/http/v3 v3.0.0-20211012122208-f63e46a7d1e9 h1:GiW+tuCoI59W+Uo+KgswIeKIrqfS4QKQKaJXxLyVgBg= +github.com/asim/go-micro/plugins/server/http/v3 v3.0.0-20211012122208-f63e46a7d1e9/go.mod h1:u0chGPXUE/PBqkx1E1gu1vVShu5slSrehYRSNujKLIU= github.com/asim/go-micro/plugins/transport/grpc/v3 v3.0.0-20210630062103-c13bb07171bc h1:HNwQZ8otoAsVfJT+VPZKXpPLcPvhdeLB4eZUV9C5Y+s= github.com/asim/go-micro/plugins/transport/grpc/v3 v3.0.0-20210630062103-c13bb07171bc/go.mod h1:he85vqmB3AW9k63zOfoauzYDE9slaL8WOL6vmq3vyUg= -github.com/asim/go-micro/plugins/wrapper/breaker/gobreaker/v3 v3.0.0-20210812172626-c7195aae9817 h1:sjvuBuOxj8vqPBw82HLaH+QhA0yqGSj+Y4u7802GUqQ= -github.com/asim/go-micro/plugins/wrapper/breaker/gobreaker/v3 v3.0.0-20210812172626-c7195aae9817/go.mod h1:NGJv3ZSfwWSegJuLlzXwHP0lwrVTcVWeq8DPCMKTJ7U= -github.com/asim/go-micro/plugins/wrapper/monitoring/prometheus/v3 v3.0.0-20210812172626-c7195aae9817 h1:un12pmoZEo6otiLpu07kuC2QT6R6cWrJ5MMyO8GAPSA= -github.com/asim/go-micro/plugins/wrapper/monitoring/prometheus/v3 v3.0.0-20210812172626-c7195aae9817/go.mod h1:6uRIlWjXd2uhK9OMhLc+Crbx9Hm4DlwImHd/yw0cf3I= -github.com/asim/go-micro/plugins/wrapper/trace/opencensus/v3 v3.0.0-20210812172626-c7195aae9817 h1:iJaeJKpmdZcVIa5kFE0g72C7jVopPjgpxC3ME5j/N9U= -github.com/asim/go-micro/plugins/wrapper/trace/opencensus/v3 v3.0.0-20210812172626-c7195aae9817/go.mod h1:Oh9DCQtnWmflPS26YuPjRjY8TGs+hGpyeBxv1kj8myk= +github.com/asim/go-micro/plugins/wrapper/breaker/gobreaker/v3 v3.0.0-20211012122208-f63e46a7d1e9 h1:KuNwSRQe7YtIDIF0rBfjd8gohjuEz18PCmVC2t8DCJI= +github.com/asim/go-micro/plugins/wrapper/breaker/gobreaker/v3 v3.0.0-20211012122208-f63e46a7d1e9/go.mod h1:gDYrZUHiB9vmTiu5cMpLKCv2fn7qsRGIQqAYJGqFkDo= +github.com/asim/go-micro/plugins/wrapper/monitoring/prometheus/v3 v3.0.0-20211012122208-f63e46a7d1e9 h1:CLh8mOgIv1J0+SR8Ny0bkWL/7a2olg9Pa62aGrvOLU4= +github.com/asim/go-micro/plugins/wrapper/monitoring/prometheus/v3 v3.0.0-20211012122208-f63e46a7d1e9/go.mod h1:Vo3SWZfj0HayR0h07xP218zoLkgkto54fujAIu8H94Y= +github.com/asim/go-micro/plugins/wrapper/trace/opencensus/v3 v3.0.0-20211012122208-f63e46a7d1e9 h1:EAewDo27l8kidfQQo3yTrJ64pFy8sCOaJ6I5ZRHKFOg= +github.com/asim/go-micro/plugins/wrapper/trace/opencensus/v3 v3.0.0-20211012122208-f63e46a7d1e9/go.mod h1:5mB3LtO4EUAWFz5PZaRxnC48OCSI005ySscXtRu37+M= github.com/asim/go-micro/v3 v3.5.1/go.mod h1:OJ5DnUQmoEVQTNbKRstR7/krtYJI+QaBe/XeN5MZkqE= github.com/asim/go-micro/v3 v3.5.2-0.20210629124054-4929a7c16ecc/go.mod h1:cNGIIYQcp0qy+taNYmrBdaIHeqMWHV5ZH/FfQzfOyE8= -github.com/asim/go-micro/v3 v3.5.2-0.20210630062103-c13bb07171bc/go.mod h1:cNGIIYQcp0qy+taNYmrBdaIHeqMWHV5ZH/FfQzfOyE8= github.com/asim/go-micro/v3 v3.6.1-0.20210924081004-8c39b1e1204d h1:EAmpwVkQtiT3yD286sYUs6VqZglabLq/DqfowID83F4= github.com/asim/go-micro/v3 v3.6.1-0.20210924081004-8c39b1e1204d/go.mod h1:Vr4N4czAznfz3gPqKUznocbo5l0knZRIpzh5+0Hml7I= github.com/aws/aws-sdk-go v1.20.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= @@ -291,8 +290,10 @@ github.com/crewjam/saml v0.4.5/go.mod h1:qCJQpUtZte9R1ZjUBcW8qtCNlinbO363ooNl02S github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e/go.mod h1:XJEZ3/EQuI3BXTp/6DUzFr850vlxq11I6satRtz0YQ4= github.com/cs3org/go-cs3apis v0.0.0-20211007101428-6d142794ec11 h1:cc/8fdzWdr/wAZOXb29J8bnXjo1poCMCLwhlFBlvhfI= github.com/cs3org/go-cs3apis v0.0.0-20211007101428-6d142794ec11/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= -github.com/cs3org/reva v1.14.1-0.20211014164014-5866f5e0f31b h1:IT6h3/gt83pge8hHRdb8FpIMkyrrgeEM1VF9I0RP/kA= -github.com/cs3org/reva v1.14.1-0.20211014164014-5866f5e0f31b/go.mod h1:uENdZEtDFmTRt6+d4+Ro4P5XnNL+9I6gwftHEBJzHQw= +github.com/cs3org/reva v1.14.1-0.20211015081146-2e9bc0c7714a h1:xauop9DkHYtOA3qLGmohOi0rt6WqN8+1BCWu5i/4cL4= +github.com/cs3org/reva v1.14.1-0.20211015081146-2e9bc0c7714a/go.mod h1:uENdZEtDFmTRt6+d4+Ro4P5XnNL+9I6gwftHEBJzHQw= +github.com/cs3org/reva v1.14.1-0.20211015144112-cddbdd4c560f h1:DVy9daUTEgnAP35Q5Vn5rt0FXiHwTr4vp0pecHFHA4Q= +github.com/cs3org/reva v1.14.1-0.20211015144112-cddbdd4c560f/go.mod h1:uENdZEtDFmTRt6+d4+Ro4P5XnNL+9I6gwftHEBJzHQw= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= @@ -581,6 +582,7 @@ github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB7 github.com/gorilla/schema v1.1.0 h1:CamqUDOFUBqzrvxuz2vEwo8+SUdwsluFh7IlzJh30LY= github.com/gorilla/schema v1.1.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.1.0/go.mod h1:f5nM7jw/oeRSadq3xCzHAvxcr8HZnzsqU6ILg/0NiiE= @@ -726,6 +728,7 @@ github.com/liquidweb/liquidweb-go v1.6.3/go.mod h1:SuXXp+thr28LnjEw18AYtWwIbWMHS github.com/longsleep/go-metrics v0.0.0-20170706183227-c1943bcf9047/go.mod h1:Eq9KjddJTZCHG0ja+SEJNp739Um4URrcBuccq3Ih/NI= github.com/longsleep/go-metrics v0.0.0-20191013204616-cddea569b0ea h1:Q5nKuCPF/m8xXz9oGchzSZJbGpJbb9Rm3SGBBHbBWiQ= github.com/longsleep/go-metrics v0.0.0-20191013204616-cddea569b0ea/go.mod h1:w6QO1LBkVla70FZrrF6XcB0YN+jTEYugjkn3+6RYTSM= +github.com/m3o/m3o-go/client v0.0.0-20210421144725-8bfd7992ada3/go.mod h1:vmeaYrKYpgVNhny/l7iH8mXS88S7ijUiYni3gZUrCq0= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.4/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= @@ -1139,6 +1142,8 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zenazn/goji v0.9.1-0.20160507202103-64eb34159fe5/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= +go-micro.dev/v4 v4.1.0 h1:XXZWlKhSpkQZTvPKcXRP5JvJoqbVhV+p/UUIfdVgN7E= +go-micro.dev/v4 v4.1.0/go.mod h1:XTEJj5ILOBW+2ndGDG56r8fBXZ8hmsVaIaS1K5zwj+s= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= @@ -1642,8 +1647,8 @@ google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9K google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= google.golang.org/grpc/examples v0.0.0-20210628165121-83f9def5feb3/go.mod h1:bF8wuZSAZTcbF7ZPKrDI/qY52toTP/yxLpRRY4Eu9Js= -google.golang.org/grpc/examples v0.0.0-20210802225658-edb9b3bc2266 h1:b/FwCzmdYrUG3vM0A1hqRcvWh7ZTXaGPr485CpByznI= -google.golang.org/grpc/examples v0.0.0-20210802225658-edb9b3bc2266/go.mod h1:bF8wuZSAZTcbF7ZPKrDI/qY52toTP/yxLpRRY4Eu9Js= +google.golang.org/grpc/examples v0.0.0-20210902184326-c93e472777b9 h1:nuV5/Eu1pLmXFqSuM5yYgg1z+m3f7+HC1HO1xsmCz9I= +google.golang.org/grpc/examples v0.0.0-20210902184326-c93e472777b9/go.mod h1:gID3PKrg7pWKntu9Ss6zTLJ0ttC0X9IHgREOCZwbCVU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/graph-explorer/pkg/server/http/server.go b/graph-explorer/pkg/server/http/server.go index ead6bcf7b..f8025d93a 100644 --- a/graph-explorer/pkg/server/http/server.go +++ b/graph-explorer/pkg/server/http/server.go @@ -1,12 +1,12 @@ package http import ( - "github.com/asim/go-micro/v3" chimiddleware "github.com/go-chi/chi/v5/middleware" svc "github.com/owncloud/ocis/graph-explorer/pkg/service/v0" "github.com/owncloud/ocis/ocis-pkg/middleware" "github.com/owncloud/ocis/ocis-pkg/service/http" "github.com/owncloud/ocis/ocis-pkg/version" + "go-micro.dev/v4" ) // Server initializes the http service and server. diff --git a/graph/pkg/middleware/auth.go b/graph/pkg/middleware/auth.go index dca9fafa9..ed4a2ecf6 100644 --- a/graph/pkg/middleware/auth.go +++ b/graph/pkg/middleware/auth.go @@ -61,7 +61,7 @@ func Auth(opts ...account.Option) func(http.Handler) http.Handler { errorcode.InvalidAuthenticationToken.Render(w, r, http.StatusUnauthorized, "invalid token") return } - if ok, err := scope.VerifyScope(tokenScope, r); err != nil || !ok { + if ok, err := scope.VerifyScope(ctx, tokenScope, r); err != nil || !ok { opt.Logger.Error().Err(err).Msg("verifying scope failed") errorcode.InvalidAuthenticationToken.Render(w, r, http.StatusUnauthorized, "verifying scope failed") return diff --git a/graph/pkg/server/http/server.go b/graph/pkg/server/http/server.go index d29e2778a..36f64ef3f 100644 --- a/graph/pkg/server/http/server.go +++ b/graph/pkg/server/http/server.go @@ -1,7 +1,6 @@ package http import ( - "github.com/asim/go-micro/v3" chimiddleware "github.com/go-chi/chi/v5/middleware" graphMiddleware "github.com/owncloud/ocis/graph/pkg/middleware" svc "github.com/owncloud/ocis/graph/pkg/service/v0" @@ -9,6 +8,7 @@ import ( "github.com/owncloud/ocis/ocis-pkg/middleware" "github.com/owncloud/ocis/ocis-pkg/service/http" "github.com/owncloud/ocis/ocis-pkg/version" + "go-micro.dev/v4" ) // Server initializes the http service and server. diff --git a/graph/pkg/service/v0/drives.go b/graph/pkg/service/v0/drives.go index a40288a8f..3507d68e6 100644 --- a/graph/pkg/service/v0/drives.go +++ b/graph/pkg/service/v0/drives.go @@ -452,10 +452,27 @@ func (g Graph) getDriveQuota(ctx context.Context, space *storageprovider.Storage Total: &total, Used: &used, } + state := calculateQuotaState(total, used) + qta.State = &state return qta, nil } +func calculateQuotaState(total int64, used int64) (state string) { + percent := (float64(used) / float64(total)) * 100 + + switch { + case percent <= float64(75): + return "normal" + case percent <= float64(90): + return "nearing" + case percent <= float64(99): + return "critical" + default: + return "exceeded" + } +} + func getQuota(quota *msgraph.Quota, defaultQuota string) *provider.Quota { switch { case quota != nil && quota.Total != nil: @@ -471,5 +488,4 @@ func getQuota(quota *msgraph.Quota, defaultQuota string) *provider.Quota { default: return nil } - } diff --git a/idp/pkg/server/http/server.go b/idp/pkg/server/http/server.go index 829552e66..22c38a5c2 100644 --- a/idp/pkg/server/http/server.go +++ b/idp/pkg/server/http/server.go @@ -4,12 +4,12 @@ import ( "crypto/tls" "os" - "github.com/asim/go-micro/v3" chimiddleware "github.com/go-chi/chi/v5/middleware" svc "github.com/owncloud/ocis/idp/pkg/service/v0" pkgcrypto "github.com/owncloud/ocis/ocis-pkg/crypto" "github.com/owncloud/ocis/ocis-pkg/middleware" "github.com/owncloud/ocis/ocis-pkg/service/http" + "go-micro.dev/v4" ) // Server initializes the http service and server. diff --git a/ocis-pkg/log/log.go b/ocis-pkg/log/log.go index 8b95d0fe4..043639195 100644 --- a/ocis-pkg/log/log.go +++ b/ocis-pkg/log/log.go @@ -6,11 +6,11 @@ import ( "strings" "time" - mdlog "github.com/asim/go-micro/v3/debug/log" - mlog "github.com/asim/go-micro/v3/util/log" - "github.com/asim/go-micro/v3/util/ring" "github.com/rs/zerolog" "github.com/rs/zerolog/log" + mdlog "go-micro.dev/v4/debug/log" + mlog "go-micro.dev/v4/util/log" + "go-micro.dev/v4/util/ring" ) // Logger simply wraps the zerolog logger. diff --git a/ocis-pkg/log/stream.go b/ocis-pkg/log/stream.go index 5b26ba201..0bb0fd43f 100644 --- a/ocis-pkg/log/stream.go +++ b/ocis-pkg/log/stream.go @@ -1,7 +1,7 @@ package log import ( - mdlog "github.com/asim/go-micro/v3/debug/log" + mdlog "go-micro.dev/v4/debug/log" ) type logStream struct { diff --git a/ocis-pkg/middleware/account.go b/ocis-pkg/middleware/account.go index 9d7c26d4e..2459a167a 100644 --- a/ocis-pkg/middleware/account.go +++ b/ocis-pkg/middleware/account.go @@ -7,10 +7,10 @@ import ( "github.com/cs3org/reva/pkg/auth/scope" - "github.com/asim/go-micro/v3/metadata" revactx "github.com/cs3org/reva/pkg/ctx" "github.com/cs3org/reva/pkg/token/manager/jwt" "github.com/owncloud/ocis/ocis-pkg/account" + "go-micro.dev/v4/metadata" ) // newAccountOptions initializes the available default options. @@ -60,7 +60,7 @@ func ExtractAccountUUID(opts ...account.Option) func(http.Handler) http.Handler opt.Logger.Error().Err(err) return } - if ok, err := scope.VerifyScope(tokenScope, r); err != nil || !ok { + if ok, err := scope.VerifyScope(r.Context(), tokenScope, r); err != nil || !ok { opt.Logger.Error().Err(err).Msg("verifying scope failed") return } diff --git a/ocis-pkg/registry/registry.go b/ocis-pkg/registry/registry.go index ad8d8ec18..40507fb9d 100644 --- a/ocis-pkg/registry/registry.go +++ b/ocis-pkg/registry/registry.go @@ -9,7 +9,7 @@ import ( mdnsr "github.com/asim/go-micro/plugins/registry/mdns/v3" natsr "github.com/asim/go-micro/plugins/registry/nats/v3" - "github.com/asim/go-micro/v3/registry" + "go-micro.dev/v4/registry" ) var ( diff --git a/ocis-pkg/roles/util.go b/ocis-pkg/roles/util.go index b5e7aab6f..8b5d25b8c 100644 --- a/ocis-pkg/roles/util.go +++ b/ocis-pkg/roles/util.go @@ -4,8 +4,8 @@ import ( "context" "encoding/json" - "github.com/asim/go-micro/v3/metadata" "github.com/owncloud/ocis/ocis-pkg/middleware" + "go-micro.dev/v4/metadata" ) // ReadRoleIDsFromContext extracts roleIDs from the metadata context and returns them as []string diff --git a/ocis-pkg/service/grpc/service.go b/ocis-pkg/service/grpc/service.go index edeab6c8e..5870100e5 100644 --- a/ocis-pkg/service/grpc/service.go +++ b/ocis-pkg/service/grpc/service.go @@ -9,9 +9,9 @@ import ( mbreaker "github.com/asim/go-micro/plugins/wrapper/breaker/gobreaker/v3" "github.com/asim/go-micro/plugins/wrapper/monitoring/prometheus/v3" "github.com/asim/go-micro/plugins/wrapper/trace/opencensus/v3" - "github.com/asim/go-micro/v3" - "github.com/asim/go-micro/v3/client" "github.com/owncloud/ocis/ocis-pkg/registry" + "go-micro.dev/v4" + "go-micro.dev/v4/client" ) // DefaultClient is a custom oCIS grpc configured client. diff --git a/ocis-pkg/service/http/service.go b/ocis-pkg/service/http/service.go index 82b941ddc..a7a9f8bd3 100644 --- a/ocis-pkg/service/http/service.go +++ b/ocis-pkg/service/http/service.go @@ -8,8 +8,8 @@ import ( "github.com/owncloud/ocis/ocis-pkg/registry" mhttps "github.com/asim/go-micro/plugins/server/http/v3" - "github.com/asim/go-micro/v3" - "github.com/asim/go-micro/v3/server" + "go-micro.dev/v4" + "go-micro.dev/v4/server" ) // Service simply wraps the go-micro web service. diff --git a/ocis/pkg/command/version.go b/ocis/pkg/command/version.go index 25eeeba60..21d762b59 100644 --- a/ocis/pkg/command/version.go +++ b/ocis/pkg/command/version.go @@ -4,12 +4,12 @@ import ( "fmt" "os" - mreg "github.com/asim/go-micro/v3/registry" tw "github.com/olekukonko/tablewriter" "github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/registry" "github.com/owncloud/ocis/ocis/pkg/register" "github.com/urfave/cli/v2" + mreg "go-micro.dev/v4/registry" ) // VersionCommand is the entrypoint for the version command. diff --git a/ocis/pkg/runtime/service/service.go b/ocis/pkg/runtime/service/service.go index 6ff29a158..28cd652b5 100644 --- a/ocis/pkg/runtime/service/service.go +++ b/ocis/pkg/runtime/service/service.go @@ -14,7 +14,6 @@ import ( "time" mzlog "github.com/asim/go-micro/plugins/logger/zerolog/v3" - "github.com/asim/go-micro/v3/logger" "github.com/mohae/deepcopy" "github.com/olekukonko/tablewriter" accounts "github.com/owncloud/ocis/accounts/pkg/command" @@ -35,6 +34,7 @@ import ( webdav "github.com/owncloud/ocis/webdav/pkg/command" "github.com/rs/zerolog" "github.com/thejerf/suture/v4" + "go-micro.dev/v4/logger" ) var ( diff --git a/ocs/pkg/server/http/server.go b/ocs/pkg/server/http/server.go index 3ac61f4fa..34eea8674 100644 --- a/ocs/pkg/server/http/server.go +++ b/ocs/pkg/server/http/server.go @@ -1,12 +1,12 @@ package http import ( - "github.com/asim/go-micro/v3" chimiddleware "github.com/go-chi/chi/v5/middleware" "github.com/owncloud/ocis/ocis-pkg/middleware" "github.com/owncloud/ocis/ocis-pkg/service/http" ocsmw "github.com/owncloud/ocis/ocs/pkg/middleware" svc "github.com/owncloud/ocis/ocs/pkg/service/v0" + "go-micro.dev/v4" ) // Server initializes the http service and server. diff --git a/ocs/pkg/server/http/svc_test.go b/ocs/pkg/server/http/svc_test.go index 7c46558f0..baad2067a 100644 --- a/ocs/pkg/server/http/svc_test.go +++ b/ocs/pkg/server/http/svc_test.go @@ -14,7 +14,6 @@ import ( "strings" "testing" - "github.com/asim/go-micro/v3/client" user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" "github.com/cs3org/reva/pkg/auth/scope" @@ -32,6 +31,7 @@ import ( settings "github.com/owncloud/ocis/settings/pkg/proto/v0" ssvc "github.com/owncloud/ocis/settings/pkg/service/v0" "github.com/stretchr/testify/assert" + "go-micro.dev/v4/client" ) const ( diff --git a/ocs/pkg/service/v0/groups.go b/ocs/pkg/service/v0/groups.go index a019663e4..e98e29117 100644 --- a/ocs/pkg/service/v0/groups.go +++ b/ocs/pkg/service/v0/groups.go @@ -9,7 +9,6 @@ import ( "regexp" "strconv" - merrors "github.com/asim/go-micro/v3/errors" revactx "github.com/cs3org/reva/pkg/ctx" "github.com/go-chi/chi/v5" "github.com/go-chi/render" @@ -17,6 +16,7 @@ import ( "github.com/owncloud/ocis/ocs/pkg/service/v0/data" "github.com/owncloud/ocis/ocs/pkg/service/v0/response" ocstracing "github.com/owncloud/ocis/ocs/pkg/tracing" + merrors "go-micro.dev/v4/errors" "go.opentelemetry.io/otel/attribute" ) diff --git a/ocs/pkg/service/v0/users.go b/ocs/pkg/service/v0/users.go index 1a7fc01f4..036efc6fb 100644 --- a/ocs/pkg/service/v0/users.go +++ b/ocs/pkg/service/v0/users.go @@ -10,7 +10,6 @@ import ( "strings" "github.com/asim/go-micro/plugins/client/grpc/v3" - merrors "github.com/asim/go-micro/v3/errors" gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1" revauser "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" rpcv1beta1 "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" @@ -27,6 +26,7 @@ import ( ocstracing "github.com/owncloud/ocis/ocs/pkg/tracing" storepb "github.com/owncloud/ocis/store/pkg/proto/v0" "github.com/pkg/errors" + merrors "go-micro.dev/v4/errors" "google.golang.org/genproto/protobuf/field_mask" "google.golang.org/grpc/metadata" "google.golang.org/protobuf/types/known/fieldmaskpb" diff --git a/proxy/pkg/command/server.go b/proxy/pkg/command/server.go index 01cdb6bbf..8b4341103 100644 --- a/proxy/pkg/command/server.go +++ b/proxy/pkg/command/server.go @@ -147,7 +147,7 @@ func Server(cfg *config.Config) *cli.Command { } } -func loadMiddlewares(ctx context.Context, l log.Logger, cfg *config.Config) alice.Chain { +func loadMiddlewares(ctx context.Context, logger log.Logger, cfg *config.Config) alice.Chain { rolesClient := settings.NewRoleService("com.owncloud.api.settings", grpc.DefaultClient) revaClient, err := cs3.GetGatewayServiceClient(cfg.Reva.Address) var userProvider backend.UserBackend @@ -158,7 +158,7 @@ func loadMiddlewares(ctx context.Context, l log.Logger, cfg *config.Config) alic "expires": int64(24 * 60 * 60), }) if err != nil { - l.Error().Err(err). + logger.Error().Err(err). Msg("Failed to create token manager") } userProvider = backend.NewAccountsServiceUserBackend( @@ -166,17 +166,17 @@ func loadMiddlewares(ctx context.Context, l log.Logger, cfg *config.Config) alic rolesClient, cfg.OIDC.Issuer, tokenManager, - l, + logger, ) case "cs3": - userProvider = backend.NewCS3UserBackend(rolesClient, revaClient, cfg.MachineAuthAPIKey, l) + userProvider = backend.NewCS3UserBackend(rolesClient, revaClient, cfg.MachineAuthAPIKey, logger) default: - l.Fatal().Msgf("Invalid accounts backend type '%s'", cfg.AccountBackend) + logger.Fatal().Msgf("Invalid accounts backend type '%s'", cfg.AccountBackend) } storeClient := storepb.NewStoreService("com.owncloud.api.store", grpc.DefaultClient) if err != nil { - l.Error().Err(err). + logger.Error().Err(err). Str("gateway", cfg.Reva.Address). Msg("Failed to create reva gateway service client") } @@ -196,7 +196,7 @@ func loadMiddlewares(ctx context.Context, l log.Logger, cfg *config.Config) alic pkgmiddleware.TraceContext, chimiddleware.RealIP, chimiddleware.RequestID, - middleware.AccessLog(l), + middleware.AccessLog(logger), middleware.HTTPSRedirect, // now that we established the basics, on with authentication middleware @@ -216,20 +216,20 @@ func loadMiddlewares(ctx context.Context, l log.Logger, cfg *config.Config) alic middleware.TokenCacheTTL(time.Second*time.Duration(cfg.OIDC.UserinfoCache.TTL)), // basic Options - middleware.Logger(l), + middleware.Logger(logger), middleware.EnableBasicAuth(cfg.EnableBasicAuth), middleware.UserProvider(userProvider), middleware.OIDCIss(cfg.OIDC.Issuer), middleware.CredentialsByUserAgent(cfg.Reva.Middleware.Auth.CredentialsByUserAgent), ), middleware.SignedURLAuth( - middleware.Logger(l), + middleware.Logger(logger), middleware.PreSignedURLConfig(cfg.PreSignedURL), middleware.UserProvider(userProvider), middleware.Store(storeClient), ), middleware.AccountResolver( - middleware.Logger(l), + middleware.Logger(logger), middleware.UserProvider(userProvider), middleware.TokenManagerConfig(cfg.TokenManager), middleware.UserOIDCClaim(cfg.UserOIDCClaim), @@ -238,17 +238,21 @@ func loadMiddlewares(ctx context.Context, l log.Logger, cfg *config.Config) alic ), middleware.SelectorCookie( - middleware.Logger(l), + middleware.Logger(logger), middleware.UserProvider(userProvider), middleware.PolicySelectorConfig(*cfg.PolicySelector), ), // finally, trigger home creation when a user logs in middleware.CreateHome( - middleware.Logger(l), + middleware.Logger(logger), middleware.TokenManagerConfig(cfg.TokenManager), middleware.RevaGatewayClient(revaClient), ), + middleware.PublicShareAuth( + middleware.Logger(logger), + middleware.RevaGatewayClient(revaClient), + ), ) } diff --git a/proxy/pkg/middleware/public_share_auth.go b/proxy/pkg/middleware/public_share_auth.go new file mode 100644 index 000000000..32e0fc004 --- /dev/null +++ b/proxy/pkg/middleware/public_share_auth.go @@ -0,0 +1,56 @@ +package middleware + +import ( + "net/http" + + gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1" +) + +const ( + headerRevaAccessToken = "x-access-token" + headerShareToken = "public-token" + basicAuthPasswordPrefix = "basic|" + authenticationType = "publicshares" +) + +// PublicShareAuth ... +func PublicShareAuth(opts ...Option) func(next http.Handler) http.Handler { + options := newOptions(opts...) + logger := options.Logger + + return func(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // Currently we only want to authenticate app open request coming from public shares. + shareToken := r.Header.Get(headerShareToken) + if shareToken == "" { + // Don't authenticate + next.ServeHTTP(w, r) + return + } + + // We can ignore the username since it is always set to "public" in public shares. + _, password, ok := r.BasicAuth() + + sharePassword := basicAuthPasswordPrefix + if ok { + sharePassword += password + } + + authResp, err := options.RevaGatewayClient.Authenticate(r.Context(), &gateway.AuthenticateRequest{ + Type: authenticationType, + ClientId: shareToken, + ClientSecret: sharePassword, + }) + + if err != nil { + logger.Debug().Err(err).Str("public_share_token", shareToken).Msg("could not authenticate public share") + // try another middleware + next.ServeHTTP(w, r) + return + } + + r.Header.Add(headerRevaAccessToken, authResp.Token) + next.ServeHTTP(w, r) + }) + } +} diff --git a/proxy/pkg/proxy/policy/selector_test.go b/proxy/pkg/proxy/policy/selector_test.go index a4ded5773..d48566c0f 100644 --- a/proxy/pkg/proxy/policy/selector_test.go +++ b/proxy/pkg/proxy/policy/selector_test.go @@ -7,12 +7,12 @@ import ( "net/http/httptest" "testing" - "github.com/asim/go-micro/v3/client" userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" revactx "github.com/cs3org/reva/pkg/ctx" "github.com/owncloud/ocis/accounts/pkg/proto/v0" "github.com/owncloud/ocis/ocis-pkg/oidc" "github.com/owncloud/ocis/proxy/pkg/config" + "go-micro.dev/v4/client" ) func TestLoadSelector(t *testing.T) { diff --git a/proxy/pkg/server/http/server.go b/proxy/pkg/server/http/server.go index 9725a63e4..a403f630d 100644 --- a/proxy/pkg/server/http/server.go +++ b/proxy/pkg/server/http/server.go @@ -4,9 +4,9 @@ import ( "crypto/tls" "os" - "github.com/asim/go-micro/v3" pkgcrypto "github.com/owncloud/ocis/ocis-pkg/crypto" svc "github.com/owncloud/ocis/ocis-pkg/service/http" + "go-micro.dev/v4" ) // Server initializes the http service and server. diff --git a/proxy/pkg/user/backend/accounts_test.go b/proxy/pkg/user/backend/accounts_test.go index 57e652def..ed2a33b66 100644 --- a/proxy/pkg/user/backend/accounts_test.go +++ b/proxy/pkg/user/backend/accounts_test.go @@ -4,7 +4,6 @@ import ( "context" "testing" - "github.com/asim/go-micro/v3/client" userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" "github.com/cs3org/reva/pkg/token/manager/jwt" accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0" @@ -13,6 +12,7 @@ import ( settings "github.com/owncloud/ocis/settings/pkg/proto/v0" "github.com/rs/zerolog" "github.com/stretchr/testify/assert" + "go-micro.dev/v4/client" ) var mockAccResp = []*accounts.Account{ diff --git a/settings/.golangci.yml b/settings/.golangci.yml index 1104c30ff..4bb1586f7 100644 --- a/settings/.golangci.yml +++ b/settings/.golangci.yml @@ -26,7 +26,7 @@ linters: - unused - varcheck - depguard - - golint + - revive - goimports - unconvert - scopelint diff --git a/settings/pkg/proto/v0/settings.mock.go b/settings/pkg/proto/v0/settings.mock.go index d33f33200..060ded41d 100644 --- a/settings/pkg/proto/v0/settings.mock.go +++ b/settings/pkg/proto/v0/settings.mock.go @@ -3,8 +3,8 @@ package proto import ( "context" - "github.com/asim/go-micro/v3/client" - "github.com/golang/protobuf/ptypes/empty" + "go-micro.dev/v4/client" + "google.golang.org/protobuf/types/known/emptypb" ) // MockBundleService can be used to write tests against the bundle service. @@ -40,7 +40,7 @@ type MockBundleService struct { GetBundleFunc func(ctx context.Context, req *GetBundleRequest, opts ...client.CallOption) (*GetBundleResponse, error) SaveBundleFunc func(ctx context.Context, req *SaveBundleRequest, opts ...client.CallOption) (*SaveBundleResponse, error) AddSettingToBundleFunc func(ctx context.Context, req *AddSettingToBundleRequest, opts ...client.CallOption) (*AddSettingToBundleResponse, error) - RemoveSettingFromBundleFunc func(ctx context.Context, req *RemoveSettingFromBundleRequest, opts ...client.CallOption) (*empty.Empty, error) + RemoveSettingFromBundleFunc func(ctx context.Context, req *RemoveSettingFromBundleRequest, opts ...client.CallOption) (*emptypb.Empty, error) } // ListBundles will panic if the function has been called, but not mocked @@ -76,7 +76,7 @@ func (m MockBundleService) AddSettingToBundle(ctx context.Context, req *AddSetti } // RemoveSettingFromBundle will panic if the function has been called, but not mocked -func (m MockBundleService) RemoveSettingFromBundle(ctx context.Context, req *RemoveSettingFromBundleRequest, opts ...client.CallOption) (*empty.Empty, error) { +func (m MockBundleService) RemoveSettingFromBundle(ctx context.Context, req *RemoveSettingFromBundleRequest, opts ...client.CallOption) (*emptypb.Empty, error) { if m.RemoveSettingFromBundleFunc != nil { return m.RemoveSettingFromBundleFunc(ctx, req, opts...) } @@ -128,7 +128,7 @@ type MockRoleService struct { ListRolesFunc func(ctx context.Context, req *ListBundlesRequest, opts ...client.CallOption) (*ListBundlesResponse, error) ListRoleAssignmentsFunc func(ctx context.Context, req *ListRoleAssignmentsRequest, opts ...client.CallOption) (*ListRoleAssignmentsResponse, error) AssignRoleToUserFunc func(ctx context.Context, req *AssignRoleToUserRequest, opts ...client.CallOption) (*AssignRoleToUserResponse, error) - RemoveRoleFromUserFunc func(ctx context.Context, req *RemoveRoleFromUserRequest, opts ...client.CallOption) (*empty.Empty, error) + RemoveRoleFromUserFunc func(ctx context.Context, req *RemoveRoleFromUserRequest, opts ...client.CallOption) (*emptypb.Empty, error) } // ListRoles will panic if the function has been called, but not mocked @@ -156,7 +156,7 @@ func (m MockRoleService) AssignRoleToUser(ctx context.Context, req *AssignRoleTo } // RemoveRoleFromUser will panic if the function has been called, but not mocked -func (m MockRoleService) RemoveRoleFromUser(ctx context.Context, req *RemoveRoleFromUserRequest, opts ...client.CallOption) (*empty.Empty, error) { +func (m MockRoleService) RemoveRoleFromUser(ctx context.Context, req *RemoveRoleFromUserRequest, opts ...client.CallOption) (*emptypb.Empty, error) { if m.RemoveRoleFromUserFunc != nil { return m.RemoveRoleFromUserFunc(ctx, req, opts...) } diff --git a/settings/pkg/proto/v0/settings.pb.go b/settings/pkg/proto/v0/settings.pb.go index 07917634f..214ce6da2 100644 --- a/settings/pkg/proto/v0/settings.pb.go +++ b/settings/pkg/proto/v0/settings.pb.go @@ -7,11 +7,11 @@ package proto import ( - empty "github.com/golang/protobuf/ptypes/empty" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" reflect "reflect" sync "sync" ) @@ -3285,7 +3285,7 @@ var file_settings_proto_goTypes = []interface{}{ (*Value)(nil), // 42: com.owncloud.ocis.settings.v0.Value (*ListValue)(nil), // 43: com.owncloud.ocis.settings.v0.ListValue (*ListOptionValue)(nil), // 44: com.owncloud.ocis.settings.v0.ListOptionValue - (*empty.Empty)(nil), // 45: google.protobuf.Empty + (*emptypb.Empty)(nil), // 45: google.protobuf.Empty } var file_settings_proto_depIdxs = []int32{ 33, // 0: com.owncloud.ocis.settings.v0.SaveBundleRequest.bundle:type_name -> com.owncloud.ocis.settings.v0.Bundle diff --git a/settings/pkg/proto/v0/settings.pb.micro.go b/settings/pkg/proto/v0/settings.pb.micro.go index 6742ec087..ac1a3c883 100644 --- a/settings/pkg/proto/v0/settings.pb.micro.go +++ b/settings/pkg/proto/v0/settings.pb.micro.go @@ -5,18 +5,18 @@ package proto import ( fmt "fmt" - empty "github.com/golang/protobuf/ptypes/empty" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" _ "google.golang.org/genproto/googleapis/api/annotations" proto "google.golang.org/protobuf/proto" + emptypb "google.golang.org/protobuf/types/known/emptypb" math "math" ) import ( context "context" - api "github.com/asim/go-micro/v3/api" - client "github.com/asim/go-micro/v3/client" - server "github.com/asim/go-micro/v3/server" + api "go-micro.dev/v4/api" + client "go-micro.dev/v4/client" + server "go-micro.dev/v4/server" ) // Reference imports to suppress errors if they are not otherwise used. @@ -79,7 +79,7 @@ type BundleService interface { GetBundle(ctx context.Context, in *GetBundleRequest, opts ...client.CallOption) (*GetBundleResponse, error) ListBundles(ctx context.Context, in *ListBundlesRequest, opts ...client.CallOption) (*ListBundlesResponse, error) AddSettingToBundle(ctx context.Context, in *AddSettingToBundleRequest, opts ...client.CallOption) (*AddSettingToBundleResponse, error) - RemoveSettingFromBundle(ctx context.Context, in *RemoveSettingFromBundleRequest, opts ...client.CallOption) (*empty.Empty, error) + RemoveSettingFromBundle(ctx context.Context, in *RemoveSettingFromBundleRequest, opts ...client.CallOption) (*emptypb.Empty, error) } type bundleService struct { @@ -134,9 +134,9 @@ func (c *bundleService) AddSettingToBundle(ctx context.Context, in *AddSettingTo return out, nil } -func (c *bundleService) RemoveSettingFromBundle(ctx context.Context, in *RemoveSettingFromBundleRequest, opts ...client.CallOption) (*empty.Empty, error) { +func (c *bundleService) RemoveSettingFromBundle(ctx context.Context, in *RemoveSettingFromBundleRequest, opts ...client.CallOption) (*emptypb.Empty, error) { req := c.c.NewRequest(c.name, "BundleService.RemoveSettingFromBundle", in) - out := new(empty.Empty) + out := new(emptypb.Empty) err := c.c.Call(ctx, req, out, opts...) if err != nil { return nil, err @@ -151,7 +151,7 @@ type BundleServiceHandler interface { GetBundle(context.Context, *GetBundleRequest, *GetBundleResponse) error ListBundles(context.Context, *ListBundlesRequest, *ListBundlesResponse) error AddSettingToBundle(context.Context, *AddSettingToBundleRequest, *AddSettingToBundleResponse) error - RemoveSettingFromBundle(context.Context, *RemoveSettingFromBundleRequest, *empty.Empty) error + RemoveSettingFromBundle(context.Context, *RemoveSettingFromBundleRequest, *emptypb.Empty) error } func RegisterBundleServiceHandler(s server.Server, hdlr BundleServiceHandler, opts ...server.HandlerOption) error { @@ -160,7 +160,7 @@ func RegisterBundleServiceHandler(s server.Server, hdlr BundleServiceHandler, op GetBundle(ctx context.Context, in *GetBundleRequest, out *GetBundleResponse) error ListBundles(ctx context.Context, in *ListBundlesRequest, out *ListBundlesResponse) error AddSettingToBundle(ctx context.Context, in *AddSettingToBundleRequest, out *AddSettingToBundleResponse) error - RemoveSettingFromBundle(ctx context.Context, in *RemoveSettingFromBundleRequest, out *empty.Empty) error + RemoveSettingFromBundle(ctx context.Context, in *RemoveSettingFromBundleRequest, out *emptypb.Empty) error } type BundleService struct { bundleService @@ -224,7 +224,7 @@ func (h *bundleServiceHandler) AddSettingToBundle(ctx context.Context, in *AddSe return h.BundleServiceHandler.AddSettingToBundle(ctx, in, out) } -func (h *bundleServiceHandler) RemoveSettingFromBundle(ctx context.Context, in *RemoveSettingFromBundleRequest, out *empty.Empty) error { +func (h *bundleServiceHandler) RemoveSettingFromBundle(ctx context.Context, in *RemoveSettingFromBundleRequest, out *emptypb.Empty) error { return h.BundleServiceHandler.RemoveSettingFromBundle(ctx, in, out) } @@ -436,7 +436,7 @@ type RoleService interface { ListRoles(ctx context.Context, in *ListBundlesRequest, opts ...client.CallOption) (*ListBundlesResponse, error) ListRoleAssignments(ctx context.Context, in *ListRoleAssignmentsRequest, opts ...client.CallOption) (*ListRoleAssignmentsResponse, error) AssignRoleToUser(ctx context.Context, in *AssignRoleToUserRequest, opts ...client.CallOption) (*AssignRoleToUserResponse, error) - RemoveRoleFromUser(ctx context.Context, in *RemoveRoleFromUserRequest, opts ...client.CallOption) (*empty.Empty, error) + RemoveRoleFromUser(ctx context.Context, in *RemoveRoleFromUserRequest, opts ...client.CallOption) (*emptypb.Empty, error) } type roleService struct { @@ -481,9 +481,9 @@ func (c *roleService) AssignRoleToUser(ctx context.Context, in *AssignRoleToUser return out, nil } -func (c *roleService) RemoveRoleFromUser(ctx context.Context, in *RemoveRoleFromUserRequest, opts ...client.CallOption) (*empty.Empty, error) { +func (c *roleService) RemoveRoleFromUser(ctx context.Context, in *RemoveRoleFromUserRequest, opts ...client.CallOption) (*emptypb.Empty, error) { req := c.c.NewRequest(c.name, "RoleService.RemoveRoleFromUser", in) - out := new(empty.Empty) + out := new(emptypb.Empty) err := c.c.Call(ctx, req, out, opts...) if err != nil { return nil, err @@ -497,7 +497,7 @@ type RoleServiceHandler interface { ListRoles(context.Context, *ListBundlesRequest, *ListBundlesResponse) error ListRoleAssignments(context.Context, *ListRoleAssignmentsRequest, *ListRoleAssignmentsResponse) error AssignRoleToUser(context.Context, *AssignRoleToUserRequest, *AssignRoleToUserResponse) error - RemoveRoleFromUser(context.Context, *RemoveRoleFromUserRequest, *empty.Empty) error + RemoveRoleFromUser(context.Context, *RemoveRoleFromUserRequest, *emptypb.Empty) error } func RegisterRoleServiceHandler(s server.Server, hdlr RoleServiceHandler, opts ...server.HandlerOption) error { @@ -505,7 +505,7 @@ func RegisterRoleServiceHandler(s server.Server, hdlr RoleServiceHandler, opts . ListRoles(ctx context.Context, in *ListBundlesRequest, out *ListBundlesResponse) error ListRoleAssignments(ctx context.Context, in *ListRoleAssignmentsRequest, out *ListRoleAssignmentsResponse) error AssignRoleToUser(ctx context.Context, in *AssignRoleToUserRequest, out *AssignRoleToUserResponse) error - RemoveRoleFromUser(ctx context.Context, in *RemoveRoleFromUserRequest, out *empty.Empty) error + RemoveRoleFromUser(ctx context.Context, in *RemoveRoleFromUserRequest, out *emptypb.Empty) error } type RoleService struct { roleService @@ -558,7 +558,7 @@ func (h *roleServiceHandler) AssignRoleToUser(ctx context.Context, in *AssignRol return h.RoleServiceHandler.AssignRoleToUser(ctx, in, out) } -func (h *roleServiceHandler) RemoveRoleFromUser(ctx context.Context, in *RemoveRoleFromUserRequest, out *empty.Empty) error { +func (h *roleServiceHandler) RemoveRoleFromUser(ctx context.Context, in *RemoveRoleFromUserRequest, out *emptypb.Empty) error { return h.RoleServiceHandler.RemoveRoleFromUser(ctx, in, out) } diff --git a/settings/pkg/proto/v0/settings.pb.micro_test.go b/settings/pkg/proto/v0/settings.pb.micro_test.go index 28c24e253..8e9e26c31 100644 --- a/settings/pkg/proto/v0/settings.pb.micro_test.go +++ b/settings/pkg/proto/v0/settings.pb.micro_test.go @@ -9,8 +9,6 @@ import ( "os" "testing" - merrors "github.com/asim/go-micro/v3/errors" - "github.com/asim/go-micro/v3/metadata" ocislog "github.com/owncloud/ocis/ocis-pkg/log" "github.com/owncloud/ocis/ocis-pkg/middleware" "github.com/owncloud/ocis/ocis-pkg/service/grpc" @@ -19,6 +17,8 @@ import ( svc "github.com/owncloud/ocis/settings/pkg/service/v0" store "github.com/owncloud/ocis/settings/pkg/store/filesystem" "github.com/stretchr/testify/assert" + merrors "go-micro.dev/v4/errors" + "go-micro.dev/v4/metadata" ) var ( diff --git a/settings/pkg/server/http/server.go b/settings/pkg/server/http/server.go index 17595078e..238d3a2c7 100644 --- a/settings/pkg/server/http/server.go +++ b/settings/pkg/server/http/server.go @@ -1,7 +1,6 @@ package http import ( - "github.com/asim/go-micro/v3" "github.com/go-chi/chi/v5" chimiddleware "github.com/go-chi/chi/v5/middleware" "github.com/owncloud/ocis/ocis-pkg/account" @@ -11,6 +10,7 @@ import ( "github.com/owncloud/ocis/settings/pkg/assets" "github.com/owncloud/ocis/settings/pkg/proto/v0" svc "github.com/owncloud/ocis/settings/pkg/service/v0" + "go-micro.dev/v4" ) // Server initializes the http service and server. diff --git a/settings/pkg/service/v0/service.go b/settings/pkg/service/v0/service.go index a9614c454..6dbf8cda7 100644 --- a/settings/pkg/service/v0/service.go +++ b/settings/pkg/service/v0/service.go @@ -4,9 +4,6 @@ import ( "context" "fmt" - merrors "github.com/asim/go-micro/v3/errors" - "github.com/asim/go-micro/v3/metadata" - "github.com/golang/protobuf/ptypes/empty" "github.com/owncloud/ocis/ocis-pkg/log" "github.com/owncloud/ocis/ocis-pkg/middleware" "github.com/owncloud/ocis/ocis-pkg/roles" @@ -14,6 +11,9 @@ import ( "github.com/owncloud/ocis/settings/pkg/proto/v0" "github.com/owncloud/ocis/settings/pkg/settings" store "github.com/owncloud/ocis/settings/pkg/store/filesystem" + merrors "go-micro.dev/v4/errors" + "go-micro.dev/v4/metadata" + "google.golang.org/protobuf/types/known/emptypb" ) // Service represents a service. @@ -190,7 +190,7 @@ func (g Service) AddSettingToBundle(ctx context.Context, req *proto.AddSettingTo } // RemoveSettingFromBundle implements the BundleServiceHandler interface -func (g Service) RemoveSettingFromBundle(ctx context.Context, req *proto.RemoveSettingFromBundleRequest, _ *empty.Empty) error { +func (g Service) RemoveSettingFromBundle(ctx context.Context, req *proto.RemoveSettingFromBundleRequest, _ *emptypb.Empty) error { if err := g.checkStaticPermissionsByBundleID(ctx, req.BundleId); err != nil { return err } @@ -332,7 +332,7 @@ func (g Service) AssignRoleToUser(ctx context.Context, req *proto.AssignRoleToUs } // RemoveRoleFromUser implements the RoleServiceHandler interface -func (g Service) RemoveRoleFromUser(ctx context.Context, req *proto.RemoveRoleFromUserRequest, _ *empty.Empty) error { +func (g Service) RemoveRoleFromUser(ctx context.Context, req *proto.RemoveRoleFromUserRequest, _ *emptypb.Empty) error { if err := g.checkStaticPermissionsByBundleType(ctx, proto.Bundle_TYPE_ROLE); err != nil { return err } diff --git a/settings/pkg/service/v0/service_test.go b/settings/pkg/service/v0/service_test.go index 9e9630f34..7c39b724a 100644 --- a/settings/pkg/service/v0/service_test.go +++ b/settings/pkg/service/v0/service_test.go @@ -4,9 +4,9 @@ import ( "context" "testing" - "github.com/asim/go-micro/v3/metadata" "github.com/owncloud/ocis/ocis-pkg/middleware" "github.com/stretchr/testify/assert" + "go-micro.dev/v4/metadata" ) var ( diff --git a/settings/pkg/store/errortypes/errortypes.go b/settings/pkg/store/errortypes/errortypes.go new file mode 100644 index 000000000..f6c37a644 --- /dev/null +++ b/settings/pkg/store/errortypes/errortypes.go @@ -0,0 +1,9 @@ +package errortypes + +// BundleNotFound is the error to use when a bundle is not found. +type BundleNotFound string + +func (e BundleNotFound) Error() string { return "error: bundle not found: " + string(e) } + +// IsBundleNotFound implements the IsBundleNotFound interface. +func (e BundleNotFound) IsBundleNotFound() {} diff --git a/settings/pkg/store/filesystem/bundles.go b/settings/pkg/store/filesystem/bundles.go index e15776e02..33b315ed0 100644 --- a/settings/pkg/store/filesystem/bundles.go +++ b/settings/pkg/store/filesystem/bundles.go @@ -9,6 +9,7 @@ import ( "github.com/gofrs/uuid" "github.com/owncloud/ocis/settings/pkg/proto/v0" + "github.com/owncloud/ocis/settings/pkg/store/errortypes" ) var m = &sync.RWMutex{} @@ -110,7 +111,12 @@ func (s Store) WriteBundle(record *proto.Bundle) (*proto.Bundle, error) { func (s Store) AddSettingToBundle(bundleID string, setting *proto.Setting) (*proto.Setting, error) { bundle, err := s.ReadBundle(bundleID) if err != nil { - return nil, err + if _, notFound := err.(errortypes.BundleNotFound); !notFound { + return nil, err + } + bundle = new(proto.Bundle) + bundle.Id = bundleID + bundle.Type = proto.Bundle_TYPE_DEFAULT } if setting.Id == "" { setting.Id = uuid.Must(uuid.NewV4()).String() diff --git a/settings/pkg/store/filesystem/io.go b/settings/pkg/store/filesystem/io.go index ba5c61046..3f3e4df03 100644 --- a/settings/pkg/store/filesystem/io.go +++ b/settings/pkg/store/filesystem/io.go @@ -1,22 +1,37 @@ package store import ( + "io/ioutil" "os" - "github.com/golang/protobuf/jsonpb" - "github.com/golang/protobuf/proto" + "github.com/owncloud/ocis/settings/pkg/store/errortypes" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" ) // Unmarshal file into record func (s Store) parseRecordFromFile(record proto.Message, filePath string) error { + _, err := os.Stat(filePath) + if err != nil { + return errortypes.BundleNotFound(err.Error()) + } + file, err := os.Open(filePath) if err != nil { return err } defer file.Close() - decoder := jsonpb.Unmarshaler{} - if err = decoder.Unmarshal(file, record); err != nil { + b, err := ioutil.ReadAll(file) + if err != nil { + return err + } + + if len(b) == 0 { + return errortypes.BundleNotFound(filePath) + } + + if err := protojson.Unmarshal(b, record); err != nil { return err } return nil @@ -30,8 +45,13 @@ func (s Store) writeRecordToFile(record proto.Message, filePath string) error { } defer file.Close() - encoder := jsonpb.Marshaler{} - if err = encoder.Marshal(file, record); err != nil { + v, err := protojson.Marshal(record) + if err != nil { + return err + } + + _, err = file.Write(v) + if err != nil { return err } diff --git a/storage/pkg/service/external/external.go b/storage/pkg/service/external/external.go index c4fbd7b0a..4ef64adac 100644 --- a/storage/pkg/service/external/external.go +++ b/storage/pkg/service/external/external.go @@ -4,10 +4,10 @@ import ( "context" "time" - "github.com/asim/go-micro/v3/broker" - "github.com/asim/go-micro/v3/registry" "github.com/owncloud/ocis/ocis-pkg/log" oregistry "github.com/owncloud/ocis/ocis-pkg/registry" + "go-micro.dev/v4/broker" + "go-micro.dev/v4/registry" ) // RegisterGRPCEndpoint publishes an arbitrary endpoint to the service-registry. This allows to query nodes of diff --git a/store/.golangci.yaml b/store/.golangci.yaml index 5957265d9..85a4bf3fe 100644 --- a/store/.golangci.yaml +++ b/store/.golangci.yaml @@ -18,7 +18,7 @@ linters: - unused - varcheck - depguard - - golint + - revive - goimports - unconvert - scopelint diff --git a/store/pkg/proto/v0/store.pb.micro.go b/store/pkg/proto/v0/store.pb.micro.go index 7b1e0215c..e302b21db 100644 --- a/store/pkg/proto/v0/store.pb.micro.go +++ b/store/pkg/proto/v0/store.pb.micro.go @@ -12,9 +12,9 @@ import ( import ( context "context" - api "github.com/asim/go-micro/v3/api" - client "github.com/asim/go-micro/v3/client" - server "github.com/asim/go-micro/v3/server" + api "go-micro.dev/v4/api" + client "go-micro.dev/v4/client" + server "go-micro.dev/v4/server" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/store/pkg/service/v0/service.go b/store/pkg/service/v0/service.go index 60b116e55..199411094 100644 --- a/store/pkg/service/v0/service.go +++ b/store/pkg/service/v0/service.go @@ -7,12 +7,12 @@ import ( "os" "path/filepath" - merrors "github.com/asim/go-micro/v3/errors" "github.com/blevesearch/bleve/v2" "github.com/blevesearch/bleve/v2/analysis/analyzer/keyword" "github.com/owncloud/ocis/ocis-pkg/log" "github.com/owncloud/ocis/store/pkg/config" "github.com/owncloud/ocis/store/pkg/proto/v0" + merrors "go-micro.dev/v4/errors" "google.golang.org/protobuf/encoding/protojson" ) diff --git a/third_party/google/api/annotations.proto b/third_party/google/api/annotations.proto deleted file mode 100644 index 18dcf2099..000000000 --- a/third_party/google/api/annotations.proto +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2015, Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.api; - -import "google/api/http.proto"; -import "google/protobuf/descriptor.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "AnnotationsProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -extend google.protobuf.MethodOptions { - // See `HttpRule`. - HttpRule http = 72295728; -} \ No newline at end of file diff --git a/third_party/google/api/field_behavior.proto b/third_party/google/api/field_behavior.proto deleted file mode 100644 index 540dbb925..000000000 --- a/third_party/google/api/field_behavior.proto +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2019 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.api; - -import "google/protobuf/descriptor.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "FieldBehaviorProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -extend google.protobuf.FieldOptions { - // A designation of a specific field behavior (required, output only, etc.) - // in protobuf messages. - // - // Examples: - // - // string name = 1 [(google.api.field_behavior) = REQUIRED]; - // State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - // google.protobuf.Duration ttl = 1 - // [(google.api.field_behavior) = INPUT_ONLY]; - // google.protobuf.Timestamp expire_time = 1 - // [(google.api.field_behavior) = OUTPUT_ONLY, - // (google.api.field_behavior) = IMMUTABLE]; - repeated google.api.FieldBehavior field_behavior = 1052; -} - -// An indicator of the behavior of a given field (for example, that a field -// is required in requests, or given as output but ignored as input). -// This **does not** change the behavior in protocol buffers itself; it only -// denotes the behavior and may affect how API tooling handles the field. -// -// Note: This enum **may** receive new values in the future. -enum FieldBehavior { - // Conventional default for enums. Do not use this. - FIELD_BEHAVIOR_UNSPECIFIED = 0; - - // Specifically denotes a field as optional. - // While all fields in protocol buffers are optional, this may be specified - // for emphasis if appropriate. - OPTIONAL = 1; - - // Denotes a field as required. - // This indicates that the field **must** be provided as part of the request, - // and failure to do so will cause an error (usually `INVALID_ARGUMENT`). - REQUIRED = 2; - - // Denotes a field as output only. - // This indicates that the field is provided in responses, but including the - // field in a request does nothing (the server *must* ignore it and - // *must not* throw an error as a result of the field's presence). - OUTPUT_ONLY = 3; - - // Denotes a field as input only. - // This indicates that the field is provided in requests, and the - // corresponding field is not included in output. - INPUT_ONLY = 4; - - // Denotes a field as immutable. - // This indicates that the field may be set once in a request to create a - // resource, but may not be changed thereafter. - IMMUTABLE = 5; -} \ No newline at end of file diff --git a/third_party/google/api/http.proto b/third_party/google/api/http.proto deleted file mode 100644 index a43cff771..000000000 --- a/third_party/google/api/http.proto +++ /dev/null @@ -1,376 +0,0 @@ -// Copyright 2019 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.api; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "HttpProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Defines the HTTP configuration for an API service. It contains a list of -// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method -// to one or more HTTP REST API methods. -message Http { - // A list of HTTP configuration rules that apply to individual API methods. - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated HttpRule rules = 1; - - // When set to true, URL path parameters will be fully URI-decoded except in - // cases of single segment matches in reserved expansion, where "%2F" will be - // left encoded. - // - // The default behavior is to not decode RFC 6570 reserved characters in multi - // segment matches. - bool fully_decode_reserved_expansion = 2; -} - -// # gRPC Transcoding -// -// gRPC Transcoding is a feature for mapping between a gRPC method and one or -// more HTTP REST endpoints. It allows developers to build a single API service -// that supports both gRPC APIs and REST APIs. Many systems, including [Google -// APIs](https://github.com/googleapis/googleapis), -// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC -// Gateway](https://github.com/grpc-ecosystem/grpc-gateway), -// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature -// and use it for large scale production services. -// -// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies -// how different portions of the gRPC request message are mapped to the URL -// path, URL query parameters, and HTTP request body. It also controls how the -// gRPC response message is mapped to the HTTP response body. `HttpRule` is -// typically specified as an `google.api.http` annotation on the gRPC method. -// -// Each mapping specifies a URL path template and an HTTP method. The path -// template may refer to one or more fields in the gRPC request message, as long -// as each field is a non-repeated field with a primitive (non-message) type. -// The path template controls how fields of the request message are mapped to -// the URL path. -// -// Example: -// -// service Messaging { -// rpc GetMessage(GetMessageRequest) returns (Message) { -// option (google.api.http) = { -// get: "/v1/{name=messages/*}" -// }; -// } -// } -// message GetMessageRequest { -// string name = 1; // Mapped to URL path. -// } -// message Message { -// string text = 1; // The resource content. -// } -// -// This enables an HTTP REST to gRPC mapping as below: -// -// HTTP | gRPC -// -----|----- -// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` -// -// Any fields in the request message which are not bound by the path template -// automatically become HTTP query parameters if there is no HTTP request body. -// For example: -// -// service Messaging { -// rpc GetMessage(GetMessageRequest) returns (Message) { -// option (google.api.http) = { -// get:"/v1/messages/{message_id}" -// }; -// } -// } -// message GetMessageRequest { -// message SubMessage { -// string subfield = 1; -// } -// string message_id = 1; // Mapped to URL path. -// int64 revision = 2; // Mapped to URL query parameter `revision`. -// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. -// } -// -// This enables a HTTP JSON to RPC mapping as below: -// -// HTTP | gRPC -// -----|----- -// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | -// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: -// "foo"))` -// -// Note that fields which are mapped to URL query parameters must have a -// primitive type or a repeated primitive type or a non-repeated message type. -// In the case of a repeated type, the parameter can be repeated in the URL -// as `...?param=A¶m=B`. In the case of a message type, each field of the -// message is mapped to a separate parameter, such as -// `...?foo.a=A&foo.b=B&foo.c=C`. -// -// For HTTP methods that allow a request body, the `body` field -// specifies the mapping. Consider a REST update method on the -// message resource collection: -// -// service Messaging { -// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { -// option (google.api.http) = { -// patch: "/v1/messages/{message_id}" -// body: "message" -// }; -// } -// } -// message UpdateMessageRequest { -// string message_id = 1; // mapped to the URL -// Message message = 2; // mapped to the body -// } -// -// The following HTTP JSON to RPC mapping is enabled, where the -// representation of the JSON in the request body is determined by -// protos JSON encoding: -// -// HTTP | gRPC -// -----|----- -// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: -// "123456" message { text: "Hi!" })` -// -// The special name `*` can be used in the body mapping to define that -// every field not bound by the path template should be mapped to the -// request body. This enables the following alternative definition of -// the update method: -// -// service Messaging { -// rpc UpdateMessage(Message) returns (Message) { -// option (google.api.http) = { -// patch: "/v1/messages/{message_id}" -// body: "*" -// }; -// } -// } -// message Message { -// string message_id = 1; -// string text = 2; -// } -// -// -// The following HTTP JSON to RPC mapping is enabled: -// -// HTTP | gRPC -// -----|----- -// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: -// "123456" text: "Hi!")` -// -// Note that when using `*` in the body mapping, it is not possible to -// have HTTP parameters, as all fields not bound by the path end in -// the body. This makes this option more rarely used in practice when -// defining REST APIs. The common usage of `*` is in custom methods -// which don't use the URL at all for transferring data. -// -// It is possible to define multiple HTTP methods for one RPC by using -// the `additional_bindings` option. Example: -// -// service Messaging { -// rpc GetMessage(GetMessageRequest) returns (Message) { -// option (google.api.http) = { -// get: "/v1/messages/{message_id}" -// additional_bindings { -// get: "/v1/users/{user_id}/messages/{message_id}" -// } -// }; -// } -// } -// message GetMessageRequest { -// string message_id = 1; -// string user_id = 2; -// } -// -// This enables the following two alternative HTTP JSON to RPC mappings: -// -// HTTP | gRPC -// -----|----- -// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` -// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: -// "123456")` -// -// ## Rules for HTTP mapping -// -// 1. Leaf request fields (recursive expansion nested messages in the request -// message) are classified into three categories: -// - Fields referred by the path template. They are passed via the URL path. -// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP -// request body. -// - All other fields are passed via the URL query parameters, and the -// parameter name is the field path in the request message. A repeated -// field can be represented as multiple query parameters under the same -// name. -// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields -// are passed via URL path and HTTP request body. -// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all -// fields are passed via URL path and URL query parameters. -// -// ### Path template syntax -// -// Template = "/" Segments [ Verb ] ; -// Segments = Segment { "/" Segment } ; -// Segment = "*" | "**" | LITERAL | Variable ; -// Variable = "{" FieldPath [ "=" Segments ] "}" ; -// FieldPath = IDENT { "." IDENT } ; -// Verb = ":" LITERAL ; -// -// The syntax `*` matches a single URL path segment. The syntax `**` matches -// zero or more URL path segments, which must be the last part of the URL path -// except the `Verb`. -// -// The syntax `Variable` matches part of the URL path as specified by its -// template. A variable template must not contain other variables. If a variable -// matches a single path segment, its template may be omitted, e.g. `{var}` -// is equivalent to `{var=*}`. -// -// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` -// contains any reserved character, such characters should be percent-encoded -// before the matching. -// -// If a variable contains exactly one path segment, such as `"{var}"` or -// `"{var=*}"`, when such a variable is expanded into a URL path on the client -// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The -// server side does the reverse decoding. Such variables show up in the -// [Discovery -// Document](https://developers.google.com/discovery/v1/reference/apis) as -// `{var}`. -// -// If a variable contains multiple path segments, such as `"{var=foo/*}"` -// or `"{var=**}"`, when such a variable is expanded into a URL path on the -// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. -// The server side does the reverse decoding, except "%2F" and "%2f" are left -// unchanged. Such variables show up in the -// [Discovery -// Document](https://developers.google.com/discovery/v1/reference/apis) as -// `{+var}`. -// -// ## Using gRPC API Service Configuration -// -// gRPC API Service Configuration (service config) is a configuration language -// for configuring a gRPC service to become a user-facing product. The -// service config is simply the YAML representation of the `google.api.Service` -// proto message. -// -// As an alternative to annotating your proto file, you can configure gRPC -// transcoding in your service config YAML files. You do this by specifying a -// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same -// effect as the proto annotation. This can be particularly useful if you -// have a proto that is reused in multiple services. Note that any transcoding -// specified in the service config will override any matching transcoding -// configuration in the proto. -// -// Example: -// -// http: -// rules: -// # Selects a gRPC method and applies HttpRule to it. -// - selector: example.v1.Messaging.GetMessage -// get: /v1/messages/{message_id}/{sub.subfield} -// -// ## Special notes -// -// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the -// proto to JSON conversion must follow the [proto3 -// specification](https://developers.google.com/protocol-buffers/docs/proto3#json). -// -// While the single segment variable follows the semantics of -// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String -// Expansion, the multi segment variable **does not** follow RFC 6570 Section -// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion -// does not expand special characters like `?` and `#`, which would lead -// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding -// for multi segment variables. -// -// The path variables **must not** refer to any repeated or mapped field, -// because client libraries are not capable of handling such variable expansion. -// -// The path variables **must not** capture the leading "/" character. The reason -// is that the most common use case "{var}" does not capture the leading "/" -// character. For consistency, all path variables must share the same behavior. -// -// Repeated message fields must not be mapped to URL query parameters, because -// no client library can support such complicated mapping. -// -// If an API needs to use a JSON array for request or response body, it can map -// the request or response body to a repeated field. However, some gRPC -// Transcoding implementations may not support this feature. -message HttpRule { - // Selects a method to which this rule applies. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // Determines the URL pattern is matched by this rules. This pattern can be - // used with any of the {get|put|post|delete|patch} methods. A custom method - // can be defined using the 'custom' field. - oneof pattern { - // Maps to HTTP GET. Used for listing and getting information about - // resources. - string get = 2; - - // Maps to HTTP PUT. Used for replacing a resource. - string put = 3; - - // Maps to HTTP POST. Used for creating a resource or performing an action. - string post = 4; - - // Maps to HTTP DELETE. Used for deleting a resource. - string delete = 5; - - // Maps to HTTP PATCH. Used for updating a resource. - string patch = 6; - - // The custom pattern is used for specifying an HTTP method that is not - // included in the `pattern` field, such as HEAD, or "*" to leave the - // HTTP method unspecified for this rule. The wild-card rule is useful - // for services that provide content to Web (HTML) clients. - CustomHttpPattern custom = 8; - } - - // The name of the request field whose value is mapped to the HTTP request - // body, or `*` for mapping all request fields not captured by the path - // pattern to the HTTP body, or omitted for not having any HTTP request body. - // - // NOTE: the referred field must be present at the top-level of the request - // message type. - string body = 7; - - // Optional. The name of the response field whose value is mapped to the HTTP - // response body. When omitted, the entire response message will be used - // as the HTTP response body. - // - // NOTE: The referred field must be present at the top-level of the response - // message type. - string response_body = 12; - - // Additional HTTP bindings for the selector. Nested bindings must - // not contain an `additional_bindings` field themselves (that is, - // the nesting may only be one level deep). - repeated HttpRule additional_bindings = 11; -} - -// A custom pattern is used for defining custom HTTP verb. -message CustomHttpPattern { - // The name of this custom HTTP verb. - string kind = 1; - - // The path matched by this custom verb. - string path = 2; -} \ No newline at end of file diff --git a/third_party/google/protobuf/descriptor.proto b/third_party/google/protobuf/descriptor.proto deleted file mode 100644 index dcfe8fe67..000000000 --- a/third_party/google/protobuf/descriptor.proto +++ /dev/null @@ -1,909 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Author: kenton@google.com (Kenton Varda) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. -// -// The messages in this file describe the definitions found in .proto files. -// A valid .proto file can be translated directly to a FileDescriptorProto -// without any other information (e.g. without reading its imports). - - -syntax = "proto2"; - -package google.protobuf; - -option go_package = "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "DescriptorProtos"; -option csharp_namespace = "Google.Protobuf.Reflection"; -option objc_class_prefix = "GPB"; -option cc_enable_arenas = true; - -// descriptor.proto must be optimized for speed because reflection-based -// algorithms don't work during bootstrapping. -option optimize_for = SPEED; - -// The protocol compiler can output a FileDescriptorSet containing the .proto -// files it parses. -message FileDescriptorSet { - repeated FileDescriptorProto file = 1; -} - -// Describes a complete .proto file. -message FileDescriptorProto { - optional string name = 1; // file name, relative to root of source tree - optional string package = 2; // e.g. "foo", "foo.bar", etc. - - // Names of files imported by this file. - repeated string dependency = 3; - // Indexes of the public imported files in the dependency list above. - repeated int32 public_dependency = 10; - // Indexes of the weak imported files in the dependency list. - // For Google-internal migration only. Do not use. - repeated int32 weak_dependency = 11; - - // All top-level definitions in this file. - repeated DescriptorProto message_type = 4; - repeated EnumDescriptorProto enum_type = 5; - repeated ServiceDescriptorProto service = 6; - repeated FieldDescriptorProto extension = 7; - - optional FileOptions options = 8; - - // This field contains optional information about the original source code. - // You may safely remove this entire field without harming runtime - // functionality of the descriptors -- the information is needed only by - // development tools. - optional SourceCodeInfo source_code_info = 9; - - // The syntax of the proto file. - // The supported values are "proto2" and "proto3". - optional string syntax = 12; -} - -// Describes a message type. -message DescriptorProto { - optional string name = 1; - - repeated FieldDescriptorProto field = 2; - repeated FieldDescriptorProto extension = 6; - - repeated DescriptorProto nested_type = 3; - repeated EnumDescriptorProto enum_type = 4; - - message ExtensionRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Exclusive. - - optional ExtensionRangeOptions options = 3; - } - repeated ExtensionRange extension_range = 5; - - repeated OneofDescriptorProto oneof_decl = 8; - - optional MessageOptions options = 7; - - // Range of reserved tag numbers. Reserved tag numbers may not be used by - // fields or extension ranges in the same message. Reserved ranges may - // not overlap. - message ReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Exclusive. - } - repeated ReservedRange reserved_range = 9; - // Reserved field names, which may not be used by fields in the same message. - // A given name may only be reserved once. - repeated string reserved_name = 10; -} - -message ExtensionRangeOptions { - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -// Describes a field within a message. -message FieldDescriptorProto { - enum Type { - // 0 is reserved for errors. - // Order is weird for historical reasons. - TYPE_DOUBLE = 1; - TYPE_FLOAT = 2; - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - // negative values are likely. - TYPE_INT64 = 3; - TYPE_UINT64 = 4; - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - // negative values are likely. - TYPE_INT32 = 5; - TYPE_FIXED64 = 6; - TYPE_FIXED32 = 7; - TYPE_BOOL = 8; - TYPE_STRING = 9; - // Tag-delimited aggregate. - // Group type is deprecated and not supported in proto3. However, Proto3 - // implementations should still be able to parse the group wire format and - // treat group fields as unknown fields. - TYPE_GROUP = 10; - TYPE_MESSAGE = 11; // Length-delimited aggregate. - - // New in version 2. - TYPE_BYTES = 12; - TYPE_UINT32 = 13; - TYPE_ENUM = 14; - TYPE_SFIXED32 = 15; - TYPE_SFIXED64 = 16; - TYPE_SINT32 = 17; // Uses ZigZag encoding. - TYPE_SINT64 = 18; // Uses ZigZag encoding. - } - - enum Label { - // 0 is reserved for errors - LABEL_OPTIONAL = 1; - LABEL_REQUIRED = 2; - LABEL_REPEATED = 3; - } - - optional string name = 1; - optional int32 number = 3; - optional Label label = 4; - - // If type_name is set, this need not be set. If both this and type_name - // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - optional Type type = 5; - - // For message and enum types, this is the name of the type. If the name - // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - // rules are used to find the type (i.e. first the nested types within this - // message are searched, then within the parent, on up to the root - // namespace). - optional string type_name = 6; - - // For extensions, this is the name of the type being extended. It is - // resolved in the same manner as type_name. - optional string extendee = 2; - - // For numeric types, contains the original text representation of the value. - // For booleans, "true" or "false". - // For strings, contains the default text contents (not escaped in any way). - // For bytes, contains the C escaped value. All bytes >= 128 are escaped. - // TODO(kenton): Base-64 encode? - optional string default_value = 7; - - // If set, gives the index of a oneof in the containing type's oneof_decl - // list. This field is a member of that oneof. - optional int32 oneof_index = 9; - - // JSON name of this field. The value is set by protocol compiler. If the - // user has set a "json_name" option on this field, that option's value - // will be used. Otherwise, it's deduced from the field's name by converting - // it to camelCase. - optional string json_name = 10; - - optional FieldOptions options = 8; - - // If true, this is a proto3 "optional". When a proto3 field is optional, it - // tracks presence regardless of field type. - // - // When proto3_optional is true, this field must be belong to a oneof to - // signal to old proto3 clients that presence is tracked for this field. This - // oneof is known as a "synthetic" oneof, and this field must be its sole - // member (each proto3 optional field gets its own synthetic oneof). Synthetic - // oneofs exist in the descriptor only, and do not generate any API. Synthetic - // oneofs must be ordered after all "real" oneofs. - // - // For message fields, proto3_optional doesn't create any semantic change, - // since non-repeated message fields always track presence. However it still - // indicates the semantic detail of whether the user wrote "optional" or not. - // This can be useful for round-tripping the .proto file. For consistency we - // give message fields a synthetic oneof also, even though it is not required - // to track presence. This is especially important because the parser can't - // tell if a field is a message or an enum, so it must always create a - // synthetic oneof. - // - // Proto2 optional fields do not set this flag, because they already indicate - // optional with `LABEL_OPTIONAL`. - optional bool proto3_optional = 17; -} - -// Describes a oneof. -message OneofDescriptorProto { - optional string name = 1; - optional OneofOptions options = 2; -} - -// Describes an enum type. -message EnumDescriptorProto { - optional string name = 1; - - repeated EnumValueDescriptorProto value = 2; - - optional EnumOptions options = 3; - - // Range of reserved numeric values. Reserved values may not be used by - // entries in the same enum. Reserved ranges may not overlap. - // - // Note that this is distinct from DescriptorProto.ReservedRange in that it - // is inclusive such that it can appropriately represent the entire int32 - // domain. - message EnumReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Inclusive. - } - - // Range of reserved numeric values. Reserved numeric values may not be used - // by enum values in the same enum declaration. Reserved ranges may not - // overlap. - repeated EnumReservedRange reserved_range = 4; - - // Reserved enum value names, which may not be reused. A given name may only - // be reserved once. - repeated string reserved_name = 5; -} - -// Describes a value within an enum. -message EnumValueDescriptorProto { - optional string name = 1; - optional int32 number = 2; - - optional EnumValueOptions options = 3; -} - -// Describes a service. -message ServiceDescriptorProto { - optional string name = 1; - repeated MethodDescriptorProto method = 2; - - optional ServiceOptions options = 3; -} - -// Describes a method of a service. -message MethodDescriptorProto { - optional string name = 1; - - // Input and output type names. These are resolved in the same way as - // FieldDescriptorProto.type_name, but must refer to a message type. - optional string input_type = 2; - optional string output_type = 3; - - optional MethodOptions options = 4; - - // Identifies if client streams multiple client messages - optional bool client_streaming = 5 [default = false]; - // Identifies if server streams multiple server messages - optional bool server_streaming = 6 [default = false]; -} - - -// =================================================================== -// Options - -// Each of the definitions above may have "options" attached. These are -// just annotations which may cause code to be generated slightly differently -// or may contain hints for code that manipulates protocol messages. -// -// Clients may define custom options as extensions of the *Options messages. -// These extensions may not yet be known at parsing time, so the parser cannot -// store the values in them. Instead it stores them in a field in the *Options -// message called uninterpreted_option. This field must have the same name -// across all *Options messages. We then use this field to populate the -// extensions when we build a descriptor, at which point all protos have been -// parsed and so all extensions are known. -// -// Extension numbers for custom options may be chosen as follows: -// * For options which will only be used within a single application or -// organization, or for experimental options, use field numbers 50000 -// through 99999. It is up to you to ensure that you do not use the -// same number for multiple options. -// * For options which will be published and used publicly by multiple -// independent entities, e-mail protobuf-global-extension-registry@google.com -// to reserve extension numbers. Simply provide your project name (e.g. -// Objective-C plugin) and your project website (if available) -- there's no -// need to explain how you intend to use them. Usually you only need one -// extension number. You can declare multiple options with only one extension -// number by putting them in a sub-message. See the Custom Options section of -// the docs for examples: -// https://developers.google.com/protocol-buffers/docs/proto#options -// If this turns out to be popular, a web service will be set up -// to automatically assign option numbers. - -message FileOptions { - - // Sets the Java package where classes generated from this .proto will be - // placed. By default, the proto package is used, but this is often - // inappropriate because proto packages do not normally start with backwards - // domain names. - optional string java_package = 1; - - - // If set, all the classes from the .proto file are wrapped in a single - // outer class with the given name. This applies to both Proto1 - // (equivalent to the old "--one_java_file" option) and Proto2 (where - // a .proto always translates to a single class, but you may want to - // explicitly choose the class name). - optional string java_outer_classname = 8; - - // If set true, then the Java code generator will generate a separate .java - // file for each top-level message, enum, and service defined in the .proto - // file. Thus, these types will *not* be nested inside the outer class - // named by java_outer_classname. However, the outer class will still be - // generated to contain the file's getDescriptor() method as well as any - // top-level extensions defined in the file. - optional bool java_multiple_files = 10 [default = false]; - - // This option does nothing. - optional bool java_generate_equals_and_hash = 20 [deprecated=true]; - - // If set true, then the Java2 code generator will generate code that - // throws an exception whenever an attempt is made to assign a non-UTF-8 - // byte sequence to a string field. - // Message reflection will do the same. - // However, an extension field still accepts non-UTF-8 byte sequences. - // This option has no effect on when used with the lite runtime. - optional bool java_string_check_utf8 = 27 [default = false]; - - - // Generated classes can be optimized for speed or code size. - enum OptimizeMode { - SPEED = 1; // Generate complete code for parsing, serialization, - // etc. - CODE_SIZE = 2; // Use ReflectionOps to implement these methods. - LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. - } - optional OptimizeMode optimize_for = 9 [default = SPEED]; - - // Sets the Go package where structs generated from this .proto will be - // placed. If omitted, the Go package will be derived from the following: - // - The basename of the package import path, if provided. - // - Otherwise, the package statement in the .proto file, if present. - // - Otherwise, the basename of the .proto file, without extension. - optional string go_package = 11; - - - - - // Should generic services be generated in each language? "Generic" services - // are not specific to any particular RPC system. They are generated by the - // main code generators in each language (without additional plugins). - // Generic services were the only kind of service generation supported by - // early versions of google.protobuf. - // - // Generic services are now considered deprecated in favor of using plugins - // that generate code specific to your particular RPC system. Therefore, - // these default to false. Old code which depends on generic services should - // explicitly set them to true. - optional bool cc_generic_services = 16 [default = false]; - optional bool java_generic_services = 17 [default = false]; - optional bool py_generic_services = 18 [default = false]; - optional bool php_generic_services = 42 [default = false]; - - // Is this file deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for everything in the file, or it will be completely ignored; in the very - // least, this is a formalization for deprecating files. - optional bool deprecated = 23 [default = false]; - - // Enables the use of arenas for the proto messages in this file. This applies - // only to generated classes for C++. - optional bool cc_enable_arenas = 31 [default = true]; - - - // Sets the objective c class prefix which is prepended to all objective c - // generated classes from this .proto. There is no default. - optional string objc_class_prefix = 36; - - // Namespace for generated classes; defaults to the package. - optional string csharp_namespace = 37; - - // By default Swift generators will take the proto package and CamelCase it - // replacing '.' with underscore and use that to prefix the types/symbols - // defined. When this options is provided, they will use this value instead - // to prefix the types/symbols defined. - optional string swift_prefix = 39; - - // Sets the php class prefix which is prepended to all php generated classes - // from this .proto. Default is empty. - optional string php_class_prefix = 40; - - // Use this option to change the namespace of php generated classes. Default - // is empty. When this option is empty, the package name will be used for - // determining the namespace. - optional string php_namespace = 41; - - // Use this option to change the namespace of php generated metadata classes. - // Default is empty. When this option is empty, the proto file name will be - // used for determining the namespace. - optional string php_metadata_namespace = 44; - - // Use this option to change the package of ruby generated classes. Default - // is empty. When this option is not set, the package name will be used for - // determining the ruby package. - optional string ruby_package = 45; - - - // The parser stores options it doesn't recognize here. - // See the documentation for the "Options" section above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. - // See the documentation for the "Options" section above. - extensions 1000 to max; - - reserved 38; -} - -message MessageOptions { - // Set true to use the old proto1 MessageSet wire format for extensions. - // This is provided for backwards-compatibility with the MessageSet wire - // format. You should not use this for any other reason: It's less - // efficient, has fewer features, and is more complicated. - // - // The message must be defined exactly as follows: - // message Foo { - // option message_set_wire_format = true; - // extensions 4 to max; - // } - // Note that the message cannot have any defined fields; MessageSets only - // have extensions. - // - // All extensions of your type must be singular messages; e.g. they cannot - // be int32s, enums, or repeated messages. - // - // Because this is an option, the above two restrictions are not enforced by - // the protocol compiler. - optional bool message_set_wire_format = 1 [default = false]; - - // Disables the generation of the standard "descriptor()" accessor, which can - // conflict with a field of the same name. This is meant to make migration - // from proto1 easier; new code should avoid fields named "descriptor". - optional bool no_standard_descriptor_accessor = 2 [default = false]; - - // Is this message deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the message, or it will be completely ignored; in the very least, - // this is a formalization for deprecating messages. - optional bool deprecated = 3 [default = false]; - - // Whether the message is an automatically generated map entry type for the - // maps field. - // - // For maps fields: - // map map_field = 1; - // The parsed descriptor looks like: - // message MapFieldEntry { - // option map_entry = true; - // optional KeyType key = 1; - // optional ValueType value = 2; - // } - // repeated MapFieldEntry map_field = 1; - // - // Implementations may choose not to generate the map_entry=true message, but - // use a native map in the target language to hold the keys and values. - // The reflection APIs in such implementations still need to work as - // if the field is a repeated message field. - // - // NOTE: Do not set the option in .proto files. Always use the maps syntax - // instead. The option should only be implicitly set by the proto compiler - // parser. - optional bool map_entry = 7; - - reserved 8; // javalite_serializable - reserved 9; // javanano_as_lite - - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message FieldOptions { - // The ctype option instructs the C++ code generator to use a different - // representation of the field than it normally would. See the specific - // options below. This option is not yet implemented in the open source - // release -- sorry, we'll try to include it in a future version! - optional CType ctype = 1 [default = STRING]; - enum CType { - // Default mode. - STRING = 0; - - CORD = 1; - - STRING_PIECE = 2; - } - // The packed option can be enabled for repeated primitive fields to enable - // a more efficient representation on the wire. Rather than repeatedly - // writing the tag and type for each element, the entire array is encoded as - // a single length-delimited blob. In proto3, only explicit setting it to - // false will avoid using packed encoding. - optional bool packed = 2; - - // The jstype option determines the JavaScript type used for values of the - // field. The option is permitted only for 64 bit integral and fixed types - // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING - // is represented as JavaScript string, which avoids loss of precision that - // can happen when a large value is converted to a floating point JavaScript. - // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to - // use the JavaScript "number" type. The behavior of the default option - // JS_NORMAL is implementation dependent. - // - // This option is an enum to permit additional types to be added, e.g. - // goog.math.Integer. - optional JSType jstype = 6 [default = JS_NORMAL]; - enum JSType { - // Use the default type. - JS_NORMAL = 0; - - // Use JavaScript strings. - JS_STRING = 1; - - // Use JavaScript numbers. - JS_NUMBER = 2; - } - - // Should this field be parsed lazily? Lazy applies only to message-type - // fields. It means that when the outer message is initially parsed, the - // inner message's contents will not be parsed but instead stored in encoded - // form. The inner message will actually be parsed when it is first accessed. - // - // This is only a hint. Implementations are free to choose whether to use - // eager or lazy parsing regardless of the value of this option. However, - // setting this option true suggests that the protocol author believes that - // using lazy parsing on this field is worth the additional bookkeeping - // overhead typically needed to implement it. - // - // This option does not affect the public interface of any generated code; - // all method signatures remain the same. Furthermore, thread-safety of the - // interface is not affected by this option; const methods remain safe to - // call from multiple threads concurrently, while non-const methods continue - // to require exclusive access. - // - // - // Note that implementations may choose not to check required fields within - // a lazy sub-message. That is, calling IsInitialized() on the outer message - // may return true even if the inner message has missing required fields. - // This is necessary because otherwise the inner message would have to be - // parsed in order to perform the check, defeating the purpose of lazy - // parsing. An implementation which chooses not to check required fields - // must be consistent about it. That is, for any particular sub-message, the - // implementation must either *always* check its required fields, or *never* - // check its required fields, regardless of whether or not the message has - // been parsed. - optional bool lazy = 5 [default = false]; - - // Is this field deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for accessors, or it will be completely ignored; in the very least, this - // is a formalization for deprecating fields. - optional bool deprecated = 3 [default = false]; - - // For Google-internal migration only. Do not use. - optional bool weak = 10 [default = false]; - - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; - - reserved 4; // removed jtype -} - -message OneofOptions { - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message EnumOptions { - - // Set this option to true to allow mapping different tag names to the same - // value. - optional bool allow_alias = 2; - - // Is this enum deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum, or it will be completely ignored; in the very least, this - // is a formalization for deprecating enums. - optional bool deprecated = 3 [default = false]; - - reserved 5; // javanano_as_lite - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message EnumValueOptions { - // Is this enum value deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum value, or it will be completely ignored; in the very least, - // this is a formalization for deprecating enum values. - optional bool deprecated = 1 [default = false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message ServiceOptions { - - // Note: Field numbers 1 through 32 are reserved for Google's internal RPC - // framework. We apologize for hoarding these numbers to ourselves, but - // we were already using them long before we decided to release Protocol - // Buffers. - - // Is this service deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the service, or it will be completely ignored; in the very least, - // this is a formalization for deprecating services. - optional bool deprecated = 33 [default = false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message MethodOptions { - - // Note: Field numbers 1 through 32 are reserved for Google's internal RPC - // framework. We apologize for hoarding these numbers to ourselves, but - // we were already using them long before we decided to release Protocol - // Buffers. - - // Is this method deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the method, or it will be completely ignored; in the very least, - // this is a formalization for deprecating methods. - optional bool deprecated = 33 [default = false]; - - // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, - // or neither? HTTP based RPC implementation may choose GET verb for safe - // methods, and PUT verb for idempotent methods instead of the default POST. - enum IdempotencyLevel { - IDEMPOTENCY_UNKNOWN = 0; - NO_SIDE_EFFECTS = 1; // implies idempotent - IDEMPOTENT = 2; // idempotent, but may have side effects - } - optional IdempotencyLevel idempotency_level = 34 - [default = IDEMPOTENCY_UNKNOWN]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - - -// A message representing a option the parser does not recognize. This only -// appears in options protos created by the compiler::Parser class. -// DescriptorPool resolves these when building Descriptor objects. Therefore, -// options protos in descriptor objects (e.g. returned by Descriptor::options(), -// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions -// in them. -message UninterpretedOption { - // The name of the uninterpreted option. Each string represents a segment in - // a dot-separated name. is_extension is true iff a segment represents an - // extension (denoted with parentheses in options specs in .proto files). - // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents - // "foo.(bar.baz).qux". - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } - repeated NamePart name = 2; - - // The value of the uninterpreted option, in whatever type the tokenizer - // identified it as during parsing. Exactly one of these should be set. - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; -} - -// =================================================================== -// Optional source code info - -// Encapsulates information about the original source file from which a -// FileDescriptorProto was generated. -message SourceCodeInfo { - // A Location identifies a piece of source code in a .proto file which - // corresponds to a particular definition. This information is intended - // to be useful to IDEs, code indexers, documentation generators, and similar - // tools. - // - // For example, say we have a file like: - // message Foo { - // optional string foo = 1; - // } - // Let's look at just the field definition: - // optional string foo = 1; - // ^ ^^ ^^ ^ ^^^ - // a bc de f ghi - // We have the following locations: - // span path represents - // [a,i) [ 4, 0, 2, 0 ] The whole field definition. - // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - // - // Notes: - // - A location may refer to a repeated field itself (i.e. not to any - // particular index within it). This is used whenever a set of elements are - // logically enclosed in a single code segment. For example, an entire - // extend block (possibly containing multiple extension definitions) will - // have an outer location whose path refers to the "extensions" repeated - // field without an index. - // - Multiple locations may have the same path. This happens when a single - // logical declaration is spread out across multiple places. The most - // obvious example is the "extend" block again -- there may be multiple - // extend blocks in the same scope, each of which will have the same path. - // - A location's span is not always a subset of its parent's span. For - // example, the "extendee" of an extension declaration appears at the - // beginning of the "extend" block and is shared by all extensions within - // the block. - // - Just because a location's span is a subset of some other location's span - // does not mean that it is a descendant. For example, a "group" defines - // both a type and a field in a single declaration. Thus, the locations - // corresponding to the type and field and their components will overlap. - // - Code which tries to interpret locations should probably be designed to - // ignore those that it doesn't understand, as more types of locations could - // be recorded in the future. - repeated Location location = 1; - message Location { - // Identifies which part of the FileDescriptorProto was defined at this - // location. - // - // Each element is a field number or an index. They form a path from - // the root FileDescriptorProto to the place where the definition. For - // example, this path: - // [ 4, 3, 2, 7, 1 ] - // refers to: - // file.message_type(3) // 4, 3 - // .field(7) // 2, 7 - // .name() // 1 - // This is because FileDescriptorProto.message_type has field number 4: - // repeated DescriptorProto message_type = 4; - // and DescriptorProto.field has field number 2: - // repeated FieldDescriptorProto field = 2; - // and FieldDescriptorProto.name has field number 1: - // optional string name = 1; - // - // Thus, the above path gives the location of a field name. If we removed - // the last element: - // [ 4, 3, 2, 7 ] - // this path refers to the whole field declaration (from the beginning - // of the label to the terminating semicolon). - repeated int32 path = 1 [packed = true]; - - // Always has exactly three or four elements: start line, start column, - // end line (optional, otherwise assumed same as start line), end column. - // These are packed into a single field for efficiency. Note that line - // and column numbers are zero-based -- typically you will want to add - // 1 to each before displaying to a user. - repeated int32 span = 2 [packed = true]; - - // If this SourceCodeInfo represents a complete declaration, these are any - // comments appearing before and after the declaration which appear to be - // attached to the declaration. - // - // A series of line comments appearing on consecutive lines, with no other - // tokens appearing on those lines, will be treated as a single comment. - // - // leading_detached_comments will keep paragraphs of comments that appear - // before (but not connected to) the current element. Each paragraph, - // separated by empty lines, will be one comment element in the repeated - // field. - // - // Only the comment content is provided; comment markers (e.g. //) are - // stripped out. For block comments, leading whitespace and an asterisk - // will be stripped from the beginning of each line other than the first. - // Newlines are included in the output. - // - // Examples: - // - // optional int32 foo = 1; // Comment attached to foo. - // // Comment attached to bar. - // optional int32 bar = 2; - // - // optional string baz = 3; - // // Comment attached to baz. - // // Another line attached to baz. - // - // // Comment attached to qux. - // // - // // Another line attached to qux. - // optional double qux = 4; - // - // // Detached comment for corge. This is not leading or trailing comments - // // to qux or corge because there are blank lines separating it from - // // both. - // - // // Detached comment for corge paragraph 2. - // - // optional string corge = 5; - // /* Block comment attached - // * to corge. Leading asterisks - // * will be removed. */ - // /* Block comment attached to - // * grault. */ - // optional int32 grault = 6; - // - // // ignored detached comments. - optional string leading_comments = 3; - optional string trailing_comments = 4; - repeated string leading_detached_comments = 6; - } -} - -// Describes the relationship between generated code and its original source -// file. A GeneratedCodeInfo message is associated with only one generated -// source file, but may contain references to different source .proto files. -message GeneratedCodeInfo { - // An Annotation connects some span of text in generated code to an element - // of its generating .proto file. - repeated Annotation annotation = 1; - message Annotation { - // Identifies the element in the original source .proto file. This field - // is formatted the same as SourceCodeInfo.Location.path. - repeated int32 path = 1 [packed = true]; - - // Identifies the filesystem path to the original source .proto. - optional string source_file = 2; - - // Identifies the starting offset in bytes in the generated code - // that relates to the identified object. - optional int32 begin = 3; - - // Identifies the ending offset in bytes in the generated code that - // relates to the identified offset. The end offset should be one past - // the last relevant byte (so the length of the text = end - begin). - optional int32 end = 4; - } -} \ No newline at end of file diff --git a/third_party/google/protobuf/empty.proto b/third_party/google/protobuf/empty.proto deleted file mode 100644 index d675375e1..000000000 --- a/third_party/google/protobuf/empty.proto +++ /dev/null @@ -1,52 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "github.com/golang/protobuf/ptypes/empty"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "EmptyProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; -option cc_enable_arenas = true; - -// A generic empty message that you can re-use to avoid defining duplicated -// empty messages in your APIs. A typical example is to use it as the request -// or the response type of an API method. For instance: -// -// service Foo { -// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -// } -// -// The JSON representation for `Empty` is empty JSON object `{}`. -message Empty {} \ No newline at end of file diff --git a/third_party/google/protobuf/field_mask.proto b/third_party/google/protobuf/field_mask.proto deleted file mode 100644 index ae488d603..000000000 --- a/third_party/google/protobuf/field_mask.proto +++ /dev/null @@ -1,245 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "FieldMaskProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; -option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask"; -option cc_enable_arenas = true; - -// `FieldMask` represents a set of symbolic field paths, for example: -// -// paths: "f.a" -// paths: "f.b.d" -// -// Here `f` represents a field in some root message, `a` and `b` -// fields in the message found in `f`, and `d` a field found in the -// message in `f.b`. -// -// Field masks are used to specify a subset of fields that should be -// returned by a get operation or modified by an update operation. -// Field masks also have a custom JSON encoding (see below). -// -// # Field Masks in Projections -// -// When used in the context of a projection, a response message or -// sub-message is filtered by the API to only contain those fields as -// specified in the mask. For example, if the mask in the previous -// example is applied to a response message as follows: -// -// f { -// a : 22 -// b { -// d : 1 -// x : 2 -// } -// y : 13 -// } -// z: 8 -// -// The result will not contain specific values for fields x,y and z -// (their value will be set to the default, and omitted in proto text -// output): -// -// -// f { -// a : 22 -// b { -// d : 1 -// } -// } -// -// A repeated field is not allowed except at the last position of a -// paths string. -// -// If a FieldMask object is not present in a get operation, the -// operation applies to all fields (as if a FieldMask of all fields -// had been specified). -// -// Note that a field mask does not necessarily apply to the -// top-level response message. In case of a REST get operation, the -// field mask applies directly to the response, but in case of a REST -// list operation, the mask instead applies to each individual message -// in the returned resource list. In case of a REST custom method, -// other definitions may be used. Where the mask applies will be -// clearly documented together with its declaration in the API. In -// any case, the effect on the returned resource/resources is required -// behavior for APIs. -// -// # Field Masks in Update Operations -// -// A field mask in update operations specifies which fields of the -// targeted resource are going to be updated. The API is required -// to only change the values of the fields as specified in the mask -// and leave the others untouched. If a resource is passed in to -// describe the updated values, the API ignores the values of all -// fields not covered by the mask. -// -// If a repeated field is specified for an update operation, new values will -// be appended to the existing repeated field in the target resource. Note that -// a repeated field is only allowed in the last position of a `paths` string. -// -// If a sub-message is specified in the last position of the field mask for an -// update operation, then new value will be merged into the existing sub-message -// in the target resource. -// -// For example, given the target message: -// -// f { -// b { -// d: 1 -// x: 2 -// } -// c: [1] -// } -// -// And an update message: -// -// f { -// b { -// d: 10 -// } -// c: [2] -// } -// -// then if the field mask is: -// -// paths: ["f.b", "f.c"] -// -// then the result will be: -// -// f { -// b { -// d: 10 -// x: 2 -// } -// c: [1, 2] -// } -// -// An implementation may provide options to override this default behavior for -// repeated and message fields. -// -// In order to reset a field's value to the default, the field must -// be in the mask and set to the default value in the provided resource. -// Hence, in order to reset all fields of a resource, provide a default -// instance of the resource and set all fields in the mask, or do -// not provide a mask as described below. -// -// If a field mask is not present on update, the operation applies to -// all fields (as if a field mask of all fields has been specified). -// Note that in the presence of schema evolution, this may mean that -// fields the client does not know and has therefore not filled into -// the request will be reset to their default. If this is unwanted -// behavior, a specific service may require a client to always specify -// a field mask, producing an error if not. -// -// As with get operations, the location of the resource which -// describes the updated values in the request message depends on the -// operation kind. In any case, the effect of the field mask is -// required to be honored by the API. -// -// ## Considerations for HTTP REST -// -// The HTTP kind of an update operation which uses a field mask must -// be set to PATCH instead of PUT in order to satisfy HTTP semantics -// (PUT must only be used for full updates). -// -// # JSON Encoding of Field Masks -// -// In JSON, a field mask is encoded as a single string where paths are -// separated by a comma. Fields name in each path are converted -// to/from lower-camel naming conventions. -// -// As an example, consider the following message declarations: -// -// message Profile { -// User user = 1; -// Photo photo = 2; -// } -// message User { -// string display_name = 1; -// string address = 2; -// } -// -// In proto a field mask for `Profile` may look as such: -// -// mask { -// paths: "user.display_name" -// paths: "photo" -// } -// -// In JSON, the same mask is represented as below: -// -// { -// mask: "user.displayName,photo" -// } -// -// # Field Masks and Oneof Fields -// -// Field masks treat fields in oneofs just as regular fields. Consider the -// following message: -// -// message SampleMessage { -// oneof test_oneof { -// string name = 4; -// SubMessage sub_message = 9; -// } -// } -// -// The field mask can be: -// -// mask { -// paths: "name" -// } -// -// Or: -// -// mask { -// paths: "sub_message" -// } -// -// Note that oneof type names ("test_oneof" in this case) cannot be used in -// paths. -// -// ## Field Mask Verification -// -// The implementation of any API method which has a FieldMask type field in the -// request should verify the included field paths, and return an -// `INVALID_ARGUMENT` error if any path is unmappable. -message FieldMask { - // The set of field mask paths. - repeated string paths = 1; -} \ No newline at end of file diff --git a/third_party/google/protobuf/timestamp.proto b/third_party/google/protobuf/timestamp.proto deleted file mode 100644 index 7279266f6..000000000 --- a/third_party/google/protobuf/timestamp.proto +++ /dev/null @@ -1,138 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option cc_enable_arenas = true; -option go_package = "github.com/golang/protobuf/ptypes/timestamp"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "TimestampProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; - -// A Timestamp represents a point in time independent of any time zone or local -// calendar, encoded as a count of seconds and fractions of seconds at -// nanosecond resolution. The count is relative to an epoch at UTC midnight on -// January 1, 1970, in the proleptic Gregorian calendar which extends the -// Gregorian calendar backwards to year one. -// -// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap -// second table is needed for interpretation, using a [24-hour linear -// smear](https://developers.google.com/time/smear). -// -// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By -// restricting to that range, we ensure that we can convert to and from [RFC -// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. -// -// # Examples -// -// Example 1: Compute Timestamp from POSIX `time()`. -// -// Timestamp timestamp; -// timestamp.set_seconds(time(NULL)); -// timestamp.set_nanos(0); -// -// Example 2: Compute Timestamp from POSIX `gettimeofday()`. -// -// struct timeval tv; -// gettimeofday(&tv, NULL); -// -// Timestamp timestamp; -// timestamp.set_seconds(tv.tv_sec); -// timestamp.set_nanos(tv.tv_usec * 1000); -// -// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. -// -// FILETIME ft; -// GetSystemTimeAsFileTime(&ft); -// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; -// -// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z -// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. -// Timestamp timestamp; -// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); -// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); -// -// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. -// -// long millis = System.currentTimeMillis(); -// -// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) -// .setNanos((int) ((millis % 1000) * 1000000)).build(); -// -// -// Example 5: Compute Timestamp from current time in Python. -// -// timestamp = Timestamp() -// timestamp.GetCurrentTime() -// -// # JSON Mapping -// -// In JSON format, the Timestamp type is encoded as a string in the -// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the -// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" -// where {year} is always expressed using four digits while {month}, {day}, -// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional -// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), -// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone -// is required. A proto3 JSON serializer should always use UTC (as indicated by -// "Z") when printing the Timestamp type and a proto3 JSON parser should be -// able to accept both UTC and other timezones (as indicated by an offset). -// -// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past -// 01:30 UTC on January 15, 2017. -// -// In JavaScript, one can convert a Date object to this format using the -// standard -// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) -// method. In Python, a standard `datetime.datetime` object can be converted -// to this format using -// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with -// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use -// the Joda Time's [`ISODateTimeFormat.dateTime()`]( -// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D -// ) to obtain a formatter capable of generating timestamps in this format. -// -// -message Timestamp { - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - // 9999-12-31T23:59:59Z inclusive. - int64 seconds = 1; - - // Non-negative fractions of a second at nanosecond resolution. Negative - // second values with fractions must still have non-negative nanos values - // that count forward in time. Must be from 0 to 999,999,999 - // inclusive. - int32 nanos = 2; -} \ No newline at end of file diff --git a/thumbnails/pkg/proto/v0/thumbnails.pb.micro.go b/thumbnails/pkg/proto/v0/thumbnails.pb.micro.go index 02b6400ca..d4892bc9c 100644 --- a/thumbnails/pkg/proto/v0/thumbnails.pb.micro.go +++ b/thumbnails/pkg/proto/v0/thumbnails.pb.micro.go @@ -12,9 +12,9 @@ import ( import ( context "context" - api "github.com/asim/go-micro/v3/api" - client "github.com/asim/go-micro/v3/client" - server "github.com/asim/go-micro/v3/server" + api "go-micro.dev/v4/api" + client "go-micro.dev/v4/client" + server "go-micro.dev/v4/server" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/thumbnails/pkg/service/v0/service.go b/thumbnails/pkg/service/v0/service.go index dab2496ab..b5388f844 100644 --- a/thumbnails/pkg/service/v0/service.go +++ b/thumbnails/pkg/service/v0/service.go @@ -7,7 +7,6 @@ import ( "path" "strings" - merrors "github.com/asim/go-micro/v3/errors" gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1" rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" @@ -18,6 +17,7 @@ import ( "github.com/owncloud/ocis/thumbnails/pkg/thumbnail" "github.com/owncloud/ocis/thumbnails/pkg/thumbnail/imgsource" "github.com/pkg/errors" + merrors "go-micro.dev/v4/errors" "google.golang.org/grpc/metadata" ) diff --git a/web/pkg/server/http/server.go b/web/pkg/server/http/server.go index ade4049b4..25a9e5db7 100644 --- a/web/pkg/server/http/server.go +++ b/web/pkg/server/http/server.go @@ -1,13 +1,13 @@ package http import ( - "github.com/asim/go-micro/v3" chimiddleware "github.com/go-chi/chi/v5/middleware" "github.com/owncloud/ocis/ocis-pkg/middleware" "github.com/owncloud/ocis/ocis-pkg/service/http" "github.com/owncloud/ocis/ocis-pkg/version" webmid "github.com/owncloud/ocis/web/pkg/middleware" svc "github.com/owncloud/ocis/web/pkg/service/v0" + "go-micro.dev/v4" ) // Server initializes the http service and server. diff --git a/webdav/pkg/dav/requests/thumbnail.go b/webdav/pkg/dav/requests/thumbnail.go index c58da798c..4bb1fc35a 100644 --- a/webdav/pkg/dav/requests/thumbnail.go +++ b/webdav/pkg/dav/requests/thumbnail.go @@ -22,15 +22,15 @@ const ( // ThumbnailRequest combines all parameters provided when requesting a thumbnail type ThumbnailRequest struct { // The file path of the source file - Filepath string + Filepath string // The file name of the source file including the extension - Filename string + Filename string // The file extension - Extension string + Extension string // The requested width of the thumbnail - Width int32 + Width int32 // The requested height of the thumbnail - Height int32 + Height int32 // In case of a public share the public link token. PublicLinkToken string } @@ -97,7 +97,7 @@ func parseDimension(d, name string, defaultValue int64) (int64, error) { result, err := strconv.ParseInt(d, 10, 32) if err != nil || result < 1 { // The error message doesn't fit but for OC10 API compatibility reasons we have to set this. - return 0, fmt.Errorf("Cannot set %s of 0 or smaller!", name) //nolint:golint + return 0, fmt.Errorf("Cannot set %s of 0 or smaller!", name) } return result, nil } diff --git a/webdav/pkg/server/http/server.go b/webdav/pkg/server/http/server.go index 16aebff92..11eeeeae3 100644 --- a/webdav/pkg/server/http/server.go +++ b/webdav/pkg/server/http/server.go @@ -1,11 +1,11 @@ package http import ( - "github.com/asim/go-micro/v3" chimiddleware "github.com/go-chi/chi/v5/middleware" "github.com/owncloud/ocis/ocis-pkg/middleware" "github.com/owncloud/ocis/ocis-pkg/service/http" svc "github.com/owncloud/ocis/webdav/pkg/service/v0" + "go-micro.dev/v4" ) // Server initializes the http service and server. diff --git a/webdav/pkg/service/v0/service.go b/webdav/pkg/service/v0/service.go index 972e6f7e5..f67c39b8e 100644 --- a/webdav/pkg/service/v0/service.go +++ b/webdav/pkg/service/v0/service.go @@ -2,12 +2,13 @@ package svc import ( "encoding/xml" - merrors "github.com/asim/go-micro/v3/errors" - "github.com/go-chi/render" "net/http" "path" "strings" + "github.com/go-chi/render" + merrors "go-micro.dev/v4/errors" + "github.com/owncloud/ocis/ocis-pkg/log" "github.com/owncloud/ocis/ocis-pkg/service/grpc"