feat #44: add CLI commands to manage apps
This commit is contained in:
parent
9d2d49425d
commit
c8958a8f44
9 changed files with 276 additions and 4 deletions
34
polyculeconnect/services/app/app.go
Normal file
34
polyculeconnect/services/app/app.go
Normal 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}
|
||||
}
|
1
polyculeconnect/services/app/app_test.go
Normal file
1
polyculeconnect/services/app/app_test.go
Normal file
|
@ -0,0 +1 @@
|
|||
package app_test
|
Loading…
Add table
Add a link
Reference in a new issue