v1

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccountIDLabel         = "managed.relay.sh/account-id"
	WorkflowIDLabel        = "managed.relay.sh/workflow-id"
	WorkflowTriggerIDLabel = "managed.relay.sh/workflow-trigger-id"
)

Variables

View Source
var MissingTenantIDError = errors.New("tenantID cannot be blank")
View Source
var MissingWorkflowIDError = errors.New("workflowID cannot be blank")
View Source
var WorkflowSchema *gojsonschema.Schema

Functions

func ValidateYAML

func ValidateYAML(y string) error

ValidateYAML validates a yaml document according to the schema specification

Types

type ApprovalWorkflowStep

type ApprovalWorkflowStep struct{}

func (*ApprovalWorkflowStep) StepType

func (sv *ApprovalWorkflowStep) StepType() string

type ContainerMixin

type ContainerMixin struct {
	Image     string        `yaml:"image" json:"image"`
	Spec      ExpressionMap `yaml:"spec" json:"spec,omitempty"`
	Env       ExpressionMap `yaml:"env" json:"env,omitempty"`
	InputFile string        `yaml:"inputFile" json:"inputFile,omitempty"`
	Input     []string      `yaml:"input" json:"input,omitempty"`
	Command   string        `yaml:"command" json:"command,omitempty"`
	Args      []string      `yaml:"args" json:"args,omitempty"`
	// contains filtered or unexported fields
}

func (*ContainerMixin) LoadInputFile

func (c *ContainerMixin) LoadInputFile(ctx context.Context, im input.FileManager) error

type ContainerWorkflowStep

type ContainerWorkflowStep struct {
	ContainerMixin
}

func (*ContainerWorkflowStep) StepType

func (sv *ContainerWorkflowStep) StepType() string

type Decoder

type Decoder interface {
	Decode(ctx context.Context, data []byte) (*WorkflowData, error)
}

Decoder takes a byte slice of serialized workflow data and decodes it into a WorkflowData struct

type DefaultRunEngineMapper

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

DefaultRunEngineMapper maps a WorkflowRun to Kubernetes runtime objects. It is the default for relay-operator.

func NewDefaultRunEngineMapper

func NewDefaultRunEngineMapper(opts ...DefaultRunEngineMapperOption) *DefaultRunEngineMapper

NewDefaultRunEngineMapper takes any number of DefaultRunEngineMapperOption's and returns a configured KubernetesEngineMapper.

func (*DefaultRunEngineMapper) ToRuntimeObjectsManifest

func (m *DefaultRunEngineMapper) ToRuntimeObjectsManifest() (*RunKubernetesObjectMapping, error)

ToRuntimeObjectsManifest returns a RunKubernetesObjectMapping that contains uncreated objects that map to relay-core CRDs and other kubernetes resources required to support a run.

type DefaultRunEngineMapperOption

type DefaultRunEngineMapperOption func(*DefaultRunEngineMapper)

DefaultRunEngineMapperOption is a func that takes a *DefaultRunEngineMapper and configures it. Each function is responsible for a small configuration, such as setting the name field.

func WithDomainIDRunOption

func WithDomainIDRunOption(id string) DefaultRunEngineMapperOption

func WithNamespaceRunOption

func WithNamespaceRunOption(ns string) DefaultRunEngineMapperOption

func WithVaultEngineMountRunOption

func WithVaultEngineMountRunOption(mount string) DefaultRunEngineMapperOption

func WithWorkflowNameRunOption

func WithWorkflowNameRunOption(name string) DefaultRunEngineMapperOption

func WithWorkflowRunNameRunOption

func WithWorkflowRunNameRunOption(name string) DefaultRunEngineMapperOption

func WithWorkflowRunOption added in v1.0.3

func WithWorkflowRunOption(workflow *v1beta1.Workflow) DefaultRunEngineMapperOption

type DefaultTenantEngineMapper

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

func (*DefaultTenantEngineMapper) ToRuntimeObjectsManifest

func (m *DefaultTenantEngineMapper) ToRuntimeObjectsManifest() (*TenantKubernetesObjectMapping, error)

type DefaultTenantEngineMapperOption

type DefaultTenantEngineMapperOption func(*DefaultTenantEngineMapper)

