Struct wasmcloud_host::policy::Manager
source · pub struct Manager {
pub policy_changes: AbortHandle,
/* private fields */
}
Expand description
Encapsulates making requests for policy decisions, and receiving updated decisions
Fields§
§policy_changes: AbortHandle
An abort handle for the policy changes subscription
Implementations§
source§impl Manager
impl Manager
sourcepub async fn new(
nats: Client,
host_info: HostInfo,
policy_topic: Option<String>,
policy_timeout: Option<Duration>,
policy_changes_topic: Option<String>,
) -> Result<Arc<Self>>
pub async fn new( nats: Client, host_info: HostInfo, policy_topic: Option<String>, policy_timeout: Option<Duration>, policy_changes_topic: Option<String>, ) -> Result<Arc<Self>>
Construct a new policy manager. Can fail if policy_changes_topic is set but we fail to subscribe to it
sourcepub async fn evaluate_start_component(
&self,
component_id: impl AsRef<str>,
image_ref: impl AsRef<str>,
max_instances: u32,
annotations: &BTreeMap<String, String>,
claims: Option<&Claims<Component>>,
) -> Result<Response>
pub async fn evaluate_start_component( &self, component_id: impl AsRef<str>, image_ref: impl AsRef<str>, max_instances: u32, annotations: &BTreeMap<String, String>, claims: Option<&Claims<Component>>, ) -> Result<Response>
Use the policy manager to evaluate whether a component may be started
sourcepub async fn evaluate_start_provider(
&self,
provider_id: impl AsRef<str>,
provider_ref: impl AsRef<str>,
annotations: &BTreeMap<String, String>,
claims: Option<&Claims<CapabilityProvider>>,
) -> Result<Response>
pub async fn evaluate_start_provider( &self, provider_id: impl AsRef<str>, provider_ref: impl AsRef<str>, annotations: &BTreeMap<String, String>, claims: Option<&Claims<CapabilityProvider>>, ) -> Result<Response>
Use the policy manager to evaluate whether a provider may be started
sourcepub async fn evaluate_perform_invocation(
&self,
component_id: impl AsRef<str>,
image_ref: impl AsRef<str>,
annotations: &BTreeMap<String, String>,
claims: Option<&Claims<Component>>,
interface: String,
function: String,
) -> Result<Response>
pub async fn evaluate_perform_invocation( &self, component_id: impl AsRef<str>, image_ref: impl AsRef<str>, annotations: &BTreeMap<String, String>, claims: Option<&Claims<Component>>, interface: String, function: String, ) -> Result<Response>
Use the policy manager to evaluate whether a component may be invoked
sourcepub async fn evaluate_action(&self, request: RequestBody) -> Result<Response>
pub async fn evaluate_action(&self, request: RequestBody) -> Result<Response>
Sends a policy request to the policy server and caches the response
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Manager
impl !RefUnwindSafe for Manager
impl Send for Manager
impl Sync for Manager
impl Unpin for Manager
impl !UnwindSafe for Manager
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> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self
file descriptor.source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self
file descriptor. Read moresource§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