services

package
v0.0.0-...-d9c5257 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_LIST_SIZE = 65500

~65500 is the maximum number of parameters that can be provided to a postgres WHERE IN clause Use it as a sane max

Variables

View Source
var (
	SearchDisallowedFields = map[string]map[string]string{}
)

Functions

func RegisterResourceMetrics

func RegisterResourceMetrics()

Register the metrics:

func ResetResourceMetrics

func ResetResourceMetrics()

Reset the metrics:

func UnregisterResourceMetrics

func UnregisterResourceMetrics()

Unregister the metrics:

func ValidateConsumer

func ValidateConsumer(consumer *api.Consumer) error

func ValidateManifest

func ValidateManifest(resType api.ResourceType, manifest datatypes.JSONMap) error

func ValidateManifestUpdate

func ValidateManifestUpdate(resType api.ResourceType, new, old datatypes.JSONMap) error

func ValidateObject

func ValidateObject(obj datatypes.JSONMap) error

func ValidateObjectUpdate

func ValidateObjectUpdate(new, old datatypes.JSONMap) error

func ValidateResourceName

func ValidateResourceName(resource *api.Resource) error

Types

type ConsumerService

type ConsumerService interface {
	Get(ctx context.Context, id string) (*api.Consumer, *errors.ServiceError)
	Create(ctx context.Context, consumer *api.Consumer) (*api.Consumer, *errors.ServiceError)
	Replace(ctx context.Context, consumer *api.Consumer) (*api.Consumer, *errors.ServiceError)
	Delete(ctx context.Context, id string) *errors.ServiceError
	All(ctx context.Context) (api.ConsumerList, *errors.ServiceError)

	FindByIDs(ctx context.Context, ids []string) (api.ConsumerList, *errors.ServiceError)
}

func NewConsumerService

func NewConsumerService(lockFactory db.LockFactory, consumerDao dao.ConsumerDao, resourceDao dao.ResourceDao, events EventService) ConsumerService

type EventService

type EventService interface {
	Get(ctx context.Context, id string) (*api.Event, *errors.ServiceError)
	Create(ctx context.Context, event *api.Event) (*api.Event, *errors.ServiceError)
	Replace(ctx context.Context, event *api.Event) (*api.Event, *errors.ServiceError)
	Delete(ctx context.Context, id string) *errors.ServiceError
	All(ctx context.Context) (api.EventList, *errors.ServiceError)

	FindByIDs(ctx context.Context, ids []string) (api.EventList, *errors.ServiceError)

	FindAllUnreconciledEvents(ctx context.Context) (api.EventList, *errors.ServiceError)
	DeleteAllReconciledEvents(ctx context.Context) *errors.ServiceError
}

func NewEventService

func NewEventService(eventDao dao.EventDao) EventService

type GenericService

type GenericService interface {
	List(ctx context.Context, username string, args *ListArguments, resourceList interface{}) (*api.PagingMeta, *errors.ServiceError)
}

func NewGenericService

func NewGenericService(genericDao dao.GenericDao) GenericService

type ListArguments

type ListArguments struct {
	Page     int
	Size     int64
	Preloads []string
	Search   string
	OrderBy  []string
	Fields   []string
}

ListArguments are arguments relevant for listing objects. This struct is common to all service List funcs in this package

func NewListArguments

func NewListArguments(params url.Values) *ListArguments

Create ListArguments from url query parameters with sane defaults

type ResourceService

type ResourceService interface {
	Get(ctx context.Context, id string) (*api.Resource, *errors.ServiceError)
	Create(ctx context.Context, resource *api.Resource) (*api.Resource, *errors.ServiceError)
	Update(ctx context.Context, resource *api.Resource) (*api.Resource, *errors.ServiceError)
	UpdateStatus(ctx context.Context, resource *api.Resource) (*api.Resource, bool, *errors.ServiceError)
	MarkAsDeleting(ctx context.Context, id string) *errors.ServiceError
	Delete(ctx context.Context, id string) *errors.ServiceError
	All(ctx context.Context) (api.ResourceList, *errors.ServiceError)

	FindByIDs(ctx context.Context, ids []string) (api.ResourceList, *errors.ServiceError)
	FindBySource(ctx context.Context, source string) (api.ResourceList, *errors.ServiceError)
	List(listOpts cetypes.ListOptions) ([]*api.Resource, error)
	ListWithArgs(ctx context.Context, username string, args *ListArguments, resources *[]api.Resource) (*api.PagingMeta, *errors.ServiceError)
}

func NewResourceService

func NewResourceService(lockFactory db.LockFactory, resourceDao dao.ResourceDao, events EventService, generic GenericService) ResourceService

type StatusEventService

type StatusEventService interface {
	Get(ctx context.Context, id string) (*api.StatusEvent, *errors.ServiceError)
	Create(ctx context.Context, event *api.StatusEvent) (*api.StatusEvent, *errors.ServiceError)
	Replace(ctx context.Context, event *api.StatusEvent) (*api.StatusEvent, *errors.ServiceError)
	Delete(ctx context.Context, id string) *errors.ServiceError
	All(ctx context.Context) (api.StatusEventList, *errors.ServiceError)
	FindByIDs(ctx context.Context, ids []string) (api.StatusEventList, *errors.ServiceError)

	FindAllUnreconciledEvents(ctx context.Context) (api.StatusEventList, *errors.ServiceError)
	DeleteAllReconciledEvents(ctx context.Context) *errors.ServiceError
	DeleteAllEvents(ctx context.Context, eventIDs []string) *errors.ServiceError
}

func NewStatusEventService

func NewStatusEventService(statusEventDao dao.StatusEventDao) StatusEventService

Jump to

Keyboard shortcuts

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