approval

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatePending  = "pending"
	StateApproved = "approved"
	StateRejected = "rejected"

	ItemTypeAnyone = "anyone"
	ItemTypeUser   = "user"
	ItemTypeRole   = "role"
	ItemTypeGroup  = "group"

	ChannelApproved = "approved"
	ChannelRejected = "rejected"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Approval

type Approval struct{}

func (*Approval) Actions

func (a *Approval) Actions() []core.Action

func (*Approval) Cancel

func (a *Approval) Cancel(ctx core.ExecutionContext) error

func (*Approval) Color

func (a *Approval) Color() string

func (*Approval) Configuration

func (a *Approval) Configuration() []configuration.Field

func (*Approval) Description

func (a *Approval) Description() string

func (*Approval) Execute

func (a *Approval) Execute(ctx core.ExecutionContext) error

func (*Approval) HandleAction

func (a *Approval) HandleAction(ctx core.ActionContext) error

func (*Approval) HandleWebhook

func (a *Approval) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*Approval) Icon

func (a *Approval) Icon() string

func (*Approval) Label

func (a *Approval) Label() string

func (*Approval) Name

func (a *Approval) Name() string

func (*Approval) OutputChannels

func (a *Approval) OutputChannels(configuration any) []core.OutputChannel

func (*Approval) ProcessQueueItem

func (a *Approval) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*Approval) Setup

func (a *Approval) Setup(ctx core.SetupContext) error

type ApprovalInfo

type ApprovalInfo struct {
	ApprovedAt string `mapstructure:"approvedAt" json:"approvedAt"`
	Comment    string `mapstructure:"comment" json:"comment"`
}

type Config

type Config struct {
	Items []Item `json:"items" mapstructure:"items"`
}

* Configuration for the component. * Filled when the component is added to a blueprint/workflow.

type Item

type Item struct {
	Type  string `mapstructure:"type" json:"type"`
	User  string `mapstructure:"user" json:"user,omitempty"`
	Role  string `mapstructure:"role" json:"role,omitempty"`
	Group string `mapstructure:"group" json:"group,omitempty"`
}

type Metadata

type Metadata struct {
	Result  string   `mapstructure:"result" json:"result"`
	Records []Record `mapstructure:"records" json:"records"`
}

* Metadata for the component.

func NewMetadata

func NewMetadata(ctx core.ExecutionContext, items []Item) (*Metadata, error)

func (*Metadata) Approve

func (m *Metadata) Approve(record *Record, index int, ctx core.ActionContext) error

func (*Metadata) Completed

func (m *Metadata) Completed() bool

func (*Metadata) Reject

func (m *Metadata) Reject(record *Record, index int, ctx core.ActionContext) error

func (*Metadata) UpdateResult

func (m *Metadata) UpdateResult()

type Record

type Record struct {
	Index     int            `mapstructure:"index" json:"index"`
	Type      string         `mapstructure:"type" json:"type"`
	State     string         `mapstructure:"state" json:"state"`
	User      *core.User     `mapstructure:"user" json:"user,omitempty"`
	Role      *string        `mapstructure:"role" json:"role,omitempty"`
	Group     *string        `mapstructure:"group" json:"group,omitempty"`
	Approval  *ApprovalInfo  `mapstructure:"approval" json:"approval,omitempty"`
	Rejection *RejectionInfo `mapstructure:"rejection" json:"rejection,omitempty"`
}

type RejectionInfo

type RejectionInfo struct {
	RejectedAt string `mapstructure:"rejectedAt" json:"rejectedAt"`
	Reason     string `mapstructure:"reason" json:"reason"`
}

Jump to

Keyboard shortcuts

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