pub struct Policy {
pub security: SecurityPolicy,
pub resources: ResourcePolicy,
pub execution: ExecutionPolicy,
pub compliance: CompliancePolicy,
}Expand description
Policy configuration for cleanroom testing
Fields§
§security: SecurityPolicySecurity policy
resources: ResourcePolicyResource policy
execution: ExecutionPolicyExecution policy
compliance: CompliancePolicyCompliance policy
Implementations§
Source§impl Policy
impl Policy
Sourcepub fn with_security_level(security_level: SecurityLevel) -> Self
pub fn with_security_level(security_level: SecurityLevel) -> Self
Create a policy with custom security level
Sourcepub fn with_resource_limits(
max_cpu_percent: f64,
max_memory_bytes: u64,
max_disk_bytes: u64,
) -> Self
pub fn with_resource_limits( max_cpu_percent: f64, max_memory_bytes: u64, max_disk_bytes: u64, ) -> Self
Create a policy with custom resource limits
Sourcepub fn high_security() -> Self
pub fn high_security() -> Self
Create a high security policy
Sourcepub fn low_security() -> Self
pub fn low_security() -> Self
Create a low security policy
Sourcepub fn with_network_disabled(self) -> Self
pub fn with_network_disabled(self) -> Self
Disable network access
Sourcepub fn with_network_isolation(self, enable: bool) -> Self
pub fn with_network_isolation(self, enable: bool) -> Self
Set network isolation
Sourcepub fn allows_network(&self) -> bool
pub fn allows_network(&self) -> bool
Check if network access is allowed
Sourcepub fn is_operation_allowed(
&self,
_operation: &str,
context: &HashMap<String, String>,
) -> Result<bool>
pub fn is_operation_allowed( &self, _operation: &str, context: &HashMap<String, String>, ) -> Result<bool>
Check if operation is allowed by policy
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Policy
impl<'de> Deserialize<'de> for Policy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Policy
impl RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnwindSafe for Policy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request