fn getSession()
Read the current session — who the configured token authenticates as, and which enterprise it is scoped to. Cheapest check that a token is still valid.
fn mintSessionToken(expiresSeconds: number)
Perform the two-step ZEDCloud token exchange (login, then session token) using the vault-resolved username and password. ZEDCloud session tokens expire — 90 days by default — so this is the rotation path. The token VALUE IS NOT WRITTEN to the data model: swamp resources are stored in the clear, and extensions cannot write to vault, so only expiry and a fingerprint are recorded. Read the value from this method's log-free return by rotating it manually into vault.
| Argument | Type | Required | Description |
|---|
| expiresSeconds | number | yes | Requested token lifetime in seconds; defaults to the tenant's configured expiry (90 days) |
fn getStatus()
Report controller version, tenant identity, and top-level object counts. Read-only health check — run this first to prove the API token works.
fn inventory(kinds: array, pageSize: number, projectName: string)
Fan-out sweep of the whole tenant: fetches projects, hardware models and brands, edge nodes, edge apps, app instances, images, datastores, volume instances, networks, and network instances in one run, writing one collection per kind.
| Argument | Type | Required | Description |
|---|
| kinds | array | yes | Object kinds to sweep. Defaults to every kind. |
| pageSize | number | yes | Rows requested per kind |
| projectName | string | yes | Optional: restrict node/app/network results to one project |
fn listNodes(namePattern: string, projectName: string, adminState: enum, pageSize: number, pageNum: number)
List edge nodes (ZEDNodes) with optional name, project, cluster, and admin-state filters.
| Argument | Type | Required | Description |
|---|
| namePattern | string | yes | Filter by node name pattern |
| projectName | string | yes | Filter by project name |
| adminState | enum | yes | Filter by admin state |
| pageSize | number | yes | Rows per page |
| pageNum | number | yes | 1-based page number |
fn getNode(id: string, name: string, serialNo: string)
Fetch one edge node's full configuration, addressed by id, name, or hardware serial number.
| Argument | Type | Required | Description |
|---|
| id | string | yes | Node id |
| name | string | yes | Node name |
| serialNo | string | yes | Hardware serial number |
fn getNodeStatus(id: string, name: string, serialNo: string)
Fetch one edge node's runtime status and hardware/software info (run state, EVE-OS version, interfaces, storage).
| Argument | Type | Required | Description |
|---|
| id | string | yes | Node id |
| name | string | yes | Node name |
| serialNo | string | yes | Hardware serial number |
fn fleetHealth(projectName: string, pageSize: number)
One-shot health sweep across every edge node: queries the node status collection and rolls up online/offline counts and EVE-OS version distribution. Use this instead of looping getNodeStatus.
| Argument | Type | Required | Description |
|---|
| projectName | string | yes | Optional: restrict to one project |
| pageSize | number | yes | Nodes fetched per page |
fn getNodeEvents(id: string, name: string, pageSize: number)
Fetch the event timeline for one edge node (onboarding, reboots, config pushes, errors).
| Argument | Type | Required | Description |
|---|
| id | string | yes | Node id |
| name | string | yes | Node name |
| pageSize | number | yes | Events per page |
fn getNodeMetrics(id: string, name: string, metricType: enum, startTime: string, endTime: string)
Fetch a time-series metric window for one edge node (CPU, memory, network, storage, or event counts).
| Argument | Type | Required | Description |
|---|
| id | string | yes | Node id |
| name | string | yes | Node name |
| metricType | enum | yes | Metric family to fetch |
| startTime | string | yes | RFC3339 window start, e.g. 2026-07-30T00:00:00Z |
| endTime | string | yes | RFC3339 window end |
fn listAppInstances(namePattern: string, projectName: string, pageSize: number)
List application instances (VMs and containers running on edge nodes), optionally filtered by name or project.
| Argument | Type | Required | Description |
|---|
| namePattern | string | yes | Filter by instance name |
| projectName | string | yes | Filter by project name |
| pageSize | number | yes | Rows per page |
fn getAppInstanceStatus(id: string, name: string)
Fetch runtime status for one application instance (run state, resource use, attached networks and volumes).
| Argument | Type | Required | Description |
|---|
| id | string | yes | App instance id |
| name | string | yes | App instance name |
fn getAppInstanceLogs(id: string, pageSize: number)
Fetch recent console/application logs for one application instance.
| Argument | Type | Required | Description |
|---|
| id | string | yes | App instance id |
| pageSize | number | yes | Log lines per page |
fn createNode(name: string, title: string, projectId: string, modelId: string, serialNo: string, description: string, adminState: enum, tags: record)
Register a new edge node in ZEDCloud ahead of hardware arriving. Requires a project and hardware model; supply the serial number for automatic onboarding, or omit it and use createSingleUseImage instead.
| Argument | Type | Required | Description |
|---|
| name | string | yes | Node name, unique within the tenant |
| title | string | yes | Human-readable title |
| projectId | string | yes | Project (resource group) id |
| modelId | string | yes | Hardware model id — see inventory kind hardwareModels |
| serialNo | string | yes | Hardware serial number; enables serial-based zero-touch onboarding |
| description | string | yes | Free-text description |
| adminState | enum | yes | Initial admin state; activate separately with setNodeState |
| tags | record | yes | Key/value tags applied to the node |
fn getNodeOnboarding(id: string, name: string)
Fetch the onboarding record for a node — onboarding key, serial, and certificate state. Use this to confirm a node is ready to claim before shipping hardware.
| Argument | Type | Required | Description |
|---|
| id | string | yes | Node id |
| name | string | yes | Node name |
fn createSingleUseImage(id: string, name: string, eveImageName: string)
Mint a single-use EVE-OS installer image bound to one registered node, and return its download link. This is the zero-touch path: flash the image, boot the hardware, and it claims itself against this node with no console work on site.
| Argument | Type | Required | Description |
|---|
| id | string | yes | Node id |
| name | string | yes | Node name |
| eveImageName | string | yes | Optional EVE-OS base image name to bake in; defaults to the tenant's latest |
fn setNodeState(id: string, name: string, action: enum)
Apply a lifecycle transition to an edge node: activate, deactivate, reboot, preparePowerOff, or offboard.
| Argument | Type | Required | Description |
|---|
| id | string | yes | Node id |
| name | string | yes | Node name |
| action | enum | yes | Transition to apply |
fn setEdgeview(id: string, name: string, enabled: boolean, fetchClientScript: boolean)
Enable or disable EdgeView on a node — the dial-out remote-access session ZEDEDA uses instead of inbound ports — and fetch the client script needed to connect.
| Argument | Type | Required | Description |
|---|
| id | string | yes | Node id |
| name | string | yes | Node name |
| enabled | boolean | yes | true to start an EdgeView session, false to stop it |
| fetchClientScript | boolean | yes | When enabling, also fetch the EdgeView client script |
fn upgradeNodeBaseOs(id: string, name: string, baseImageName: string, forceUpgrade: boolean)
Set the EVE-OS base image on a node and publish the change, driving an in-place EVE-OS upgrade on next check-in.
| Argument | Type | Required | Description |
|---|
| id | string | yes | Node id |
| name | string | yes | Node name |
| baseImageName | string | yes | EVE-OS base image name to apply — see inventory kind images |
| forceUpgrade | boolean | yes | Bypass the controller's upgrade eligibility checks |
fn createAppInstance(name: string, title: string, deviceId: string, appId: string, projectId: string, activate: boolean, interfaces: array, customConfig: record)
Deploy an application instance (VM or container) onto an edge node from an existing edge app bundle.
| Argument | Type | Required | Description |
|---|
| name | string | yes | Instance name, unique within the tenant |
| title | string | yes | Human-readable title |
| deviceId | string | yes | Edge node id to deploy onto |
| appId | string | yes | Edge app bundle id |
| projectId | string | yes | Project id |
| activate | boolean | yes | Start the instance immediately after creation |
| interfaces | array | yes | Network interface bindings, e.g. [{ intfname: 'eth0', netinstname: 'lab-local' }] |
| customConfig | record | yes | Optional cloud-init / custom config block passed through verbatim |
fn setAppInstanceState(id: string, action: enum)
Apply a lifecycle transition to an application instance: activate, deactivate, restart, refresh, or purge.
| Argument | Type | Required | Description |
|---|
| id | string | yes | App instance id |
| action | enum | yes | Transition to apply |
fn deleteAppInstance(id: string)
Delete an application instance. Verify the target with getAppInstanceStatus first — this removes the workload from the node.
| Argument | Type | Required | Description |
|---|
| id | string | yes | App instance id |
fn createNetworkInstance(name: string, title: string, deviceId: string, kind: enum, port: string, projectId: string, dhcpSubnet: string)
Create a network instance on an edge node — the node-local network (local NAT, switch/bridge, or cloud) that application instances attach to.
| Argument | Type | Required | Description |
|---|
| name | string | yes | Network instance name |
| title | string | yes | Human-readable title |
| deviceId | string | yes | Edge node id to create it on |
| kind | enum | yes | Local = NAT behind the node; Switch = bridged to the LAN; Cloud = tunnelled |
| port | string | yes | Node port or port label to bind to, e.g. uplink or eth0 |
| projectId | string | yes | Project id |
| dhcpSubnet | string | yes | Optional subnet for the built-in DHCP server, e.g. 10.10.1.0/24 |
fn createDatastore(name: string, title: string, dsType: enum, dsFQDN: string, dsPath: string, region: string, apiKey: string, apiPasswd: string)
Register an image datastore — the bucket, container, or registry ZEDCloud pulls edge-app images from. Credentials go in as apiKey/apiPasswd and are encrypted server-side; supply apiPasswd from vault rather than on the command line, and note that nothing secret is written back to the data model.
| Argument | Type | Required | Description |
|---|
| name | string | yes | Datastore name |
| title | string | yes | Human-readable title; defaults to the name |
| dsType | enum | yes | Backing store kind |
| dsFQDN | string | yes | Endpoint, e.g. https://<account>.blob.core.windows.net or https://index.docker.io |
| dsPath | string | yes | Container, bucket, or repository path within the endpoint |
| region | string | yes | Region, where the backing store needs one (S3). Leave empty for Azure Blob. |
| apiKey | string | yes | Identity half of the credential — the storage account name for Azure Blob, the access key id for S3, the username for a registry. |
| apiPasswd | string | yes | Secret half of the credential — the account key, secret access key, or registry password. Resolve this from vault. |
fn createImage(name: string, title: string, datastoreId: string, imageRelUrl: string, imageFormat: enum, imageArch: enum, imageType: enum, imageSha256: string, imageSizeBytes: string, description: string)
Register one image artifact sitting in a datastore. ZEDCloud does not scan a datastore and discover its contents — every blob, object, or registry tag has to be declared here before an edge app can reference it.
| Argument | Type | Required | Description |
|---|
| name | string | yes | Image name, unique across the tenant and immutable once created |
| title | string | yes | Human-readable title; defaults to the name |
| datastoreId | string | yes | Datastore id the artifact lives in — see listDatastores or the createDatastore result |
| imageRelUrl | string | yes | Path to the artifact relative to the datastore root, e.g. pexip-node.qcow2 or library/nginx:latest |
| imageFormat | enum | yes | Binary format of the artifact |
| imageArch | enum | yes | Target architecture |
| imageType | enum | yes | Application workload, EVE-OS base image, or one of the runtime/artifact kinds |
| imageSha256 | string | yes | Optional SHA256 checksum; when set, EVE verifies the download against it |
| imageSizeBytes | string | yes | Optional declared size in bytes |
| description | string | yes | Free-text description |
fn apiRequest(method: enum, path: string, query: record, body: record)
Generic authenticated passthrough to any ZEDCloud API path. Use for endpoints without a dedicated method; path is API-relative and begins with /v1 or /v2.
| Argument | Type | Required | Description |
|---|
| method | enum | yes | HTTP method |
| path | string | yes | API-relative path, e.g. /v1/apps/images/baseos/latest |
| query | record | yes | Query parameters |
| body | record | yes | JSON request body for POST/PUT |