Skip to content

Instantly share code, notes, and snippets.

@bahamat
Created October 11, 2019 17:01
Show Gist options
  • Save bahamat/36d1071d715f215f813044fe120ba18f to your computer and use it in GitHub Desktop.
Save bahamat/36d1071d715f215f813044fe120ba18f to your computer and use it in GitHub Desktop.
Example for setting up CLOUDAPI_SERVICES sapi metadata
> triton -p west1 services
NAME    ENDPOINT
cmon    https://cmon.us-west-1.triton.zone:9163
docker  tcp://us-west-1.docker.joyent.com:2376
> triton -p west1 services -j
{"docker":"tcp://us-west-1.docker.joyent.com:2376","cmon":"https://cmon.us-west-1.triton.zone:9163"}
> triton -p west1 services -j | json
{
  "docker": "tcp://us-west-1.docker.joyent.com:2376",
  "cmon": "https://cmon.us-west-1.triton.zone:9163"
}

All sapi metadata takes strings. When adding a json object it needs to be encoded as a string first.

[bbennett@headnode (us-west-1) ~]$ sdc-sapi /services?name=cloudapi | json -Ha metadata | grep CLOUDAPI_SERVICES
  "CLOUDAPI_SERVICES": "{\"docker\":\"tcp://us-west-1.docker.joyent.com:2376\",\"cmon\":\"https://cmon.us-west-1.triton.zone:9163\"}",
[bbennett@headnode (us-west-1) ~]$ sdc-sapi /services?name=cloudapi | json -Ha metadata.CLOUDAPI_SERVICES
{"docker":"tcp://us-west-1.docker.joyent.com:2376","cmon":"https://cmon.us-west-1.triton.zone:9163"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment