queue

package
v0.3.45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueuesToAPI added in v0.2.18

func QueuesToAPI(queues []Queue) []*api.Queue

Types

type CreateAPI

type CreateAPI func(Queue) error

func Create

func Create(getConnectionDetails client.ConnectionDetails) CreateAPI

type DeleteAPI

type DeleteAPI func(string) error

func Delete

func Delete(getConnectionDetails client.ConnectionDetails) DeleteAPI

type GetInfoAPI

type GetInfoAPI func(string) (*api.QueueInfo, error)

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

func (kind PermissionSubjectKind) Generate(rand *rand.Rand, size int) reflect.Value

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

func (verb PermissionVerb) Generate(rand *rand.Rand, size int) reflect.Value

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

func (f PriorityFactor) Generate(rand *rand.Rand, size int) reflect.Value

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

func NewQueue(in *api.Queue) (Queue, error)

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

func (Queue) ToAPI added in v0.2.18

func (q Queue) ToAPI() *api.Queue

ToAPI transforms Queue to *api.Queue structure

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

func (ResourceLimit) Generate(rand *rand.Rand, size int) reflect.Value

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

func (ResourceName) Generate(rand *rand.Rand, size int) reflect.Value

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.

type UpdateAPI

type UpdateAPI func(queue Queue) error

func Update

func Update(getConnectionDetails client.ConnectionDetails) UpdateAPI

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL