pub struct Oso { /* private fields */ }Implementations§
source§impl Oso
impl Oso
pub fn new_with_url(url: &str, api_key: &str) -> Result<Self, Error>
pub fn new(api_key: &str) -> Result<Self, Error>
sourcepub async fn policy(&self, policy_src: &str) -> Result<(), Error>
pub async fn policy(&self, policy_src: &str) -> Result<(), Error>
Update the current policy for the environment
sourcepub async fn tell<'a>(&self, fact: Fact<'a>) -> Result<(), Error>
pub async fn tell<'a>(&self, fact: Fact<'a>) -> Result<(), Error>
Add a single fact into Oso Cloud
sourcepub async fn bulk_tell<'a>(&self, facts: &[Fact<'a>]) -> Result<(), Error>
pub async fn bulk_tell<'a>(&self, facts: &[Fact<'a>]) -> Result<(), Error>
Add multiple facts into Oso Cloud
sourcepub async fn bulk_delete<'a>(&self, facts: &[Fact<'a>]) -> Result<(), Error>
pub async fn bulk_delete<'a>(&self, facts: &[Fact<'a>]) -> Result<(), Error>
Deletes many facts at once. Does not throw an error when some of the facts are not found.
Value::any and Value::any_of_type can be used as a wildcard in facts in delete.
Does not throw an error when the facts to delete are not found.
sourcepub async fn bulk<'a>(
&self,
delete: &[Fact<'a>],
tell: &'a [Fact<'a>]
) -> Result<(), Error>
pub async fn bulk<'a>( &self, delete: &[Fact<'a>], tell: &'a [Fact<'a>] ) -> Result<(), Error>
Deletes and adds many facts in one atomic transaction. The deletions are performed before the adds.
Value::any and Value::any_of_type can be used as a wildcard in facts in delete.
Does not throw an error when the facts to delete are not found.
sourcepub async fn get<'a>(
&self,
fact: &Fact<'a>
) -> Result<Vec<Fact<'static>>, Error>
pub async fn get<'a>( &self, fact: &Fact<'a> ) -> Result<Vec<Fact<'static>>, Error>
Lists facts that are stored in Oso Cloud. Can be used to check the existence of a particular fact, or used to fetch all facts that have a particular argument
pub async fn actions<'a>( &self, actor: impl Into<Value<'a>>, resource: impl Into<Value<'a>> ) -> Result<Vec<String>, Error>
pub async fn list<'a>( &self, actor: impl Into<Value<'a>>, action: &str, resource_type: &str ) -> Result<Vec<String>, Error>
sourcepub async fn query<'a>(
&self,
fact: &Fact<'a>
) -> Result<Vec<Fact<'static>>, Error>
pub async fn query<'a>( &self, fact: &Fact<'a> ) -> Result<Vec<Fact<'static>>, Error>
Query Oso Cloud for any predicate and any combination of concrete and wildcard arguments.
Unlike oso.get, which only lists facts you’ve added, you can use oso.query to list
derived information about any rule in your policy.