-
Notifications
You must be signed in to change notification settings - Fork 2
/
service.go
31 lines (25 loc) · 922 Bytes
/
service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package cmd
import (
"github.com/dpb587/ssoca/client"
"github.com/dpb587/ssoca/client/service"
globalservice "github.com/dpb587/ssoca/service"
"github.com/sirupsen/logrus"
)
type ServiceCommand struct {
Runtime client.Runtime
ServiceManager service.Manager `no-flag:"true"`
ServiceType globalservice.Type `no-flag:"true"`
ServiceName string `long:"service" short:"s" description:"Service name" env:"SSOCA_SERVICE"`
}
func (sc ServiceCommand) GetLogger() logrus.FieldLogger {
return sc.Runtime.GetLogger().WithFields(logrus.Fields{
"service.type": sc.ServiceType,
"service.name": sc.ServiceName,
})
}
func (sc ServiceCommand) GetService() (service.Service, error) {
return sc.ServiceManager.Get(sc.ServiceType, sc.ServiceName)
}
type InteractiveAuthCommand struct {
SkipAuthRetry bool `long:"skip-auth-retry" description:"Skip interactive authentication retries when logged out"`
}