pub struct DomainManager { /* private fields */ }Expand description
Domain management service.
Implementations§
Source§impl DomainManager
impl DomainManager
Sourcepub fn new(
pool: PgPool,
verification_service: Arc<DomainVerificationService>,
) -> Self
pub fn new( pool: PgPool, verification_service: Arc<DomainVerificationService>, ) -> Self
Create a new domain manager.
Sourcepub async fn create_domain(
&self,
tenant_id: Uuid,
req: CreateDomainRequest,
) -> ProxyResult<DomainResponse>
pub async fn create_domain( &self, tenant_id: Uuid, req: CreateDomainRequest, ) -> ProxyResult<DomainResponse>
Create a new domain for a tenant.
Sourcepub async fn get_domain(
&self,
id: Uuid,
tenant_id: Uuid,
) -> ProxyResult<Option<DomainResponse>>
pub async fn get_domain( &self, id: Uuid, tenant_id: Uuid, ) -> ProxyResult<Option<DomainResponse>>
Get a domain by ID for a tenant.
Sourcepub async fn list_domains(&self, tenant_id: Uuid) -> ProxyResult<Vec<Domain>>
pub async fn list_domains(&self, tenant_id: Uuid) -> ProxyResult<Vec<Domain>>
List all domains for a tenant.
Sourcepub async fn delete_domain(
&self,
id: Uuid,
tenant_id: Uuid,
) -> ProxyResult<bool>
pub async fn delete_domain( &self, id: Uuid, tenant_id: Uuid, ) -> ProxyResult<bool>
Delete a domain.
Sourcepub async fn verify_domain(
&self,
id: Uuid,
tenant_id: Uuid,
) -> ProxyResult<VerificationResult>
pub async fn verify_domain( &self, id: Uuid, tenant_id: Uuid, ) -> ProxyResult<VerificationResult>
Verify a domain.
Sourcepub async fn find_live_http_challenge(
&self,
token: &str,
) -> ProxyResult<Option<HttpChallenge>>
pub async fn find_live_http_challenge( &self, token: &str, ) -> ProxyResult<Option<HttpChallenge>>
Look up a live HTTP verification challenge by its token.
Exposed so the well-known endpoint can answer challenges without reaching past this service for the pool. The caller must still check that the request arrived for the returned domain.
Sourcepub async fn update_domain(
&self,
id: Uuid,
tenant_id: Uuid,
req: UpdateDomainRequest,
) -> ProxyResult<Domain>
pub async fn update_domain( &self, id: Uuid, tenant_id: Uuid, req: UpdateDomainRequest, ) -> ProxyResult<Domain>
Apply a partial update to a domain.
The domain name cannot be changed – see UpdateDomainRequest for
why – so this only moves the verification method and the SSL provider.
Sourcepub async fn upload_certificate(
&self,
id: Uuid,
tenant_id: Uuid,
cert_store: &CertificateStore,
req: UploadCertificateRequest,
) -> ProxyResult<Domain>
pub async fn upload_certificate( &self, id: Uuid, tenant_id: Uuid, cert_store: &CertificateStore, req: UploadCertificateRequest, ) -> ProxyResult<Domain>
Store a certificate an operator supplied, after checking it.
The checks are the point. An unchecked upload gives a listener that accepts the certificate now and fails every handshake later: the key may not match the chain, the certificate may be expired, or it may be for another domain entirely. All three are refused here, with a message saying which.
Sourcepub async fn queue_ssl_issuance(
&self,
id: Uuid,
tenant_id: Uuid,
) -> ProxyResult<Domain>
pub async fn queue_ssl_issuance( &self, id: Uuid, tenant_id: Uuid, ) -> ProxyResult<Domain>
Queue a verified ACME domain for certificate issuance.
Sets state and returns; the work is done by the issuance worker. That is the whole endpoint, and deliberately so: an ACME order is several round trips to the CA plus a challenge the CA has to fetch back from us, and retrying under a rate limit is the normal failure mode. Doing it inline would hold the request open and let a client timeout orphan an order the CA had already started.
Idempotent, and also the way to retry after a failure – it clears the attempt count and the backoff.
Sourcepub async fn enable_domain(
&self,
id: Uuid,
tenant_id: Uuid,
) -> ProxyResult<bool>
pub async fn enable_domain( &self, id: Uuid, tenant_id: Uuid, ) -> ProxyResult<bool>
Enable a verified domain.
Sourcepub async fn disable_domain(
&self,
id: Uuid,
tenant_id: Uuid,
) -> ProxyResult<bool>
pub async fn disable_domain( &self, id: Uuid, tenant_id: Uuid, ) -> ProxyResult<bool>
Disable a domain.
Sourcepub async fn create_route(
&self,
domain_id: Uuid,
tenant_id: Uuid,
req: CreateDomainRouteRequest,
) -> ProxyResult<DomainRoute>
pub async fn create_route( &self, domain_id: Uuid, tenant_id: Uuid, req: CreateDomainRouteRequest, ) -> ProxyResult<DomainRoute>
Create a route for a domain.
Sourcepub async fn get_route(
&self,
id: Uuid,
tenant_id: Uuid,
) -> ProxyResult<Option<DomainRoute>>
pub async fn get_route( &self, id: Uuid, tenant_id: Uuid, ) -> ProxyResult<Option<DomainRoute>>
Get a route by ID.
Sourcepub async fn list_routes_for_domain(
&self,
domain_id: Uuid,
tenant_id: Uuid,
) -> ProxyResult<Vec<DomainRoute>>
pub async fn list_routes_for_domain( &self, domain_id: Uuid, tenant_id: Uuid, ) -> ProxyResult<Vec<DomainRoute>>
List routes for a domain.
Sourcepub async fn update_route(
&self,
id: Uuid,
tenant_id: Uuid,
req: UpdateDomainRouteRequest,
) -> ProxyResult<Option<DomainRoute>>
pub async fn update_route( &self, id: Uuid, tenant_id: Uuid, req: UpdateDomainRouteRequest, ) -> ProxyResult<Option<DomainRoute>>
Update a route.
Sourcepub async fn delete_route(&self, id: Uuid, tenant_id: Uuid) -> ProxyResult<bool>
pub async fn delete_route(&self, id: Uuid, tenant_id: Uuid) -> ProxyResult<bool>
Delete a route.
Sourcepub async fn create_upstream(
&self,
tenant_id: Uuid,
req: CreateUpstreamRequest,
) -> ProxyResult<DomainUpstream>
pub async fn create_upstream( &self, tenant_id: Uuid, req: CreateUpstreamRequest, ) -> ProxyResult<DomainUpstream>
Create an upstream for a tenant.
Sourcepub async fn get_upstream(
&self,
id: Uuid,
tenant_id: Uuid,
) -> ProxyResult<Option<DomainUpstream>>
pub async fn get_upstream( &self, id: Uuid, tenant_id: Uuid, ) -> ProxyResult<Option<DomainUpstream>>
Get an upstream by ID.
Sourcepub async fn list_upstreams(
&self,
tenant_id: Uuid,
) -> ProxyResult<Vec<DomainUpstream>>
pub async fn list_upstreams( &self, tenant_id: Uuid, ) -> ProxyResult<Vec<DomainUpstream>>
List upstreams for a tenant.
Sourcepub async fn update_upstream(
&self,
id: Uuid,
tenant_id: Uuid,
req: UpdateUpstreamRequest,
) -> ProxyResult<Option<DomainUpstream>>
pub async fn update_upstream( &self, id: Uuid, tenant_id: Uuid, req: UpdateUpstreamRequest, ) -> ProxyResult<Option<DomainUpstream>>
Update an upstream.
Sourcepub async fn delete_upstream(
&self,
id: Uuid,
tenant_id: Uuid,
) -> ProxyResult<bool>
pub async fn delete_upstream( &self, id: Uuid, tenant_id: Uuid, ) -> ProxyResult<bool>
Delete an upstream.
Sourcepub async fn add_backend(
&self,
upstream_id: Uuid,
tenant_id: Uuid,
req: CreateBackendRequest,
) -> ProxyResult<DomainBackend>
pub async fn add_backend( &self, upstream_id: Uuid, tenant_id: Uuid, req: CreateBackendRequest, ) -> ProxyResult<DomainBackend>
Add a backend to an upstream.
Sourcepub async fn remove_backend(
&self,
backend_id: Uuid,
upstream_id: Uuid,
tenant_id: Uuid,
) -> ProxyResult<bool>
pub async fn remove_backend( &self, backend_id: Uuid, upstream_id: Uuid, tenant_id: Uuid, ) -> ProxyResult<bool>
Remove a backend from an upstream.
Sourcepub async fn get_tenant_usage(
&self,
tenant_id: Uuid,
) -> ProxyResult<TenantUsage>
pub async fn get_tenant_usage( &self, tenant_id: Uuid, ) -> ProxyResult<TenantUsage>
Get tenant usage statistics.
Auto Trait Implementations§
impl !RefUnwindSafe for DomainManager
impl !UnwindSafe for DomainManager
impl Freeze for DomainManager
impl Send for DomainManager
impl Sync for DomainManager
impl Unpin for DomainManager
impl UnsafeUnpin for DomainManager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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> ⓘ
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> ⓘ
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