pub trait DataSource: Send + Sync {
type State<'a>: Serialize + Deserialize<'a> + Send;
type ProviderMetaState<'a>: Serialize + Deserialize<'a> + Send;
// Required methods
fn schema(&self, diags: &mut Diagnostics) -> Option<Schema>;
fn read<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
diags: &'life1 mut Diagnostics,
config: Self::State<'a>,
provider_meta_state: Self::ProviderMetaState<'a>,
) -> Pin<Box<dyn Future<Output = Option<Self::State<'a>>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn validate<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
diags: &'life1 mut Diagnostics,
config: Self::State<'a>,
) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Trait for implementing a data source with automatic serialization/deserialization
See also: DynamicDataSource
Required Associated Types§
Sourcetype State<'a>: Serialize + Deserialize<'a> + Send
type State<'a>: Serialize + Deserialize<'a> + Send
State of the data source
The state will be automatically serialized/deserialized at the border of the request.
Sourcetype ProviderMetaState<'a>: Serialize + Deserialize<'a> + Send
type ProviderMetaState<'a>: Serialize + Deserialize<'a> + Send
State of the provider metadata
The state will be automatically serialized/deserialized at the border of the request.
Required Methods§
Sourcefn schema(&self, diags: &mut Diagnostics) -> Option<Schema>
fn schema(&self, diags: &mut Diagnostics) -> Option<Schema>
Sourcefn read<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
diags: &'life1 mut Diagnostics,
config: Self::State<'a>,
provider_meta_state: Self::ProviderMetaState<'a>,
) -> Pin<Box<dyn Future<Output = Option<Self::State<'a>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
diags: &'life1 mut Diagnostics,
config: Self::State<'a>,
provider_meta_state: Self::ProviderMetaState<'a>,
) -> Pin<Box<dyn Future<Output = Option<Self::State<'a>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read the state of the data source
§Arguments
diags- Diagnostics to record warnings and errors that occured during the readconfig- State as declared in the Terraform fileprovider_meta_state- State of the provider metadata as declared in the Terraform file
§Remarks
The return is ignored if there is an error in diagnostics.
If the return is None, an ad-hoc error is added to diagnostics.
Provided Methods§
Sourcefn validate<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
diags: &'life1 mut Diagnostics,
config: Self::State<'a>,
) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn validate<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
diags: &'life1 mut Diagnostics,
config: Self::State<'a>,
) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Validate the configuration of the data source
§Arguments
diags- Diagnostics to record warnings and errors that occured during validationconfig- State as declared in the Terraform file
§Remarks
The return is ignored if there is an error in diagnostics.
If the return is None, an ad-hoc error is added to diagnostics.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.