pub enum Action {
Any,
Specific(SpecificActionDetails),
}
Expand description
An action in an Aspen policy.
This can either be Any
action (represented by the string *
), or a service and an API pattern (Specific
)
in the form service:api_pattern
. The API pattern may contain wildcard characters (*
and ?
).
Variants§
Implementations§
Source§impl Action
impl Action
Sourcepub fn new<S: Into<String>, A: Into<String>>(
service: S,
api: A,
) -> Result<Self, AspenError>
pub fn new<S: Into<String>, A: Into<String>>( service: S, api: A, ) -> Result<Self, AspenError>
Create a new Action::Specific action.
§Errors
An AspenError::InvalidAction error is returned in any of the following cases:
service
orapi
is empty.service
contains non-ASCII alphanumeric characters, hyphen (-
), or underscore (_
).service
begins or ends with a hyphen or underscore.api
contains non-ASCII alphanumeric characters, hyphen (-
), underscore (_
), asterisk (*
), or question mark (?
).api
begins or ends with a hyphen or underscore.
Sourcepub fn is_any(&self) -> bool
pub fn is_any(&self) -> bool
Returns true if this action is Action::Any.
Sourcepub fn specific(&self) -> Option<(&str, &str)>
pub fn specific(&self) -> Option<(&str, &str)>
If the action is Action::Specific, returns the service and action.
Sourcepub fn service(&self) -> &str
pub fn service(&self) -> &str
Returns the service for this action or “*” if this action is Action::Any.
Sourcepub fn api(&self) -> &str
pub fn api(&self) -> &str
Returns the API for this action or “*” if this action is Action::Any.
Trait Implementations§
impl Eq for Action
Auto Trait Implementations§
impl Freeze for Action
impl RefUnwindSafe for Action
impl Send for Action
impl Sync for Action
impl Unpin for Action
impl UnwindSafe for Action
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