Skip to content

Instantly share code, notes, and snippets.

@jmvrbanac
Last active August 29, 2015 14:07
Show Gist options
  • Save jmvrbanac/162a59ee6615304dc126 to your computer and use it in GitHub Desktop.
Save jmvrbanac/162a59ee6615304dc126 to your computer and use it in GitHub Desktop.
Barbican Request (cheatsheet for workshop)

Get Authentication Token:

POST http://workshop-ord-auth.cloudkeep.io/v2.0/tokens
Content-Type: application/json
Accept: application/json

Body:

{
  "auth": {
    "passwordCredentials": {
      "username": "{YOUR_USERNAME}",
      "password": "{YOUR_PASSWORD}"
    },
    "tenantName": "{YOUR_TENANT_NAME}"
  }
}

Response:

{
    "access": {
        "metadata": {
            "is_admin": 0,
            "roles": [
                "852946dde44c4a389c688a7c829d2f58"
            ]
        },
        "token": {
            "id": "{YOUR_AUTH_TOKEN}",
            "expires": "2014-10-10T22:23:47Z",
            "issued_at": "2014-10-10T21:23:47.498474",
            "tenant": {
                "description": null,
                "enabled": true,
                "id": "{YOUR_TENANT_ID}",
                "name": "{YOUR_TENANT_NAME}"
            }
        },
       ----------------- snip ----------------
    }
}

Creating a Secret:

POST http://workshop-ord-api.cloudkeep.io/v1/secrets
Content-Type: application/json
X-Auth-Token: {YOUR_AUTH_TOKEN}

Body:

{
  "name": "AES key",
  "expiration": "2014-12-28T19:14:44.180394",
  "algorithm": "aes",
  "bit_length": 256,
  "mode": "cbc",
  "payload": "8J+Nug==",
  "payload_content_type": "application/octet-stream",
  "payload_content_encoding": "base64"
}

Response:

{
    "secret_ref": "http://workshop-ord-api.cloudkeep.io/v1/secrets/fe0eac05-8eff-4eff-81e3-16e2e640241b"
}

Retrieve Secret Metadata:

GET http://workshop-ord-api.cloudkeep.io/v1/secrets/{YOUR_SECRET_UUID}
X-Auth-Token: {YOUR_AUTH_TOKEN}

Response:

{
    "created": "2014-10-10T19:44:57.833424",
    "updated": "2014-10-10T19:44:57.838825",
    "expiration": "2014-10-28T19:14:44.180394",
    "mode": "cbc",
    "name": "AES key",
    "status": "ACTIVE",
    "algorithm": "aes",
    "bit_length": 256,
    "secret_ref": "http://workshop-ord-api.cloudkeep.io/v1/secrets/{YOUR_SECRET_UUID}",
    "content_types": {
        "default": "application/octet-stream"
    }
}

Retrieve Secret Payload:

GET http://workshop-ord-api.cloudkeep.io/v1/secrets/{YOUR_SECRET_UUID}
Accept: application/octet-stream
X-Auth-Token: {YOUR_AUTH_TOKEN}

Response: {YOUR_SECRET_PAYLOAD}

Retrieve a list of Secrets:

GET http://workshop-ord-api.cloudkeep.io/v1/secrets
X-Auth-Token: {YOUR_AUTH_TOKEN}

Response:

{
    "next": "http://workshop-ord-api.cloudkeep.io/v1/secrets?limit=10&offset=10",
    "secrets": [
        {
            "algorithm": "aes",
            "bit_length": 256,
            "content_types": {
                "default": "application/octet-stream"
            },
            "created": "2014-10-10T02:35:42.463513",
            "expiration": "2014-10-28T19:14:44.180394",
            "mode": "cbc",
            "name": "AES key",
            "secret_ref": "http://workshop-ord-api.cloudkeep.io/v1/secrets/3a5a6b00-af61-4276-a714-f311064127e9",
            "status": "ACTIVE",
            "updated": "2014-10-10T02:35:42.470646"
        },
        --------------- snip -------------------
    ],
    "total": 3803
}

Deleting a Secret:

DELETE http://workshop-ord-api.cloudkeep.io/v1/secrets/{YOUR_SECRET_UUID}
X-Auth-Token: {YOUR_AUTH_TOKEN}

Creating an Order:

POST http://workshop-ord-api.cloudkeep.io/v1/orders
Content-Type: application/json
X-Auth-Token: {YOUR_AUTH_TOKEN}

Body:

{
  "type": "key",
  "meta": {
    "mode": "cbc",
    "bit_length": 256,
    "name": "secretname",
    "algorithm": "aes",
    "payload_content_type": "application/octet-stream"
  }
}

