messages

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoResource = errors.New("ruleset does not have entry for resource")
	ErrNoRule     = errors.New("resource does not have entry for rule")
)

Functions

This section is empty.

Types

type RulesetIdentityModel

type RulesetIdentityModel struct {
	Id   string              `json:"id" bson:"id"`
	Type RulesetIdentityType `json:"type" bson:"type"`
}

type RulesetIdentityType

type RulesetIdentityType string
const (
	RulesetIdentityTypeUnknown  RulesetIdentityType = "unknown"
	RulesetIdentityTypeInternal RulesetIdentityType = "internal"
	RulesetIdentityTypeCluster  RulesetIdentityType = "cluster"
)

type RulesetLifetimeType

type RulesetLifetimeType string
const (
	RulesetLifetimeTypeUnknown RulesetLifetimeType = "unknown"
	RulesetLifetimeTypeRegular RulesetLifetimeType = "regular"
	RulesetLifetimeTypeOneshot RulesetLifetimeType = "oneshot"
)

type RulesetModel

type RulesetModel struct {
	ID string `json:"id" bson:"_id,omitempty"`

	Identity  RulesetIdentityModel   `json:"identity" bson:"identity"`
	Resources []RulesetResourceModel `json:"resources" bson:"resources"`
}

func (*RulesetModel) FindResourceByCombination

func (ruleset *RulesetModel) FindResourceByCombination(namespace string, apiVersion string, kind string) (*RulesetResourceModel, error)

func (*RulesetModel) FindResourceById

func (ruleset *RulesetModel) FindResourceById(id string) (*RulesetResourceModel, error)

func (*RulesetModel) FindResourceByUid

func (ruleset *RulesetModel) FindResourceByUid(uid string) (*RulesetResourceModel, error)

type RulesetResourceInput

type RulesetResourceInput struct {
	Uid        string `json:"uid"`
	ApiVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`
	Namespace  string `json:"namespace"`
}

type RulesetResourceModel

type RulesetResourceModel struct {
	Id  string `json:"id"`
	Ref struct {
		// if present, only this is used for lookup
		Uid string `json:"uid"`

		// used for constructing a unique situation where uid is wildcard
		ApiVersion string `json:"apiVersion"`
		Kind       string `json:"kind"`
		Namespace  string `json:"namespace"`

		// only for presenting
		Name string `json:"name"`
	} `json:"ref"`
	Rules []RulesetRuleModel `json:"rules"`
}

func (*RulesetResourceModel) FindRule

func (resource *RulesetResourceModel) FindRule(rule RulesetRuleType) (*RulesetRuleModel, error)

type RulesetRuleInput

type RulesetRuleInput struct {
	Type     RulesetRuleType     `json:"type"`
	Lifetime RulesetLifetimeType `json:"lifetime"`
	Service  RulesetServiceType  `json:"service"`

	Slack RulesetSlackModel `json:"slack,omitempty"`
}

type RulesetRuleModel

type RulesetRuleModel struct {
	Id string `json:"id" bson:"id"`

	Type     RulesetRuleType     `json:"type" bson:"type"`
	Lifetime RulesetLifetimeType `json:"lifetime" bson:"lifetime"`
	Service  RulesetServiceType  `json:"service" bson:"service"`

	Slack RulesetSlackModel `json:"slack,omitempty" bson:"slack,omitempty"`
}

type RulesetRuleType

type RulesetRuleType string
const (
	RulesetRuleTypeUnknown RulesetRuleType = "unknown"
	RulesetRuleTypeStarted RulesetRuleType = "started"
	RulesetRuleTypeCreated RulesetRuleType = "created"
	RulesetRuleTypeUpdated RulesetRuleType = "updated"
	RulesetRuleTypeCrashed RulesetRuleType = "crashed"
	RulesetRuleTypeDeleted RulesetRuleType = "deleted"
)

type RulesetServiceType

type RulesetServiceType string
const (
	RulesetServiceTypeUnknown RulesetServiceType = "unknown"
	RulesetServiceTypeIgnore  RulesetServiceType = "ignore"
	RulesetServiceTypeSlack   RulesetServiceType = "slack"
	RulesetServiceTypeSms     RulesetServiceType = "sms"
)

type RulesetSlackModel

type RulesetSlackModel struct {
	ChannelId string `json:"channelId"`
}

Jump to

Keyboard shortcuts

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