TripleParity / docks-api

RESTful API Server for Docks
https://tripleparity.github.io/docks-api/stack-api-spec.html
GNU General Public License v3.0
0 stars 0 forks source link

Stackfile endpoint implementation #86

Closed devosray closed 6 years ago

devosray commented 6 years ago

Closes issue #83

Finalizes the /stackfile endpoint. The following is an example of calling the endpoint using HTTPie:

$ export AUTH_HEADER=Authorization:"Bearer eyJhbG..............ciOiJIUzI"

$ http GET 0.0.0.0:8080/stacks/docks-db/stackfile $AUTH_HEADER

HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 473
Content-Type: application/json; charset=utf-8
Date: Thu, 11 Oct 2018 20:12:19 GMT
ETag: W/"1d9-Vu6ye3Osq8+x/7MzOa4RPTtvLTo"
X-Powered-By: Express

{
    "data": {
        "stackFile": "dmVyc2lvbjogJzMuMycKc2VydmljZXM6CiAgZGI6CiAgICBpbWFnZTogJ3Bvc3RncmVzOmxhdGVzdCcKICAgIHBvcnRzOgogICAgICAtIHB1Ymxpc2hlZDogNTQzMgogICAgICAgIHRhcmdldDogNTQzMgogICAgICAgIHByb3RvY29sOiB0Y3AKICAgICAgICBtb2RlOiBpbmdyZXNzCiAgICBuZXR3b3JrczoKICAgICAgLSBkZWZhdWx0CiAgICBkZXBsb3k6CiAgICAgIG1vZGU6IHJlcGxpY2F0ZWQKICAgICAgcmVwbGljYXM6IDEKICAgIGVudmlyb25tZW50OgogICAgICAtIFBPU1RHUkVTX1BBU1NXT1JEPWV4YW1wbGUKbmV0d29ya3M6CiAgZGVmYXVsdDoKICAgIGRyaXZlcjogb3ZlcmxheQo="
    }
}

Decoding the base64:

services:
  db:
    image: 'postgres:latest'
    ports:
      - published: 5432
        target: 5432
        protocol: tcp
        mode: ingress
    networks:
      - default
    deploy:
      mode: replicated
      replicas: 1
    environment:
      - POSTGRES_PASSWORD=example
networks:
  default:
    driver: overlay