Create virtural hosts and users in a RabbitMQ Cluster.
- CLUSTERS: Comma seperated list of rabbitmq clusters. Ex: sandbox,live
- LIVE_RABBIT_AMQP: hostname to access queues in cluster 'live'. See below
- LIVE_RABBIT_URL: hostname to access management api in cluster 'live'.
- RABBITMQ_SECRET: Vault path to secret. Ex: secret/to/rabbitmq-api/admin/secrets
- VAULT_ADDR: Full url to vault. Ex: https://vault.example.io
- VAULT_TOKEN: Access token for vault.
- PORT: Port to access this api. Default is 3000 (See Go Martini)
- [CLUSTER_NAME]_RABBIT_URL - Api hostname (can be same as queue hostname)
- Ex: LIVE_RABBIT_URL=rabbitmq-prod.example.com
- Ex: SANDBOX_RABBIT_URL=rabbitmq-sandbox-api.example.io
- [CLUSTER_NAME]_RABBIT_AMQP - Queues hostname
- Ex: LIVE_RABBIT_AMQP=rabbitmq-prod.example.com
- Ex: SANDBOX_RABBIT_AMQP=rabbitmq-sandbox.example.io
The vault secret must contain these fields:
- brokerdb: URL for postgress database that stores created rabbitmq users/virtual hosts
- postgres://username:[email protected]:5432/dbname
- key: 32 byte key used to encrypt rabbitmq user password to store in database
- "this is thirty-two characters 32"
- username: Username for rabbitmq cluster that has admin privileges
- password: Password for rabbitmq admin user
Get a list of plans that can be used. The plans correlate to the cluster
names, so each cluster needs to be configured as a plan.
The defaults are sandbox and live.
URL : /v1/rabbitmq/plans
Method : GET
Code : 200 OK
Content
{
"live":"Prod and real use. Bigger cluster. Not purged",
"sandbox":"Dev and Testing and QA and Load testing. May be purged regularly"
}
Create a virtual host and user in the cluster from the plan.
URL : /v1/rabbitmq/instance
Method : POST
Data All fields required
{
"plan": "live",
"billingcode":"MyTeam"
}
Condition Virtual host and user created and added to database.
Code : 201 CREATED
Content
{
"RABBITMQ_URL":"amqp://username:[email protected]:5672/username"
}
Condition : Invalid plan or plan missing
Code : 400 Bad Request
Returned Response : None
URL : /v1/rabbitmq/url/:vhost
Method : GET
Condition : Virtual host found
Content :
{
"RABBITMQ_URL":"amqp://username:[email protected]:5672/vhost"
}
Condition : Virtual host not found
Code : 404 Not Found
URL : /v1/rabbitmq/instance/:vhost
URL Parameters : username=[string]
Method : DELETE
Condition : Virtual host and user deleted from database and rabbitmq cluster.
Code : 200 OK
Content : None
Condition : Virtual host not found in DB
Code : 404 Not Found
Content : None
URL : /v1/tag
Method : POST
Data :
- resource: virtual host name
- name: tag name
- value: tag value
{
"resource":"VHOST",
"name":"owner",
"value":"Captain Janeway"
}
Condition : Tag was added to virtual host in database
Code : 201 Created
Content :
{
"response":"tag added"
}
Condition : Vhost no in database
Code : 404 Not found
- Document structures and functions
- Add error handling