pub struct Config {
pub api_url: Url,
pub client_id: ClientId,
pub tenant_id: String,
pub client_secret: Option<Secret>,
pub scope: Option<String>,
}Expand description
Freta client Config
Fields§
§api_url: UrlURL for the Freta API.
NOTE: For the public Freta service, this should always be https://freta.microsoft.com
client_id: ClientIdAAD app registration client id
tenant_id: StringTenant of the AAD app registration for the client
client_secret: Option<Secret>Client Secrt for custom app registrations to connect to Freta
scope: Option<String>AAD App registration scope
Implementations§
source§impl Config
impl Config
sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a new Config with the default values
Errors
This will return an error if the default API URL cannot be parsed.
sourcepub async fn load_or_default() -> Result<Self>
pub async fn load_or_default() -> Result<Self>
Load the user’s current configuration or use the default if that does not exist
Errors
This will return an error in the following cases:
- The path loading the configuration file cannot be determined
- Loading the configuration file fails
- Saving the default configuration file fails if there is not an existing file
sourcepub async fn save(&self) -> Result<()>
pub async fn save(&self) -> Result<()>
Save the user’s configuration to ~/.config/freta/cli.config
At the moment, client configuration only includes login configuration information. Therefore, on any change, log the user out and log them back in.
Errors
This will return an error if the configuration file cannot be saved