Documentation
¶
Index ¶
- func QueuesToAPI(queues []Queue) []*api.Queue
- type CreateAPI
- type DeleteAPI
- type GetInfoAPI
- type PermissionSubject
- type PermissionSubjectKind
- type PermissionSubjects
- type PermissionVerb
- type PermissionVerbs
- type Permissions
- type PriorityFactor
- type Queue
- type ResourceLimit
- type ResourceLimits
- type ResourceName
- type UpdateAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QueuesToAPI ¶ added in v0.2.18
Types ¶
type GetInfoAPI ¶
func GetInfo ¶
func GetInfo(getConnectionDetails client.ConnectionDetails) GetInfoAPI
type PermissionSubject ¶ added in v0.2.18
type PermissionSubject struct { Kind PermissionSubjectKind `json:"kind"` Name string `json:"name"` }
type PermissionSubjectKind ¶ added in v0.2.18
type PermissionSubjectKind string
const ( PermissionSubjectKindGroup PermissionSubjectKind = "Group" PermissionSubjectKindUser PermissionSubjectKind = "User" )
func NewPermissionSubjectKind ¶ added in v0.2.18
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 ¶ added in v0.2.18
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 (*PermissionSubjectKind) UnmarshalJSON ¶ added in v0.2.18
func (kind *PermissionSubjectKind) UnmarshalJSON(data []byte) error
UnmarshalJSON is implementation of https://pkg.go.dev/encoding/json#Unmarshaler interface.
type PermissionSubjects ¶ added in v0.2.18
type PermissionSubjects []PermissionSubject
func NewPermissionSubjects ¶ added in v0.2.18
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 ¶ added in v0.2.18
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 ¶ added in v0.2.18
type PermissionVerb string
const ( PermissionVerbSubmit PermissionVerb = "submit" PermissionVerbCancel PermissionVerb = "cancel" PermissionVerbReprioritize PermissionVerb = "reprioritize" PermissionVerbWatch PermissionVerb = "watch" )
func NewPermissionVerb ¶ added in v0.2.18
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", "reprioritize", "watch"], and error is returned.
func (PermissionVerb) Generate ¶ added in v0.2.18
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 ¶ added in v0.2.18
func (verb *PermissionVerb) UnmarshalJSON(data []byte) error
UnmarshalJSON is implementation of https://pkg.go.dev/encoding/json#Unmarshaler interface.
type PermissionVerbs ¶ added in v0.2.18
type PermissionVerbs []PermissionVerb
func AllPermissionVerbs ¶ added in v0.2.18
func AllPermissionVerbs() PermissionVerbs
AllPermissionVerbs returns PermissionsVerbs containing all PermissionVerb values
func NewPermissionVerbs ¶ added in v0.2.18
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 ¶ added in v0.2.18
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 ¶ added in v0.2.18
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 ¶ added in v0.2.18
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 ¶ added in v0.2.18
func (p Permissions) ToAPI() *api.Queue_Permissions
ToAPI converts Permissions to *api.Queue_Permissions.
type PriorityFactor ¶ added in v0.2.18
type PriorityFactor float64
func NewPriorityFactor ¶ added in v0.2.18
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 ¶ added in v0.2.18
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 ¶ added in v0.2.18
func (f *PriorityFactor) UnmarshalJSON(data []byte) error
UnmarshalJSON is implementation of https://pkg.go.dev/encoding/json#Unmarshaler interface.
type Queue ¶ added in v0.2.18
type Queue struct { Name string `json:"name"` Permissions []Permissions `json:"permissions"` PriorityFactor PriorityFactor `json:"priorityFactor"` ResourceLimits ResourceLimits `json:"resourceLimits"` }
func NewQueue ¶ added in v0.2.18
NewQueue returnes new Queue using the in parameter. Error is returned if any of the queue fields has corresponding value in in that is invalid.
func (Queue) HasPermission ¶ added in v0.2.18
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 ¶ added in v0.2.18
type ResourceLimit float64
func NewResourceLimit ¶ added in v0.2.18
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 ¶ added in v0.2.18
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 ¶ added in v0.2.18
func (rl *ResourceLimit) UnmarshalJSON(data []byte) error
UnmarshalJSON is implementation of https://pkg.go.dev/encoding/json#Unmarshaler interface.
type ResourceLimits ¶ added in v0.2.18
type ResourceLimits map[ResourceName]ResourceLimit
func NewResourceLimits ¶ added in v0.2.18
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 ¶ added in v0.2.18
type ResourceName string
const ( ResourceNameCPU ResourceName = "cpu" ResourceNameMemory ResourceName = "memory" )
func NewResourceName ¶ added in v0.2.18
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 ¶ added in v0.2.18
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 ¶ added in v0.2.18
func (rn *ResourceName) UnmarshalJSON(data []byte) error
UnmarshalJSON is implementation of https://pkg.go.dev/encoding/json#Unmarshaler interface.