Resource Groups
Resource groups let you organize related resources and schedule them together with defined execution ordering.
Overview
A resource group is a logical collection of cloud resources that should be managed together. When a group is attached to a schedule, all its members are started/stopped according to their execution tier and order — ensuring dependencies are respected.
Execution Tiers
Create Resource Group
/resource-groupsCreate a new resource group.
curl -X POST https://zopnight.com/api/resource-groups \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Backend Stack",
"description": "Database, cache, and app servers for the backend"
}'{
"data": {
"id": "grp_abc123",
"name": "Backend Stack",
"description": "Database, cache, and app servers for the backend",
"members": [],
"createdBy": "user@company.com",
"createdAt": "2025-01-15T10:30:00Z",
"updatedAt": "2025-01-15T10:30:00Z"
}
}List Resource Groups
/resource-groupsList all resource groups.
Get Resource Group
/resource-groups/{groupID}Get a resource group with its members.
Get Group Schedules
/resource-groups/{groupID}/schedulesList all schedules attached to a resource group.
Update Resource Group
/resource-groups/{groupID}Update group name or description.
curl -X PUT https://zopnight.com/api/resource-groups/grp_abc123 \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Full Backend Stack",
"description": "Updated description"
}'Delete Resource Group
/resource-groups/{groupID}Delete a resource group. Schedule attachments are also removed.
Add Member
/resource-groups/{groupID}/resources/{resourceID}Add a resource to the group.
Members are added with a default execution tier and order. Use the update sequence endpoint to configure execution ordering.
Update Execution Order
/resource-groups/{groupID}/resources/{resourceID}/sequenceUpdate the execution tier and order for a group member.
curl -X PATCH https://zopnight.com/api/resource-groups/grp_abc123/resources/res_001/sequence \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"executionTier": "tier-1",
"executionOrder": 1
}'Example ordering for a backend stack:
| Resource | Tier | Order | Starts |
|---|---|---|---|
| PostgreSQL RDS | tier-1 | 1 | First |
| Redis ElastiCache | tier-1 | 2 | Second |
| App Server EC2 | tier-2 | 1 | After tier 1 completes |
| Worker EC2 | tier-2 | 2 | After app server |
Remove Member
/resource-groups/{groupID}/resources/{resourceID}Remove a resource from the group.
Group Member Object
| Field | Type | Description |
|---|---|---|
id | string | Membership ID |
resourceUID | string | Cloud provider resource UID |
resourceName | string | Resource display name |
resourceType | string | Resource type (e.g., aws-ec2) |
provider | string | Cloud provider |
cloudAccountID | string | Connected cloud account ID |
region | string | Cloud region |
executionTier | string | Execution tier for ordering (e.g., tier-1, tier-2) |
executionOrder | integer | Order within the tier |