pub struct Tenant {
pub id: TenantId,
pub db_name: String,
pub db_secret_name: String,
pub s3_name: String,
pub os_index_name: String,
pub env: String,
pub event_queue_url: Option<String>,
}Fields§
§id: TenantIdUnique ID for the tenant
db_name: StringName of the tenant database
db_secret_name: StringName for the AWS secret used for the database user
s3_name: StringName of the tenant s3 bucket
os_index_name: StringName of the tenant search index
env: StringEnvironment for the tenant
event_queue_url: Option<String>Optional event queue (SQS) to send docbox events to
Implementations§
Source§impl Tenant
impl Tenant
Sourcepub async fn create(
db: impl DbExecutor<'_>,
create: CreateTenant,
) -> DbResult<Tenant>
pub async fn create( db: impl DbExecutor<'_>, create: CreateTenant, ) -> DbResult<Tenant>
Create a new tenant
Sourcepub async fn find_by_id(
db: impl DbExecutor<'_>,
id: TenantId,
env: &str,
) -> DbResult<Option<Tenant>>
pub async fn find_by_id( db: impl DbExecutor<'_>, id: TenantId, env: &str, ) -> DbResult<Option<Tenant>>
Find a tenant by id within a specific env
Sourcepub async fn find_by_bucket(
db: impl DbExecutor<'_>,
bucket: &str,
) -> DbResult<Option<Tenant>>
pub async fn find_by_bucket( db: impl DbExecutor<'_>, bucket: &str, ) -> DbResult<Option<Tenant>>
Find a tenant using its S3 bucket
Sourcepub async fn find_by_env(
db: impl DbExecutor<'_>,
env: &str,
) -> DbResult<Vec<Tenant>>
pub async fn find_by_env( db: impl DbExecutor<'_>, env: &str, ) -> DbResult<Vec<Tenant>>
Finds all tenants for the specified environment
Sourcepub async fn update_os_index(
&mut self,
db: impl DbExecutor<'_>,
os_index_name: String,
) -> DbResult<()>
pub async fn update_os_index( &mut self, db: impl DbExecutor<'_>, os_index_name: String, ) -> DbResult<()>
Update the open search index for the tenant
Sourcepub async fn delete(self, db: impl DbExecutor<'_>) -> DbResult<()>
pub async fn delete(self, db: impl DbExecutor<'_>) -> DbResult<()>
Deletes the tenant
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tenant
impl RefUnwindSafe for Tenant
impl Send for Tenant
impl Sync for Tenant
impl Unpin for Tenant
impl UnwindSafe for Tenant
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