メインコンテンツへスキップ

get-cloud-diagram-resource-relationships

dci get-cloud-diagram-resource-relationships <id> <rid> [flags]

Walks the diagram graph from the anchor resource and returns related resources. Edge traversal walks the diagram's link set (same-scheme guard, BFS, cycle-safe); group traversal walks the group membership set. The result list is capped at 200 relations; truncated is true when the cap is hit. Read-only: does not mutate diagram state.

  • id — Layer ID: the ssid of a layer listed by dci get-cloud-diagram-components (also the ss_id field in dci get-cloud-diagrams-stats and dci search-cloud-diagrams results).
  • rid — Anchor resource ID: the _id of a node, element, or group on that layer, as returned by dci search-cloud-diagrams or dci export-cloud-diagram-json.

Examples

# Direct neighbours of a resource along the diagram's links, in both directions.
dci get-cloud-diagram-resource-relationships <layer-id> <resource-id>
# Everything downstream of it, following links transitively (capped at 200 relations).
dci get-cloud-diagram-resource-relationships <layer-id> <resource-id> --direction downstream --depth transitive
# Group membership instead of links — the members of a group, or the groups that contain a resource.
dci get-cloud-diagram-resource-relationships <layer-id> <resource-id> --kind group_members
# Links and groups merged, as JSON; check `truncated` before trusting the count.
dci get-cloud-diagram-resource-relationships <layer-id> <resource-id> --kind both --output json

Flags

FlagTypeDefaultExampleDescription
--directionstring"both"Edge direction relative to the anchor. both returns upstream and downstream neighbours. Defaults to both. One of: "downstream", "upstream", "both".
--depthstring"direct"direct returns one-hop neighbours; transitive runs a cycle-safe BFS to the connected component (still capped at 200 relations). Defaults to direct. One of: "direct", "transitive".
--kindstring"edges"edges walks the link graph; group_members walks group membership (children and parent groups); both merges the two and dedupes by id, preserving the smallest observed hop count. Defaults to edges. One of: "edges", "group_members", "both".

Every command also accepts the CLI-wide flags for output shaping — see Output formats and Table output options.

Output

OK - Related resources returned.

By default dci renders the result as a table. Use --output json to get the full structure described below — see Output formats.

FieldTypeDescription
anchorobjectThe anchor resource the traversal started from.
anchor.idstringAnchor resource ID (matches the rid path parameter).
anchor.typestringComponent bucket the anchor lives in. One of: "node", "element", "group".
anchor.namestringHuman-readable resource name.
anchor.serviceTypestringCloud service type when available (e.g. Amazon RDS, GCP Cloud SQL).
directionstringOne of: "downstream", "upstream", "both".
depthstringOne of: "direct", "transitive".
kindstringOne of: "edges", "group_members", "both".
relationsarray of objectResources related to the anchor (capped at 200).
relations[].idstringRelated resource ID.
relations[].typestringComponent bucket the related resource lives in. One of: "node", "element", "group".
relations[].namestringHuman-readable name of the related resource.
relations[].serviceTypestringCloud service type when available.
relations[].relationstringHow the resource is related to the anchor. downstream / upstream are edge relations (anchor is the edge origin / destination respectively). group_member means the related resource is contained in the anchor (anchor is a group); group_parent means the related resource is a group that contains the anchor. One of: "downstream", "upstream", "group_member", "group_parent".
relations[].hopsintegerEdge hop count from the anchor. Group-member / group-parent entries are reported as 1.
truncatedbooleanTrue when the relation list was capped at 200 entries.
Raw JSON schema
{
"type": "object",
"required": [
"anchor",
"direction",
"depth",
"kind",
"relations",
"truncated"
],
"description": "The response payload for the resource relationships endpoint.",
"properties": {
"anchor": {
"type": "object",
"required": [
"id",
"type",
"name"
],
"description": "The anchor resource the traversal started from.",
"properties": {
"id": {
"type": "string",
"description": "Anchor resource ID (matches the `rid` path parameter)."
},
"type": {
"type": "string",
"enum": [
"node",
"element",
"group"
],
"description": "Component bucket the anchor lives in."
},
"name": {
"type": "string",
"description": "Human-readable resource name."
},
"serviceType": {
"type": "string",
"description": "Cloud service type when available (e.g. `Amazon RDS`, `GCP Cloud SQL`)."
}
}
},
"direction": {
"type": "string",
"enum": [
"downstream",
"upstream",
"both"
]
},
"depth": {
"type": "string",
"enum": [
"direct",
"transitive"
]
},
"kind": {
"type": "string",
"enum": [
"edges",
"group_members",
"both"
]
},
"relations": {
"type": "array",
"items": {
"type": "object",
"required": [
"id",
"type",
"name",
"relation",
"hops"
],
"description": "One related resource returned by the traversal.",
"properties": {
"id": {
"type": "string",
"description": "Related resource ID."
},
"type": {
"type": "string",
"enum": [
"node",
"element",
"group"
],
"description": "Component bucket the related resource lives in."
},
"name": {
"type": "string",
"description": "Human-readable name of the related resource."
},
"serviceType": {
"type": "string",
"description": "Cloud service type when available."
},
"relation": {
"type": "string",
"enum": [
"downstream",
"upstream",
"group_member",
"group_parent"
],
"description": "How the resource is related to the anchor. `downstream` / `upstream` are edge\nrelations (anchor is the edge origin / destination respectively).\n`group_member` means the related resource is contained in the anchor (anchor is\na group); `group_parent` means the related resource is a group that contains\nthe anchor."
},
"hops": {
"type": "integer",
"minimum": 1,
"description": "Edge hop count from the anchor. Group-member / group-parent entries are reported as 1."
}
}
},
"description": "Resources related to the anchor (capped at 200)."
},
"truncated": {
"type": "boolean",
"description": "True when the relation list was capped at 200 entries."
}
}
}

Errors

On failure, dci prints a single error message — with a hint when one is available — and exits with a typed code your scripts can branch on. See Errors and exit codes for the full contract.

HTTP status to exit code mapping
HTTP statusExit codeError codeMeaning
40030VALIDATION_ERRORThe arguments or request body were rejected. Review the command's flags and payload.
40110AUTHENTICATION_FAILEDNot signed in, or the API token is invalid. Run dci login or check DCI_API_KEY.
40311PERMISSION_DENIEDThe DoiT user or the active customer context does not have access.
40420RESOURCE_NOT_FOUNDThe requested resource does not exist. Check the identifier argument.

Aliases: getclouddiagramresourcerelationships