pub async fn new(state: ConfigState, context: &str) -> Result<(Config, Region)> {
        let mut conf = Self::read().await?;
        let region = if let Some(r) = conf.resolve_context(context.to_string()) {
            r
        } else {
            error!("Please use an existing kube context or add your current context to shipcat.conf");
            bail!(
                "The current kube context ('{}') is not defined in shipcat.conf",
                context
            );
        };

        if state == ConfigState::Filtered || state == ConfigState::Base {
            conf.remove_redundant_regions(&region)?;
        } else if state != ConfigState::UnionisedBase {
            bail!("Config::new only supports Filtered, Base and UnionisedBase types");
        }

        if state == ConfigState::Filtered {
            conf.secrets(&region).await?;
        }
        let reg = conf.get_region(&region)?;
        Ok((conf, reg))
    }
/// Main constructor for CLI
///
/// Pass this a region request via argument or a current context
Main constructor for CLI
Pass this a region request via argument or a current context
Main constructor for CLI Pass this a region request via argument or a current context
pub async fn new(state: ConfigState, context: &str) -> Result<(Config, Region)> {
        let mut conf = Self::read().await?;
        let region = if let Some(r) = conf.resolve_context(context.to_string()) {
            r
        } else {
            error!("Please use an existing kube context or add your current context to shipcat.conf");
            bail!(
                "The current kube context ('{}') is not defined in shipcat.conf",
                context
            );
        };
        if state == ConfigState::Filtered || state == ConfigState::Base {
            conf.remove_redundant_regions(&region)?;
        } else if state != ConfigState::UnionisedBase {
            bail!("Config::new only supports Filtered, Base and UnionisedBase types");
        }
        if state == ConfigState::Filtered {
            conf.secrets(&region).await?;
        }
        let reg = conf.get_region(&region)?;
        Ok((conf, reg))
    }
pub async fn new ( state : ConfigState , context : & str ) -> Result < ( Config , Region ) > { let mut conf = Self :: read ( ) . await ? ; let region = if let Some ( r ) = conf . resolve_context ( context . to_string ( ) ) { r } else { error ! ( " " ) ; bail ! ( " " context ) ; } ; if state == ConfigState :: Filtered || state == ConfigState :: Base { conf . remove_redundant_regions ( & region ) ? ; } else if state != ConfigState :: UnionisedBase { bail ! ( " " ) ; } if state == ConfigState :: Filtered { conf . secrets ( & region ) . await ? ; } let reg = conf . get_region ( & region ) ? ; Ok ( ( conf , reg ) ) }
Main constructor for CLI
Pass this a region request via argument or a current context
Main constructor for CLI Pass this a region request via argument or a current context
state
ConfigState
context
&str
state
ConfigState
context
&str