Provider

Trait Provider 

Source
pub trait Provider:
    Send
    + Sync
    + 'static {
    type Config<'a>: Serialize + Deserialize<'a> + Send;
    type MetaState<'a>: Serialize + Deserialize<'a> + Send;

    // Required method
    fn schema(&self, diags: &mut Diagnostics) -> Option<Schema>;

    // Provided methods
    fn validate<'a, 'life0, 'life1, 'async_trait>(
        &'life0 self,
        diags: &'life1 mut Diagnostics,
        config: Self::Config<'a>,
    ) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn configure<'a, 'life0, 'life1, 'async_trait>(
        &'life0 self,
        diags: &'life1 mut Diagnostics,
        terraform_version: String,
        config: Self::Config<'a>,
    ) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn meta_schema(&self, diags: &mut Diagnostics) -> Option<Schema> { ... }
    fn get_resources(
        &self,
        diags: &mut Diagnostics,
    ) -> Option<HashMap<String, Box<dyn DynamicResource>>> { ... }
    fn get_data_sources(
        &self,
        diags: &mut Diagnostics,
    ) -> Option<HashMap<String, Box<dyn DynamicDataSource>>> { ... }
    fn get_functions(
        &self,
        diags: &mut Diagnostics,
    ) -> Option<HashMap<String, Box<dyn DynamicFunction>>> { ... }
}
Expand description

Trait for implementing a provider with automatic serialization/deserialization

See also: DynamicProvider

Required Associated Types§

Source

type Config<'a>: Serialize + Deserialize<'a> + Send

Configuration of the provider

The state will be automatically serialized/deserialized at the border of the request.

Source

type MetaState<'a>: Serialize + Deserialize<'a> + Send

State of the provider metadata

The metadata state will be automatically serialized/deserialized at the border of the request.

Required Methods§

Source

fn schema(&self, diags: &mut Diagnostics) -> Option<Schema>

Get the schema of the provider

§Arguments
  • diags - Diagnostics to record warnings and errors that occured when getting back the schema
§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§

Source

fn validate<'a, 'life0, 'life1, 'async_trait>( &'life0 self, diags: &'life1 mut Diagnostics, config: Self::Config<'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 provider

§Arguments
  • diags - Diagnostics to record warnings and errors that occured during validation
  • config - 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.

Source

fn configure<'a, 'life0, 'life1, 'async_trait>( &'life0 self, diags: &'life1 mut Diagnostics, terraform_version: String, config: Self::Config<'a>, ) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Configure the provider

§Arguments
  • diags - Diagnostics to record warnings and errors that occured during validation
  • terraform_version - Version of the Terraform binary that calls the provider
  • config - 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.

Source

fn meta_schema(&self, diags: &mut Diagnostics) -> Option<Schema>

Get the schema for the provider metadata (defaults to empty)

§Arguments
  • diags - Diagnostics to record warnings and errors that occured when getting back the schema
§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.

Source

fn get_resources( &self, diags: &mut Diagnostics, ) -> Option<HashMap<String, Box<dyn DynamicResource>>>

Get the resources of the provider

§Arguments
  • diags - Diagnostics to record warnings and errors that occured when getting back the resources
§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.

Source

fn get_data_sources( &self, diags: &mut Diagnostics, ) -> Option<HashMap<String, Box<dyn DynamicDataSource>>>

Get the data sources of the provider

§Arguments
  • diags - Diagnostics to record warnings and errors that occured when getting back the data sources
§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.

Source

fn get_functions( &self, diags: &mut Diagnostics, ) -> Option<HashMap<String, Box<dyn DynamicFunction>>>

Get the functions of the provider

§Arguments
  • diags - Diagnostics to record warnings and errors that occured when getting back the functions
§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.

Implementors§