pub struct Policy { /* private fields */ }Expand description
Policy for a resource that controls compliance checking for data flows.
A Policy combines multiple dimensions of access control and resource management
to determine whether data flows involving a resource should be permitted.
§Fields
confidentiality: Controls whether the resource contains sensitive dataintegrity: Numeric trust level (0 = lowest, higher = more trusted)deleted: Tracks deletion status through a multi-phase processconsent: Whether the resource owner consent is required for flows
§Policy Evaluation
When evaluating flows between resources, policies are checked to ensure:
- No deleted resources are involved
- Integrity levels are compatible (source >= destination)
- Confidentiality is preserved (secret data doesn’t leak to public)
- All parties have given consent
This policy is used to check the compliance of input/output flows of the associated resource.
Implementations§
Source§impl Policy
impl Policy
Sourcepub fn new(
confidentiality: ConfidentialityPolicy,
integrity: u32,
deleted: DeletionPolicy,
consent: bool,
) -> Self
pub fn new( confidentiality: ConfidentialityPolicy, integrity: u32, deleted: DeletionPolicy, consent: bool, ) -> Self
Creates a new policy with the specified parameters.
§Arguments
confidentiality- The confidentiality level for the resourceintegrity- The integrity level (0 = lowest, higher = more trusted)deleted- The deletion statusconsent- Whether the resource owner consent is required for flows
Sourcepub fn is_confidential(&self) -> bool
pub fn is_confidential(&self) -> bool
Returns true if the resource contains confidential data.
This is a convenience method that checks if the confidentiality policy
is set to Secret.
Sourcepub fn is_deleted(&self) -> bool
pub fn is_deleted(&self) -> bool
Returns true if the resource is deleted or pending deletion.
Resources that are deleted cannot participate in data flows.
Sourcepub fn is_pending_deletion(&self) -> bool
pub fn is_pending_deletion(&self) -> bool
Returns true if the resource is pending deletion.
This indicates the resource has been marked for deletion but hasn’t been fully removed yet.
Sourcepub fn get_integrity(&self) -> u32
pub fn get_integrity(&self) -> u32
Returns the integrity level of the resource.
Higher values indicate more trusted data. For flows to be permitted, the source integrity must be greater than or equal to the destination integrity.
Sourcepub fn get_consent(&self) -> bool
pub fn get_consent(&self) -> bool
Returns true if the resource owner has given consent for flows.
When consent is false, flows involving this resource should be denied.
Sourcepub fn with_consent(&mut self, consent: bool) -> ComplianceResponse
pub fn with_consent(&mut self, consent: bool) -> ComplianceResponse
Updates the consent flag for this policy.
Returns PolicyUpdated if the consent was successfully changed,
or PolicyNotUpdated if the resource is deleted and cannot be modified.
Sourcepub fn with_integrity(&mut self, integrity: u32) -> ComplianceResponse
pub fn with_integrity(&mut self, integrity: u32) -> ComplianceResponse
Updates the integrity level for this policy.
Returns PolicyUpdated if the integrity was successfully changed,
or PolicyNotUpdated if the resource is deleted and cannot be modified.
§Arguments
integrity- The new integrity level
Sourcepub fn with_confidentiality(
&mut self,
confidentiality: ConfidentialityPolicy,
) -> ComplianceResponse
pub fn with_confidentiality( &mut self, confidentiality: ConfidentialityPolicy, ) -> ComplianceResponse
Updates the confidentiality level for this policy.
Returns PolicyUpdated if the confidentiality was successfully changed,
or PolicyNotUpdated if the resource is deleted and cannot be modified.
§Arguments
confidentiality- The new confidentiality level
Sourcepub fn deleted(&mut self) -> ComplianceResponse
pub fn deleted(&mut self) -> ComplianceResponse
Marks the resource for deletion.
This transitions the resource from NotDeleted to Pending deletion status.
Once marked for deletion, the policy cannot be further modified.
Returns PolicyUpdated if the deletion was successfully marked as pending,
or PolicyNotUpdated if the resource is already deleted or pending deletion.
Sourcepub fn deletion_enforced(&mut self) -> ComplianceResponse
pub fn deletion_enforced(&mut self) -> ComplianceResponse
Marks the deletion as enforced for a resource that is pending deletion.
This transitions the resource from Pending to Deleted status.
This method should be called after the actual deletion has been performed.
Returns PolicyUpdated if the deletion was successfully marked,
or PolicyNotUpdated if the resource is not pending deletion.
Trait Implementations§
Source§impl From<Policy> for DestinationPolicy
Converts internal M2M DestinationPolicy response to Protocol Buffer response.
impl From<Policy> for DestinationPolicy
Converts internal M2M DestinationPolicy response to Protocol Buffer response.
impl Eq for Policy
impl StructuralPartialEq for Policy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].