features

package
v0.73.21 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

package features provides functionality for interacting with hatchet features.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidCronExpression added in v0.72.2

func IsValidCronExpression(expression string) bool

IsValidCronExpression validates that a string is a valid cron expression.

Types

type CELClient

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

CELClient provides methods for evaluating CEL expressions

func NewCELClient

func NewCELClient(
	api *rest.ClientWithResponses,
	tenantId string,
) *CELClient

NewCELClient creates a new CELClient

func (*CELClient) Debug

func (c *CELClient) Debug(ctx context.Context, expression string, input map[string]any, additionalMetadata, filterPayload *map[string]any) (*rest.V1CELDebugResponse, error)

Debug evaluates a CEL expression with the provided input, filter payload, and optional metadata. Useful for testing and validating CEL expressions and debugging issues in production.

type CreateCronTrigger

type CreateCronTrigger struct {
	// Name is the unique identifier for the cron trigger.
	Name string `json:"name"`

	// Expression is the cron expression that defines the schedule.
	Expression string `json:"expression"`

	// (optional) Input is the input data for the workflow.
	Input map[string]interface{} `json:"input,omitempty"`

	// (optional) AdditionalMetadata is metadata to associate with the cron trigger.
	AdditionalMetadata map[string]interface{} `json:"additionalMetadata,omitempty"`

	// (optional) Priority is the priority of the run triggered by the cron.
	Priority *RunPriority `json:"priority,omitempty"`
}

CreateCronTrigger contains the configuration for creating a cron trigger.

type CreateRatelimitOpts

type CreateRatelimitOpts struct {
	// key is the unique identifier for the rate limit
	Key string
	// limit is the maximum number of requests allowed within the duration
	Limit int
	// duration specifies the time period for the rate limit
	Duration types.RateLimitDuration
}

CreateRatelimitOpts contains options for creating or updating a rate limit.

type CreateScheduledRunTrigger

type CreateScheduledRunTrigger struct {
	// TriggerAt specifies when the workflow should be triggered.
	TriggerAt time.Time `json:"triggerAt"`

	// Input is the optional input data for the workflow.
	Input map[string]interface{} `json:"input,omitempty"`

	// AdditionalMetadata is optional metadata to associate with the scheduled run.
	AdditionalMetadata map[string]interface{} `json:"additionalMetadata,omitempty"`

	Priority *RunPriority `json:"priority,omitempty"`
}

CreateScheduledRunTrigger contains the configuration for creating a scheduled run trigger.

type CronsClient

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

CronsClient provides methods for interacting with cron workflow triggers

func NewCronsClient

func NewCronsClient(
	api *rest.ClientWithResponses,
	tenantId string,
) *CronsClient

NewCronsClient creates a new CronsClient

func (*CronsClient) Create

func (c *CronsClient) Create(ctx context.Context, workflowName string, cron CreateCronTrigger) (*rest.CronWorkflows, error)

Create creates a new cron workflow trigger.

func (*CronsClient) Delete

func (c *CronsClient) Delete(ctx context.Context, cronId string) error

Delete removes a cron workflow trigger.

func (*CronsClient) Get

func (c *CronsClient) Get(ctx context.Context, cronId string) (*rest.CronWorkflows, error)

Get retrieves a specific cron workflow trigger by its ID.

func (*CronsClient) List

List retrieves a collection of cron workflow triggers based on the provided parameters.

type FiltersClient

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

FiltersClient provides methods for interacting with filters

func NewFiltersClient

func NewFiltersClient(
	api *rest.ClientWithResponses,
	tenantID string,
) *FiltersClient

NewFiltersClient creates a new FiltersClient

func (*FiltersClient) Create

Create creates a new filter.

func (*FiltersClient) Delete

func (c *FiltersClient) Delete(ctx context.Context, filterID string) (*rest.V1Filter, error)

Delete deletes a filter by its ID.

func (*FiltersClient) Get

func (c *FiltersClient) Get(ctx context.Context, filterID string) (*rest.V1Filter, error)

Get gets a filter by its ID.

func (*FiltersClient) List

List lists filters for a given tenant.

func (*FiltersClient) Update

Update updates a filter by its ID.

type InvalidCronExpressionError

type InvalidCronExpressionError struct {
	Expression string
}

InvalidCronExpressionError represents an error when an invalid cron expression is provided.

func (*InvalidCronExpressionError) Error

type MetricsClient

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

MetricsClient provides methods for retrieving metrics for workflows, tasks, and tenant queue

func NewMetricsClient

func NewMetricsClient(
	api *rest.ClientWithResponses,
	tenantId string,
) *MetricsClient

NewMetricsClient creates a new MetricsClient

func (*MetricsClient) GetQueueMetrics

GetQueueMetrics retrieves tenant-wide queue metrics.

func (*MetricsClient) GetTaskQueueMetrics

func (m *MetricsClient) GetTaskQueueMetrics(ctx context.Context) (*rest.TenantStepRunQueueMetrics, error)

GetTaskQueueMetrics retrieves tenant-wide step run queue metrics.

func (*MetricsClient) GetWorkflowMetrics

func (m *MetricsClient) GetWorkflowMetrics(ctx context.Context, workflowName string, opts *rest.WorkflowGetMetricsParams) (*rest.WorkflowMetrics, error)

GetWorkflowMetrics retrieves metrics for a specific workflow.

type RateLimitsClient

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

RateLimitsClient provides methods for interacting with rate limits

