Bastion API for Clusters

Bastion API documentation for clusters

Clusters

GET /clusters

Get the list of clusters

Response JSON Object
  • [] (object) –

  • [].id (string) – The cluster ID.

  • [].instanceID (string) – The Terraform instance ID.

  • [].source (string) – The Terraform source location.

  • [].static.isStatic (boolean) – If the cluster is static or not

  • [].static.output[key] (undefined) –

  • [].category (string) – The cluster category.

Example response:

[
  {
    "id": "myCluster",
    "instanceID": "myCluster",
    "category": "cluster",
    "static": {
      "isStatic": true,
      "output": {
        "server_public_ips": {
          "type": "list",
          "value": [
            "127.0.0.1"
          ]
        }
      }
    }
  }
]
GET /cluster/{clusterID}

Get a cluster

Parameters
  • clusterID – The cluster ID

Response JSON Object
  • id (string) – The cluster ID.

  • instanceID (string) – The Terraform instance ID.

  • source (string) – The Terraform source location.

  • static.isStatic (boolean) – If the cluster is static or not

  • static.output[key] (undefined) –

  • category (string) – The cluster category.

Example response:

{
  "id": "myCluster",
  "instanceID": "myCluster",
  "category": "cluster",
  "static": {
    "isStatic": true,
    "output": {
      "server_public_ips": {
        "type": "list",
        "value": [
          "127.0.0.1"
        ]
      }
    }
  }
}
POST /cluster/{clusterID}

Create a cluster. This operation will create a terraform instance.

Changed in version 1.35.0: Add -reconfigure to the terraform init command.

Parameters
  • clusterID – The cluster ID

Query Parameters
  • fromCluster – The cluster ID you want this new cluster to be cloned from.

Request JSON Object
  • id (string) – The backend ID.

  • variables[key] (string) –

  • category (string) – The cluster category.

  • static.isStatic (boolean) – If the cluster is static or not

  • static.output[key] (undefined) –

Example query:

{
  "id": "",
  "variables": {},
  "category": "",
  "static": {
    "isStatic": true,
    "output": {
      "server_public_ips": {
        "type": "list",
        "value": [
          "127.0.0.1"
        ]
      }
    }
  }
}
DELETE /cluster/{clusterID}

Delete a cluster. This operation will be rejected if the terraform instance is not destroyed

Parameters
  • clusterID – The cluster ID

Query Parameters
  • force – Force the delete operation

PUT /cluster/{clusterID}/static/output

Update a static cluster output.

Parameters
  • clusterID – The cluster ID

Request JSON Object
  • isStatic (boolean) – If the cluster is static or not

  • output[key].sensitive (boolean) –

  • output[key].type (string) –

  • output[key].value (undefined) –

Example query:

{
  "isStatic": true,
  "output": {
    "server_public_ips": {
      "type": "list",
      "value": [
        "127.0.0.1"
      ]
    }
  }
}

Images

GET /cluster/{clusterID}/images

Get the images

Parameters
  • clusterID – The cluster ID

Response JSON Object
  • [key].id (string) –

  • [key].tag (string) –

  • [key].archfmt (string) –

  • [key].url (string) –

  • [key].dirty (boolean) –

Example response:

{
  "itemA": {
    "id": "",
    "tag": "",
    "archfmt": "",
    "url": "",
    "dirty": false
  }
}
POST /cluster/{clusterID}/images

Set the images

Parameters
  • clusterID – The cluster ID

Request JSON Object
  • [key].id (string) –

  • [key].tag (string) –

  • [key].archfmt (string) –

  • [key].url (string) –

  • [key].dirty (boolean) –

Example query:

{
  "itemA": {
    "id": "",
    "tag": "",
    "archfmt": "",
    "url": "",
    "dirty": false
  }
}
DELETE /cluster/{clusterID}/images

Delete all images

Parameters
  • clusterID – The cluster ID

DELETE /cluster/{clusterID}/image/{imageID}

Delete an image

Parameters
  • clusterID – The cluster ID

  • imageID – The image ID

Setup Jobs

A setup job will be started on the cluster when doing a POST /bastion/cluster/{clusterID}/setup. This is the case for the Hashi-UI job.

GET /cluster/{clusterID}/setup_jobs

Get the setup jobs.

Parameters
  • clusterID – The cluster ID

Response JSON Object
  • [key].id (string) – The unique ID of the setup job.

  • [key].template (string) – The template used to create the job.

  • [key].hclv1 (boolean) – If the job template is using HCLv1.

Example response:

{
  "itemA": {
    "id": "",
    "template": "",
    "hclv1": false
  }
}
POST /cluster/{clusterID}/setup_jobs

Set the setup jobs

Parameters
  • clusterID – The cluster ID

Request JSON Object
  • [key].id (string) – The unique ID of the setup job.

  • [key].template (string) – The template used to create the job.

  • [key].hclv1 (boolean) – If the job template is using HCLv1.

Example query:

{
  "itemA": {
    "id": "",
    "template": "",
    "hclv1": false
  }
}
DELETE /cluster/{clusterID}/setup_jobs

Delete all setup jobs

Parameters
  • clusterID – The cluster ID

Setup

POST /cluster/{clusterID}/setup

Start the setup jobs

Parameters
  • clusterID – The cluster ID

POST /cluster/{clusterID}/clean

Stop the setup jobs and clean consul config

Parameters
  • clusterID – The cluster ID

Services

GET /cluster/{clusterID}/services/{service}

Get service addresses

Parameters
  • clusterID – The cluster ID

  • service – The service ID

Response JSON Object
  • [] (string) –

Example response:

[
  "[::1]:20222"
]