func WithEventURLTenantOption

func WithEventURLTenantOption(u *url.URL) DefaultTenantEngineMapperOption

func WithFolderNameTenantOption added in v1.1.0

func WithFolderNameTenantOption(name string) DefaultTenantEngineMapperOption

func WithIDTenantOption

func WithIDTenantOption(id string) DefaultTenantEngineMapperOption

func WithNameTenantOption

func WithNameTenantOption(name string) DefaultTenantEngineMapperOption

func WithNamespaceTenantOption

func WithNamespaceTenantOption(ns string) DefaultTenantEngineMapperOption

func WithTokenSecretNameTenantOption

func WithTokenSecretNameTenantOption(name string) DefaultTenantEngineMapperOption

func WithToolInjectionTenantOption

func WithToolInjectionTenantOption(enabled bool) DefaultTenantEngineMapperOption

func WithWorkflowExecutionURLTenantOption added in v1.0.4

func WithWorkflowExecutionURLTenantOption(u *url.URL) DefaultTenantEngineMapperOption

func WithWorkflowIDTenantOption

func WithWorkflowIDTenantOption(id string) DefaultTenantEngineMapperOption

func WithWorkflowNameTenantOption

func WithWorkflowNameTenantOption(name string) DefaultTenantEngineMapperOption

type DefaultWebhookTriggerEngineMapper

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

func (*DefaultWebhookTriggerEngineMapper) ToRuntimeObjectsManifest

type DefaultWebhookTriggerEngineMapperOption

type DefaultWebhookTriggerEngineMapperOption func(*DefaultWebhookTriggerEngineMapper)

func WithDomainIDWebhookTriggerOption

func WithDomainIDWebhookTriggerOption(domainID string) DefaultWebhookTriggerEngineMapperOption

func WithImageWebhookTriggerOption

func WithImageWebhookTriggerOption(image string) DefaultWebhookTriggerEngineMapperOption

func WithNameWebhookTriggerOption

func WithNameWebhookTriggerOption(name string) DefaultWebhookTriggerEngineMapperOption

func WithVaultEngineMountWebhookTriggerOption

func WithVaultEngineMountWebhookTriggerOption(mount string) DefaultWebhookTriggerEngineMapperOption

func WithWorkflowNameWebhookTriggerOption

func WithWorkflowNameWebhookTriggerOption(workflowName string) DefaultWebhookTriggerEngineMapperOption

type DefaultWorkflowMapper added in v1.0.2

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

func NewDefaultWorkflowMapper added in v1.0.2

func NewDefaultWorkflowMapper(opts ...DefaultWorkflowMapperOption) *DefaultWorkflowMapper

func (*DefaultWorkflowMapper) Map added in v1.0.2

type DefaultWorkflowMapperOption added in v1.0.2

type DefaultWorkflowMapperOption func(*DefaultWorkflowMapper)

func WithDomainIDOption added in v1.0.2

func WithDomainIDOption(id string) DefaultWorkflowMapperOption

func WithNamespaceOption added in v1.0.2

func WithNamespaceOption(ns string) DefaultWorkflowMapperOption

func WithTenantOption added in v1.0.2

func WithTenantOption(tenant *relayv1beta1.Tenant) DefaultWorkflowMapperOption

func WithVaultEngineMountOption added in v1.0.2

func WithVaultEngineMountOption(mount string) DefaultWorkflowMapperOption

func WithWorkflowNameOption added in v1.0.2

func WithWorkflowNameOption(name string) DefaultWorkflowMapperOption

type ExpressionMap

type ExpressionMap map[string]serialize.JSONTree

func (ExpressionMap) AsParseTree

func (em ExpressionMap) AsParseTree() parse.Tree

type PushWorkflowTriggerSource

type PushWorkflowTriggerSource struct {
	// TODO: Implement serialization for schema field types.
	Schema map[string]interface{} `yaml:"schema" json:"schema,omitempty"`
}

func (*PushWorkflowTriggerSource) TriggerSourceType

func (wtsv *PushWorkflowTriggerSource) TriggerSourceType() string

type RunKubernetesEngineMapper

type RunKubernetesEngineMapper interface {
	ToRuntimeObjectsManifest(*WorkflowData) (*RunKubernetesObjectMapping, error)
}

