Jobs

This endpoint is used to create, update, search or delete jobs for a particular Terrakube workspace.

To use this endpoint you need to create a Terrakube workspace.

Entity fields:

Path
Type
Description

data.type

string

Should be "job"

data.attributes.tcl

string

Terraform Configuration Language job template

data.attributes.templateReference

string

Terrakube template id to use when running the job

data.relationships.workspace.data.type

string

Should be "workspace"

data.relationships.workspace.data.Id

string

Should be the VCS Workspace Id (OPTIONAL)

To better understand Terrakube Configuration Language job templates please refer to the following GitHub repository.

Example:

{
  "data": {
    "type": "job",
    "attributes": {
      "tcl": "Base64 TCL job template"
      "templateReference": "XXXXXXXXX"
    },
    "relationships":{
        "workspace":{
            "data":{
                "type": "workspace",
                "id": "{{workspaceId}}"
            }
        }
    }
  }
}

Supported Operations

Returns an instance of type job

get

/workspace/{workspaceId}/job/{jobId}

Path parameters
workspaceIdanyrequired

workspace Identifier

jobIdanyrequired

job Identifier

Query parameters
fields[job]any

Selects the set of job fields that should be returned in the result.

includeany

Selects the set of relationships that should be expanded as a compound document in the result.

Responses
curl -L \
  --url 'null/workspace/{workspaceId}/job/{jobId}'
{
  "data": {
    "type": "text",
    "id": "text",
    "attributes": {
      "output": "text",
      "command": "plan",
      "status": "pending"
    },
    "relationships": {
      "organization": {
        "id": "text",
        "type": "organization"
      },
      "workspace": {
        "id": "text",
        "type": "workspace"
      }
    }
  },
  "included": [
    {
      "attributes": {},
      "id": "text",
      "relationships": {},
      "type": "text"
    }
  ]
}

Creates an item of type job and adds it to job

post

/workspace/{workspaceId}/job

Path parameters
workspaceIdanyrequired

workspace Identifier

Body
dataobject
Responses
curl -L \
  --request POST \
  --url 'null/workspace/{workspaceId}/job' \
  --header 'Content-Type: application/vnd.api+json' \
  --data '{
    "data": {
      "type": "text",
      "id": "text",
      "attributes": {
        "output": "text",
        "command": "plan",
        "status": "pending"
      },
      "relationships": {
        "organization": {
          "id": "text",
          "type": "organization"
        },
        "workspace": {
          "id": "text",
          "type": "workspace"
        }
      }
    }
  }'
{
  "data": {
    "type": "text",
    "id": "text",
    "attributes": {
      "output": "text",
      "command": "plan",
      "status": "pending"
    },
    "relationships": {
      "organization": {
        "id": "text",
        "type": "organization"
      },
      "workspace": {
        "id": "text",
        "type": "workspace"
      }
    }
  }
}

Deletes an instance of type job

delete

/workspace/{workspaceId}/job/{jobId}

Path parameters
workspaceIdanyrequired

workspace Identifier

jobIdanyrequired

job Identifier

Responses
curl -L \
  --request DELETE \
  --url 'null/workspace/{workspaceId}/job/{jobId}'

No body

Modifies an instance of type job

patch

/workspace/{workspaceId}/job/{jobId}

Path parameters
workspaceIdanyrequired

workspace Identifier

jobIdanyrequired

job Identifier

Body
dataobject
Responses
curl -L \
  --request PATCH \
  --url 'null/workspace/{workspaceId}/job/{jobId}' \
  --header 'Content-Type: application/vnd.api+json' \
  --data '{
    "data": {
      "type": "text",
      "id": "text",
      "attributes": {
        "output": "text",
        "command": "plan",
        "status": "pending"
      },
      "relationships": {
        "organization": {
          "id": "text",
          "type": "organization"
        },
        "workspace": {
          "id": "text",
          "type": "workspace"
        }
      }
    }
  }'

No body

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

Last updated

Was this helpful?