Documentation ¶
Overview ¶
The hooks service provides a mechanism for creating tasks in response to events.
See:
How to use this package ¶
First create a Hooks object:
hooks := tchooks.New(nil)
and then call one or more of hooks's methods, e.g.:
err := hooks.Ping(.....)
handling any errors...
if err != nil { // handle error... }
Taskcluster Schema ¶
The source code of this go package was auto-generated from the API definition at https://community-tc.services.mozilla.com/references/hooks/v1/api.json together with the input and output schemas it references, downloaded on Thu, 31 Oct 2019 at 18:23:00 UTC. The code was generated by https://github.com/taskcluster/taskcluster-client-go/blob/master/build.sh.
Index ¶
- type Binding
- type FailedFire
- type HookCreationRequest
- type HookDefinition
- type HookGroups
- type HookList
- type HookMetadata
- type HookStatusResponse
- type Hooks
- func (hooks *Hooks) CreateHook(hookGroupId, hookId string, payload *HookCreationRequest) (*HookDefinition, error)
- func (hooks *Hooks) GetHookStatus(hookGroupId, hookId string) (*HookStatusResponse, error)
- func (hooks *Hooks) GetTriggerToken(hookGroupId, hookId string) (*TriggerTokenResponse, error)
- func (hooks *Hooks) GetTriggerToken_SignedURL(hookGroupId, hookId string, duration time.Duration) (*url.URL, error)
- func (hooks *Hooks) Hook(hookGroupId, hookId string) (*HookDefinition, error)
- func (hooks *Hooks) ListHookGroups() (*HookGroups, error)
- func (hooks *Hooks) ListHooks(hookGroupId string) (*HookList, error)
- func (hooks *Hooks) ListLastFires(hookGroupId, hookId string) (*LastFiresList, error)
- func (hooks *Hooks) Ping() error
- func (hooks *Hooks) RemoveHook(hookGroupId, hookId string) error
- func (hooks *Hooks) ResetTriggerToken(hookGroupId, hookId string) (*TriggerTokenResponse, error)
- func (hooks *Hooks) TriggerHook(hookGroupId, hookId string, payload *TriggerHookRequest) (*TriggerHookResponse, error)
- func (hooks *Hooks) TriggerHookWithToken(hookGroupId, hookId, token string, payload *TriggerHookRequest) (*TriggerHookResponse, error)
- func (hooks *Hooks) UpdateHook(hookGroupId, hookId string, payload *HookCreationRequest) (*HookDefinition, error)
- type LastFiresList
- type NoFire
- type RunInformation
- type Status
- type SuccessfulFire
- type TaskStatusStructure
- type TriggerHookRequest
- type TriggerHookResponse
- type TriggerHookResponse1
- type TriggerTokenResponse
- type Var
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binding ¶
type Binding struct { // Min length: 1 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/bindings.json#/items/properties/exchange Exchange string `json:"exchange"` // Min length: 1 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/bindings.json#/items/properties/routingKeyPattern RoutingKeyPattern string `json:"routingKeyPattern"` }
Exchange and RoutingKeyPattern for each binding
See https://community-tc.services.mozilla.com/schemas/hooks/v1/bindings.json#/items
type FailedFire ¶
type FailedFire struct { // The error that occurred when firing the task. This is typically, // but not always, an API error message. // // Additional properties allowed // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-status.json#/properties/lastFire/oneOf[1]/properties/error Error json.RawMessage `json:"error"` // Possible values: // * "error" // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-status.json#/properties/lastFire/oneOf[1]/properties/result Result string `json:"result"` // The time the task was created. This will not necessarily match `task.created`. // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-status.json#/properties/lastFire/oneOf[1]/properties/time Time tcclient.Time `json:"time"` }
Information about an unsuccessful firing of the hook
type HookCreationRequest ¶
type HookCreationRequest struct { // See https://community-tc.services.mozilla.com/schemas/hooks/v1/bindings.json# Bindings []Binding `json:"bindings,omitempty"` // Syntax: ^([a-zA-Z0-9-_]*)$ // Min length: 1 // Max length: 64 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/create-hook-request.json#/properties/hookGroupId HookGroupID string `json:"hookGroupId,omitempty"` // Syntax: ^([a-zA-Z0-9-_/]*)$ // Min length: 1 // Max length: 64 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/create-hook-request.json#/properties/hookId HookID string `json:"hookId,omitempty"` // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-metadata.json# Metadata HookMetadata `json:"metadata"` // Definition of the times at which a hook will result in creation of a task. // If several patterns are specified, tasks will be created at any time // specified by one or more patterns. // // Default: [] // // Array items: // Cron-like specification for when tasks should be created. The pattern is // parsed in a UTC context. // See [cron-parser on npm](https://www.npmjs.com/package/cron-parser). // Note that tasks may not be created at exactly the time specified. // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/create-hook-request.json#/properties/schedule/items // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/create-hook-request.json#/properties/schedule Schedule []string `json:"schedule,omitempty"` // Template for the task definition. This is rendered using [JSON-e](https://taskcluster.github.io/json-e/) // as described in [firing hooks](/docs/reference/core/hooks/firing-hooks) to produce // a task definition that is submitted to the Queue service. // // Additional properties allowed // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/create-hook-request.json#/properties/task Task json.RawMessage `json:"task"` // Default: { // "additionalProperties": false, // "type": "object" // } // // Additional properties allowed // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/create-hook-request.json#/properties/triggerSchema TriggerSchema json.RawMessage `json:"triggerSchema,omitempty"` }
Definition of a hook that can create tasks at defined times.
See https://community-tc.services.mozilla.com/schemas/hooks/v1/create-hook-request.json#
type HookDefinition ¶
type HookDefinition struct { // See https://community-tc.services.mozilla.com/schemas/hooks/v1/bindings.json# Bindings []Binding `json:"bindings,omitempty"` // Syntax: ^([a-zA-Z0-9-_]*)$ // Min length: 1 // Max length: 64 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-definition.json#/properties/hookGroupId HookGroupID string `json:"hookGroupId"` // Syntax: ^([a-zA-Z0-9-_/]*)$ // Min length: 1 // Max length: 64 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-definition.json#/properties/hookId HookID string `json:"hookId"` // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-metadata.json# Metadata HookMetadata `json:"metadata"` // A list of cron-style definitions to represent a set of moments in (UTC) time. // If several patterns are specified, a given moment in time represented by // more than one pattern is considered only to be counted once, in other words // it is allowed for the cron patterns to overlap; duplicates are redundant. // // Default: [] // // Array items: // Cron-like specification for when tasks should be created. The pattern is // parsed in a UTC context. // See [cron-parser on npm](https://www.npmjs.com/package/cron-parser). // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/schedule.json#/items // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/schedule.json# Schedule []string `json:"schedule"` // Template for the task definition. This is rendered using [JSON-e](https://taskcluster.github.io/json-e/) // as described in [firing hooks](/docs/reference/core/hooks/firing-hooks) to produce // a task definition that is submitted to the Queue service. // // Additional properties allowed // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-definition.json#/properties/task Task json.RawMessage `json:"task"` // Additional properties allowed // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-definition.json#/properties/triggerSchema TriggerSchema json.RawMessage `json:"triggerSchema"` }
Definition of a hook that will create tasks when defined events occur.
See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-definition.json#
type HookGroups ¶
type HookGroups struct { // Array items: // See https://community-tc.services.mozilla.com/schemas/hooks/v1/list-hook-groups-response.json#/properties/groups/items // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/list-hook-groups-response.json#/properties/groups Groups []string `json:"groups"` }
List of `hookGroupIds`.
See https://community-tc.services.mozilla.com/schemas/hooks/v1/list-hook-groups-response.json#
type HookList ¶
type HookList struct { // See https://community-tc.services.mozilla.com/schemas/hooks/v1/list-hooks-response.json#/properties/hooks Hooks []HookDefinition `json:"hooks"` }
List of hooks
See https://community-tc.services.mozilla.com/schemas/hooks/v1/list-hooks-response.json#
type HookMetadata ¶
type HookMetadata struct { // Long-form of the hook's purpose and behavior // // Max length: 32768 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-metadata.json#/properties/description Description string `json:"description"` // Whether to email the owner on an error creating the task. // // Default: true // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-metadata.json#/properties/emailOnError EmailOnError bool `json:"emailOnError,omitempty"` // Human readable name of the hook // // Max length: 255 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-metadata.json#/properties/name Name string `json:"name"` // Email of the person or group responsible for this hook. // // Max length: 255 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-metadata.json#/properties/owner Owner string `json:"owner"` }
See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-metadata.json#
type HookStatusResponse ¶
type HookStatusResponse struct { // Information about the last time this hook fired. This property is only present // if the hook has fired at least once. // // One of: // * SuccessfulFire // * FailedFire // * NoFire // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-status.json#/properties/lastFire LastFire json.RawMessage `json:"lastFire"` // The next time this hook's task is scheduled to be created. This property // is only present if there is a scheduled next time. Some hooks don't have // any schedules. // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-status.json#/properties/nextScheduledDate NextScheduledDate tcclient.Time `json:"nextScheduledDate,omitempty"` }
A snapshot of the current status of a hook.
See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-status.json#
type Hooks ¶
func New ¶
func New(credentials *tcclient.Credentials, rootURL string) *Hooks
New returns a Hooks client, configured to run against production. Pass in nil credentials to create a client without authentication. The returned client is mutable, so returned settings can be altered.
hooks := tchooks.New( nil, // client without authentication "http://localhost:1234/my/taskcluster", // taskcluster hosted at this root URL on local machine ) err := hooks.Ping(.....) // for example, call the Ping(.....) API endpoint (described further down)... if err != nil { // handle errors... }
func NewFromEnv ¶
func NewFromEnv() *Hooks
NewFromEnv returns a *Hooks configured from environment variables.
The root URL is taken from TASKCLUSTER_PROXY_URL if set to a non-empty string, otherwise from TASKCLUSTER_ROOT_URL if set, otherwise the empty string.
The credentials are taken from environment variables:
TASKCLUSTER_CLIENT_ID TASKCLUSTER_ACCESS_TOKEN TASKCLUSTER_CERTIFICATE
If TASKCLUSTER_CLIENT_ID is empty/unset, authentication will be disabled.
func (*Hooks) CreateHook ¶
func (hooks *Hooks) CreateHook(hookGroupId, hookId string, payload *HookCreationRequest) (*HookDefinition, error)
This endpoint will create a new hook.
The caller's credentials must include the role that will be used to create the task. That role must satisfy task.scopes as well as the necessary scopes to add the task to the queue.
Required scopes:
All of: * hooks:modify-hook:<hookGroupId>/<hookId> * assume:hook-id:<hookGroupId>/<hookId>
See #createHook
func (*Hooks) GetHookStatus ¶
func (hooks *Hooks) GetHookStatus(hookGroupId, hookId string) (*HookStatusResponse, error)
Stability: *** DEPRECATED ***
This endpoint will return the current status of the hook. This represents a snapshot in time and may vary from one call to the next.
This method is deprecated in favor of listLastFires.
See #getHookStatus
func (*Hooks) GetTriggerToken ¶
func (hooks *Hooks) GetTriggerToken(hookGroupId, hookId string) (*TriggerTokenResponse, error)
Retrieve a unique secret token for triggering the specified hook. This token can be deactivated with `resetTriggerToken`.
Required scopes:
hooks:get-trigger-token:<hookGroupId>/<hookId>
See #getTriggerToken
func (*Hooks) GetTriggerToken_SignedURL ¶
func (hooks *Hooks) GetTriggerToken_SignedURL(hookGroupId, hookId string, duration time.Duration) (*url.URL, error)
Returns a signed URL for GetTriggerToken, valid for the specified duration.
Required scopes:
hooks:get-trigger-token:<hookGroupId>/<hookId>
See GetTriggerToken for more details.
func (*Hooks) Hook ¶
func (hooks *Hooks) Hook(hookGroupId, hookId string) (*HookDefinition, error)
This endpoint will return the hook definition for the given `hookGroupId` and hookId.
See #hook
func (*Hooks) ListHookGroups ¶
func (hooks *Hooks) ListHookGroups() (*HookGroups, error)
This endpoint will return a list of all hook groups with at least one hook.
See #listHookGroups
func (*Hooks) ListHooks ¶
This endpoint will return a list of all the hook definitions within a given hook group.
See #listHooks
func (*Hooks) ListLastFires ¶
func (hooks *Hooks) ListLastFires(hookGroupId, hookId string) (*LastFiresList, error)
Stability: *** EXPERIMENTAL ***
This endpoint will return information about the the last few times this hook has been fired, including whether the hook was fired successfully or not
See #listLastFires
func (*Hooks) Ping ¶
Respond without doing anything. This endpoint is used to check that the service is up.
See #ping
func (*Hooks) RemoveHook ¶
This endpoint will remove a hook definition.
Required scopes:
hooks:modify-hook:<hookGroupId>/<hookId>
See #removeHook
func (*Hooks) ResetTriggerToken ¶
func (hooks *Hooks) ResetTriggerToken(hookGroupId, hookId string) (*TriggerTokenResponse, error)
Reset the token for triggering a given hook. This invalidates token that may have been issued via getTriggerToken with a new token.
Required scopes:
hooks:reset-trigger-token:<hookGroupId>/<hookId>
See #resetTriggerToken
func (*Hooks) TriggerHook ¶
func (hooks *Hooks) TriggerHook(hookGroupId, hookId string, payload *TriggerHookRequest) (*TriggerHookResponse, error)
This endpoint will trigger the creation of a task from a hook definition.
The HTTP payload must match the hooks `triggerSchema`. If it does, it is provided as the `payload` property of the JSON-e context used to render the task template.
Required scopes:
hooks:trigger-hook:<hookGroupId>/<hookId>
See #triggerHook
func (*Hooks) TriggerHookWithToken ¶
func (hooks *Hooks) TriggerHookWithToken(hookGroupId, hookId, token string, payload *TriggerHookRequest) (*TriggerHookResponse, error)
This endpoint triggers a defined hook with a valid token.
The HTTP payload must match the hooks `triggerSchema`. If it does, it is provided as the `payload` property of the JSON-e context used to render the task template.
See #triggerHookWithToken
func (*Hooks) UpdateHook ¶
func (hooks *Hooks) UpdateHook(hookGroupId, hookId string, payload *HookCreationRequest) (*HookDefinition, error)
This endpoint will update an existing hook. All fields except `hookGroupId` and `hookId` can be modified.
Required scopes:
All of: * hooks:modify-hook:<hookGroupId>/<hookId> * assume:hook-id:<hookGroupId>/<hookId>
See #updateHook
type LastFiresList ¶
type LastFiresList struct { // See https://community-tc.services.mozilla.com/schemas/hooks/v1/list-lastFires-response.json#/properties/lastFires LastFires []Var `json:"lastFires"` }
List of lastFires
See https://community-tc.services.mozilla.com/schemas/hooks/v1/list-lastFires-response.json#
type NoFire ¶
type NoFire struct { // Possible values: // * "no-fire" // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-status.json#/properties/lastFire/oneOf[2]/properties/result Result string `json:"result"` }
Information about no firing of the hook (e.g., a new hook)
type RunInformation ¶
type RunInformation struct { // Reason for the creation of this run, // **more reasons may be added in the future**. // // Possible values: // * "scheduled" // * "retry" // * "task-retry" // * "rerun" // * "exception" // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/runs/items/properties/reasonCreated ReasonCreated string `json:"reasonCreated"` // Reason that run was resolved, this is mainly // useful for runs resolved as `exception`. // Note, **more reasons may be added in the future**, also this // property is only available after the run is resolved. // // Possible values: // * "completed" // * "failed" // * "deadline-exceeded" // * "canceled" // * "superseded" // * "claim-expired" // * "worker-shutdown" // * "malformed-payload" // * "resource-unavailable" // * "internal-error" // * "intermittent-task" // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/runs/items/properties/reasonResolved ReasonResolved string `json:"reasonResolved,omitempty"` // Date-time at which this run was resolved, ie. when the run changed // state from `running` to either `completed`, `failed` or `exception`. // This property is only present after the run as been resolved. // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/runs/items/properties/resolved Resolved tcclient.Time `json:"resolved,omitempty"` // Id of this task run, `run-id`s always starts from `0` // // Mininum: 0 // Maximum: 1000 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/runs/items/properties/runId RunID int64 `json:"runId"` // Date-time at which this run was scheduled, ie. when the run was // created in state `pending`. // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/runs/items/properties/scheduled Scheduled tcclient.Time `json:"scheduled"` // Date-time at which this run was claimed, ie. when the run changed // state from `pending` to `running`. This property is only present // after the run has been claimed. // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/runs/items/properties/started Started tcclient.Time `json:"started,omitempty"` // State of this run // // Possible values: // * "pending" // * "running" // * "completed" // * "failed" // * "exception" // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/runs/items/properties/state State string `json:"state"` // Time at which the run expires and is resolved as `failed`, if the // run isn't reclaimed. Note, only present after the run has been // claimed. // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/runs/items/properties/takenUntil TakenUntil tcclient.Time `json:"takenUntil,omitempty"` // Identifier for group that worker who executes this run is a part of, // this identifier is mainly used for efficient routing. // Note, this property is only present after the run is claimed. // // Syntax: ^([a-zA-Z0-9-_]*)$ // Min length: 1 // Max length: 38 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/runs/items/properties/workerGroup WorkerGroup string `json:"workerGroup,omitempty"` // Identifier for worker evaluating this run within given // `workerGroup`. Note, this property is only available after the run // has been claimed. // // Syntax: ^([a-zA-Z0-9-_]*)$ // Min length: 1 // Max length: 38 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/runs/items/properties/workerId WorkerID string `json:"workerId,omitempty"` }
JSON object with information about a run
type Status ¶
type Status struct { // Deadline of the task, `pending` and `running` runs are // resolved as **exception** if not resolved by other means // before the deadline. Note, deadline cannot be more than // 5 days into the future // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/deadline Deadline tcclient.Time `json:"deadline"` // Task expiration, time at which task definition and // status is deleted. Notice that all artifacts for the task // must have an expiration that is no later than this. // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/expires Expires tcclient.Time `json:"expires"` // Unique identifier for the provisioner that this task must be scheduled on // // Syntax: ^([a-zA-Z0-9-_]*)$ // Min length: 1 // Max length: 38 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/provisionerId ProvisionerID string `json:"provisionerId"` // Number of retries left for the task in case of infrastructure issues // // Mininum: 0 // Maximum: 999 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/retriesLeft RetriesLeft int64 `json:"retriesLeft"` // List of runs, ordered so that index `i` has `runId == i` // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/runs Runs []RunInformation `json:"runs"` // Identifier for the scheduler that _defined_ this task. // // Syntax: ^([a-zA-Z0-9-_]*)$ // Min length: 1 // Max length: 38 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/schedulerId SchedulerID string `json:"schedulerId"` // State of this task. This is just an auxiliary property derived from state // of latests run, or `unscheduled` if none. // // Possible values: // * "unscheduled" // * "pending" // * "running" // * "completed" // * "failed" // * "exception" // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/state State string `json:"state"` // Identifier for a group of tasks scheduled together with this task, by // scheduler identified by `schedulerId`. For tasks scheduled by the // task-graph scheduler, this is the `taskGraphId`. // // Syntax: ^[A-Za-z0-9_-]{8}[Q-T][A-Za-z0-9_-][CGKOSWaeimquy26-][A-Za-z0-9_-]{10}[AQgw]$ // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/taskGroupId TaskGroupID string `json:"taskGroupId"` // Unique task identifier, this is UUID encoded as // [URL-safe base64](http://tools.ietf.org/html/rfc4648#section-5) and // stripped of `=` padding. // // Syntax: ^[A-Za-z0-9_-]{8}[Q-T][A-Za-z0-9_-][CGKOSWaeimquy26-][A-Za-z0-9_-]{10}[AQgw]$ // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/taskId TaskID string `json:"taskId"` // Identifier for worker type within the specified provisioner // // Syntax: ^([a-zA-Z0-9-_]*)$ // Min length: 1 // Max length: 38 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status/properties/workerType WorkerType string `json:"workerType"` }
See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status
type SuccessfulFire ¶
type SuccessfulFire struct { // Possible values: // * "success" // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-status.json#/properties/lastFire/oneOf[0]/properties/result Result string `json:"result"` // The task created // // Syntax: ^[A-Za-z0-9_-]{8}[Q-T][A-Za-z0-9_-][CGKOSWaeimquy26-][A-Za-z0-9_-]{10}[AQgw]$ // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-status.json#/properties/lastFire/oneOf[0]/properties/taskId TaskID string `json:"taskId"` // The time the task was created. This will not necessarily match `task.created`. // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/hook-status.json#/properties/lastFire/oneOf[0]/properties/time Time tcclient.Time `json:"time"` }
Information about a successful firing of the hook
type TaskStatusStructure ¶
type TaskStatusStructure struct { // See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#/properties/status Status Status `json:"status"` }
A representation of **task status** as known by the queue
See https://community-tc.services.mozilla.com/schemas/hooks/v1/task-status.json#
type TriggerHookRequest ¶
type TriggerHookRequest json.RawMessage
A request to trigger a hook. The payload must be a JSON object, and is used as the context for a JSON-e rendering of the hook's task template, as described in "Firing Hooks".
Additional properties allowed ¶
See https://community-tc.services.mozilla.com/schemas/hooks/v1/trigger-hook.json#
func (*TriggerHookRequest) MarshalJSON ¶
func (this *TriggerHookRequest) MarshalJSON() ([]byte, error)
MarshalJSON calls json.RawMessage method of the same name. Required since TriggerHookRequest is of type json.RawMessage...
func (*TriggerHookRequest) UnmarshalJSON ¶
func (this *TriggerHookRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON is a copy of the json.RawMessage implementation.
type TriggerHookResponse ¶
type TriggerHookResponse json.RawMessage
Response to a `triggerHook` or `triggerHookWithToken` call.
In most cases, this is a task status, but in cases where the hook template does not generate a task, it is an empty object with no `status` property.
Any of:
- TaskStatusStructure
- TriggerHookResponse1
See https://community-tc.services.mozilla.com/schemas/hooks/v1/trigger-hook-response.json#
func (*TriggerHookResponse) MarshalJSON ¶
func (this *TriggerHookResponse) MarshalJSON() ([]byte, error)
MarshalJSON calls json.RawMessage method of the same name. Required since TriggerHookResponse is of type json.RawMessage...
func (*TriggerHookResponse) UnmarshalJSON ¶
func (this *TriggerHookResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON is a copy of the json.RawMessage implementation.
type TriggerHookResponse1 ¶
type TriggerHookResponse1 struct { }
Empty response indicating no task was created
See https://community-tc.services.mozilla.com/schemas/hooks/v1/trigger-hook-response.json#/anyOf[1]
type TriggerTokenResponse ¶
type TriggerTokenResponse struct { // See https://community-tc.services.mozilla.com/schemas/hooks/v1/trigger-token-response.json#/properties/token Token string `json:"token"` }
Secret token for a trigger
See https://community-tc.services.mozilla.com/schemas/hooks/v1/trigger-token-response.json#
type Var ¶
type Var struct { // The error that occurred when firing the task. This is typically, // but not always, an API error message. // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/list-lastFires-response.json#/properties/lastFires/items/properties/error Error string `json:"error"` // Possible values: // * "schedule" // * "triggerHook" // * "triggerHookWithToken" // * "pulseMessage" // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/list-lastFires-response.json#/properties/lastFires/items/properties/firedBy FiredBy string `json:"firedBy"` // Syntax: ^([a-zA-Z0-9-_]*)$ // Min length: 1 // Max length: 64 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/list-lastFires-response.json#/properties/lastFires/items/properties/hookGroupId HookGroupID string `json:"hookGroupId"` // Syntax: ^([a-zA-Z0-9-_/]*)$ // Min length: 1 // Max length: 64 // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/list-lastFires-response.json#/properties/lastFires/items/properties/hookId HookID string `json:"hookId"` // Information about success or failure of firing of the hook // // Possible values: // * "success" // * "error" // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/list-lastFires-response.json#/properties/lastFires/items/properties/result Result string `json:"result"` // Time when the task was created // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/list-lastFires-response.json#/properties/lastFires/items/properties/taskCreateTime TaskCreateTime tcclient.Time `json:"taskCreateTime"` // Unique task identifier, this is UUID encoded as // [URL-safe base64](http://tools.ietf.org/html/rfc4648#section-5) and // stripped of `=` padding. // // Syntax: ^[A-Za-z0-9_-]{8}[Q-T][A-Za-z0-9_-][CGKOSWaeimquy26-][A-Za-z0-9_-]{10}[AQgw]$ // // See https://community-tc.services.mozilla.com/schemas/hooks/v1/list-lastFires-response.json#/properties/lastFires/items/properties/taskId TaskID string `json:"taskId"` }