KosmoKrator

cloud

DigitalOcean Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the DigitalOcean KosmoKrator integration.

10 functions 7 read 3 write Bearer token auth

Lua Namespace

Agents call this integration through app.integrations.digitalocean.*. Use lua_read_doc("integrations.digitalocean") inside KosmoKrator to discover the same reference at runtime.

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

DigitalOcean — Lua API Reference

list_droplets

List all droplets (virtual machines) in the account.

Parameters

NameTypeRequiredDescription
pageintegernoPage number for pagination (default: 1)
per_pageintegernoItems per page (default: 20, max: 200)

Example

local result = app.integrations.digitalocean.list_droplets({
  per_page = 50
})

for _, droplet in ipairs(result.droplets) do
  print(droplet.name .. " (" .. droplet.status .. ") - " .. droplet.size_slug)
end

get_droplet

Get details for a specific droplet.

Parameters

NameTypeRequiredDescription
idintegeryesThe droplet ID

Example

local result = app.integrations.digitalocean.get_droplet({ id = 12345678 })
local d = result.droplet
print(d.name .. " - " .. d.region.name .. " - " .. d.networks.v4[1].ip_address)

create_droplet

Create a new droplet (virtual machine).

Parameters

NameTypeRequiredDescription
namestringyesHostname for the droplet
regionstringyesRegion slug (e.g., "nyc3", "ams3", "sgp1")
sizestringyesSize slug (e.g., "s-1vcpu-1gb", "s-2vcpu-4gb")
imagestringyesImage slug or ID (e.g., "ubuntu-24-04-x64")
ssh_keysarraynoSSH key IDs or fingerprints
backupsbooleannoEnable automated backups (default: false)
ipv6booleannoEnable IPv6 (default: false)
user_datastringnoCloud-init user data script
tagsarraynoTag names to apply

Common Region Slugs

nyc1, nyc3, ams3, sgp1, lon1, fra1, tor1, sfo3, blr1, syd1

Common Size Slugs

s-1vcpu-1gb, s-1vcpu-2gb, s-2vcpu-2gb, s-2vcpu-4gb, s-4vcpu-8gb

Common Image Slugs

ubuntu-24-04-x64, ubuntu-22-04-x64, debian-12-x64, debian-11-x64, centos-stream-9-x64, rockylinux-9-x64, fedora-39-x64

Example

local result = app.integrations.digitalocean.create_droplet({
  name = "web-01",
  region = "ams3",
  size = "s-1vcpu-1gb",
  image = "ubuntu-24-04-x64",
  ssh_keys = { "fingerprint_or_id" },
  tags = { "web", "production" }
})

print("Created droplet: " .. result.droplet.id)

delete_droplet

Permanently delete a droplet. This action is irreversible.

Parameters

NameTypeRequiredDescription
idintegeryesThe droplet ID to delete

Example

app.integrations.digitalocean.delete_droplet({ id = 12345678 })
print("Droplet deleted")

reboot_droplet

Reboot a droplet. The droplet will be temporarily unavailable during the reboot.

Parameters

NameTypeRequiredDescription
idintegeryesThe droplet ID to reboot

Example

local result = app.integrations.digitalocean.reboot_droplet({ id = 12345678 })
print("Reboot initiated: " .. result.action.status)

list_domains

List all DNS domains in the account.

Parameters

NameTypeRequiredDescription
pageintegernoPage number for pagination
per_pageintegernoItems per page

Example

local result = app.integrations.digitalocean.list_domains({})

for _, domain in ipairs(result.domains) do
  print(domain.name .. " (TTL: " .. domain.ttl .. ")")
end

get_domain

Get details for a specific DNS domain.

Parameters

NameTypeRequiredDescription
namestringyesThe domain name (e.g., "example.com")

Example

local result = app.integrations.digitalocean.get_domain({ name = "example.com" })
print(result.domain.name .. " - zone file: " .. result.domain.zone_file)

list_spaces

List Spaces (S3-compatible object storage buckets).

Parameters

NameTypeRequiredDescription
pageintegernoPage number for pagination
per_pageintegernoItems per page

Example

local result = app.integrations.digitalocean.list_spaces({})

for _, space in ipairs(result.spaces) do
  print(space.name .. " - " .. space.region)
end

list_kubernetes

List Kubernetes (DOKS) clusters.

Parameters

NameTypeRequiredDescription
pageintegernoPage number for pagination
per_pageintegernoItems per page

Example

local result = app.integrations.digitalocean.list_kubernetes({})

