Documentation
¶
Overview ¶
package features provides functionality for interacting with hatchet features.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateCronExpression ¶
ValidateCronExpression validates that a string is a valid cron expression.
Types ¶
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"`
// Input is the optional input data for the workflow.
Input map[string]interface{} `json:"input,omitempty"`
// AdditionalMetadata is optional metadata to associate with the cron trigger.
AdditionalMetadata map[string]interface{} `json:"additionalMetadata,omitempty"`
Priority *int32 `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 *int32 `json:"priority,omitempty"`
}
CreateScheduledRunTrigger contains the configuration for creating a scheduled run trigger.
type CronsClient ¶
type CronsClient interface {
// Create creates a new cron workflow trigger.
Create(ctx context.Context, workflowName string, cron CreateCronTrigger) (*rest.CronWorkflows, error)
// Delete removes a cron workflow trigger.
Delete(ctx context.Context, cronId string) error
// List retrieves a collection of cron workflow triggers based on the provided parameters.
List(ctx context.Context, opts rest.CronWorkflowListParams) (*rest.CronWorkflowsList, error)
// Get retrieves a specific cron workflow trigger by its ID.
Get(ctx context.Context, cronId string) (*rest.CronWorkflows, error)
}
CronsClient provides methods for interacting with cron workflow triggers in the Hatchet platform.
func NewCronsClient ¶
func NewCronsClient( api *rest.ClientWithResponses, tenantId *string, ) CronsClient
NewCronsClient creates a new client for interacting with cron workflow triggers.
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 MetricsClient ¶
type MetricsClient interface {
// GetWorkflowMetrics retrieves metrics for a specific workflow.
GetWorkflowMetrics(ctx context.Context, workflowId string, opts *rest.WorkflowGetMetricsParams) (*rest.WorkflowMetrics, error)
// GetQueueMetrics retrieves tenant-wide queue metrics.
GetQueueMetrics(ctx context.Context, opts *rest.TenantGetQueueMetricsParams) (*rest.TenantGetQueueMetricsResponse, error)
// GetTaskQueueMetrics retrieves tenant-wide step run queue metrics.
GetTaskQueueMetrics(ctx context.Context) (*rest.TenantGetStepRunQueueMetricsResponse, error)
}
MetricsClient provides methods for retrieving metrics data in the Hatchet platform.
func NewMetricsClient ¶
func NewMetricsClient( api *rest.ClientWithResponses, tenantId *string, ) MetricsClient
NewMetricsClient creates a new client for interacting with metrics.
type RateLimitsClient ¶
type RateLimitsClient interface {
// upsert creates or updates a rate limit with the provided options.
Upsert(opts CreateRatelimitOpts) error
// list retrieves rate limits based on the provided parameters (optional).
List(ctx context.Context, opts *rest.RateLimitListParams) (*rest.RateLimitListResponse, error)
}
rateLimitsClient provides an interface for managing 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.
type RunsClient ¶
type RunsClient interface {
// Get retrieves a workflow run by its ID.
Get(ctx context.Context, runId string) (*rest.V1WorkflowRunGetResponse, error)
// GetDetails retrieves detailed information about a workflow run by its ID.
GetDetails(ctx context.Context, runId string) (*rest.WorkflowRunGetShapeResponse, error)
// List retrieves a collection of workflow runs based on the provided parameters.
List(ctx context.Context, opts rest.V1WorkflowRunListParams) (*rest.V1WorkflowRunListResponse, error)
// Replay requests a task to be replayed within a workflow run.
Replay(ctx context.Context, opts rest.V1ReplayTaskRequest) (*rest.V1TaskReplayResponse, error)
// Cancel requests cancellation of a specific task within a workflow run.
Cancel(ctx context.Context, opts rest.V1CancelTaskRequest) (*rest.V1TaskCancelResponse, error)
}
RunsClient provides methods for interacting with workflow runs in the Hatchet platform.
func NewRunsClient ¶
func NewRunsClient( api *rest.ClientWithResponses, tenantId *string, ) RunsClient
NewRunsClient creates a new client for interacting with workflow runs.
type SchedulesClient ¶
type SchedulesClient interface {
// Create creates a new scheduled workflow run.
Create(ctx context.Context, workflowName string, trigger CreateScheduledRunTrigger) (*rest.ScheduledWorkflows, error)
// Delete removes a scheduled workflow run.
Delete(ctx context.Context, scheduledRunId string) error
// List retrieves a collection of scheduled workflow runs based on the provided parameters.
List(ctx context.Context, opts rest.WorkflowScheduledListParams) (*rest.ScheduledWorkflowsList, error)
// Get retrieves a specific scheduled workflow run by its ID.
Get(ctx context.Context, scheduledRunId string) (*rest.ScheduledWorkflows, error)
}
SchedulesClient provides methods for interacting with workflow schedules in the Hatchet platform.
func NewSchedulesClient ¶
func NewSchedulesClient( api *rest.ClientWithResponses, tenantId *string, ) SchedulesClient
NewSchedulesClient creates a new client for interacting with workflow schedules.
type WorkersClient ¶
type WorkersClient interface {
// Get retrieves a worker by its ID.
Get(ctx context.Context, workerId string) (*rest.Worker, error)
// List retrieves all workers for the tenant.
List(ctx context.Context) (*rest.WorkerList, error)
// IsPaused checks if a worker is paused.
IsPaused(ctx context.Context, workerId string) (bool, error)
// Pause pauses a worker.
Pause(ctx context.Context, workerId string) (*rest.Worker, error)
// Unpause unpauses a worker.
Unpause(ctx context.Context, workerId string) (*rest.Worker, error)
}
WorkersClient provides methods for interacting with workers in the Hatchet platform.
func NewWorkersClient ¶
func NewWorkersClient( api *rest.ClientWithResponses, tenantId *string, ) WorkersClient
NewWorkersClient creates a new client for interacting with workers.
type WorkflowsClient ¶
type WorkflowsClient interface {
// Get retrieves a workflow by its name.
Get(ctx context.Context, workflowName string) (*rest.Workflow, error)
// GetId retrieves a workflow by its name.
GetId(ctx context.Context, workflowName string) (uuid.UUID, error)
// List retrieves all workflows for the tenant with optional filtering parameters.
List(ctx context.Context, opts *rest.WorkflowListParams) (*rest.WorkflowList, error)
// Delete removes a workflow by its name.
Delete(ctx context.Context, workflowName string) (*rest.WorkflowDeleteResponse, error)
}
WorkflowsClient provides methods for interacting with workflows in the Hatchet platform.
func NewWorkflowsClient ¶
func NewWorkflowsClient( api *rest.ClientWithResponses, tenantId *string, ) WorkflowsClient
NewWorkflowsClient creates a new client for interacting with workflows.