#[non_exhaustive]pub struct OperationGroupPermissions {
pub account: Option<ReadWritePermissions>,
pub basin: Option<ReadWritePermissions>,
pub stream: Option<ReadWritePermissions>,
}Expand description
Permissions at the operation group level.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.account: Option<ReadWritePermissions>Account-level access permissions.
Defaults to None.
basin: Option<ReadWritePermissions>Basin-level access permissions.
Defaults to None.
stream: Option<ReadWritePermissions>Stream-level access permissions.
Defaults to None.
Implementations§
Source§impl OperationGroupPermissions
impl OperationGroupPermissions
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new OperationGroupPermissions with default values.
Examples found in repository?
examples/issue_access_token.rs (line 23)
10async fn main() -> Result<(), Box<dyn std::error::Error>> {
11 let access_token =
12 std::env::var("S2_ACCESS_TOKEN").map_err(|_| "S2_ACCESS_TOKEN env var not set")?;
13 let basin_name: BasinName = std::env::var("S2_BASIN")
14 .map_err(|_| "S2_BASIN env var not set")?
15 .parse()?;
16
17 let config = S2Config::new(access_token);
18 let s2 = S2::new(config)?;
19
20 let input = IssueAccessTokenInput::new(
21 "ro-token".parse()?,
22 AccessTokenScopeInput::from_op_group_perms(
23 OperationGroupPermissions::new().with_account(ReadWritePermissions::read_only()),
24 )
25 .with_ops([Operation::CreateStream])
26 .with_streams(StreamMatcher::Prefix("audit".parse()?))
27 .with_basins(BasinMatcher::Exact(basin_name)),
28 );
29 let issued_token = s2.issue_access_token(input).await?;
30 println!("Issued access token: {issued_token}");
31
32 Ok(())
33}Sourcepub fn read_only_all() -> Self
pub fn read_only_all() -> Self
Create read-only permissions for all groups.
Sourcepub fn write_only_all() -> Self
pub fn write_only_all() -> Self
Create write-only permissions for all groups.
Sourcepub fn read_write_all() -> Self
pub fn read_write_all() -> Self
Create read-write permissions for all groups.
Sourcepub fn with_account(self, account: ReadWritePermissions) -> Self
pub fn with_account(self, account: ReadWritePermissions) -> Self
Set account-level access permissions.
Examples found in repository?
examples/issue_access_token.rs (line 23)
10async fn main() -> Result<(), Box<dyn std::error::Error>> {
11 let access_token =
12 std::env::var("S2_ACCESS_TOKEN").map_err(|_| "S2_ACCESS_TOKEN env var not set")?;
13 let basin_name: BasinName = std::env::var("S2_BASIN")
14 .map_err(|_| "S2_BASIN env var not set")?
15 .parse()?;
16
17 let config = S2Config::new(access_token);
18 let s2 = S2::new(config)?;
19
20 let input = IssueAccessTokenInput::new(
21 "ro-token".parse()?,
22 AccessTokenScopeInput::from_op_group_perms(
23 OperationGroupPermissions::new().with_account(ReadWritePermissions::read_only()),
24 )
25 .with_ops([Operation::CreateStream])
26 .with_streams(StreamMatcher::Prefix("audit".parse()?))
27 .with_basins(BasinMatcher::Exact(basin_name)),
28 );
29 let issued_token = s2.issue_access_token(input).await?;
30 println!("Issued access token: {issued_token}");
31
32 Ok(())
33}Sourcepub fn with_basin(self, basin: ReadWritePermissions) -> Self
pub fn with_basin(self, basin: ReadWritePermissions) -> Self
Set basin-level access permissions.
Sourcepub fn with_stream(self, stream: ReadWritePermissions) -> Self
pub fn with_stream(self, stream: ReadWritePermissions) -> Self
Set stream-level access permissions.
Trait Implementations§
Source§impl Clone for OperationGroupPermissions
impl Clone for OperationGroupPermissions
Source§fn clone(&self) -> OperationGroupPermissions
fn clone(&self) -> OperationGroupPermissions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OperationGroupPermissions
impl Debug for OperationGroupPermissions
Source§impl Default for OperationGroupPermissions
impl Default for OperationGroupPermissions
Source§fn default() -> OperationGroupPermissions
fn default() -> OperationGroupPermissions
Returns the “default value” for a type. Read more
Source§impl From<OperationGroupPermissions> for PermittedOperationGroups
impl From<OperationGroupPermissions> for PermittedOperationGroups
Source§fn from(value: OperationGroupPermissions) -> Self
fn from(value: OperationGroupPermissions) -> Self
Converts to this type from the input type.
Source§impl From<PermittedOperationGroups> for OperationGroupPermissions
impl From<PermittedOperationGroups> for OperationGroupPermissions
Source§fn from(value: PermittedOperationGroups) -> Self
fn from(value: PermittedOperationGroups) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for OperationGroupPermissions
impl RefUnwindSafe for OperationGroupPermissions
impl Send for OperationGroupPermissions
impl Sync for OperationGroupPermissions
impl Unpin for OperationGroupPermissions
impl UnwindSafe for OperationGroupPermissions
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§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 more