Enum scratchstack_aspen::Action
source · [−]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
Any
Any action.
Specific(SpecificActionDetails)
A specific action.
Implementations
sourceimpl 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:
serviceorapiis empty.servicecontains non-ASCII alphanumeric characters, hyphen (-), or underscore (_).servicebegins or ends with a hyphen or underscore.apicontains non-ASCII alphanumeric characters, hyphen (-), underscore (_), asterisk (*), or question mark (?).apibegins 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 RefUnwindSafe for Action
impl Send for Action
impl Sync for Action
impl Unpin for Action
impl UnwindSafe for Action
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more