Enum wick_config::config::WickConfiguration
source · pub enum WickConfiguration {
Component(ComponentConfiguration),
App(AppConfiguration),
Types(TypesConfiguration),
Tests(TestConfiguration),
Lockdown(LockdownConfiguration),
}Expand description
A catch-all enum for root-level Wick configurations.
Variants§
Component(ComponentConfiguration)
A component_config::ComponentConfiguration configuration.
App(AppConfiguration)
An app_config::AppConfiguration configuration.
Types(TypesConfiguration)
A types_config::TypesConfiguration configuration.
Tests(TestConfiguration)
A test_config::TestConfiguration configuration.
Lockdown(LockdownConfiguration)
A lockdown_config::LockdownConfiguration configuration.
Implementations§
source§impl WickConfiguration
impl WickConfiguration
sourcepub async fn fetch_tree(
path: impl Into<AssetReference> + Send,
root_config: Option<RuntimeConfig>,
root_env: Option<HashMap<String, String>>,
options: FetchOptions
) -> Result<ConfigurationTreeNode<WickConfiguration>, Error>
pub async fn fetch_tree( path: impl Into<AssetReference> + Send, root_config: Option<RuntimeConfig>, root_env: Option<HashMap<String, String>>, options: FetchOptions ) -> Result<ConfigurationTreeNode<WickConfiguration>, Error>
Fetch a configuration and all referenced assets from a path.
Example
use wick_config::WickConfiguration;
use wick_asset_reference::FetchOptions;
let opts = FetchOptions::default();
let env : HashMap<String,String> = std::env::vars().collect();
let root_config = None;
let manifest = WickConfiguration::fetch_tree("path/to/manifest.yaml", root_config, env, opts).await?;sourcepub async fn fetch_uninitialized_tree(
path: impl Into<AssetReference> + Send,
options: FetchOptions
) -> Result<ConfigurationTreeNode<UninitializedConfiguration>, Error>
pub async fn fetch_uninitialized_tree( path: impl Into<AssetReference> + Send, options: FetchOptions ) -> Result<ConfigurationTreeNode<UninitializedConfiguration>, Error>
Fetch a configuration and all referenced assets from a path.
Example
use wick_config::WickConfiguration;
use wick_asset_reference::FetchOptions;
let opts = FetchOptions::default();
let manifest = WickConfiguration::fetch_uninitialized_tree("path/to/manifest.yaml", opts).await?;sourcepub async fn fetch(
asset: impl Into<AssetReference> + Send,
options: FetchOptions
) -> Result<UninitializedConfiguration, Error>
pub async fn fetch( asset: impl Into<AssetReference> + Send, options: FetchOptions ) -> Result<UninitializedConfiguration, Error>
Fetch a configuration from a path.
Example
use wick_config::WickConfiguration;
use wick_asset_reference::FetchOptions;
let opts = FetchOptions::default();
let manifest = WickConfiguration::fetch("path/to/manifest.yaml", opts).await?;sourcepub fn load_from_bytes(
bytes: &[u8],
source: &Option<PathBuf>
) -> Result<UninitializedConfiguration, Error>
pub fn load_from_bytes( bytes: &[u8], source: &Option<PathBuf> ) -> Result<UninitializedConfiguration, Error>
Load a configuration from raw bytes. Pass in an optional source to track where the bytes came from.
Example
use wick_config::WickConfiguration;
use std::path::PathBuf;
let path = PathBuf::from("path/to/manifest.yaml");
let bytes = std::fs::read(&path)?;
let manifest = WickConfiguration::load_from_bytes(&bytes, &Some(path))?;sourcepub fn from_yaml(
src: &str,
source: &Option<PathBuf>
) -> Result<UninitializedConfiguration, Error>
pub fn from_yaml( src: &str, source: &Option<PathBuf> ) -> Result<UninitializedConfiguration, Error>
Load a configuration from a string. Pass in an optional source to track where the string came from.
Example
use std::path::PathBuf;
use wick_config::WickConfiguration;
let path = PathBuf::from("path/to/manifest.yaml");
let string = std::fs::read_to_string(&path)?;
let manifest = WickConfiguration::from_yaml(&string, &Some(path))?;sourcepub fn into_v1_yaml(self) -> Result<String, Error>
pub fn into_v1_yaml(self) -> Result<String, Error>
Convert a WickConfiguration into V1 configuration yaml source.
Example
use wick_config::WickConfiguration;
use wick_asset_reference::FetchOptions;
let opts = FetchOptions::default();
let manifest = WickConfiguration::fetch_all("path/to/manifest.yaml", opts).await?;
let manifest = manifest.finish()?;
let v1_yaml = manifest.into_v1_yaml()?;sourcepub fn into_v1_json(self) -> Result<Value, Error>
pub fn into_v1_json(self) -> Result<Value, Error>
Convert a WickConfiguration into a V1 configuration JSON value.
Example
use wick_config::WickConfiguration;
use wick_asset_reference::FetchOptions;
let opts = FetchOptions::default();
let manifest = WickConfiguration::fetch_all("path/to/manifest.yaml", opts).await?;
let manifest = manifest.finish()?;
let v1_json = manifest.into_v1_json()?;sourcepub fn name(&self) -> Option<&str>
pub fn name(&self) -> Option<&str>
Get the name (if any) associated with the inner configuration.
sourcepub fn metadata(&self) -> Option<&Metadata>
pub fn metadata(&self) -> Option<&Metadata>
Get the metadata (if any) associated with the inner configuration.
sourcepub const fn kind(&self) -> ConfigurationKind
pub const fn kind(&self) -> ConfigurationKind
Get the kind of the inner configuration.
sourcepub fn resources(&self) -> &[Binding<ResourceDefinition>]
pub fn resources(&self) -> &[Binding<ResourceDefinition>]
Get the resources for the configuration, if any
sourcepub fn version(&self) -> Option<&str>
pub fn version(&self) -> Option<&str>
Get the version (if any) associated with the inner configuration.
sourcepub fn package(&self) -> Option<&PackageConfig>
pub fn package(&self) -> Option<&PackageConfig>
Get the package configuration (if any) associated with the inner configuration.
sourcepub fn try_component_config(self) -> Result<ComponentConfiguration, Error>
pub fn try_component_config(self) -> Result<ComponentConfiguration, Error>
Unwrap the inner ComponentConfiguration, returning an error if it is anything else.
sourcepub fn try_app_config(self) -> Result<AppConfiguration, Error>
pub fn try_app_config(self) -> Result<AppConfiguration, Error>
Unwrap the inner AppConfiguration, returning an error if it is anything else.
sourcepub fn try_test_config(self) -> Result<TestConfiguration, Error>
pub fn try_test_config(self) -> Result<TestConfiguration, Error>
Unwrap the inner TestConfiguration, returning an error if it is anything else.
sourcepub fn try_types_config(self) -> Result<TypesConfiguration, Error>
pub fn try_types_config(self) -> Result<TypesConfiguration, Error>
Unwrap the inner TypesConfiguration, returning an error if it is anything else.
sourcepub fn try_lockdown_config(self) -> Result<LockdownConfiguration, Error>
pub fn try_lockdown_config(self) -> Result<LockdownConfiguration, Error>
Unwrap the inner LockdownConfiguration, returning an error if it is anything else.
sourcepub fn set_source(&mut self, src: &Path)
pub fn set_source(&mut self, src: &Path)
Set the source of the configuration if it is not already set on load.
Trait Implementations§
source§impl AssetManager for WickConfiguration
impl AssetManager for WickConfiguration
type Asset = AssetReference
fn set_baseurl(&self, baseurl: &Path)
fn assets(&self) -> Assets<'_, AssetReference>
fn get_asset_flags(&self) -> u32
source§impl Clone for WickConfiguration
impl Clone for WickConfiguration
source§fn clone(&self) -> WickConfiguration
fn clone(&self) -> WickConfiguration
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more