Documentation ¶
Index ¶
- Variables
- func AddBlock(b *Block) error
- func FormToCustomData(form url.Values) []map[string]interface{}
- func LoadThrottling() error
- func MarkAsRemoved(target Target) error
- func Migrate(query bson.M, cb func(*Event) error) error
- func RemoveBlock(id bson.ObjectId) error
- func SetThrottling(spec ThrottlingSpec)
- type AllowedPermission
- type Block
- type ErrActiveEventBlockNotFound
- type ErrEventBlocked
- type ErrEventLocked
- type ErrThrottled
- type ErrValidation
- type Event
- func (e *Event) Abort() error
- func (e *Event) AckCancel() (bool, error)
- func (e *Event) Done(evtErr error) error
- func (e *Event) DoneCustomData(evtErr error, customData interface{}) error
- func (e *Event) EndData(value interface{}) error
- func (e *Event) Logf(format string, params ...interface{})
- func (e *Event) OtherData(value interface{}) error
- func (e *Event) RawInsert(start, other, end interface{}) error
- func (e *Event) SetLogWriter(w io.Writer)
- func (e *Event) SetOtherCustomData(data interface{}) error
- func (e *Event) StartData(value interface{}) error
- func (e *Event) String() string
- func (e *Event) TryCancel(reason, owner string) error
- func (e *Event) Write(data []byte) (int, error)
- type Filter
- type Kind
- type Opts
- type Owner
- type Target
- type TargetFilter
- type TargetType
- type ThrottlingSpec
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotCancelable = errors.New("event is not cancelable") ErrCancelAlreadyRequested = errors.New("event cancel already requested") ErrEventNotFound = errors.New("event not found") ErrNoTarget = ErrValidation("event target is mandatory") ErrNoKind = ErrValidation("event kind is mandatory") ErrNoOwner = ErrValidation("event owner is mandatory") ErrNoOpts = ErrValidation("event opts is mandatory") ErrNoInternalKind = ErrValidation("event internal kind is mandatory") ErrNoAllowed = errors.New("event allowed is mandatory") ErrNoAllowedCancel = errors.New("event allowed cancel is mandatory for cancelable events") ErrInvalidOwner = ErrValidation("event owner must not be set on internal events") ErrInvalidKind = ErrValidation("event kind must not be set on internal events") ErrInvalidTargetType = errors.New("invalid event target type") OwnerTypeUser = ownerType("user") OwnerTypeApp = ownerType("app") OwnerTypeInternal = ownerType("internal") KindTypePermission = kindType("permission") KindTypeInternal = kindType("internal") TargetTypeGlobal = TargetType("global") TargetTypeApp = TargetType("app") TargetTypeNode = TargetType("node") TargetTypeContainer = TargetType("container") TargetTypePool = TargetType("pool") TargetTypeService = TargetType("service") TargetTypeServiceInstance = TargetType("service-instance") TargetTypeTeam = TargetType("team") TargetTypeUser = TargetType("user") TargetTypeIaas = TargetType("iaas") TargetTypeRole = TargetType("role") TargetTypePlatform = TargetType("platform") TargetTypePlan = TargetType("plan") TargetTypeNodeContainer = TargetType("node-container") TargetTypeInstallHost = TargetType("install-host") TargetTypeEventBlock = TargetType("event-block") TargetTypeCluster = TargetType("cluster") TargetTypeVolume = TargetType("volume") )
Functions ¶
func FormToCustomData ¶
func LoadThrottling ¶
func LoadThrottling() error
func MarkAsRemoved ¶
func RemoveBlock ¶
func SetThrottling ¶
func SetThrottling(spec ThrottlingSpec)
Types ¶
type AllowedPermission ¶
type AllowedPermission struct { Scheme string Contexts []permission.PermissionContext `bson:",omitempty"` }
func Allowed ¶
func Allowed(scheme *permission.PermissionScheme, contexts ...permission.PermissionContext) AllowedPermission
func (*AllowedPermission) GetBSON ¶
func (ap *AllowedPermission) GetBSON() (interface{}, error)
type Block ¶
type Block struct { ID bson.ObjectId `bson:"_id,omitempty"` StartTime time.Time EndTime time.Time `bson:"endtime,omitempty"` KindName string OwnerName string Target Target `bson:"target,omitempty"` Reason string Active bool }
func ListBlocks ¶
type ErrActiveEventBlockNotFound ¶
type ErrActiveEventBlockNotFound struct {
// contains filtered or unexported fields
}
func (*ErrActiveEventBlockNotFound) Error ¶
func (e *ErrActiveEventBlockNotFound) Error() string
type ErrEventBlocked ¶
type ErrEventBlocked struct {
// contains filtered or unexported fields
}
func (ErrEventBlocked) Error ¶
func (e ErrEventBlocked) Error() string
type ErrEventLocked ¶
type ErrEventLocked struct {
// contains filtered or unexported fields
}
func (ErrEventLocked) Error ¶
func (err ErrEventLocked) Error() string
type ErrThrottled ¶
type ErrThrottled struct { Spec *ThrottlingSpec Target Target AllTargets bool }
func (ErrThrottled) Error ¶
func (err ErrThrottled) Error() string
type ErrValidation ¶
type ErrValidation string
func (ErrValidation) Error ¶
func (err ErrValidation) Error() string
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
func NewInternal ¶
func (*Event) DoneCustomData ¶
func (*Event) SetLogWriter ¶
func (*Event) SetOtherCustomData ¶
type Filter ¶
type Filter struct { Target Target KindType kindType KindNames []string `form:"-"` OwnerType ownerType OwnerName string Since time.Time Until time.Time Running *bool IncludeRemoved bool ErrorOnly bool Raw bson.M AllowedTargets []TargetFilter Permissions []permission.Permission Limit int Skip int Sort string }
func (*Filter) LoadKindNames ¶
func (*Filter) PruneUserValues ¶
func (f *Filter) PruneUserValues()
type Opts ¶
type Opts struct { Target Target Kind *permission.PermissionScheme InternalKind string Owner auth.Token RawOwner Owner CustomData interface{} DisableLock bool Cancelable bool Allowed AllowedPermission AllowedCancel AllowedPermission }
type Target ¶
type Target struct { Type TargetType Value string }
type TargetFilter ¶
type TargetFilter struct { Type TargetType Values []string }
type TargetType ¶
type TargetType string
func GetTargetType ¶
func GetTargetType(t string) (TargetType, error)
type ThrottlingSpec ¶
type ThrottlingSpec struct { TargetType TargetType `json:"target-type"` KindName string `json:"kind-name"` Max int `json:"limit"` Time time.Duration `json:"window"` AllTargets bool `json:"all-targets"` WaitFinish bool `json:"wait-finish"` }
func (*ThrottlingSpec) UnmarshalJSON ¶
func (d *ThrottlingSpec) UnmarshalJSON(data []byte) error
Click to show internal directories.
Click to hide internal directories.