public class Hooks extends TaskClusterRequestHandler
Hooks are a mechanism for creating tasks in response to events.
Hooks are identified with a hookGroupId and a hookId.
When an event occurs, the resulting task is automatically created. The task is created using the scope assume:hook-id:<hookGroupId>/<hookId>, which must have scopes to make the createTask call, including satisfying all scopes in task.scopes.
Hooks can have a ‘schedule’ indicating specific times that new tasks should be created. Each schedule is in a simple cron format, per https://www.npmjs.com/package/cron-parser. For example: * ["0 0 1 * * *"] – daily at 1:00 UTC * ["0 0 9,21 * * 1-5", "0 0 12 * * 0,6"] – weekdays at 9:00 and 21:00 UTC, weekends at noon
| Modifier and Type | Field and Description |
|---|---|
protected static String |
defaultBaseURL |
| Constructor and Description |
|---|
Hooks() |
Hooks(String baseURL) |
Hooks(String clientId,
String accessToken) |
Hooks(String clientId,
String accessToken,
String certificate) |
| Modifier and Type | Method and Description |
|---|---|
CallSummary<HookCreationRequest,HookDefinition> |
createHook(String hookGroupId,
String hookId,
HookCreationRequest payload)
This endpoint will create a new hook.
|
CallSummary<EmptyPayload,HookScheduleResponse> |
getHookSchedule(String hookGroupId,
String hookId)
This endpoint will return the schedule and next scheduled creation time for the given hook.
|
CallSummary<EmptyPayload,HookStatusResponse> |
getHookStatus(String hookGroupId,
String hookId)
This endpoint will return the current status of the hook.
|
CallSummary<EmptyPayload,HookDefinition> |
hook(String hookGroupId,
String hookId)
This endpoint will return the hook defintion for the given
hookGroupId and hookId. |
CallSummary<EmptyPayload,HookGroups> |
listHookGroups()
This endpoint will return a list of all hook groups with at least one hook.
|
CallSummary<EmptyPayload,HookList> |
listHooks(String hookGroupId)
This endpoint will return a list of all the hook definitions within a given hook group.
|
CallSummary<EmptyPayload,EmptyPayload> |
removeHook(String hookGroupId,
String hookId)
This endpoint will remove a hook definition.
|
CallSummary<HookCreationRequest,HookDefinition> |
updateHook(String hookGroupId,
String hookId,
HookCreationRequest payload)
This endpoint will update an existing hook.
|
apiCall, configureHawk, setBaseURL, uriEncodeprotected static final String defaultBaseURL
public Hooks(String baseURL)
public Hooks()
public CallSummary<EmptyPayload,HookGroups> listHookGroups() throws APICallFailure
This endpoint will return a list of all hook groups with at least one hook.
See http://docs.taskcluster.net/services/hooks/#listHookGroups
APICallFailurepublic CallSummary<EmptyPayload,HookList> listHooks(String hookGroupId) throws APICallFailure
This endpoint will return a list of all the hook definitions within a given hook group.
APICallFailurepublic CallSummary<EmptyPayload,HookDefinition> hook(String hookGroupId, String hookId) throws APICallFailure
This endpoint will return the hook defintion for the given hookGroupId and hookId.
APICallFailurepublic CallSummary<EmptyPayload,HookStatusResponse> getHookStatus(String hookGroupId, String hookId) throws APICallFailure
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.
See http://docs.taskcluster.net/services/hooks/#getHookStatus
APICallFailurepublic CallSummary<EmptyPayload,HookScheduleResponse> getHookSchedule(String hookGroupId, String hookId) throws APICallFailure
This endpoint will return the schedule and next scheduled creation time for the given hook.
See http://docs.taskcluster.net/services/hooks/#getHookSchedule
APICallFailurepublic CallSummary<HookCreationRequest,HookDefinition> createHook(String hookGroupId, String hookId, HookCreationRequest payload) throws APICallFailure
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.
APICallFailurepublic CallSummary<HookCreationRequest,HookDefinition> updateHook(String hookGroupId, String hookId, HookCreationRequest payload) throws APICallFailure
This endpoint will update an existing hook. All fields except hookGroupId and hookId can be modified.
APICallFailurepublic CallSummary<EmptyPayload,EmptyPayload> removeHook(String hookGroupId, String hookId) throws APICallFailure
This endpoint will remove a hook definition.
APICallFailureCopyright © 2014–2016 Mozilla. All rights reserved.