Debian Codegraph @

api/v0/scheduler/handler.go

raw symbols SCIP
1 package scheduler
2
3 import (
4 "github.com/mesos/mesos-go/api/v0/auth/callback"
5 mesos "github.com/mesos/mesos-go/api/v0/mesosproto"
6 "github.com/mesos/mesos-go/api/v0/upid"
7 )
8
9 type CredentialHandler struct {
10 pid *upid.UPID // the process to authenticate against (master)
11 client *upid.UPID // the process to be authenticated (slave / framework)
12 credential *mesos.Credential
13 }
14
15 func (h *CredentialHandler) Handle(callbacks ...callback.Interface) error {
16 for _, cb := range callbacks {
17 switch cb := cb.(type) {
18 case *callback.Name:
19 cb.Set(h.credential.GetPrincipal())
20 case *callback.Password:
21 cb.Set(([]byte)(h.credential.GetSecret()))
22 case *callback.Interprocess:
23 cb.Set(*(h.pid), *(h.client))
24 default:
25 return &callback.Unsupported{Callback: cb}
26 }
27 }
28 return nil
29 }