MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / sandbox_policy_to_json_value

Function sandbox_policy_to_json_value

crates/openshell-policy/src/lib.rs:983–988  ·  view source on GitHub ↗

Convert a proto sandbox policy into the canonical policy JSON representation. The shape mirrors the YAML schema used by [`serialize_sandbox_policy`], so automation can use the same documented field names in either format.

(policy: &SandboxPolicy)

Source from the content-addressed store, hash-verified

981/// The shape mirrors the YAML schema used by [`serialize_sandbox_policy`], so
982/// automation can use the same documented field names in either format.
983pub fn sandbox_policy_to_json_value(policy: &SandboxPolicy) -> Result<serde_json::Value> {
984 let json_repr = from_proto(policy);
985 serde_json::to_value(&json_repr)
986 .into_diagnostic()
987 .wrap_err("failed to serialize policy to JSON")
988}
989
990/// Serialize a proto sandbox policy to a pretty-printed JSON string.
991pub fn serialize_sandbox_policy_json(policy: &SandboxPolicy) -> Result<String> {

Calls 1

from_protoFunction · 0.85

Tested by 1