type RunKubernetesObjectMapping

type RunKubernetesObjectMapping struct {
	Namespace   *corev1.Namespace
	WorkflowRun *v1beta1.Run
}

type ScheduleWorkflowTriggerSource

type ScheduleWorkflowTriggerSource struct {
	Schedule string `yaml:"schedule" json:"schedule,omitempty"`
}

func (*ScheduleWorkflowTriggerSource) Next

func (swts *ScheduleWorkflowTriggerSource) Next(from time.Time) (time.Time, error)

func (*ScheduleWorkflowTriggerSource) TriggerSourceType

func (wtsv *ScheduleWorkflowTriggerSource) TriggerSourceType() string

type StreamingDecoder

type StreamingDecoder interface {
	// DecodeStream returns io.EOF when the reader is empty. If the error is
	// nil, then additional calls to DecodeStream will return more WorkflowData
	// objects if the implementation supports streaming multiple objects.
	DecodeStream(ctx context.Context) (*WorkflowData, error)
	Close() error
}

StremStreamingDecoder returns WorkflowData struct from a stream of data. Most implementations of this will take an io.Reader or io.ReadCloser and a Decoder.

func NewDocumentStreamingDecoder

func NewDocumentStreamingDecoder(r io.ReadCloser, decoder Decoder) StreamingDecoder

NewDocumentStreamingDecoder takes an io.ReadCloser and a Decoder and returns a new StreamingDecoder.

type TenantKubernetesEngineMapper

type TenantKubernetesEngineMapper interface {
	ToRuntimeObjectsManifest(id string) (*TenantKubernetesObjectMapping, error)
}

type TenantKubernetesObjectMapping

type TenantKubernetesObjectMapping struct {
	Namespace *corev1.Namespace
	Tenant    *v1beta1.Tenant
}

type WebhookTriggerKubernetesEngineMapper

type WebhookTriggerKubernetesEngineMapper interface {
	ToRuntimeObjectsManifest(source *WebhookWorkflowTriggerSource) (*WebhookTriggerKubernetesObjectMapping, error)
}

type WebhookTriggerKubernetesObjectMapping

type WebhookTriggerKubernetesObjectMapping struct {
	WebhookTrigger *v1beta1.WebhookTrigger
}

type WebhookWorkflowTriggerSource

type WebhookWorkflowTriggerSource struct {
	ContainerMixin
}

func (*WebhookWorkflowTriggerSource) TriggerSourceType

func (wtsv *WebhookWorkflowTriggerSource) TriggerSourceType() string

type WorkflowData

type WorkflowData struct {
	APIVersion  string                 `yaml:"apiVersion" json:"apiVersion"`
	Description string                 `yaml:"description" json:"description"`
	Name        string                 `yaml:"name" json:"name,omitempty"`
	Parameters  WorkflowParameters     `yaml:"parameters" json:"parameters,omitempty"`
	Steps       []*WorkflowStep        `yaml:"steps" json:"steps"`
	Triggers    []*WorkflowDataTrigger `yaml:"triggers" json:"triggers"`
}

type WorkflowDataTrigger

type WorkflowDataTrigger struct {
	Name    string                      `yaml:"name" json:"name"`
	Source  *WorkflowDataTriggerSource  `yaml:"source" json:"source,omitempty"`
	Binding *WorkflowDataTriggerBinding `yaml:"binding" json:"binding,omitempty"`
	When    serialize.JSONTree          `yaml:"when" json:"when,omitempty"`
}

type WorkflowDataTriggerBinding

type WorkflowDataTriggerBinding struct {
	Key        serialize.JSONTree `yaml:"key" json:"key,omitempty"`
	Parameters ExpressionMap      `yaml:"parameters" json:"parameters,omitempty"`
}

type WorkflowDataTriggerSource

type WorkflowDataTriggerSource struct {
	Type    string `yaml:"type" json:"type,omitempty"`
	Variant WorkflowTriggerSourceVariant
}

type WorkflowFileFormatError

type WorkflowFileFormatError struct {
	Cause error
}

func (*WorkflowFileFormatError) Error

func (e *WorkflowFileFormatError) Error() string

