MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / describe_delegation

Function describe_delegation

atomic-cli/src/commands/identity/agent/list.rs:134–151  ·  view source on GitHub ↗

The JSON view of a delegation for `--json`.

(resolved: &ResolvedDelegation)

Source from the content-addressed store, hash-verified

132
133/// The JSON view of a delegation for `--json`.
134fn describe_delegation(resolved: &ResolvedDelegation) -> serde_json::Value {
135 let d = &resolved.delegation;
136 json!({
137 "id": d.id.to_urn(),
138 "delegator": d.delegator,
139 "delegatorName": d.delegator_name,
140 "softwareAgent": d.software_agent,
141 "permissions": d.scope.permissions.iter().map(|p| p.to_string()).collect::<Vec<_>>(),
142 "servers": d.scope.servers,
143 "workspaces": d.scope.workspaces,
144 "projects": d.scope.projects,
145 "views": d.scope.views,
146 "maxChanges": d.scope.max_changes,
147 "issued": d.issued.to_rfc3339(),
148 "expires": d.expires.map(|e| e.to_rfc3339()),
149 "status": resolved.status.to_string(),
150 })
151}
152
153/// Render a list into a fixed width, eliding the tail as `first,+n`.
154///

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected