Workspace

This endpoint is used to create, update, search or delete workspace information inside a Terrakube organization.

To use this endpoint you should have "manageWorkspace" access at team level and a Terrakube organization

Entity fields:

Path
Type
Description

data.type

string

Should be "workspace"

data.attributes.name

string

Unique workspace for an Terrakube organization

data.attributes.branch

boolean

Git branch to be used

data.attributes.source

boolean

Git repository to be used

data.attributes.terraformVersion

boolean

Terraform version to run the workspace

data.relationships.vcs.data.type

string

Should be "vcs" (OPTIONAL)

data.relationships.vcs.data.type

string

Should be the VCS Connection Id (OPTIONAL)

Example:

{
    "data": {
        "type": "workspace",
        "attributes": {
            "branch": "main",
            "name": "Terrakube Workspace",
            "source": "https://github.com/AzBuilder/terraform-sample-repository.git",
            "terraformVersion": "0.15.0"
        },
        "relationships": {
            "vcs": {
                "data": {
                    "type": "vcs",
                    "id": "{{vcsIdGitHub}}"
                }
            }
        }
    }
}

Supported Operations

Returns an instance of type workspace

GET/api/v1/organization/{organizationId}/workspace/{workspaceId}
Path parameters
organizationId*string

organization Identifier

workspaceId*string

workspace Identifier

Query parameters
Response

Successful response

Body
dataworkspace (object)
includedarray of object

Included resources

Request
const response = await fetch('/api/v1/organization/{organizationId}/workspace/{workspaceId}', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "data": {
    "type": "text",
    "id": "text",
    "attributes": {
      "branch": "text",
      "name": "text",
      "source": "text",
      "terraformVersion": "text"
    },
    "relationships": {
      "job": {
        "id": "text",
        "type": "job"
      },
      "organization": {
        "id": "text",
        "type": "organization"
      },
      "variable": {
        "id": "text",
        "type": "variable"
      }
    }
  },
  "included": [
    {
      "id": "text",
      "type": "text"
    }
  ]
}

Creates an item of type workspace and adds it to workspace

POST/api/v1/organization/{organizationId}/workspace
Path parameters
organizationId*string

organization Identifier

Body
dataworkspace (object)
Response

Successful response

Body
dataworkspace (object)
Request
const response = await fetch('/api/v1/organization/{organizationId}/workspace', {
    method: 'POST',
    headers: {
      "Content-Type": "application/vnd.api+json"
    },
    body: JSON.stringify({}),
});
const data = await response.json();
Response
{
  "data": {
    "type": "text",
    "id": "text",
    "attributes": {
      "branch": "text",
      "name": "text",
      "source": "text",
      "terraformVersion": "text"
    },
    "relationships": {
      "job": {
        "id": "text",
        "type": "job"
      },
      "organization": {
        "id": "text",
        "type": "organization"
      },
      "variable": {
        "id": "text",
        "type": "variable"
      }
    }
  }
}

Deletes an instance of type workspace

DELETE/api/v1/organization/{organizationId}/workspace/{workspaceId}
Path parameters
organizationId*string

organization Identifier

workspaceId*string

workspace Identifier

Response

Successful response

Request
const response = await fetch('/api/v1/organization/{organizationId}/workspace/{workspaceId}', {
    method: 'DELETE',
    headers: {},
});
const data = await response.json();

Modifies an instance of type workspace

PATCH/api/v1/organization/{organizationId}/workspace/{workspaceId}
Path parameters
organizationId*string

organization Identifier

workspaceId*string

workspace Identifier

Body
dataworkspace (object)
Response

Successful response

Request
const response = await fetch('/api/v1/organization/{organizationId}/workspace/{workspaceId}', {
    method: 'PATCH',
    headers: {
      "Content-Type": "application/vnd.api+json"
    },
    body: JSON.stringify({}),
});
const data = await response.json();

For a complete list of organization operation please visit the OpenAPI specification

Last updated