func (*WorkflowFileFormatError) Unwrap

func (e *WorkflowFileFormatError) Unwrap() error

type WorkflowMapper added in v1.0.2

type WorkflowMapper interface {
	Map(*WorkflowData) (*WorkflowMapping, error)
}

type WorkflowMapping added in v1.0.2

type WorkflowMapping struct {
	Namespace *corev1.Namespace
	Workflow  *v1beta1.Workflow
}

type WorkflowParameter

type WorkflowParameter struct {
	Description string
	Type        string
	// contains filtered or unexported fields
}

func (*WorkflowParameter) Default

func (wp *WorkflowParameter) Default() (interface{}, bool)

func (WorkflowParameter) MarshalJSON

func (wp WorkflowParameter) MarshalJSON() ([]byte, error)

func (WorkflowParameter) MarshalYAML

func (wp WorkflowParameter) MarshalYAML() (interface{}, error)

func (*WorkflowParameter) UnmarshalJSON

func (wp *WorkflowParameter) UnmarshalJSON(data []byte) error

func (*WorkflowParameter) UnmarshalYAML

func (wp *WorkflowParameter) UnmarshalYAML(node *yaml.Node) error

func (*WorkflowParameter) WithDefault

func (wp *WorkflowParameter) WithDefault(value interface{}) *WorkflowParameter

func (*WorkflowParameter) WithoutDefault

func (wp *WorkflowParameter) WithoutDefault() *WorkflowParameter

type WorkflowParameters

type WorkflowParameters map[string]*WorkflowParameter

type WorkflowRunParameter

type WorkflowRunParameter struct {
	Value interface{} `json:"value"`
}

type WorkflowRunParameters

type WorkflowRunParameters map[string]*WorkflowRunParameter

type WorkflowStep

type WorkflowStep struct {
	Name      string             `yaml:"name" json:"name"`
	DependsOn []string           `yaml:"dependsOn" json:"depends_on"`
	When      serialize.JSONTree `yaml:"when" json:"when,omitempty"`
	Variant   WorkflowStepVariant
}

func (WorkflowStep) MarshalJSON

func (ws WorkflowStep) MarshalJSON() ([]byte, error)

func (*WorkflowStep) UnmarshalJSON

func (ws *WorkflowStep) UnmarshalJSON(data []byte) error

type WorkflowStepApprovalStatus

type WorkflowStepApprovalStatus string
const (
	WorkflowStepApprovalWaiting  WorkflowStepApprovalStatus = "waiting"
	WorkflowStepApprovalApproved WorkflowStepApprovalStatus = "approved"
	WorkflowStepApprovalRejected WorkflowStepApprovalStatus = "rejected"
)

func (WorkflowStepApprovalStatus) String

func (ws WorkflowStepApprovalStatus) String() string

type WorkflowStepInvalidError

type WorkflowStepInvalidError struct {
	Name string
	Type string
}

func (*WorkflowStepInvalidError) Error

func (e *WorkflowStepInvalidError) Error() string

type WorkflowStepType

type WorkflowStepType string
const (
	WorkflowStepTypeContainer WorkflowStepType = "container"
	WorkflowStepTypeApproval  WorkflowStepType = "approval"
	WorkflowStepTypeUnknown   WorkflowStepType = "unknown" // Unrecognized deserialized yaml values
)

type WorkflowStepVariant

type WorkflowStepVariant interface {
	StepType() string
	// contains filtered or unexported methods
}

type WorkflowTriggerSource

type WorkflowTriggerSource struct {
	Type    string `json:"type,omitempty"`
	Variant WorkflowTriggerSourceVariant
}

func (WorkflowTriggerSource) MarshalJSON

func (wts WorkflowTriggerSource) MarshalJSON() ([]byte, error)

func (*WorkflowTriggerSource) UnmarshalJSON

func (wts *WorkflowTriggerSource) UnmarshalJSON(data []byte) error

type WorkflowTriggerSourceType

type WorkflowTriggerSourceType string
const (
	WorkflowTriggerSourceTypePush     WorkflowTriggerSourceType = "push"
	WorkflowTriggerSourceTypeSchedule WorkflowTriggerSourceType = "schedule"
	WorkflowTriggerSourceTypeWebhook  WorkflowTriggerSourceType = "webhook"
)

