actions

package
v5.10.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: MIT, MIT, MIT, + 1 more Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckController

type CheckController struct {
	// contains filtered or unexported fields
}

CheckController exposes actions which a viewer can perform.

func NewCheckController

func NewCheckController(store store.CheckConfigStore, getter types.QueueGetter) CheckController

NewCheckController returns new CheckController

func (CheckController) AddCheckHook

func (a CheckController) AddCheckHook(ctx context.Context, check string, checkHook corev2.HookList) error

AddCheckHook adds an association between a hook and a check

func (CheckController) Find

Find returns resource associated with given parameters if available to the viewer.

func (CheckController) QueueAdhocRequest

func (a CheckController) QueueAdhocRequest(ctx context.Context, name string, adhocRequest *corev2.AdhocRequest) error

QueueAdhocRequest takes a check request and adds it to the queue for processing.

func (CheckController) RemoveCheckHook

func (a CheckController) RemoveCheckHook(ctx context.Context, checkName string, hookType string, hookName string) error

RemoveCheckHook removes an association between a hook and a check

type ClusterController

type ClusterController struct {
	// contains filtered or unexported fields
}

ClusterController is a thin wrapper around clientv3.Cluster. It exists only for the purposes of access control.

func NewClusterController

func NewClusterController(cluster clientv3.Cluster, store store.ClusterIDStore) ClusterController

NewClusterController provides a new controller for the etcd cluster.

func (ClusterController) ClusterID

func (c ClusterController) ClusterID(ctx context.Context) (string, error)

ClusterID gets the sensu cluster id.

func (ClusterController) MemberAdd

func (c ClusterController) MemberAdd(ctx context.Context, addrs []string) (*clientv3.MemberAddResponse, error)

MemberAdd adds a member to the cluster.

func (ClusterController) MemberList

MemberList returns the list of members in the cluster.

func (ClusterController) MemberRemove

MemberRemove removes a member from the cluster.

func (ClusterController) MemberUpdate

func (c ClusterController) MemberUpdate(ctx context.Context, id uint64, addrs []string) (*clientv3.MemberUpdateResponse, error)

MemberUpdate updates the specified member addresses.

type EntityDeleter

type EntityDeleter struct {
	EntityStore store.EntityStore
	EventStore  store.EventStore
}

func (EntityDeleter) Delete

func (d EntityDeleter) Delete(req *http.Request) (interface{}, error)

type ErrCode

type ErrCode uint32

ErrCode is an unsigned 32-bit integer used for defining error codes.

const (
	// InternalErr refers to an issue that occured in the underlying system. Eg.
	// if etcd was unreachable or something was implemented incorrectly.
	InternalErr ErrCode = iota

	// InvalidArgument refers to an issue with the arguments the user provided.
	// Eg. if arguments were of the wrong type or if the purposed changes cause
	// the record's validation to fail.
	InvalidArgument

	// NotFound means that the requested resource is unreachable or does not
	// exist.
	NotFound

	// AlreadyExistsErr means that a create operation failed because the given
	// resource already exists in the system.
	AlreadyExistsErr

	// PermissionDenied means that the viewer does not have permission to perform
	// the action they are attempting. Is not used when user is unauthenticated.
	// Eg. if the viewer is trying to list all events but doesn't not have the
	// approriate roles for the operation.
	PermissionDenied

	// Unauthenticated used when viewer is not authenticated but action requires
	// viewer to be authenticated.
	Unauthenticated

	// PaymentRequired is used when the user tries to use a feature that's gated
	// behind a license.
	PaymentRequired
)

func StatusFromError

func StatusFromError(err error) (ErrCode, bool)

StatusFromError extracts code from the given error.

type Error

type Error struct {
	// Code refers to predefined codes that describe type of error that occurred.
	Code ErrCode
	// Message is a developer / operator friendly message briefly describing what
	// occurred.
	Message string
}

Error describes an issue that ocurred while performing the action. TODO: This should likely be moved to the types package.

func NewError

func NewError(code ErrCode, err error) Error

NewError returns a new Error given existing error and code.

func NewErrorf

func NewErrorf(code ErrCode, s ...interface{}) Error

NewErrorf returns a new Error given message and code.

func (Error) Error

func (err Error) Error() string

Error method implements error interface

type EventController

type EventController struct {
	// contains filtered or unexported fields
}

EventController expose actions in which a viewer can perform.

func NewEventController

func NewEventController(store store.EventStore, bus messaging.MessageBus) EventController

NewEventController returns new EventController

func (EventController) Create

func (a EventController) Create(ctx context.Context, event *corev2.Event) error

Create creates the event indicated by the supplied entity and check. If an event already exists for the entity and check, it updates that event.

func (EventController) CreateOrReplace

func (a EventController) CreateOrReplace(ctx context.Context, event *corev2.Event) error

