Documentation
¶
Overview ¶
package features provides functionality for interacting with hatchet features.
Index ¶
- func IsValidCronExpression(expression string) bool
- type APIKeyAuth
- type BasicAuth
- type CELClient
- type CreateCronTrigger
- type CreateRatelimitOpts
- type CreateScheduledRunTrigger
- type CreateWebhookOpts
- type CronsClient
- func (c *CronsClient) Create(ctx context.Context, workflowName string, cron CreateCronTrigger) (*rest.CronWorkflows, error)
- func (c *CronsClient) Delete(ctx context.Context, cronId string) error
- func (c *CronsClient) Get(ctx context.Context, cronId string) (*rest.CronWorkflows, error)
- func (c *CronsClient) List(ctx context.Context, opts rest.CronWorkflowListParams) (*rest.CronWorkflowsList, error)
- type FiltersClient
- func (c *FiltersClient) Create(ctx context.Context, opts rest.V1CreateFilterRequest) (*rest.V1Filter, error)
- func (c *FiltersClient) Delete(ctx context.Context, filterID string) (*rest.V1Filter, error)
- func (c *FiltersClient) Get(ctx context.Context, filterID string) (*rest.V1Filter, error)
- func (c *FiltersClient) List(ctx context.Context, opts *rest.V1FilterListParams) (*rest.V1FilterList, error)
- func (c *FiltersClient) Update(ctx context.Context, filterID string, opts rest.V1FilterUpdateJSONRequestBody) (*rest.V1Filter, error)
- type HMACAuth
- type InvalidCronExpressionError
- type LogsClient
- type MetricsClient
- func (m *MetricsClient) GetQueueMetrics(ctx context.Context, opts *rest.TenantGetQueueMetricsParams) (*rest.TenantQueueMetrics, error)
- func (m *MetricsClient) GetTaskQueueMetrics(ctx context.Context) (*rest.TenantStepRunQueueMetrics, error)
- func (m *MetricsClient) GetWorkflowMetrics(ctx context.Context, workflowName string, opts *rest.WorkflowGetMetricsParams) (*rest.WorkflowMetrics, error)
- type RateLimitsClient
- type RunPriority
- type RunsClient
- func (r *RunsClient) BranchDurableTask(ctx context.Context, taskExternalId string, nodeId, branchId int64) (*rest.V1BranchDurableTaskResponse, error)
- func (r *RunsClient) Cancel(ctx context.Context, opts rest.V1CancelTaskRequest) (*rest.V1CancelledTasks, error)
- func (r *RunsClient) Get(ctx context.Context, runId string) (*rest.V1WorkflowRunDetails, error)
- func (r *RunsClient) GetDetails(ctx context.Context, runId uuid.UUID) (*client.RunDetails, error)
- func (r *RunsClient) GetStatus(ctx context.Context, runId string) (*rest.V1TaskStatus, error)
- func (r *RunsClient) List(ctx context.Context, opts rest.V1WorkflowRunListParams) (*rest.V1TaskSummaryList, error)
- func (r *RunsClient) Replay(ctx context.Context, opts rest.V1ReplayTaskRequest) (*rest.V1ReplayedTasks, error)
- func (r *RunsClient) Restore(ctx context.Context, taskExternalId string) (*rest.V1RestoreTaskResponse, error)
- func (r *RunsClient) SubscribeToStream(ctx context.Context, workflowRunId string) <-chan string
- type SchedulesClient
- func (s *SchedulesClient) Create(ctx context.Context, workflowName string, trigger CreateScheduledRunTrigger) (*rest.ScheduledWorkflows, error)
- func (s *SchedulesClient) Delete(ctx context.Context, scheduledRunId string) error
- func (s *SchedulesClient) Get(ctx context.Context, scheduledRunId string) (*rest.ScheduledWorkflows, error)
- func (s *SchedulesClient) List(ctx context.Context, opts rest.WorkflowScheduledListParams) (*rest.ScheduledWorkflowsList, error)
- type StreamCallOpt
- type StreamEvent
- type StreamsClient
- type SvixAuth
- type TenantClient
- type UpdateWebhookOpts
- type WebhookAuth
- type WebhooksClient
- func (c *WebhooksClient) Create(ctx context.Context, opts CreateWebhookOpts) (*rest.V1Webhook, error)
- func (c *WebhooksClient) Delete(ctx context.Context, webhookName string) error
- func (c *WebhooksClient) Get(ctx context.Context, webhookName string) (*rest.V1Webhook, error)
- func (c *WebhooksClient) List(ctx context.Context, opts rest.V1WebhookListParams) (*rest.V1WebhookList, error)
- func (c *WebhooksClient) Update(ctx context.Context, webhookName string, opts UpdateWebhookOpts) (*rest.V1Webhook, error)
- type WorkersClient
- func (w *WorkersClient) Get(ctx context.Context, workerId string) (*rest.Worker, error)
- func (w *WorkersClient) List(ctx context.Context) (*rest.WorkerList, error)
- func (w *WorkersClient) Pause(ctx context.Context, workerId string) (*rest.Worker, error)
- func (w *WorkersClient) Unpause(ctx context.Context, workerId string) (*rest.Worker, error)
- type WorkflowsClient
- func (w *WorkflowsClient) Delete(ctx context.Context, workflowName string) (*rest.WorkflowDeleteResponse, error)
- func (w *WorkflowsClient) Get(ctx context.Context, workflowName string) (*rest.Workflow, error)
- func (w *WorkflowsClient) GetId(ctx context.Context, workflowName string) (uuid.UUID, error)
- func (w *WorkflowsClient) List(ctx context.Context, opts *rest.WorkflowListParams) (*rest.WorkflowList, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidCronExpression ¶ added in v0.72.2
IsValidCronExpression validates that a string is a valid cron expression.
Types ¶
type APIKeyAuth ¶ added in v0.77.20
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 CreateWebhookOpts ¶ added in v0.77.20
type CreateWebhookOpts struct {
Name string
SourceName rest.V1WebhookSourceName
EventKeyExpression string
ScopeExpression *string
StaticPayload *map[string]interface{}
ReturnEventAsResponsePayload *bool
Auth WebhookAuth
}
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 ¶
func (c *CronsClient) List(ctx context.Context, opts rest.CronWorkflowListParams) (*rest.CronWorkflowsList, error)
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 ¶
func (c *FiltersClient) Create(ctx context.Context, opts rest.V1CreateFilterRequest) (*rest.V1Filter, error)
Create creates a new filter.
func (*FiltersClient) List ¶
func (c *FiltersClient) List(ctx context.Context, opts *rest.V1FilterListParams) (*rest.V1FilterList, error)
List lists filters for a given tenant.
type HMACAuth ¶ added in v0.77.20
type HMACAuth struct {
SigningSecret string
SignatureHeaderName string
Algorithm rest.V1WebhookHMACAlgorithm
Encoding rest.V1WebhookHMACEncoding
}
type InvalidCronExpressionError ¶
type InvalidCronExpressionError struct {
Expression string
}
InvalidCronExpressionError represents an error when an invalid cron expression is provided.
func (*InvalidCronExpressionError) Error ¶
func (e *InvalidCronExpressionError) Error() string
type LogsClient ¶ added in v0.73.83
type LogsClient struct {
// contains filtered or unexported fields
}
LogsClient provides methods for interacting with Hatchet's logs API. To write logs from inside a task, use the task context's Log method instead.
func NewLogsClient ¶ added in v0.73.83
func NewLogsClient(api *rest.ClientWithResponses, tenantId string) *LogsClient
NewLogsClient creates a new LogsClient
func (*LogsClient) List ¶ added in v0.73.83
func (l *LogsClient) List(ctx context.Context, taskRunId uuid.UUID, opts *rest.V1LogLineListParams) (*rest.V1LogLineList, error)
List retrieves the log lines for a given task run.
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 ¶
func (m *MetricsClient) GetQueueMetrics(ctx context.Context, opts *rest.TenantGetQueueMetricsParams) (*rest.TenantQueueMetrics, error)
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 ¶
func (c *RateLimitsClient) List(ctx context.Context, opts *rest.RateLimitListParams) (*rest.RateLimitList, error)
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) BranchDurableTask ¶ added in v0.83.58
func (r *RunsClient) BranchDurableTask(ctx context.Context, taskExternalId string, nodeId, branchId int64) (*rest.V1BranchDurableTaskResponse, error)
BranchDurableTask creates a branch from a durable task at the specified node.
func (*RunsClient) Cancel ¶
func (r *RunsClient) Cancel(ctx context.Context, opts rest.V1CancelTaskRequest) (*rest.V1CancelledTasks, error)
Cancel requests cancellation of a specific task within a workflow run.
func (*RunsClient) Get ¶
func (r *RunsClient) Get(ctx context.Context, runId string) (*rest.V1WorkflowRunDetails, error)
Get retrieves a workflow run by its ID.
func (*RunsClient) GetDetails ¶
func (r *RunsClient) GetDetails(ctx context.Context, runId uuid.UUID) (*client.RunDetails, error)
GetDetails retrieves detailed information about a workflow run via gRPC, including task-level output, errors, and status.
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 ¶
func (r *RunsClient) List(ctx context.Context, opts rest.V1WorkflowRunListParams) (*rest.V1TaskSummaryList, error)
List retrieves a collection of workflow runs based on the provided parameters.
func (*RunsClient) Replay ¶
func (r *RunsClient) Replay(ctx context.Context, opts rest.V1ReplayTaskRequest) (*rest.V1ReplayedTasks, error)
Replay requests a task to be replayed within a workflow run.
func (*RunsClient) Restore ¶ added in v0.83.58
func (r *RunsClient) Restore(ctx context.Context, taskExternalId string) (*rest.V1RestoreTaskResponse, error)
Restore re-enqueues an evicted task so it can resume execution.
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 ¶
func (s *SchedulesClient) List(ctx context.Context, opts rest.WorkflowScheduledListParams) (*rest.ScheduledWorkflowsList, error)
List retrieves a collection of scheduled workflow runs based on the provided parameters.
type StreamCallOpt ¶ added in v0.110.0
type StreamCallOpt func(*streamCallOpts)
StreamCallOpt configures a call to StreamsClient.Publish or StreamsClient.Events.
func WithCursor ¶ added in v0.110.0
func WithCursor(cursor string) StreamCallOpt
WithCursor resumes Events after the StreamEvent the cursor came from. Without it, Events starts at the oldest retained message. Ignored by Publish.
func WithNamespace ¶ added in v0.110.0
func WithNamespace(namespace string) StreamCallOpt
WithNamespace sets the namespace; the default is "".
type StreamEvent ¶ added in v0.110.0
StreamEvent is a stored message. Its Cursor resumes Events right after it.
type StreamsClient ¶ added in v0.110.0
type StreamsClient struct {
// contains filtered or unexported fields
}
StreamsClient publishes to and reads from durable topics. Unlike ctx.PutStream streams, topics are stored, independent of any run, and readers can resume from a cursor.
func NewStreamsClient ¶ added in v0.110.0
func NewStreamsClient(v0Client client.Client) *StreamsClient
func (*StreamsClient) Events ¶ added in v0.110.0
func (s *StreamsClient) Events(ctx context.Context, topic string, opts ...StreamCallOpt) <-chan StreamEvent
Events streams topic's messages from the start or WithCursor. The channel closes when ctx ends, the connection drops or the server hangs up; to continue, call Events again with the last event's Cursor.
func (*StreamsClient) Publish ¶ added in v0.110.0
func (s *StreamsClient) Publish(ctx context.Context, topic string, message []byte, opts ...StreamCallOpt) error
Publish returns once the message is stored. A topic is created on first publish. A client's messages to a topic are delivered in the order they were stored.
type SvixAuth ¶ added in v0.78.20
type SvixAuth struct {
SigningSecret string
}
SvixAuth implements Svix's signature verification protocol for webhooks. Only the signing secret (whsec_...) is required; signature headers and algorithms are configured explicitly to match Svix's expectations.
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
type UpdateWebhookOpts ¶ added in v0.77.20
type WebhookAuth ¶ added in v0.77.20
type WebhookAuth interface {
// contains filtered or unexported methods
}
type WebhooksClient ¶ added in v0.77.20
type WebhooksClient struct {
// contains filtered or unexported fields
}
WebhooksClient provides methods for managing webhook configurations
func NewWebhooksClient ¶ added in v0.77.20
func NewWebhooksClient( api *rest.ClientWithResponses, tenantId string, ) *WebhooksClient
NewWebhooksClient creates a new WebhooksClient
func (*WebhooksClient) Create ¶ added in v0.77.20
func (c *WebhooksClient) Create(ctx context.Context, opts CreateWebhookOpts) (*rest.V1Webhook, error)
Create creates a new webhook configuration.
func (*WebhooksClient) Delete ¶ added in v0.77.20
func (c *WebhooksClient) Delete(ctx context.Context, webhookName string) error
Delete removes a webhook configuration.
func (*WebhooksClient) List ¶ added in v0.77.20
func (c *WebhooksClient) List(ctx context.Context, opts rest.V1WebhookListParams) (*rest.V1WebhookList, error)
List retrieves a collection of webhooks based on the provided parameters.
func (*WebhooksClient) Update ¶ added in v0.77.20
func (c *WebhooksClient) Update(ctx context.Context, webhookName string, opts UpdateWebhookOpts) (*rest.V1Webhook, error)
Update updates an existing webhook configuration.
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) List ¶
func (w *WorkersClient) List(ctx context.Context) (*rest.WorkerList, error)
List retrieves all workers for the tenant.
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) List ¶
func (w *WorkflowsClient) List(ctx context.Context, opts *rest.WorkflowListParams) (*rest.WorkflowList, error)
List retrieves all workflows for the tenant with optional filtering parameters.