for _, cluster in ipairs(result.kubernetes_clusters) do
  print(cluster.name .. " (" .. cluster.version .. ") - " .. cluster.region)
end

get_current_user

Get the current authenticated account information.

Parameters

None.

Example

local result = app.integrations.digitalocean.get_current_user({})
print("Account: " .. result.account.email .. " (" .. result.account.uuid .. ")")

Multi-Account Usage

If you have multiple DigitalOcean accounts configured, use account-specific namespaces:

-- Default account (always works)
app.integrations.digitalocean.list_droplets({})

-- Explicit default (portable across setups)
app.integrations.digitalocean.default.list_droplets({})

-- Named accounts
app.integrations.digitalocean.production.list_droplets({})
app.integrations.digitalocean.staging.list_droplets({})

All functions are identical across accounts — only the credentials differ.

Raw agent markdown
# DigitalOcean — Lua API Reference

## list_droplets

List all droplets (virtual machines) in the account.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination (default: 1) |
| `per_page` | integer | no | Items per page (default: 20, max: 200) |

### Example

```lua
local result = app.integrations.digitalocean.list_droplets({
  per_page = 50
})

for _, droplet in ipairs(result.droplets) do
  print(droplet.name .. " (" .. droplet.status .. ") - " .. droplet.size_slug)
end
```

---

## get_droplet

Get details for a specific droplet.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The droplet ID |

### Example

```lua
local result = app.integrations.digitalocean.get_droplet({ id = 12345678 })
local d = result.droplet
print(d.name .. " - " .. d.region.name .. " - " .. d.networks.v4[1].ip_address)
```

---

## create_droplet

Create a new droplet (virtual machine).

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | Hostname for the droplet |
| `region` | string | yes | Region slug (e.g., `"nyc3"`, `"ams3"`, `"sgp1"`) |
| `size` | string | yes | Size slug (e.g., `"s-1vcpu-1gb"`, `"s-2vcpu-4gb"`) |
| `image` | string | yes | Image slug or ID (e.g., `"ubuntu-24-04-x64"`) |
| `ssh_keys` | array | no | SSH key IDs or fingerprints |
| `backups` | boolean | no | Enable automated backups (default: false) |
| `ipv6` | boolean | no | Enable IPv6 (default: false) |
| `user_data` | string | no | Cloud-init user data script |
| `tags` | array | no | Tag names to apply |

### Common Region Slugs

`nyc1`, `nyc3`, `ams3`, `sgp1`, `lon1`, `fra1`, `tor1`, `sfo3`, `blr1`, `syd1`

### Common Size Slugs

` s-1vcpu-1gb`, `s-1vcpu-2gb`, `s-2vcpu-2gb`, `s-2vcpu-4gb`, `s-4vcpu-8gb`

### Common Image Slugs

`ubuntu-24-04-x64`, `ubuntu-22-04-x64`, `debian-12-x64`, `debian-11-x64`, `centos-stream-9-x64`, `rockylinux-9-x64`, `fedora-39-x64`

### Example

```lua
local result = app.integrations.digitalocean.create_droplet({
  name = "web-01",
  region = "ams3",
  size = "s-1vcpu-1gb",
  image = "ubuntu-24-04-x64",
  ssh_keys = { "fingerprint_or_id" },
  tags = { "web", "production" }
})

print("Created droplet: " .. result.droplet.id)
```

---

## delete_droplet

Permanently delete a droplet. **This action is irreversible.**

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The droplet ID to delete |

### Example

```lua
app.integrations.digitalocean.delete_droplet({ id = 12345678 })
print("Droplet deleted")
```

---

## reboot_droplet

Reboot a droplet. The droplet will be temporarily unavailable during the reboot.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The droplet ID to reboot |

### Example

```lua
local result = app.integrations.digitalocean.reboot_droplet({ id = 12345678 })
print("Reboot initiated: " .. result.action.status)
```

---

## list_domains

List all DNS domains in the account.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination |
| `per_page` | integer | no | Items per page |

### Example

```lua
local result = app.integrations.digitalocean.list_domains({})

for _, domain in ipairs(result.domains) do
  print(domain.name .. " (TTL: " .. domain.ttl .. ")")
end
```

---

## get_domain

Get details for a specific DNS domain.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | The domain name (e.g., `"example.com"`) |

### Example

```lua
local result = app.integrations.digitalocean.get_domain({ name = "example.com" })
print(result.domain.name .. " - zone file: " .. result.domain.zone_file)
```

---

## list_spaces

List Spaces (S3-compatible object storage buckets).

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination |
| `per_page` | integer | no | Items per page |

### Example

