Adjust import paths and service urls in index.js
This commit is contained in:
@@ -3,17 +3,19 @@ package command
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v1"
|
||||
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v1"
|
||||
|
||||
"github.com/asim/go-micro/plugins/client/grpc/v4"
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
// AddAccount command creates a new account
|
||||
func AddAccount(cfg *config.Config) *cli.Command {
|
||||
a := &accounts.Account{
|
||||
PasswordProfile: &accounts.PasswordProfile{},
|
||||
a := &accountsmsg.Account{
|
||||
PasswordProfile: &accountsmsg.PasswordProfile{},
|
||||
}
|
||||
return &cli.Command{
|
||||
Name: "add",
|
||||
@@ -43,8 +45,8 @@ func AddAccount(cfg *config.Config) *cli.Command {
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
accSvcID := cfg.GRPC.Namespace + "." + cfg.Service.Name
|
||||
accSvc := accounts.NewAccountsService(accSvcID, grpc.NewClient())
|
||||
_, err := accSvc.CreateAccount(c.Context, &accounts.CreateAccountRequest{
|
||||
accSvc := accountssvc.NewAccountsService(accSvcID, grpc.NewClient())
|
||||
_, err := accSvc.CreateAccount(c.Context, &accountssvc.CreateAccountRequest{
|
||||
Account: a,
|
||||
})
|
||||
|
||||
|
||||
@@ -5,12 +5,14 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v1"
|
||||
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v1"
|
||||
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
|
||||
"github.com/asim/go-micro/plugins/client/grpc/v4"
|
||||
tw "github.com/olekukonko/tablewriter"
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -30,8 +32,8 @@ func InspectAccount(cfg *config.Config) *cli.Command {
|
||||
}
|
||||
|
||||
uid := c.Args().First()
|
||||
accSvc := accounts.NewAccountsService(accServiceID, grpc.NewClient())
|
||||
acc, err := accSvc.GetAccount(c.Context, &accounts.GetAccountRequest{
|
||||
accSvc := accountssvc.NewAccountsService(accServiceID, grpc.NewClient())
|
||||
acc, err := accSvc.GetAccount(c.Context, &accountssvc.GetAccountRequest{
|
||||
Id: uid,
|
||||
})
|
||||
|
||||
@@ -45,7 +47,7 @@ func InspectAccount(cfg *config.Config) *cli.Command {
|
||||
}}
|
||||
}
|
||||
|
||||
func buildAccountInspectTable(acc *accounts.Account) *tw.Table {
|
||||
func buildAccountInspectTable(acc *accountsmsg.Account) *tw.Table {
|
||||
table := tw.NewWriter(os.Stdout)
|
||||
table.SetAutoMergeCells(true)
|
||||
table.AppendBulk([][]string{
|
||||
|
||||
@@ -5,12 +5,14 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v1"
|
||||
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v1"
|
||||
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
|
||||
"github.com/asim/go-micro/plugins/client/grpc/v4"
|
||||
tw "github.com/olekukonko/tablewriter"
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -24,8 +26,8 @@ func ListAccounts(cfg *config.Config) *cli.Command {
|
||||
Flags: flagset.ListAccountsWithConfig(cfg),
|
||||
Action: func(c *cli.Context) error {
|
||||
accSvcID := cfg.GRPC.Namespace + "." + cfg.Service.Name
|
||||
accSvc := accounts.NewAccountsService(accSvcID, grpc.NewClient())
|
||||
resp, err := accSvc.ListAccounts(c.Context, &accounts.ListAccountsRequest{})
|
||||
accSvc := accountssvc.NewAccountsService(accSvcID, grpc.NewClient())
|
||||
resp, err := accSvc.ListAccounts(c.Context, &accountssvc.ListAccountsRequest{})
|
||||
|
||||
if err != nil {
|
||||
fmt.Println(fmt.Errorf("could not list accounts %w", err))
|
||||
@@ -38,7 +40,7 @@ func ListAccounts(cfg *config.Config) *cli.Command {
|
||||
}
|
||||
|
||||
// buildAccountsListTable creates an ascii table for printing on the cli
|
||||
func buildAccountsListTable(accs []*accounts.Account) *tw.Table {
|
||||
func buildAccountsListTable(accs []*accountsmsg.Account) *tw.Table {
|
||||
table := tw.NewWriter(os.Stdout)
|
||||
table.SetHeader([]string{"Id", "DisplayName", "Mail", "AccountEnabled"})
|
||||
table.SetAutoFormatHeaders(false)
|
||||
|
||||
@@ -4,9 +4,10 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v1"
|
||||
|
||||
"github.com/asim/go-micro/plugins/client/grpc/v4"
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
index "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/urfave/cli/v2"
|
||||
merrors "go-micro.dev/v4/errors"
|
||||
)
|
||||
@@ -20,9 +21,9 @@ func RebuildIndex(cdf *config.Config) *cli.Command {
|
||||
Aliases: []string{"rebuild", "ri"},
|
||||
Action: func(ctx *cli.Context) error {
|
||||
idxSvcID := "com.owncloud.api.accounts"
|
||||
idxSvc := index.NewIndexService(idxSvcID, grpc.NewClient())
|
||||
idxSvc := accountssvc.NewIndexService(idxSvcID, grpc.NewClient())
|
||||
|
||||
_, err := idxSvc.RebuildIndex(context.Background(), &index.RebuildIndexRequest{})
|
||||
_, err := idxSvc.RebuildIndex(context.Background(), &accountssvc.RebuildIndexRequest{})
|
||||
if err != nil {
|
||||
fmt.Println(merrors.FromError(err).Detail)
|
||||
return err
|
||||
|
||||
@@ -4,11 +4,12 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v1"
|
||||
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
|
||||
"github.com/asim/go-micro/plugins/client/grpc/v4"
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -29,8 +30,8 @@ func RemoveAccount(cfg *config.Config) *cli.Command {
|
||||
}
|
||||
|
||||
uid := c.Args().First()
|
||||
accSvc := accounts.NewAccountsService(accServiceID, grpc.NewClient())
|
||||
_, err := accSvc.DeleteAccount(c.Context, &accounts.DeleteAccountRequest{Id: uid})
|
||||
accSvc := accountssvc.NewAccountsService(accServiceID, grpc.NewClient())
|
||||
_, err := accSvc.DeleteAccount(c.Context, &accountssvc.DeleteAccountRequest{Id: uid})
|
||||
|
||||
if err != nil {
|
||||
fmt.Println(fmt.Errorf("could not delete account %w", err))
|
||||
|
||||
@@ -4,19 +4,21 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v1"
|
||||
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v1"
|
||||
|
||||
"github.com/owncloud/ocis/accounts/pkg/flagset"
|
||||
|
||||
"github.com/asim/go-micro/plugins/client/grpc/v4"
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/urfave/cli/v2"
|
||||
"google.golang.org/genproto/protobuf/field_mask"
|
||||
)
|
||||
|
||||
// UpdateAccount command for modifying accounts including password policies
|
||||
func UpdateAccount(cfg *config.Config) *cli.Command {
|
||||
a := &accounts.Account{
|
||||
PasswordProfile: &accounts.PasswordProfile{},
|
||||
a := &accountsmsg.Account{
|
||||
PasswordProfile: &accountsmsg.PasswordProfile{},
|
||||
}
|
||||
return &cli.Command{
|
||||
Name: "update",
|
||||
@@ -42,8 +44,8 @@ func UpdateAccount(cfg *config.Config) *cli.Command {
|
||||
Action: func(c *cli.Context) error {
|
||||
a.Id = c.Args().First()
|
||||
accSvcID := cfg.GRPC.Namespace + "." + cfg.Service.Name
|
||||
accSvc := accounts.NewAccountsService(accSvcID, grpc.NewClient())
|
||||
_, err := accSvc.UpdateAccount(c.Context, &accounts.UpdateAccountRequest{
|
||||
accSvc := accountssvc.NewAccountsService(accSvcID, grpc.NewClient())
|
||||
_, err := accSvc.UpdateAccount(c.Context, &accountssvc.UpdateAccountRequest{
|
||||
Account: a,
|
||||
UpdateMask: buildAccUpdateMask(c.FlagNames()),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user