Skip to content

Commit

Permalink
fix svc name (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
labkode committed Oct 17, 2019
1 parent 82f6f58 commit 55380db
Show file tree
Hide file tree
Showing 45 changed files with 348 additions and 348 deletions.
4 changes: 2 additions & 2 deletions cmd/reva/gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ level = "debug"
# What services, http middlewares and grpc interceptors should be started?
[http]
enabled_services = ["datasvc", "ocdavsvc", "ocssvc"{{if eq .CredentialStrategy "oidc"}}, "oidcprovider", "wellknown"{{end}}]
enabled_services = ["datasvc", "ocdav", "ocssvc"{{if eq .CredentialStrategy "oidc"}}, "oidcprovider", "wellknown"{{end}}]
enabled_middlewares = ["log", "trace", "auth"{{if eq .CredentialStrategy "oidc"}}, "cors"{{end}}]
network = "tcp"
address = "0.0.0.0:9998"
Expand Down Expand Up @@ -140,7 +140,7 @@ secret = "{{.TokenSecret}}"
# HTTP services
[http.services.ocdavsvc]
[http.services.ocdav]
prefix = ""
chunk_folder = "/var/tmp/owncloud/chunks"
storageregistrysvc = "127.0.0.1:9999"
Expand Down
2 changes: 1 addition & 1 deletion internal/grpc/services/appprovider/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

package appprovidersvc
package appprovider

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion internal/grpc/services/authregistry/authregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

package storageregsvc
package authregistry

import (
"context"
Expand Down
16 changes: 8 additions & 8 deletions internal/grpc/services/gateway/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

package gatewaysvc
package gateway

import (
"context"
Expand All @@ -34,7 +34,7 @@ import (
func (s *svc) Open(ctx context.Context, req *appproviderv0alphapb.OpenRequest) (*appproviderv0alphapb.OpenResponse, error) {
provider, err := s.findAppProvider(ctx, req.ResourceInfo)
if err != nil {
err = errors.Wrap(err, "gatewaysvc: error calling findAppProvider")
err = errors.Wrap(err, "gateway: error calling findAppProvider")
var st *rpcpb.Status
if _, ok := err.(errtypes.IsNotFound); ok {
st = status.NewNotFound(ctx, "app provider not found")
Expand All @@ -49,15 +49,15 @@ func (s *svc) Open(ctx context.Context, req *appproviderv0alphapb.OpenRequest) (

c, err := pool.GetAppProviderClient(provider.Address)
if err != nil {
err = errors.Wrap(err, "gatewaysvc: error calling GetAppProviderClient")
err = errors.Wrap(err, "gateway: error calling GetAppProviderClient")
return &appproviderv0alphapb.OpenResponse{
Status: status.NewInternal(ctx, err, "error getting appprovider client"),
}, nil
}

res, err := c.Open(ctx, req)
if err != nil {
return nil, errors.Wrap(err, "gatewaysvc: error calling c.Open")
return nil, errors.Wrap(err, "gateway: error calling c.Open")
}

return res, nil
Expand All @@ -66,7 +66,7 @@ func (s *svc) Open(ctx context.Context, req *appproviderv0alphapb.OpenRequest) (
func (s *svc) findAppProvider(ctx context.Context, ri *storageproviderv0alphapb.ResourceInfo) (*appregistryv0alphapb.ProviderInfo, error) {
c, err := pool.GetAppRegistryClient(s.c.AppRegistryEndpoint)
if err != nil {
err = errors.Wrap(err, "gatewaysvc: error getting appregistry client")
err = errors.Wrap(err, "gateway: error getting appregistry client")
return nil, err
}

Expand All @@ -75,7 +75,7 @@ func (s *svc) findAppProvider(ctx context.Context, ri *storageproviderv0alphapb.
})

if err != nil {
err = errors.Wrap(err, "gatewaysvc: error calling GetAppProviders")
err = errors.Wrap(err, "gateway: error calling GetAppProviders")
return nil, err
}

Expand All @@ -86,8 +86,8 @@ func (s *svc) findAppProvider(ctx context.Context, ri *storageproviderv0alphapb.
}

if res.Status.Code == rpcpb.Code_CODE_NOT_FOUND {
return nil, errtypes.NotFound("gatewaysvc: app provider not found for resource: " + ri.String())
return nil, errtypes.NotFound("gateway: app provider not found for resource: " + ri.String())
}

return nil, errors.New("gatewaysvc: error finding a storage provider")
return nil, errors.New("gateway: error finding a storage provider")
}
10 changes: 5 additions & 5 deletions internal/grpc/services/gateway/appregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

package gatewaysvc
package gateway

import (
"context"
Expand All @@ -30,15 +30,15 @@ import (
func (s *svc) GetAppProviders(ctx context.Context, req *appregistryv0alphapb.GetAppProvidersRequest) (*appregistryv0alphapb.GetAppProvidersResponse, error) {
c, err := pool.GetAppRegistryClient(s.c.AppRegistryEndpoint)
if err != nil {
err = errors.Wrap(err, "gatewaysvc: error calling GetOCMShareProviderClient")
err = errors.Wrap(err, "gateway: error calling GetOCMShareProviderClient")
return &appregistryv0alphapb.GetAppProvidersResponse{
Status: status.NewInternal(ctx, err, "error getting user share provider client"),
}, nil
}

res, err := c.GetAppProviders(ctx, req)
if err != nil {
return nil, errors.Wrap(err, "gatewaysvc: error calling ListShares")
return nil, errors.Wrap(err, "gateway: error calling ListShares")
}

return res, nil
Expand All @@ -47,15 +47,15 @@ func (s *svc) GetAppProviders(ctx context.Context, req *appregistryv0alphapb.Get
func (s *svc) ListAppProviders(ctx context.Context, req *appregistryv0alphapb.ListAppProvidersRequest) (*appregistryv0alphapb.ListAppProvidersResponse, error) {
c, err := pool.GetAppRegistryClient(s.c.AppRegistryEndpoint)
if err != nil {
err = errors.Wrap(err, "gatewaysvc: error calling GetOCMShareProviderClient")
err = errors.Wrap(err, "gateway: error calling GetOCMShareProviderClient")
return &appregistryv0alphapb.ListAppProvidersResponse{
Status: status.NewInternal(ctx, err, "error getting user share provider client"),
}, nil
}

res, err := c.ListAppProviders(ctx, req)
if err != nil {
return nil, errors.Wrap(err, "gatewaysvc: error calling ListShares")
return nil, errors.Wrap(err, "gateway: error calling ListShares")
}

return res, nil
Expand Down
20 changes: 10 additions & 10 deletions internal/grpc/services/gateway/authprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

package gatewaysvc
package gateway

import (
"context"
Expand All @@ -39,7 +39,7 @@ func (s *svc) Authenticate(ctx context.Context, req *gatewayv0alphapb.Authentica
// find auth provider
c, err := s.findAuthProvider(ctx, req.Type)
if err != nil {
err = errors.New("gatewaysvc: error finding auth provider for type: " + req.Type)
err = errors.New("gateway: error finding auth provider for type: " + req.Type)
return &gatewayv0alphapb.AuthenticateResponse{
Status: status.NewInternal(ctx, err, "error getting auth provider client"),
}, nil
Expand All @@ -57,7 +57,7 @@ func (s *svc) Authenticate(ctx context.Context, req *gatewayv0alphapb.Authentica
}

if res.Status.Code != rpcpb.Code_CODE_OK {
err := status.NewErrorFromCode(res.Status.Code, "gatewaysvc")
err := status.NewErrorFromCode(res.Status.Code, "gateway")
return &gatewayv0alphapb.AuthenticateResponse{
Status: status.NewUnauthenticated(ctx, err, ""),
}, nil
Expand All @@ -66,7 +66,7 @@ func (s *svc) Authenticate(ctx context.Context, req *gatewayv0alphapb.Authentica
// validate valid userId
uid := res.UserId
if uid == nil {
err := errors.New("gatewaysvc: uid after Authenticate is nil")
err := errors.New("gateway: uid after Authenticate is nil")
log.Err(err).Msg("user id is nil")
return &gatewayv0alphapb.AuthenticateResponse{
Status: status.NewInternal(ctx, err, "user id is nil"),
Expand Down Expand Up @@ -123,7 +123,7 @@ func (s *svc) Authenticate(ctx context.Context, req *gatewayv0alphapb.Authentica
func (s *svc) WhoAmI(ctx context.Context, req *gatewayv0alphapb.WhoAmIRequest) (*gatewayv0alphapb.WhoAmIResponse, error) {
u, err := s.tokenmgr.DismantleToken(ctx, req.Token)
if err != nil {
err = errors.Wrap(err, "gatewaysvc: error getting user from token")
err = errors.Wrap(err, "gateway: error getting user from token")
return &gatewayv0alphapb.WhoAmIResponse{
Status: status.NewUnauthenticated(ctx, err, "error dismantling token"),
}, nil
Expand All @@ -139,7 +139,7 @@ func (s *svc) WhoAmI(ctx context.Context, req *gatewayv0alphapb.WhoAmIRequest) (
func (s *svc) findAuthProvider(ctx context.Context, authType string) (authproviderv0alphapb.AuthProviderServiceClient, error) {
c, err := pool.GetAuthRegistryServiceClient(s.c.AuthRegistryEndpoint)
if err != nil {
err = errors.Wrap(err, "gatewaysvc: error getting auth registry client")
err = errors.Wrap(err, "gateway: error getting auth registry client")
return nil, err
}

Expand All @@ -148,24 +148,24 @@ func (s *svc) findAuthProvider(ctx context.Context, authType string) (authprovid
})

if err != nil {
err = errors.Wrap(err, "gatewaysvc: error calling GetAuthProvider")
err = errors.Wrap(err, "gateway: error calling GetAuthProvider")
return nil, err
}

if res.Status.Code == rpcpb.Code_CODE_OK && res.Provider != nil {
// TODO(labkode): check for capabilities here
c, err := pool.GetAuthProviderServiceClient(res.Provider.Address)
if err != nil {
err = errors.Wrap(err, "gatewaysvc: error getting an auth provider client")
err = errors.Wrap(err, "gateway: error getting an auth provider client")
return nil, err
}

return c, nil
}

if res.Status.Code == rpcpb.Code_CODE_NOT_FOUND {
return nil, errtypes.NotFound("gatewaysvc: auth provider not found for type:" + authType)
return nil, errtypes.NotFound("gateway: auth provider not found for type:" + authType)
}

return nil, errors.New("gatewaysvc: error finding an auth provider for type: " + authType)
return nil, errors.New("gateway: error finding an auth provider for type: " + authType)
}
14 changes: 7 additions & 7 deletions internal/grpc/services/gateway/authregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

package gatewaysvc
package gateway

import (
"context"
Expand All @@ -32,24 +32,24 @@ import (
func (s *svc) ListAuthProviders(ctx context.Context, req *authregistryv0alphapb.ListAuthProvidersRequest) (*gatewayv0alphapb.ListAuthProvidersResponse, error) {
c, err := pool.GetAuthRegistryServiceClient(s.c.AuthRegistryEndpoint)
if err != nil {
err = errors.Wrap(err, "gatewaysvc: error getting auth registry client")
err = errors.Wrap(err, "gateway: error getting auth registry client")
return &gatewayv0alphapb.ListAuthProvidersResponse{
Status: status.NewInternal(ctx, err, "gatewaysvc"),
Status: status.NewInternal(ctx, err, "gateway"),
}, nil
}

res, err := c.ListAuthProviders(ctx, req)
if err != nil {
err = errors.Wrap(err, "gatewaysvc: error calling ListAuthProviders")
err = errors.Wrap(err, "gateway: error calling ListAuthProviders")
return &gatewayv0alphapb.ListAuthProvidersResponse{
Status: status.NewInternal(ctx, err, "gatewaysvc"),
Status: status.NewInternal(ctx, err, "gateway"),
}, nil
}

if res.Status.Code != rpcpb.Code_CODE_OK {
err := status.NewErrorFromCode(res.Status.Code, "gatewaysvc")
err := status.NewErrorFromCode(res.Status.Code, "gateway")
return &gatewayv0alphapb.ListAuthProvidersResponse{
Status: status.NewInternal(ctx, err, "gatewaysvc"),
Status: status.NewInternal(ctx, err, "gateway"),
}, nil
}

Expand Down
10 changes: 5 additions & 5 deletions internal/grpc/services/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

package gatewaysvc
package gateway

import (
"fmt"
Expand All @@ -34,7 +34,7 @@ import (
)

func init() {
rgrpc.Register("gatewaysvc", New)
rgrpc.Register("gateway", New)
}

type config struct {
Expand All @@ -48,7 +48,7 @@ type config struct {
UserProviderEndpoint string `mapstructure:"userprovidersvc"`
CommitShareToStorageGrant bool `mapstructure:"commit_share_to_storage_grant"`
CommitShareToStorageRef bool `mapstructure:"commit_share_to_storage_ref"`
DataGatewayEndpoint string `mapstructure:"datagatewaysvc"`
DataGatewayEndpoint string `mapstructure:"datagateway"`
TransferSharedSecret string `mapstructure:"transfer_shared_secret"`
TranserExpires int64 `mapstructure:"transfer_expires"`
TokenManager string `mapstructure:"token_manager"`
Expand All @@ -72,7 +72,7 @@ func New(m map[string]interface{}, ss *grpc.Server) (io.Closer, error) {

// ensure DataGatewayEndpoint is a valid URI
if c.DataGatewayEndpoint == "" {
return nil, errors.New("datagatewaysvc is not defined")
return nil, errors.New("datagateway is not defined")
}

u, err := url.Parse(c.DataGatewayEndpoint)
Expand Down Expand Up @@ -102,7 +102,7 @@ func (s *svc) Close() error {
func parseConfig(m map[string]interface{}) (*config, error) {
c := &config{}
if err := mapstructure.Decode(m, c); err != nil {
err = errors.Wrap(err, "gatewaysvc: error decoding conf")
err = errors.Wrap(err, "gateway: error decoding conf")
return nil, err
}
return c, nil
Expand Down

0 comments on commit 55380db

Please sign in to comment.