The Notification Pipeline
The notification pipeline is a websocket connection that broadcasts the events of a hub. It broadcasts JSON messages over the socket, with a header field that can be used to determine the event that took place.
- dataobject
The data object holding the token.
Show child fields
- topicstring
A header topic, for the full list see the table included on this page.
- objectobject
The ID of the notification and potential state and error information.
Show child fields - contextobject
The context associated with this notification including but not limited to data on the hub, account, environment, DNS zone, cluster, or containers associated with this notification.
Show child fields - flagsobjectoptional
Flags used internally, if returned will show null.
Authenticating
Connecting to the websocket is a two step process.
First you authenticate against the endpoint:
/v1/hubs/current/notifications
This returns a URL and a token you can use to create a websocket connection to the notification pipeline.
If you're using the TypeScript client this is automatically handled for you. The function calls are shown in the example area. If you're not using the TypeScript client its probably a good idea write a short script to handle the two steps.
The return from the authentication request will be a token, and the token will need to be appended to the URL as a parameter to complete the websocket connection.
Hub
https://api.cycle.io/v1/hubs/current/notifications?token=$token
Account
https://api.cycle.io/v1/hubs/current/notifications?token=$token
Connecting to the Notification Pipeline
The hub pipeline will send notifications about the events happening on the hub (types listed below). It's at your discretion to use that information and decide whether to make a follow up API call for the rest.
Headers
Header | Type | Description |
---|---|---|
billing.credit.state.changed | Hub | A credit state has changed. |
billing.credit.error | Hub | A credit error has occurred. |
billing.discount.state.changed | Hub | A discount items state has changed. |
billing.discount.error | Hub | A discount item error has occurred. |
billing.invoice.state.changed | Hub | A billing invoice has changed state. |
billing.invoice.error | Hub | A billing invoice has encountered an error. |
billing.invoice.created | Hub | A new billing invoice was created. |
billing.method.state.changed | Hub | The billing method state has been changed. |
billing.method.error | Hub | A billing method error has occurred. |
billing.method.created | Hub | A billing method has been created. |
billing.method.updated | Hub | The billing method has been updated. |
billing.order.state.changed | Hub | An order state has changed. |
billing.order.error | Hub | An order error has occurred. |
billing.order.created | Hub | A new order has been created. |
billing.order.updated | Hub | A billing order has been updated. |
billing.service.state.changed | Hub | A billing service state has changed. |
billing.service.error | Hub | A billing service error has occurred. |
container.created | Hub | A container has been created. |
container.updated | Hub | A containers has been updated. |
container.reconfigured | Hub | A container has been reconfigured. |
container.state.changed | Hub | A container state has changed. |
container.desired_state.changed | Hub | A container state change has been requested. |
container.error | Hub | A container error has occurred. |
container.instance.state.changed | Hub | There has been a state change in the container instance. |
container.instance.error | Hub | The container instance has produced an error |
container.instance.health.status.changed | Hub | The container instance's health has changed. Possible status's are healthy and unhealthy |
container.instances.reconfigured | Hub | The container instance has been reconfigured. |
dns.certificate.state.changed | Hub | A certificate state has changed. |
dns.certificate.error | Hub | A certificate error has occurred. |
dns.zone.state.changed | Hub | A DNS zone state change has occurred. |
dns.zone.error | Hub | A DNS zone error has occurred. |
dns.zone.created | Hub | A DNS zone has been created. |
dns.zone.verified | Hub | A DNS zone has been verified. |
dns.zone.reconfigured | Hub | A DNS zone has been reconfigured. |
dns.zone.records.reconfigured | Hub | The DNS Zone records have been reconfigured. |
dns.zone.record.state.changed | Hub | A DNS Zone record has changed state. |
dns.zone.certificate.ready | Hub | A DNS Zone record's certificate is ready. |
dns.zone.certificate.ready | Hub | A DNS Zone record's certificate is ready. |
environment.started | Hub | An environment has been started. |
environment.stopped | Hub | An environment has been stopped. |
environment.created | Hub | An environment has been created. |
environment.updated | Hub | An environment has been updated. |
environment.state.changed | Hub | The state of an environment has changed. |
environment.error | Hub | A environment error has occurred. |
environment.services.reconfigured | Hub | An environment service container has been reconfigured. |
environment.services.vpn.users.updated | Hub | A new user for an environment VPN has been updated. |
environment.services.lb.ip.acquired | Hub | The load balancer has successfully acquired an IP. |
environment.variable.created | Hub | An environment secret variable has been created. |
environment.variable.updated | Hub | An environment secret variable has been updated. |
environment.variable.state.changed | Hub | An environment secret variable's state has changed. |
hub.state.changed | Hub | The state of a hub has changed. |
hub.updated | Hub | A hub has been updated. |
hub.membership.new | Hub | There has been a new hub membership event. |
hub.api_key.state.changed | Hub | The state of a hub API key has changed. |
hub.api_key.error | Hub | A hub API key error has occurred. |
hub.api_key.created | Hub | A new hub API key has been created. |
hub.api_key.updated | Hub | A hub API key has been updated. |
image.state.changed | Hub | The state of an image has changed. |
image.updated | Hub | An image has been updated. |
image.error | Hub | An image error has occurred. |
infrastructure.ips.assignment.state.changed | Hub | The IP assignment on the some infrastructure has changed state. |
infrastructure.ips.assignment.error | Hub | There was an error with the IP assignment on some infrastructure. |
ips_pool.state.changed | Hub | The state of an IP Pool has changed. |
ips_pool.error | Hub | An IP Pool error has occurred. |
infrastructure.server.state.changed | Hub | The state of a server has changed. |
infrastructure.server.error | Hub | A server error has occurred. |
infrastructure.server.new | Hub | A new server has been added. |
infrastructure.server.reconfigured | Hub | A server has been reconfigured. |
job.created | Hub | The job has been created. |
job.state.changed | Hub | The job's state has changed. |
stack.created | Hub | A new stack has been created. |
stack.error | Hub | A stack error has occurred. |
stack.state.changed | Hub | The state of a stack has changed. |
stack.updated | Hub | A stack has updated. |
stack.build.created | Hub | A new stack build has been created. |
stack.build.state.changed | Hub | The state of a stack build has changed. |
stack.build.error | Hub | A stack build error has occurred. |
stack.build.deployed | Hub | A stack build has been deployed. |
sdn.network.created | Hub | A new SDN network has been created. |
sdn.network.error | Hub | An |
sdn.network.reconfigured | Hub | A SDN network has been reconfigured. |
sdn.network.state.changed | Hub | The state of a SDN network has changed. |
sdn.network.updated | Hub | The SDN network was updated. |
pipeline.state.changed | Hub | A pipelines state has changed. |
pipeline.error | Hub | A pipeline error has occurred. |
pipeline.updated | Hub | A pipeline has been updated. |
pipeline.created | Hub | A pipeline has been created. |
pipeline.key.state.changed | Hub | A pipeline key has encounterd a state change. |
pipeline.key.error | Hub | A pipeline key error has occurred. |
pipeline.key.updated | Hub | A pipeline key has been updated. |
pipeline.key.created | Hub | A pipeline key has been created. |
pipeline.run.state.changed | Hub | A pipeline run state change has occured. |
pipeline.run.error | Hub | A pipeline run error has occured. |
pipeline.run.created | Hub | A pipeline run has been created. |
Auth
# This will return the AUTH data object$ curl https://api.cycle.io/v1/hubs/current/notifications \-H"Authorization: Bearer API_KEY"\-H"X-Hub-Id: HUB_ID"# Capture the Auth data object returned above and save the token to use in this call (AUTH_TOKEN)# WILL NOT WORK WITHOUT HTTP1.1 Flag$ curl -o - --http1.1 --include \--no-buffer \--header "Connection: Upgrade" \--header "Upgrade: websocket" \--header "Host: api.cycle.io" \--header "Origin: https://api.cycle.io" \--header"Sec-WebSocket-Key: API_KEY"\--header "Sec-WebSocket-Version: 13" \-H"x-cycle-token: AUTH_TOKEN"\-H"Authorization: Bearer API_KEY"\-H"X-Hub-Id: HUB_ID"\https://api.cycle.io/v1/hubs/current/notifications?token=$token
GET /v1/hubs/current/notifications
{"data": {"token": "Im3tH1omJkGH9pdtesNcPcgxl3iC7nGDsgH5pZU8g odJNzIaicp7ixkDMgrvKaadRrLcU1JtWmTsRvlC4AKh_D_DobPM0j_\n rgvQL4Cq017P6Wi5OuasC5VGxm4UATkdNEQRXbm820\n 9kYyif2g9YdEA 9RhrUz4cWbKMwjy3o41Eceno2nxvaTub_meLBmxljC"}}
{"topic": "container.reconfigured","object": {"id": "5d71fa31db2ab0000167b87e","state": "","error": ""},"context": {"hub_id": "5d71fa31db2ab0000167b87e","account_id": "5d71fa31db2ab0000167b87e","environments": ["5d71fa31db2ab0000167b87e"],"dns_zones": [],"clusters": ["production"],"containers": ["5d71fa31db2ab0000167b87e"]}}