pub struct BindingsProvider { /* private fields */ }Expand description
Direct platform-specific bindings provider. Routes to appropriate platform implementations based on binding configuration.
Caches all loaded bindings by name. Each load_* call creates cloud clients
(HTTP connection pools, token caches) which are expensive to initialize. Since
the binding configuration is immutable for the provider’s lifetime, the same
binding name always produces the same client — so we cache on first load.
Implementations§
Source§impl BindingsProvider
impl BindingsProvider
Sourcepub fn new(
client_config: ClientConfig,
bindings: HashMap<String, Value>,
) -> Result<BindingsProvider, AlienError<ErrorData>>
pub fn new( client_config: ClientConfig, bindings: HashMap<String, Value>, ) -> Result<BindingsProvider, AlienError<ErrorData>>
Creates a new BindingsProvider with explicit credentials and bindings.
This is the base constructor used by all other convenience constructors.
Sourcepub async fn from_env(
env: HashMap<String, String>,
) -> Result<BindingsProvider, AlienError<ErrorData>>
pub async fn from_env( env: HashMap<String, String>, ) -> Result<BindingsProvider, AlienError<ErrorData>>
Creates a BindingsProvider from environment variables (for runtime use).
This parses the platform from ALIEN_DEPLOYMENT_TYPE, loads ClientConfig from environment, and extracts all ALIEN_*_BINDING environment variables.
Sourcepub fn from_stack_state(
stack_state: &StackState,
client_config: ClientConfig,
) -> Result<BindingsProvider, AlienError<ErrorData>>
pub fn from_stack_state( stack_state: &StackState, client_config: ClientConfig, ) -> Result<BindingsProvider, AlienError<ErrorData>>
Pattern 1: Creates a BindingsProvider from stack state and client config.
Convenience helper that extracts bindings from stack state’s remote_binding_params.
Only resources with remote_access: true will have binding params available.
When to use: You already have ClientConfig and StackState.
Example use cases:
- alien-deployment (has credentials from RemoteAccessResolver)
- Platform API backend (has stack state from DB)
Trait Implementations§
Source§impl BindingsProviderApi for BindingsProvider
impl BindingsProviderApi for BindingsProvider
Source§fn load_storage<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Storage>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
fn load_storage<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Storage>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
Source§fn load_build<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Build>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
fn load_build<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Build>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
Source§fn load_artifact_registry<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ArtifactRegistry>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
fn load_artifact_registry<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ArtifactRegistry>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
Source§fn load_vault<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Vault>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
fn load_vault<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Vault>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
Source§fn load_kv<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Kv>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
fn load_kv<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Kv>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
Source§fn load_queue<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Queue>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
fn load_queue<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Queue>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
Source§fn load_function<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Function>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
fn load_function<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Function>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
Source§fn load_container<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Container>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
fn load_container<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Container>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
Source§fn load_service_account<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ServiceAccount>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
fn load_service_account<'life0, 'life1, 'async_trait>(
&'life0 self,
binding_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ServiceAccount>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BindingsProvider: 'async_trait,
Source§impl Clone for BindingsProvider
impl Clone for BindingsProvider
Source§fn clone(&self) -> BindingsProvider
fn clone(&self) -> BindingsProvider
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for BindingsProvider
impl !RefUnwindSafe for BindingsProvider
impl Send for BindingsProvider
impl Sync for BindingsProvider
impl Unpin for BindingsProvider
impl UnsafeUnpin for BindingsProvider
impl !UnwindSafe for BindingsProvider
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
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request