Response:

{
    "order_ref": "http://workshop-ord-api.cloudkeep.io/v1/orders/{YOUR_ORDER_UUID}"
}

Get an Order:

GET http://workshop-ord-api.cloudkeep.io/v1/orders/{YOUR_ORDER_UUID}
X-Auth-Token: {YOUR_AUTH_TOKEN}

Response:

{
    "status": "ACTIVE",
    "type": "key",
    "meta": {
        "algorithm": "aes",
        "bit_length": 256,
        "mode": "cbc",
        "payload_content_type": "application/octet-stream"
    },
    "order_ref": "http://workshop-ord-api.cloudkeep.io/v1/orders/{YOUR_ORDER_UUID}",
    "secret_ref": "http://workshop-ord-api.cloudkeep.io/v1/secrets/{CREATED_SECRET_UUID}",
    "created": "2014-10-10T19:43:09.828927",
    "updated": "2014-10-10T19:43:09.864890"
}

Get a list of Orders:

GET http://workshop-ord-api.cloudkeep.io/v1/orders
X-Auth-Token: {YOUR_AUTH_TOKEN}

Response:

{
    "next": "http://workshop-ord-api.cloudkeep.io/v1/orders?limit=10&offset=10",
    "orders": [
        {
            "status": "ACTIVE",
            "type": "key",
            "meta": {
                "algorithm": "aes",
                "bit_length": 256,
                "expiration": null,
                "mode": "cbc",
                "name": "secretname"
            },
            "order_ref": "http://workshop-ord-api.cloudkeep.io/v1/orders/{ORDER_UUID}",
            "secret_ref": "http://workshop-ord-api.cloudkeep.io/v1/secrets/{SECRET_UUID}",
            "created": "2014-10-10T02:47:48.564067",
            "updated": "2014-10-10T02:47:48.591162"
        },
        -------------- snip ------------
    ],
    "total": 3803
}

Delete an Order:

DELETE http://workshop-ord-api.cloudkeep.io/v1/orders/{YOUR_ORDER_UUID}
X-Auth-Token: {YOUR_AUTH_TOKEN}

Creating a Container:

POST http://workshop-ord-api.cloudkeep.io/v1/containers
X-Auth-Token: {YOUR_AUTH_TOKEN}
Content-Type: application/json

Body:

{
  "type": "generic",
  "name": "Pitcher",
  "secret_refs": [
    {
       "name": "Something important",
       "secret_ref":"http://workshop-ord-api.cloudkeep.io/v1/secrets/{A_SECRET_UUID}"
    }
  ]
}

Response:

{
    "container_ref": "http://workshop-ord-api.cloudkeep.io/v1/containers/{YOUR_CONTAINER_UUID}"
}

Get a Container:

GET http://workshop-ord-api.cloudkeep.io/v1/containers/{YOUR_CONTAINER_UUID}
X-Auth-Token: {YOUR_AUTH_TOKEN}

Response:

{
    "status": "ACTIVE",
    "type": "generic",
    "name": "container name",
    "consumers": [],
    "secret_refs": [
        {
            "name": "private_key",
            "secret_ref": "http://workshop-ord-api.cloudkeep.io/v1/secrets/{SECRET_UUID}"
        }
    ],
    "container_ref": "http://workshop-ord-api.cloudkeep.io/v1/containers/{YOUR_CONTAINER_UUID}",
    "created": "2014-10-10T19:36:42.313216",
    "updated": "2014-10-10T19:36:42.313225"
}

Get a list of Containers:

GET http://workshop-ord-api.cloudkeep.io/v1/containers
X-Auth-Token: {YOUR_AUTH_TOKEN}

Response:

{
    "next": "http://workshop-ord-api.cloudkeep.io/v1/containers?limit=10&offset=10",
    "containers": [
        {
            "status": "ACTIVE",
            "type": "generic",
            "name": "container name",
            "consumers": [],
            "secret_refs": [
                {
                    "name": "private_key",
                    "secret_ref": "http://workshop-ord-api.cloudkeep.io/v1/secrets/{SECRET_UUID}"
                }
            ],
            "container_ref": "http://workshop-ord-api.cloudkeep.io/v1/containers/{CONTAINER_UUID}",
            "created": "2014-10-10T19:36:42.313216",
            "updated": "2014-10-10T19:36:42.313225"
        },
        ------------------ snip ----------------------
    ],
    "total": 2102
}

Delete a Container:

DELETE http://workshop-ord-api.cloudkeep.io/v1/containers/{YOUR__UUID}
X-Auth-Token: {YOUR_AUTH_TOKEN}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment