Documentation
¶
Index ¶
- Constants
- func AlphanumericSpace(fl validator.FieldLevel) bool
- func AlphanumericUnderscore(fl validator.FieldLevel) bool
- func ConvertToSchedulerFlow(ctx context.Context, f Flow, namespaceUUID uuid.UUID, ...) (scheduler.Flow, error)
- func MarshalFlow(f Flow, format FlowFormat) ([]byte, error)
- func NoHTML(fl validator.FieldLevel) bool
- func ParseActionTargets(on []string) (nodeNames []string, tags []string)
- func ValidNotificationReceiver(fl validator.FieldLevel) bool
- func ValidRBACAction(a RBACAction) bool
- func ValidResource(r Resource) bool
- type Action
- type ApprovalDetails
- type ApprovalPaginationDetails
- type ApprovalRequest
- type ApprovalType
- type AuthMethod
- type Credential
- type Execution
- type ExecutionCheckpoint
- type ExecutionStatus
- type ExecutionSummary
- type Flow
- type FlowFormat
- type FlowPrefix
- type FlowSecret
- type FlowValidationError
- type Group
- type GroupNamespaceAccess
- type GroupWithUsers
- type Input
- type InputType
- type LogMessage
- type MessageType
- type Metadata
- type Namespace
- type NamespaceMember
- type NamespaceRole
- type NamespaceSecret
- func RepoNamespaceSecretByUUIDToNamespaceSecret(repoSecret repo.GetNamespaceSecretByUUIDRow) NamespaceSecret
- func RepoNamespaceSecretListToNamespaceSecret(repoSecrets []repo.ListNamespaceSecretsRow) []NamespaceSecret
- func RepoNamespaceSecretToNamespaceSecret(repoSecret repo.NamespaceSecret) NamespaceSecret
- type NamespaceWithRole
- type Node
- type NodeAuth
- type NodeStats
- type Notify
- type NotifyEvent
- type Output
- type PrefixAccess
- type RBACAction
- type Resource
- type Schedule
- type ScheduledExecution
- type StreamMessage
- type User
- type UserInfo
- type UserLoginType
- type UserRoleType
- type UserSearchResult
- type UserWithGroups
- type Variable
Constants ¶
const ( OIDCLoginType UserLoginType = "oidc" // Password based login StandardLoginType UserLoginType = "standard" SuperuserUserRole UserRoleType = "superuser" StandardUserRole UserRoleType = "user" )
const TimeFormat = time.RFC3339
Variables ¶
This section is empty.
Functions ¶
func AlphanumericSpace ¶
func AlphanumericSpace(fl validator.FieldLevel) bool
func AlphanumericUnderscore ¶
func AlphanumericUnderscore(fl validator.FieldLevel) bool
func ConvertToSchedulerFlow ¶
func ConvertToSchedulerFlow(ctx context.Context, f Flow, namespaceUUID uuid.UUID, getNodesByNames func(context.Context, []string, uuid.UUID) ([]Node, error), getNodesByTags func(context.Context, []string, uuid.UUID) ([]Node, error)) (scheduler.Flow, error)
ConvertToSchedulerFlow converts a Flow to scheduler.Flow
func MarshalFlow ¶
func MarshalFlow(f Flow, format FlowFormat) ([]byte, error)
MarshalFlow marshals a flow to either YAML or HUML format
func NoHTML ¶ added in v0.8.0
func NoHTML(fl validator.FieldLevel) bool
func ParseActionTargets ¶ added in v0.5.0
ParseActionTargets parses the On array and separates node names from tag references. Tag references are prefixed with "tag:" (e.g., "tag:web"). Returns two slices: node names and tags (without the "tag:" prefix).
func ValidNotificationReceiver ¶ added in v0.2.0
func ValidNotificationReceiver(fl validator.FieldLevel) bool
ValidNotificationReceiver validates notification receiver format Receivers must be either a valid email address or group reference "group:name"
func ValidRBACAction ¶ added in v0.8.0
func ValidRBACAction(a RBACAction) bool
ValidRBACAction checks if the given action is a known RBAC action.
func ValidResource ¶ added in v0.8.0
ValidResource checks if the given resource is a known RBAC resource.
Types ¶
type Action ¶
type Action struct {
ID string `yaml:"id" huml:"id" validate:"required,alphanum_underscore"`
Name string `yaml:"name" huml:"name" validate:"required"`
Executor string `yaml:"executor" huml:"executor"`
With map[string]any `yaml:"with" huml:"with" validate:"required"`
Approval bool `yaml:"approval" huml:"approval"`
Variables []Variable `yaml:"variables" huml:"variables"`
On []string `yaml:"on" huml:"on"`
}
func SchedulerActionToAction ¶
type ApprovalDetails ¶
type ApprovalDetails struct {
ApprovalRequest
DecidedBy string
Inputs json.RawMessage
FlowName string
FlowID string
CreatedAt string
UpdatedAt string
}
type ApprovalPaginationDetails ¶
type ApprovalPaginationDetails struct {
ApprovalRequest
FlowName string
CreatedAt string
UpdatedAt string
}
type ApprovalRequest ¶
type ApprovalRequest struct {
UUID string
ActionID string
Status ApprovalType
ExecID string
RequestedBy string
}
func (ApprovalRequest) MarshalBinary ¶
func (a ApprovalRequest) MarshalBinary() ([]byte, error)
func (*ApprovalRequest) UnmarshalBinary ¶
func (a *ApprovalRequest) UnmarshalBinary(data []byte) error
type ApprovalType ¶
type ApprovalType string
const ( ApprovalStatusPending ApprovalType = "pending" ApprovalStatusApproved ApprovalType = "approved" ApprovalStatusRejected ApprovalType = "rejected" )
type AuthMethod ¶
type AuthMethod string
const ( AuthMethodPrivateKey AuthMethod = "private_key" AuthMethodPassword AuthMethod = "password" )
type Credential ¶
type ExecutionCheckpoint ¶
func (ExecutionCheckpoint) MarshalBinary ¶
func (ec ExecutionCheckpoint) MarshalBinary() ([]byte, error)
MarshalBinary implements the encoding.BinaryMarshaler interface. It serializes the ExecutionCheckpoint into a binary format.
func (*ExecutionCheckpoint) UnmarshalBinary ¶
func (ec *ExecutionCheckpoint) UnmarshalBinary(data []byte) error
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. It deserializes the binary data back into an ExecutionCheckpoint.
type ExecutionStatus ¶
type ExecutionStatus string
const ( ExecutionStatusCancelled ExecutionStatus = "cancelled" ExecutionStatusPending ExecutionStatus = "pending" ExecutionStatusPendingApproval ExecutionStatus = "pending_approval" ExecutionStatusCompleted ExecutionStatus = "completed" ExecutionStatusErrored ExecutionStatus = "errored" )
type ExecutionSummary ¶
type ExecutionSummary struct {
ExecID string
FlowName string
FlowID string
Status ExecutionStatus
Input json.RawMessage
TriggerType string
TriggeredByName string
TriggeredByID string
CurrentActionID string
CreatedAt time.Time
StartedAt time.Time
CompletedAt time.Time
ScheduledAt time.Time
ActionRetries map[string]int
}
type Flow ¶
type Flow struct {
Meta Metadata `yaml:"metadata" huml:"metadata" validate:"required"`
Inputs []Input `yaml:"inputs" huml:"inputs" validate:"required,dive"`
Actions []Action `yaml:"actions" huml:"actions" validate:"required,dive"`
Outputs []Output `yaml:"outputs" huml:"outputs"`
Schedules []Schedule `yaml:"schedules" huml:"schedules" validate:"omitempty,dive"`
Notify []Notify `yaml:"notify" huml:"notify" json:"notify" validate:"omitempty,dive"`
}
func UnmarshalFlow ¶
func UnmarshalFlow(data []byte, format FlowFormat) (Flow, error)
UnmarshalFlow unmarshals flow data from either YAML or HUML format
func (Flow) IsApprovalRequired ¶
func (Flow) ValidateInput ¶
func (f Flow) ValidateInput(inputs map[string]interface{}) *FlowValidationError
type FlowFormat ¶
type FlowFormat string
FlowFormat represents the file format for flows
const ( FlowFormatYAML FlowFormat = "yaml" FlowFormatHUML FlowFormat = "huml" )
type FlowPrefix ¶ added in v0.8.0
type FlowSecret ¶
type FlowSecret struct {
ID string
FlowID int32
Key string
Value string // Only populated when creating/updating, not when listing
Description string
NamespaceUUID string
CreatedAt string
UpdatedAt string
}
func RepoFlowSecretByUUIDToFlowSecret ¶
func RepoFlowSecretByUUIDToFlowSecret(repoSecret repo.GetFlowSecretByUUIDRow) FlowSecret
func RepoFlowSecretListToFlowSecret ¶
func RepoFlowSecretListToFlowSecret(repoSecrets []repo.ListFlowSecretsRow) []FlowSecret
func RepoFlowSecretToFlowSecret ¶
func RepoFlowSecretToFlowSecret(repoSecret repo.FlowSecret) FlowSecret
type FlowValidationError ¶
func (*FlowValidationError) Error ¶
func (f *FlowValidationError) Error() string
type GroupNamespaceAccess ¶
type GroupWithUsers ¶
type Input ¶
type Input struct {
Name string `yaml:"name" huml:"name" json:"name" validate:"required,alphanum_underscore"`
Type InputType `yaml:"type" huml:"type" json:"type" validate:"required,oneof=string number password file datetime checkbox select"`
Label string `yaml:"label" huml:"label" json:"label"`
Description string `yaml:"description" huml:"description" json:"description"`
Validation string `yaml:"validation" huml:"validation" json:"validation"`
Required bool `yaml:"required" huml:"required" json:"required"`
Default string `yaml:"default" huml:"default" json:"default"`
Options []string `yaml:"options" huml:"options" json:"options"`
MaxFileSize int64 `yaml:"max_file_size" huml:"max_file_size" json:"max_file_size"`
}
type LogMessage ¶
type MessageType ¶
type MessageType string
const ( LogMessageType MessageType = "log" ErrMessageType MessageType = "error" ResultMessageType MessageType = "result" ApprovalMessageType MessageType = "approval" CancelledMessageType MessageType = "cancelled" )
type Metadata ¶
type Metadata struct {
ID string `yaml:"id" huml:"id" validate:"required,alphanum_underscore"`
DBID int32 `yaml:"-" huml:"-"`
Name string `yaml:"name" huml:"name" validate:"required,alphanum_whitespace,min=1,max=150"`
Description string `yaml:"description" huml:"description" validate:"max=255,no_html"`
SrcDir string `yaml:"-" huml:"-"`
Namespace string `yaml:"namespace" huml:"namespace"`
Prefix string `yaml:"prefix" huml:"prefix" validate:"omitempty,alphanum_underscore,max=100"`
AllowOverlap bool `yaml:"allow_overlap" huml:"allow_overlap"`
UserSchedulable bool `yaml:"user_schedulable" huml:"user_schedulable"`
}
type NamespaceMember ¶
type NamespaceRole ¶
type NamespaceRole string
const ( NamespaceRoleUser NamespaceRole = "user" NamespaceRoleReviewer NamespaceRole = "reviewer" NamespaceRoleAdmin NamespaceRole = "admin" )
type NamespaceSecret ¶
type NamespaceSecret struct {
ID string
Key string
Value string // Only populated when creating/updating, not when listing
Description string
NamespaceUUID string
CreatedAt string
UpdatedAt string
}
func RepoNamespaceSecretByUUIDToNamespaceSecret ¶
func RepoNamespaceSecretByUUIDToNamespaceSecret(repoSecret repo.GetNamespaceSecretByUUIDRow) NamespaceSecret
func RepoNamespaceSecretListToNamespaceSecret ¶
func RepoNamespaceSecretListToNamespaceSecret(repoSecrets []repo.ListNamespaceSecretsRow) []NamespaceSecret
func RepoNamespaceSecretToNamespaceSecret ¶
func RepoNamespaceSecretToNamespaceSecret(repoSecret repo.NamespaceSecret) NamespaceSecret
type NamespaceWithRole ¶
type NamespaceWithRole struct {
Namespace Namespace `json:"namespace"`
Role NamespaceRole `json:"role"`
}
type NodeAuth ¶
type NodeAuth struct {
CredentialID string
Method AuthMethod
Key string
}
type Notify ¶ added in v0.2.0
type Notify struct {
Channel string `yaml:"channel" huml:"channel" json:"channel" validate:"required,oneof=email webhook"`
Config map[string]any `yaml:"config" huml:"config" json:"config" validate:"required"`
Events []NotifyEvent `yaml:"events" huml:"events" json:"events" validate:"required,dive,min=1,oneof=on_success on_failure on_waiting on_cancelled"`
}
type NotifyEvent ¶ added in v0.2.0
type NotifyEvent string
const ( NotifyEventOnSuccess NotifyEvent = "on_success" NotifyEventOnFailure NotifyEvent = "on_failure" NotifyEventOnWaiting NotifyEvent = "on_waiting" NotifyEventOnCancelled NotifyEvent = "on_cancelled" )
type PrefixAccess ¶ added in v0.8.0
type RBACAction ¶
type RBACAction string
const ( RBACActionView RBACAction = "view" RBACActionExecute RBACAction = "execute" RBACActionApprove RBACAction = "approve" RBACActionUpdate RBACAction = "update" RBACActionDelete RBACAction = "delete" RBACActionCreate RBACAction = "create" )
type Resource ¶
type Resource string
const ( ResourceFlow Resource = "flow" ResourceFlowSecret Resource = "flow_secret" ResourceNamespaceSecret Resource = "namespace_secret" ResourceNode Resource = "node" ResourceCredential Resource = "credential" ResourceMember Resource = "member" ResourceExecution Resource = "execution" ResourceApproval Resource = "approval" ResourceNamespace Resource = "namespace" )
type Schedule ¶
type Schedule struct {
UUID string `json:"uuid" yaml:"-" huml:"-"`
FlowSlug string `json:"flow_slug" yaml:"-" huml:"-"`
FlowName string `json:"flow_name" yaml:"-" huml:"-"`
Cron string `json:"cron" yaml:"cron" huml:"cron"`
Timezone string `json:"timezone" yaml:"timezone" huml:"timezone"`
Inputs map[string]interface{} `json:"inputs" yaml:"-" huml:"-"`
CreatedByID string `json:"created_by_id" yaml:"-" huml:"-"`
CreatedByName string `json:"created_by_name" yaml:"-" huml:"-"`
IsActive bool `json:"is_active" yaml:"-" huml:"-"`
IsUserCreated bool `json:"is_user_created" yaml:"-" huml:"-"`
CreatedAt time.Time `json:"created_at" yaml:"-" huml:"-"`
UpdatedAt time.Time `json:"updated_at" yaml:"-" huml:"-"`
}
type ScheduledExecution ¶ added in v0.4.0
type StreamMessage ¶
type StreamMessage struct {
ActionID string `json:"action_id"`
MType MessageType `json:"message_type"`
NodeID string `json:"node_id"`
Val string `json:"value"`
Timestamp string `json:"timestamp"`
}
func (StreamMessage) MarshalBinary ¶
func (s StreamMessage) MarshalBinary() ([]byte, error)
func (*StreamMessage) UnmarshalBinary ¶
func (s *StreamMessage) UnmarshalBinary(data []byte) error
type User ¶
type User struct {
ID string `json:"uuid"`
Username string `json:"username"`
Name string `json:"name"`
LoginType UserLoginType `json:"login_type"`
Role UserRoleType `json:"role"`
// contains filtered or unexported fields
}
func (User) CheckPassword ¶
func (User) WithPassword ¶
WithPassword sets the user password, the password should be hashed
type UserInfo ¶
type UserLoginType ¶
type UserLoginType string
type UserRoleType ¶
type UserRoleType string
type UserSearchResult ¶
type UserSearchResult struct {
Users []UserWithGroups `json:"users"`
PageCount int64 `json:"page_count"`
TotalCount int64 `json:"total_count"`
}
type UserWithGroups ¶
func (UserWithGroups) GetUser ¶
func (u UserWithGroups) GetUser() User
func (UserWithGroups) HasGroup ¶
func (u UserWithGroups) HasGroup(groupUUID string) bool
func (UserWithGroups) ToUserInfo ¶
func (u UserWithGroups) ToUserInfo() UserInfo