Documentation ¶
Index ¶
- func QueuesToAPI(queues []Queue) []*api.Queue
- type CordonAPI
- type CreateAPI
- type DeleteAPI
- type GetAPI
- type GetAllAPI
- type PermissionSubject
- type PermissionSubjectKind
- type PermissionSubjects
- type PermissionVerb
- type PermissionVerbs
- type Permissions
- type PriorityFactor
- type Queue
- type ResourceLimit
- type ResourceLimits
- type ResourceName
- type UncordonAPI
- type UpdateAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QueuesToAPI ¶
Types ¶
type CordonAPI ¶ added in v0.9.8
func Cordon ¶ added in v0.9.8
func Cordon(getConnectionDetails client.ConnectionDetails) CordonAPI
type GetAPI ¶ added in v0.3.100
func Get ¶ added in v0.3.100
func Get(getConnectionDetails client.ConnectionDetails) GetAPI
type GetAllAPI ¶ added in v0.9.8
func GetAll ¶ added in v0.9.8
func GetAll(getConnectionDetails client.ConnectionDetails) GetAllAPI
type PermissionSubject ¶
type PermissionSubject struct { Kind PermissionSubjectKind `json:"kind"` Name string `json:"name"` }
type PermissionSubjectKind ¶
type PermissionSubjectKind string
const ( PermissionSubjectKindGroup PermissionSubjectKind = "Group" PermissionSubjectKindUser PermissionSubjectKind = "User" )
func NewPermissionSubjectKind ¶
func NewPermissionSubjectKind(in string) (PermissionSubjectKind, error)
NewPermissionSubjectKind returns PermissionSubjectKind from input string. If input string doesn't match one of the allowed kind values ["Group", "User"] error is returned.
func (PermissionSubjectKind) Generate ¶
Generate is implementation of https://pkg.go.dev/testing/quick#Generator interface. This method is used for writing tests usign https://pkg.go.dev/testing/quick package.
TODO: Unused.
func (*PermissionSubjectKind) UnmarshalJSON ¶
func (kind *PermissionSubjectKind) UnmarshalJSON(data []byte) error
UnmarshalJSON is implementation of https://pkg.go.dev/encoding/json#Unmarshaler interface.
TODO: Unused.
type PermissionSubjects ¶
type PermissionSubjects []PermissionSubject
func NewPermissionSubjects ¶
func NewPermissionSubjects(subjects []*api.Queue_Permissions_Subject) (PermissionSubjects, error)
NewPermissionSibjects returns PermissionSubjects using the subjects values. If any of the subjects has an invalid subject kind an error is returned.
func NewPermissionSubjectsFromOwners ¶
func NewPermissionSubjectsFromOwners(users, groups []string) PermissionSubjects
NewPermissionSubjectsFromOwners creates Subjects from user and group owners. Subjects will have User subjects that contains all users specified in users parameter and Group subjects that contains all groups specified in groups parameter. This function is used for backward compatibility when permission subjects didn't exist and only user and group owners could be associated with the queues.
type PermissionVerb ¶
type PermissionVerb string
const ( PermissionVerbSubmit PermissionVerb = "submit" PermissionVerbCancel PermissionVerb = "cancel" PermissionVerbPreempt PermissionVerb = "preempt" PermissionVerbReprioritize PermissionVerb = "reprioritize" PermissionVerbWatch PermissionVerb = "watch" )
func NewPermissionVerb ¶
func NewPermissionVerb(in string) (PermissionVerb, error)
NewPermissionVerb returns PermissionVerb from input string. If input string doesn't match one of allowed verb values ["submit", "cancel", "preempt", "reprioritize", "watch"], and error is returned.
func (PermissionVerb) Generate ¶
Generate is implementation of https://pkg.go.dev/testing/quick#Generator interface. This method is used for writing tests usign https://pkg.go.dev/testing/quick package
func (*PermissionVerb) UnmarshalJSON ¶
func (verb *PermissionVerb) UnmarshalJSON(data []byte) error
UnmarshalJSON is implementation of https://pkg.go.dev/encoding/json#Unmarshaler interface.
type PermissionVerbs ¶
type PermissionVerbs []PermissionVerb
func AllPermissionVerbs ¶
func AllPermissionVerbs() PermissionVerbs
AllPermissionVerbs returns PermissionsVerbs containing all PermissionVerb values
func NewPermissionVerbs ¶
func NewPermissionVerbs(verbs []string) (PermissionVerbs, error)
NewPermissionVerbs returns PermissionVerbs from string slice. Every string from slice is transformed into PermissionVerb. Error is returned if a string cannot be transformed to PermissionVerb.
type Permissions ¶
type Permissions struct { Subjects PermissionSubjects `json:"subjects"` Verbs PermissionVerbs `json:"verbs"` }
Permissions specifies the list of subjects that are allowed to perform queue operations specified by the list of verbs.
func NewPermissions ¶
func NewPermissions(perm *api.Queue_Permissions) (Permissions, error)
NewPermissions returns Permissions from *api.Queue_Permissions. An error is returned if subjects/verbs can't be generated from *api.Queue_Permissions.Subjects/*api.Queue_Permissions.Verbs
func NewPermissionsFromOwners ¶
func NewPermissionsFromOwners(users, groups []string) Permissions
NewPermissionsFromOwners creates Permissions from user and group owners. Permissions will have User subjects that contains all users specified in users parameter and Group subjects that contains all groups specified in groups parameter. Permissions will also include all currently supported verbs (effectively emulating old user's and group's owner permissions). This function is used for backward compatibility when permissions didn't exist and only user and group owners could perform queue operations.
func (Permissions) ToAPI ¶
func (p Permissions) ToAPI() *api.Queue_Permissions
ToAPI converts Permissions to *api.Queue_Permissions.
type PriorityFactor ¶
type PriorityFactor float64
func NewPriorityFactor ¶
func NewPriorityFactor(in float64) (PriorityFactor, error)
NewPriorityFactor return PriorityFactor using the value of in. If in value is lower than 1.0 an error is returned.
func (PriorityFactor) Generate ¶
Generate is implementation of https://pkg.go.dev/testing/quick#Generator interface. This method is used for writing tests usign https://pkg.go.dev/testing/quick package
func (*PriorityFactor) UnmarshalJSON ¶
func (f *PriorityFactor) UnmarshalJSON(data []byte) error
UnmarshalJSON is implementation of https://pkg.go.dev/encoding/json#Unmarshaler interface.
type Queue ¶
type Queue struct { Name string `json:"name"` Permissions []Permissions `json:"permissions"` PriorityFactor PriorityFactor `json:"priorityFactor"` ResourceLimitsByPriorityClassName map[string]api.PriorityClassResourceLimits Cordoned bool `json:"cordoned"` Labels map[string]string `json:"labels"` }
func NewQueue ¶
NewQueue returns new Queue using the in parameter. Error is returned if any of the queue fields has corresponding value that is invalid.
func (Queue) HasPermission ¶
func (q Queue) HasPermission(inputSubject PermissionSubject, inputVerb PermissionVerb) bool
HasPermission returns true if the inputSubject is allowed to peform a queue operation specified by inputVerb parameter, otherwise returns false
type ResourceLimit ¶
type ResourceLimit float64
func NewResourceLimit ¶
func NewResourceLimit(in float64) (ResourceLimit, error)
NewResourceLimit return ResourceLimit using the value of in. If in value is not in [0, 1] range an error is returned.
func (ResourceLimit) Generate ¶
Generate is implementation of https://pkg.go.dev/testing/quick#Generator interface. This method is used for writing tests usign https://pkg.go.dev/testing/quick package
func (*ResourceLimit) UnmarshalJSON ¶
func (rl *ResourceLimit) UnmarshalJSON(data []byte) error
UnmarshalJSON is implementation of https://pkg.go.dev/encoding/json#Unmarshaler interface.
type ResourceLimits ¶
type ResourceLimits map[ResourceName]ResourceLimit
func NewResourceLimits ¶
func NewResourceLimits(in map[string]float64) (ResourceLimits, error)
NewResourceLimits return ResourceLimits using the value of in. If any of the map values is not successfully converted to ResourceLimit an error is returned.
type ResourceName ¶
type ResourceName string
const ( ResourceNameCPU ResourceName = "cpu" ResourceNameMemory ResourceName = "memory" )
func NewResourceName ¶
func NewResourceName(in string) (ResourceName, error)
NewResourceName return ResourceName using the value of in. If in value is not one of: "cpu", "memory" an error is returned.
func (ResourceName) Generate ¶
Generate is implementation of https://pkg.go.dev/testing/quick#Generator interface. This method is used for writing tests usign https://pkg.go.dev/testing/quick package
func (*ResourceName) UnmarshalJSON ¶
func (rn *ResourceName) UnmarshalJSON(data []byte) error
UnmarshalJSON is implementation of https://pkg.go.dev/encoding/json#Unmarshaler interface.
type UncordonAPI ¶ added in v0.9.8
func Uncordon ¶ added in v0.9.8
func Uncordon(getConnectionDetails client.ConnectionDetails) UncordonAPI