CreateOrReplace creates the event indicated by the supplied entity and check. If an event already exists for the entity and check, it updates that event.

func (EventController) Delete

func (a EventController) Delete(ctx context.Context, entity, check string) error

Delete destroys the event indicated by the supplied entity and check.

func (EventController) Get

func (a EventController) Get(ctx context.Context, entity, check string) (*corev2.Event, error)

Get returns resource associated with given parameters if available to the viewer.

func (EventController) List

List returns resources available to the viewer filter by given params.

type HealthController

type HealthController struct {
	// contains filtered or unexported fields
}

HealthController exposes actions which a viewer can perform

func NewHealthController

func NewHealthController(store store.HealthStore, cluster clientv3.Cluster, etcdClientTLSConfig *tls.Config) HealthController

NewHealthController returns new HealthController

func (HealthController) GetClusterHealth

func (h HealthController) GetClusterHealth(ctx context.Context) *types.HealthResponse

GetClusterHealth returns health information

type QueryParams

type QueryParams map[string]string

QueryParams keys inwhich to filter results of query.

type SilencedController

type SilencedController struct {
	Store store.SilencedStore
}

SilencedController exposes actions in which a viewer can perform.

func NewSilencedController

func NewSilencedController(store store.SilencedStore) SilencedController

NewSilencedController returns new SilencedController

func (SilencedController) Create

func (c SilencedController) Create(ctx context.Context, entry *corev2.Silenced) error

Create creates a new silenced entry. It returns an error if the entry already exists.

func (SilencedController) CreateOrReplace

func (c SilencedController) CreateOrReplace(ctx context.Context, entry *corev2.Silenced) error

CreateOrReplace creates or replaces a silenced entry.

func (SilencedController) List

func (c SilencedController) List(ctx context.Context, sub, check string) ([]*corev2.Silenced, error)

Query returns resources available to the viewer.

type TessenController

type TessenController struct {
	// contains filtered or unexported fields
}

TessenController exposes actions which a viewer can perform

func NewTessenController

func NewTessenController(store store.TessenConfigStore, bus messaging.MessageBus) TessenController

NewTessenController returns a new TessenController

func (TessenController) CreateOrUpdate

func (c TessenController) CreateOrUpdate(ctx context.Context, config *corev2.TessenConfig) error

CreateOrUpdate creates or updates the tessen configuration

func (TessenController) Get

Get gets the tessen configuration

type TessenMetricController

type TessenMetricController struct {
	// contains filtered or unexported fields
}

TessenMetricController exposes actions which a viewer can perform

func NewTessenMetricController

func NewTessenMetricController(bus messaging.MessageBus) TessenMetricController

NewTessenMetricController returns a new TessenMetricController

func (TessenMetricController) Publish

func (c TessenMetricController) Publish(ctx context.Context, metrics []corev2.MetricPoint) error

Publish publishes the metrics to the message bus used by TessenD

type UserController

type UserController struct {
	// contains filtered or unexported fields
}

UserController exposes actions in which a viewer can perform.

func NewUserController

func NewUserController(store store.Store) UserController

NewUserController returns new UserController

func (UserController) AddGroup

func (a UserController) AddGroup(ctx context.Context, username string, group string) error

AddGroup adds a given group to a user

func (UserController) Create

func (a UserController) Create(ctx context.Context, user *corev2.User) error

Create creates a new user. It returns an error if the user already exists.

func (UserController) CreateOrReplace

func (a UserController) CreateOrReplace(ctx context.Context, user *corev2.User) error

CreateOrReplace creates or replaces a user.

func (UserController) Disable

func (a UserController) Disable(ctx context.Context, name string) error

Disable disables user identified by given name if viewer has access.

func (UserController) Enable

func (a UserController) Enable(ctx context.Context, name string) error

Enable disables user identified by given name if viewer has access.

func (UserController) Get

func (a UserController) Get(ctx context.Context, name string) (*corev2.User, error)

Get returns resource associated with given parameters if available to the viewer.

func (UserController) List

List returns resources available to the viewer filter by given params.

func (UserController) RemoveAllGroups

func (a UserController) RemoveAllGroups(ctx context.Context, username string) error

RemoveAllGroups removes all groups from a given user

func (UserController) RemoveGroup

func (a UserController) RemoveGroup(ctx context.Context, username string, group string) error

RemoveGroup removes a group from a given user

type VersionController

type VersionController struct {
	// contains filtered or unexported fields
}

VersionController exposes actions which a viewer can perform

func NewVersionController

func NewVersionController(clusterVersion string) VersionController

NewVersionController returns a new VersionController

func (VersionController) GetVersion

func (v VersionController) GetVersion(ctx context.Context) *corev2.Version

GetVersion returns version information

Jump to

Keyboard shortcuts

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