Documentation

Resources

Resources are cloud infrastructure components (VMs, databases, clusters, etc.) discovered across your connected cloud accounts.

Overview

When you connect a cloud account, ZopNight's discoverer service scans for resources across all enabled regions. Each resource is classified by type, tagged as schedulable or inventory-only, and stored with its cloud metadata.

Resource UID

Each resource has a uid field containing the cloud provider's native resource identifier (e.g., i-0abc123def456 for AWS EC2, orprojects/my-project/zones/us-central1-a/instances/vm1 for GCP Compute). This UID is used to reference resources in schedules, actions, and other operations.

Resource Statuses

StatusDescription
runningResource is active and running
stoppedResource has been stopped
startingResource is transitioning to running state
stoppingResource is transitioning to stopped state
pendingResource state is being determined

List Resources

GET
/resources

List all discovered resources with filtering and pagination.

Query Parameters

ParameterTypeDescription
searchstringSearch by resource name or UID
typestringFilter by resource type (e.g., aws-ec2, gcp-compute)
providerstringFilter by cloud provider (aws, gcp, azure)
statusstringFilter by status (running, stopped, etc.)
regionstringFilter by cloud region
schedulablebooleanFilter by schedulable capability
pageintegerPage number (default: 1)
limitintegerItems per page (default: 20)
sort_bystringSort field (name, type, status, provider)
sort_orderstringasc or desc
Examplebash
curl "https://zopnight.com/api/resources?provider=aws&type=aws-ec2&status=running&limit=10" \
  -H "Authorization: Bearer <token>"
Responsejson
{
  "data": [
    {
      "id": "res_001",
      "name": "web-server-prod",
      "uid": "i-0abc123def456",
      "type": "aws-ec2",
      "instanceType": "t3.medium",
      "region": "us-east-1",
      "status": "running",
      "cloudAccountID": "ca_abc123",
      "cloudAccountName": "Production AWS",
      "provider": "aws",
      "schedulable": true,
      "tags": {
        "Environment": "production",
        "Team": "platform"
      },
      "createdAt": "2025-01-15T10:30:00Z",
      "updatedAt": "2025-01-20T08:00:00Z"
    }
  ]
}

Get Resource

GET
/resources/{resourceID}

Get detailed information about a specific resource.

Get Resources by IDs

GET
/resources/by-ids

Fetch multiple resources by their IDs in a single request.

Examplebash
curl "https://zopnight.com/api/resources/by-ids?ids=res_001,res_002,res_003" \
  -H "Authorization: Bearer <token>"

Get Filter Fields

GET
/resources/filter-fields

Get available filter options (distinct types, providers, regions, statuses) for building filter UIs.

Responsejson
{
  "data": {
    "types": ["aws-ec2", "aws-rds", "gcp-compute", "azure-vm"],
    "providers": ["aws", "gcp", "azure"],
    "regions": ["us-east-1", "us-west-2", "europe-west1"],
    "statuses": ["running", "stopped"]
  }
}

Refresh Discovery

Trigger an on-demand resource discovery scan for a specific cloud account. Discovery runs across all enabled regions and updates the resource inventory.

POST
/resources/refresh

Trigger a resource discovery refresh.

Requestbash
curl -X POST https://zopnight.com/api/resources/refresh \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "cloudAccountID": "ca_abc123",
    "cloudAccountName": "Production AWS",
    "provider": "aws"
  }'
Responsejson
{
  "data": {
    "refreshID": "ref_xyz789",
    "status": "queued"
  }
}

Refresh Status

GET
/resources/refresh/status

Check the status of a discovery refresh.

Responsejson
{
  "data": {
    "id": "ref_xyz789",
    "status": "success",
    "discovered": 47,
    "startedAt": "2025-01-20T08:00:00Z",
    "completedAt": "2025-01-20T08:02:15Z"
  }
}

Resource Object

FieldTypeDescription
idstringUnique resource ID
namestringResource display name
uidstringCloud provider native resource identifier
typestringResource type (e.g., aws-ec2, gcp-compute, azure-vm)
instanceTypestringInstance size/type (e.g., t3.medium)
sizeGBnumber?Storage size in GB (storage resources)
unitCountinteger?Container/unit count (containerized resources)
regionstringCloud region
statusstringCurrent status (running, stopped, etc.)
cloudAccountIDstringConnected cloud account ID
cloudAccountNamestringCloud account display name
providerstringCloud provider (aws, gcp, azure)
parentUIDstringParent resource UID (e.g., cluster for a node)
childCountintegerNumber of child resources
schedulablebooleanWhether the resource supports start/stop scheduling
tagsobjectCloud provider tags as key-value pairs
createdAtstringISO 8601 creation timestamp
updatedAtstringISO 8601 last update timestamp

See Cloud Support Matrix for the full list of supported resource types per cloud provider.