airflow

package
v0.0.0-...-d1533f9 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

pkg/workflow/airflow/client.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AirflowClient

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

AirflowClient provides integration with Apache Airflow

func NewAirflowClient

func NewAirflowClient(config AirflowConfig) (*AirflowClient, error)

NewAirflowClient creates a new Airflow client

func (*AirflowClient) CreateSecurityScanDAG

func (c *AirflowClient) CreateSecurityScanDAG(ctx context.Context, scanConfig ScanConfiguration) (*SecurityScanDAG, error)

CreateSecurityScanDAG creates a new security scanning DAG

func (*AirflowClient) GetDAGRunStatus

func (c *AirflowClient) GetDAGRunStatus(ctx context.Context, dagID, runID string) (*DAGRun, error)

GetDAGRunStatus gets the status of a DAG run

func (*AirflowClient) GetTaskInstances

func (c *AirflowClient) GetTaskInstances(ctx context.Context, dagID, runID string) ([]TaskInstance, error)

GetTaskInstances gets task instances for a DAG run

func (*AirflowClient) TriggerDAGRun

func (c *AirflowClient) TriggerDAGRun(ctx context.Context, dagID string, conf map[string]interface{}) (*DAGRun, error)

TriggerDAGRun triggers a DAG run

type AirflowConfig

type AirflowConfig struct {
	BaseURL     string
	APIKey      string
	Timeout     time.Duration
	MaxRetries  int
	RetryDelay  time.Duration
	WebserverID string
}

AirflowConfig holds Airflow configuration

type ChannelConfig

type ChannelConfig struct {
	Type     string            `json:"type"`
	Settings map[string]string `json:"settings"`
}

ChannelConfig holds channel-specific notification config

type DAG

type DAG struct {
	ID               string                 `json:"dag_id"`
	Description      string                 `json:"description"`
	IsPaused         bool                   `json:"is_paused"`
	IsActive         bool                   `json:"is_active"`
	FileToken        string                 `json:"file_token"`
	Owners           []string               `json:"owners"`
	Tags             []string               `json:"tags"`
	ScheduleInterval string                 `json:"schedule_interval"`
	DefaultArgs      map[string]interface{} `json:"default_args"`
}

DAG represents an Airflow DAG

type DAGRun

type DAGRun struct {
	ID              string                 `json:"dag_run_id"`
	DAGID           string                 `json:"dag_id"`
	LogicalDate     time.Time              `json:"logical_date"`
	ExecutionDate   time.Time              `json:"execution_date"`
	StartDate       *time.Time             `json:"start_date"`
	EndDate         *time.Time             `json:"end_date"`
	State           string                 `json:"state"`
	ExternalTrigger bool                   `json:"external_trigger"`
	Conf            map[string]interface{} `json:"conf"`
}

DAGRun represents an Airflow DAG run

type NotificationConfig

type NotificationConfig struct {
	OnSuccess []string                 `json:"on_success"`
	OnFailure []string                 `json:"on_failure"`
	OnRetry   []string                 `json:"on_retry"`
	Channels  map[string]ChannelConfig `json:"channels"`
}

NotificationConfig holds notification settings

type ScanConfiguration

type ScanConfiguration struct {
	Target          string                 `json:"target"`
	ScanType        string                 `json:"scan_type"`
	Scanners        []string               `json:"scanners"`
	MaxConcurrency  int                    `json:"max_concurrency"`
	ConditionalFlow map[string]interface{} `json:"conditional_flow"`
	Notifications   NotificationConfig     `json:"notifications"`
}

ScanConfiguration holds scanning workflow configuration

type SecurityScanDAG

type SecurityScanDAG struct {
	*DAG
	ScanConfig ScanConfiguration `json:"scan_config"`
}

SecurityScanDAG represents a security scanning workflow DAG

type TaskInstance

type TaskInstance struct {
	TaskID         string     `json:"task_id"`
	DAGID          string     `json:"dag_id"`
	DAGRunID       string     `json:"dag_run_id"`
	ExecutionDate  time.Time  `json:"execution_date"`
	StartDate      *time.Time `json:"start_date"`
	EndDate        *time.Time `json:"end_date"`
	Duration       float64    `json:"duration"`
	State          string     `json:"state"`
	TryNumber      int        `json:"try_number"`
	MaxTries       int        `json:"max_tries"`
	Hostname       string     `json:"hostname"`
	Pool           string     `json:"pool"`
	Queue          string     `json:"queue"`
	PriorityWeight int        `json:"priority_weight"`
	Operator       string     `json:"operator"`
	QueuedWhen     *time.Time `json:"queued_when"`
	PID            *int       `json:"pid"`
	ExecutorConfig string     `json:"executor_config"`
}

TaskInstance represents a task instance in a DAG run

Jump to

Keyboard shortcuts

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