func (WorkflowTriggerSourceType) String

func (wtst WorkflowTriggerSourceType) String() string

type WorkflowTriggerSourceVariant

type WorkflowTriggerSourceVariant interface {
	TriggerSourceType() string
	// contains filtered or unexported methods
}

type YAMLContainerMixin

type YAMLContainerMixin struct {
	Image     string                        `yaml:"image" json:"image,omitempty"`
	Spec      map[string]serialize.YAMLTree `yaml:"spec" json:"spec,omitempty"`
	Env       map[string]serialize.YAMLTree `yaml:"env,omitempty" json:"env,omitempty"`
	Input     []string                      `yaml:"input,omitempty" json:"input,omitempty"`
	InputFile string                        `yaml:"inputFile,omitempty" json:"inputFile,omitempty"`
	Command   string                        `yaml:"command,omitempty" json:"command,omitempty"`
	Args      []string                      `yaml:"args,omitempty" json:"args,omitempty"`
}

type YAMLDecoder

type YAMLDecoder struct{}

YAMLDecoder expects a YAML data payload and decodes it into a WorkflowData struct.

func (*YAMLDecoder) Decode

func (d *YAMLDecoder) Decode(ctx context.Context, data []byte) (*WorkflowData, error)

type YAMLPushWorkflowTriggerSource

type YAMLPushWorkflowTriggerSource struct {
	// TODO: Implement serialization for schema field types.
	Schema map[string]interface{} `yaml:"schema" json:"schema,omitempty"`
}

type YAMLScheduleWorkflowTriggerSource

type YAMLScheduleWorkflowTriggerSource struct {
	Schedule string `yaml:"schedule" json:"schedule,omitempty"`
}

type YAMLWebhookWorkflowTriggerSource

type YAMLWebhookWorkflowTriggerSource struct {
	YAMLContainerMixin `yaml:",inline"`
}

type YAMLWorkflowData

type YAMLWorkflowData struct {
	APIVersion  string                `yaml:"apiVersion,omitempty" json:"apiVersion"`
	Description string                `yaml:"description,omitempty" json:"description"`
	Name        string                `yaml:"name,omitempty" json:"name,omitempty"`
	Parameters  WorkflowParameters    `yaml:"parameters,omitempty" json:"parameters,omitempty"`
	Steps       []YAMLWorkflowStep    `yaml:"steps" json:"steps"`
	Triggers    []YAMLWorkflowTrigger `yaml:"triggers,omitempty" json:"triggers"`
}

type YAMLWorkflowStep

type YAMLWorkflowStep struct {
	Name               string `yaml:"name" json:"name"`
	Type               string `yaml:"type,omitempty" json:"type,omitempty"`
	YAMLContainerMixin `yaml:",inline"`
	DependsOn          stringutil.StringArray `yaml:"dependsOn,omitempty" json:"depends_on,omitempty"`
	When               serialize.YAMLTree     `yaml:"when,omitempty" json:"when,omitempty"`
}

type YAMLWorkflowTrigger

type YAMLWorkflowTrigger struct {
	Name    string                     `yaml:"name" json:"name"`
	Source  YAMLWorkflowTriggerSource  `yaml:"source" json:"source"`
	Binding YAMLWorkflowTriggerBinding `yaml:"binding" json:"binding"`
	When    serialize.YAMLTree         `yaml:"when" json:"when,omitempty"`
}

type YAMLWorkflowTriggerBinding

type YAMLWorkflowTriggerBinding struct {
	Key        serialize.YAMLTree            `yaml:"key" json:"key,omitempty"`
	Parameters map[string]serialize.YAMLTree `yaml:"parameters" json:"parameters,omitempty"`
}

type YAMLWorkflowTriggerSource

type YAMLWorkflowTriggerSource struct {
	Type                              string `yaml:"type" json:"type,omitempty"`
	YAMLPushWorkflowTriggerSource     `yaml:",inline"`
	YAMLScheduleWorkflowTriggerSource `yaml:",inline"`
	YAMLWebhookWorkflowTriggerSource  `yaml:",inline"`
}

Jump to

Keyboard shortcuts

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