File: role.go

package info (click to toggle)
golang-github-mesos-mesos-go 0.0.6%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 11,724 kB
  • sloc: makefile: 163
file content (25 lines) | stat: -rw-r--r-- 379 bytes parent folder | download
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
package resources

type Role string

const RoleDefault = Role("*")

func (r Role) IsDefault() bool {
	return r == RoleDefault
}

func (r Role) Assign() func(interface{}) {
	return func(v interface{}) {
		type roler interface {
			WithRole(string)
		}
		if ri, ok := v.(roler); ok {
			ri.WithRole(string(r))
		}
	}
}

func (r Role) Proto() *string {
	s := string(r)
	return &s
}