mesosphere/service-net — pull request #7 by ConnorDoyle (2014-05-16 07:44:04+00:00)
Title: More JSON and HTTP features

Demo session with the HTTP endpoints:

```
connor@mabuya:~ $ http localhost:9000/doc
HTTP/1.1 200 OK
Content-Length: 48
Server: Jetty(8.1.13.v20130916)

{"interfaces":[],"dns":[],"nat":[],"tunnels":[]}

connor@mabuya:~ $ http PATCH localhost:9000/doc
HTTP/1.1 405 Method Not Allowed
Content-Length: 18
Server: Jetty(8.1.13.v20130916)

Must be GET or PUT

connor@mabuya:~ $ http PUT localhost:9000/doc interfaces:='[]'
HTTP/1.1 400 Bad Request
Content-Length: 158
Content-Type: application/json
Server: Jetty(8.1.13.v20130916)

{
"obj.dns": [
{
"args": [],
"msg": "error.path.missing"
}
],
"obj.nat": [
{
"args": [],
"msg": "error.path.missing"
}
],
"obj.tunnels": [
{
"args": [],
"msg": "error.path.missing"
}
]
}

connor@mabuya:~ $ http PUT localhost:9000/doc < doc.json
HTTP/1.1 200 OK
Content-Length: 2
Server: Jetty(8.1.13.v20130916)

OK

connor@mabuya:~ $ http GET localhost:9000/doc --pretty format
HTTP/1.1 200 OK
Content-Length: 480
Content-Type: application/json
Server: Jetty(8.1.13.v20130916)

{
"dns": [
{
"addresses": [
"fc75:0:0:0:0:9fb2:0:804"
],
"label": "foo.bar"
}
],
"interfaces": [
{
"addr": "fc75:0:0:0:0:9fb2:0:804",
"name": "my-service"
}
],
"nat": [
{
"instances": [
"fc75:0:0:0:0:9fb2:0:804",
"fc75:0:0:0:0:9fb2:0:804"
],
"name": "my-nat",
"service": {
"addr": "fc75:0:0:0:0:9fb2:0:804",
"prefixBits": 64
}
}
],
"tunnels": [
{
"addr": "fc75:0:0:0:0:9fb2:0:804",
"localEnd": "192.168.1.115",
"name": "my-tunnel",
"remoteEnd": "192.168.1.115",
"remoteIPv6Net": {
"addr": "fc75:0:0:0:0:9fb2:0:804",
"prefixBits": 64
}
}
]
}
```