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

Method try_from

crates/openshell-core/src/policy.rs:102–120  ·  view source on GitHub ↗
(proto: ProtoSandboxPolicy)

Source from the content-addressed store, hash-verified

100 type Error = miette::Report;
101
102 fn try_from(proto: ProtoSandboxPolicy) -> Result<Self, Self::Error> {
103 // In cluster mode we always run with proxy networking so all egress
104 // can be evaluated by OPA and `inference.local` is always addressable.
105 let network = NetworkPolicy {
106 mode: NetworkMode::Proxy,
107 proxy: Some(ProxyPolicy { http_addr: None }),
108 };
109
110 Ok(Self {
111 version: proto.version,
112 filesystem: proto
113 .filesystem
114 .map(FilesystemPolicy::from)
115 .unwrap_or_default(),
116 network,
117 landlock: proto.landlock.map(LandlockPolicy::from).unwrap_or_default(),
118 process: proto.process.map(ProcessPolicy::from).unwrap_or_default(),
119 })
120 }
121}
122
123impl From<ProtoFilesystemPolicy> for FilesystemPolicy {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected