Documentation
¶
Index ¶
Constants ¶
const SignatureHeader = "X-Hatchet-Signature"
SignatureHeader is the HTTP header carrying the HMAC-SHA256 (hex-encoded) signature of the request body. Receivers verify it by recomputing the HMAC over the raw body with their copy of the signing secret (see signature.Verify).
const SigningSecretEncryptionDataID = "v1_operator_signing_secret"
SigningSecretEncryptionDataID is the envelope-encryption data id used when encrypting and decrypting the operator's signing secret. The API encrypts the secret under this id before persisting it in the operator config, and the operator decrypts it at startup.
Variables ¶
This section is empty.
Functions ¶
func SlotConfig ¶
func SlotConfig(op *sqlcv1.V1Operator) (map[string]int32, error)
SlotConfig returns the worker slot config (slot_type -> max units) for an HTTP operator, derived from its stored config. It is used to provision the operator's worker and may vary between operators.
Types ¶
type HTTPOperator ¶
type HTTPOperator struct {
*operator.SharedOperator[HTTPOperatorConfig]
// contains filtered or unexported fields
}
func NewHTTPOperator ¶
func NewHTTPOperator(op *sqlcv1.V1Operator, l *zerolog.Logger, repo repository.Repository, taskEventWriter operator.TaskEventWriter, enc encryption.EncryptionService, infraBlockedCIDRs []string, workerId uuid.UUID) (*HTTPOperator, error)
func (*HTTPOperator) Cleanup ¶
func (h *HTTPOperator) Cleanup()
Cleanup stops the healthcheck poller in addition to the shared operator's goroutines.
func (*HTTPOperator) Drain ¶
func (h *HTTPOperator) Drain()
Drain stops the healthcheck poller and drains in-flight tasks without pausing the worker (used for bulk teardown, where the caller pauses all operator workers in one query).
func (*HTTPOperator) HandleAction ¶
func (h *HTTPOperator) HandleAction(ctx context.Context, action *contracts.AssignedAction) error
type HTTPOperatorConfig ¶
type HTTPOperatorConfig struct {
HealthcheckEndpoint string `json:"healthcheckEndpoint"`
TriggerEndpoint string `json:"triggerEndpoint"`
// SigningSecret is the encrypted (envelope-encrypted, base64) HMAC signing secret as
// stored in the operator config. It is encrypted by the API under
// SigningSecretEncryptionDataID and decrypted by the operator at startup; the plaintext
// is never persisted.
SigningSecret string `json:"signingSecret"`
// RequestTimeoutSeconds optionally overrides defaultRequestTimeout for a single
// delivery. The caller's context deadline still applies if it is earlier.
RequestTimeoutSeconds int `json:"requestTimeoutSeconds"`
// Slots is the number of concurrent task slots the operator's worker advertises.
// Defaults to defaultOperatorSlots when unset.
Slots int `json:"slots"`
}
type HealthcheckRequest ¶
type HealthcheckRequest struct{}
HealthcheckRequest is the body POSTed to the operator's healthcheck endpoint. It is currently empty (the endpoint just advertises the actions it handles) but exists as a typed envelope so the poll can carry additional fields in the future.
type HealthcheckResponse ¶
type HealthcheckResponse struct {
Actions []string `json:"actions"`
}
HealthcheckResponse is returned by the operator's healthcheck endpoint. Actions is the list of action names the endpoint handles; the operator registers these with the dispatcher so matching tasks are routed to it.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package safeclient provides an SSRF-hardened HTTP client for delivering outbound requests to user-supplied endpoints.
|
Package safeclient provides an SSRF-hardened HTTP client for delivering outbound requests to user-supplied endpoints. |