func NewRateLimitsClient

func NewRateLimitsClient(
	api *rest.ClientWithResponses,
	tenantId string,
	admin v0Client.AdminClient,
) *RateLimitsClient

NewRateLimitsClient creates a new RateLimitsClient with the provided api client, tenant id, and admin client.

func (*RateLimitsClient) List

List retrieves rate limits based on the provided parameters (optional).

func (*RateLimitsClient) Upsert

func (c *RateLimitsClient) Upsert(opts CreateRatelimitOpts) error

Upsert creates or updates a rate limit with the provided options.

type RunPriority added in v0.72.2

type RunPriority int32

RunPriority is the priority for a workflow run.

const (
	// RunPriorityLow is the lowest priority for a workflow run.
	RunPriorityLow RunPriority = 1
	// RunPriorityMedium is the medium priority for a workflow run.
	RunPriorityMedium RunPriority = 2
	// RunPriorityHigh is the highest priority for a workflow run.
	RunPriorityHigh RunPriority = 3
)

type RunsClient

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

RunsClient provides methods for interacting with workflow runs

func NewRunsClient

func NewRunsClient(
	api *rest.ClientWithResponses,
	tenantId string,
	v0Client client.Client,
) *RunsClient

NewRunsClient creates a new client for interacting with workflow runs.

func (*RunsClient) Cancel

Cancel requests cancellation of a specific task within a workflow run.

func (*RunsClient) Get

Get retrieves a workflow run by its ID.

func (*RunsClient) GetStatus

func (r *RunsClient) GetStatus(ctx context.Context, runId string) (*rest.V1TaskStatus, error)

GetStatus retrieves the status of a workflow run by its ID.

func (*RunsClient) List

List retrieves a collection of workflow runs based on the provided parameters.

func (*RunsClient) Replay

Replay requests a task to be replayed within a workflow run.

func (*RunsClient) SubscribeToStream

func (r *RunsClient) SubscribeToStream(ctx context.Context, workflowRunId string) <-chan string

SubscribeToStream subscribes to streaming events for a specific workflow run.

type SchedulesClient

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

SchedulesClient provides methods for interacting with workflow schedules

func NewSchedulesClient

func NewSchedulesClient(
	api *rest.ClientWithResponses,
	tenantId string,
	namespace *string,
) *SchedulesClient

NewSchedulesClient creates a new SchedulesClient

func (*SchedulesClient) Create

func (s *SchedulesClient) Create(ctx context.Context, workflowName string, trigger CreateScheduledRunTrigger) (*rest.ScheduledWorkflows, error)

Create creates a new scheduled workflow run.

func (*SchedulesClient) Delete

func (s *SchedulesClient) Delete(ctx context.Context, scheduledRunId string) error

Delete removes a scheduled workflow run.

func (*SchedulesClient) Get

func (s *SchedulesClient) Get(ctx context.Context, scheduledRunId string) (*rest.ScheduledWorkflows, error)

Get retrieves a specific scheduled workflow run by its ID.

func (*SchedulesClient) List

List retrieves a collection of scheduled workflow runs based on the provided parameters.

type TenantClient

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

TenantClient provides methods for interacting with your Tenant

func NewTenantCliet

func NewTenantCliet(
	api *rest.ClientWithResponses,
	tenantId string,
) *TenantClient

NewTenantCliet creates a new TenantClient

func (*TenantClient) Get

func (t *TenantClient) Get(ctx context.Context) (*rest.Tenant, error)

Get retrieves the details of the current tenant

type WorkersClient

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

WorkersClient provides methods for interacting with workers

func NewWorkersClient

func NewWorkersClient(
	api *rest.ClientWithResponses,
	tenantId string,
) *WorkersClient

NewWorkersClient creates a new WorkersClient

func (*WorkersClient) Get

func (w *WorkersClient) Get(ctx context.Context, workerId string) (*rest.Worker, error)

Get retrieves a worker by its ID.

func (*WorkersClient) List

func (w *WorkersClient) List(ctx context.Context) (*rest.WorkerList, error)

List retrieves all workers for the tenant.

func (*WorkersClient) Pause

func (w *WorkersClient) Pause(ctx context.Context, workerId string) (*rest.Worker, error)

Pause pauses a worker.

func (*WorkersClient) Unpause

func (w *WorkersClient) Unpause(ctx context.Context, workerId string) (*rest.Worker, error)

Unpause unpauses a worker.

type WorkflowsClient

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

WorkflowsClient provides methods for interacting with workflows

func NewWorkflowsClient

func NewWorkflowsClient(
	api *rest.ClientWithResponses,
	tenantId string,
) *WorkflowsClient

NewWorkflowsClient creates a new WorkflowsClient

func (*WorkflowsClient) Delete

func (w *WorkflowsClient) Delete(ctx context.Context, workflowName string) (*rest.WorkflowDeleteResponse, error)

Delete removes a workflow by its ID or name.

func (*WorkflowsClient) Get

func (w *WorkflowsClient) Get(ctx context.Context, workflowName string) (*rest.Workflow, error)

Get retrieves a workflow by its ID or name.

func (*WorkflowsClient) GetId

func (w *WorkflowsClient) GetId(ctx context.Context, workflowName string) (uuid.UUID, error)

GetId retrieves a workflow by its name.

func (*WorkflowsClient) List

List retrieves all workflows for the tenant with optional filtering parameters.

Jump to

Keyboard shortcuts

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