```lua
local result = app.integrations.digitalocean.list_spaces({})

for _, space in ipairs(result.spaces) do
  print(space.name .. " - " .. space.region)
end
```

---

## list_kubernetes

List Kubernetes (DOKS) clusters.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination |
| `per_page` | integer | no | Items per page |

### Example

```lua
local result = app.integrations.digitalocean.list_kubernetes({})

for _, cluster in ipairs(result.kubernetes_clusters) do
  print(cluster.name .. " (" .. cluster.version .. ") - " .. cluster.region)
end
```

---

## get_current_user

Get the current authenticated account information.

### Parameters

None.

### Example

```lua
local result = app.integrations.digitalocean.get_current_user({})
print("Account: " .. result.account.email .. " (" .. result.account.uuid .. ")")
```

---

## Multi-Account Usage

If you have multiple DigitalOcean accounts configured, use account-specific namespaces:

```lua
-- Default account (always works)
app.integrations.digitalocean.list_droplets({})

-- Explicit default (portable across setups)
app.integrations.digitalocean.default.list_droplets({})

-- Named accounts
app.integrations.digitalocean.production.list_droplets({})
app.integrations.digitalocean.staging.list_droplets({})
```

All functions are identical across accounts — only the credentials differ.

Metadata-Derived Lua Example

local result = app.integrations.digitalocean.digitalocean_list_droplets({
  page = 1,
  per_page = 1
})
print(result)

Functions

digitalocean_list_droplets

List all droplets (virtual machines) in the DigitalOcean account. Returns IDs, names, status, size, region, and IP addresses.

Operation
Read read
Full name
digitalocean.digitalocean_list_droplets
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
per_page integer no Number of droplets per page (default: 20, max: 200).

digitalocean_get_droplet

Get details for a specific DigitalOcean droplet by ID. Returns full droplet information including networks, image, and region.

Operation
Read read
Full name
digitalocean.digitalocean_get_droplet
ParameterTypeRequiredDescription
id integer yes The droplet ID.

digitalocean_create_droplet

Create a new DigitalOcean droplet (virtual machine). Requires a name, region, size, and image.

Operation
Write write
Full name
digitalocean.digitalocean_create_droplet
ParameterTypeRequiredDescription
name string yes The hostname for the droplet (e.g., "web-01").
region string yes The region slug (e.g., "nyc3", "ams3", "sgp1").
size string yes The size slug (e.g., "s-1vcpu-1gb", "s-2vcpu-4gb").
image string yes The image slug or ID (e.g., "ubuntu-24-04-x64", "debian-12-x64").
ssh_keys array no Array of SSH key IDs or fingerprints to embed.
backups boolean no Enable automated backups (default: false).
ipv6 boolean no Enable IPv6 (default: false).
user_data string no Cloud-init user data script.
tags array no Array of tag names to apply.

digitalocean_delete_droplet

Permanently delete a DigitalOcean droplet. This action is irreversible and will destroy all data on the droplet.

Operation
Write write
Full name
digitalocean.digitalocean_delete_droplet
ParameterTypeRequiredDescription
id integer yes The droplet ID to delete.

digitalocean_reboot_droplet

Reboot a DigitalOcean droplet. The droplet will be power-cycled and will be temporarily unavailable.

Operation
Write write
Full name
digitalocean.digitalocean_reboot_droplet
ParameterTypeRequiredDescription
id integer yes The droplet ID to reboot.

digitalocean_list_domains

List all DNS domains managed in the DigitalOcean account.

Operation
Read read
Full name
digitalocean.digitalocean_list_domains
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
per_page integer no Number of domains per page (default: 20).

digitalocean_get_domain

Get details for a specific DNS domain in DigitalOcean, including zone file and TTL information.

Operation
Read read
Full name
digitalocean.digitalocean_get_domain
ParameterTypeRequiredDescription
name string yes The domain name (e.g., "example.com").

digitalocean_list_spaces

List Spaces (S3-compatible object storage buckets) in the DigitalOcean account.

Operation
Read read
Full name
digitalocean.digitalocean_list_spaces
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
per_page integer no Number of items per page (default: 20).

digitalocean_list_kubernetes

List Kubernetes (DOKS) clusters in the DigitalOcean account.

Operation
Read read
Full name
digitalocean.digitalocean_list_kubernetes
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
per_page integer no Number of items per page (default: 20).

digitalocean_get_current_user

Get information about the current authenticated DigitalOcean account, including email, UUID, and status.

Operation
Read read
Full name
digitalocean.digitalocean_get_current_user
ParameterTypeRequiredDescription
No parameters.