feat #44: add CLI commands to manage apps
All checks were successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/push/deploy Pipeline was successful

This commit is contained in:
Melora Hugues 2023-11-08 19:31:34 +01:00
parent 9d2d49425d
commit c8958a8f44
9 changed files with 276 additions and 4 deletions

View file

@ -0,0 +1,34 @@
package app
import "github.com/dexidp/dex/storage"
type Service interface {
ListApps() ([]storage.Client, error)
GetApp(id string) (storage.Client, error)
AddApp(config storage.Client) error
RemoveApp(id string) error
}
type concreteAppService struct {
s storage.Storage
}
func (cas *concreteAppService) ListApps() ([]storage.Client, error) {
return cas.s.ListClients()
}
func (cas *concreteAppService) GetApp(id string) (storage.Client, error) {
return cas.s.GetClient(id)
}
func (cas *concreteAppService) AddApp(config storage.Client) error {
return cas.s.CreateClient(config)
}
func (cas *concreteAppService) RemoveApp(id string) error {
return cas.s.DeleteClient(id)
}
func New(s storage.Storage) Service {
return &concreteAppService{s}
}

View file

@ -0,0 +1 @@
package app_test