Loads the context from the provided arguments.
(
ContextLoadArgs {
config_file_path,
output_format,
no_color,
region,
profile,
}: ContextLoadArgs,
)
| 66 | impl Context { |
| 67 | /// Loads the context from the provided arguments. |
| 68 | pub async fn load( |
| 69 | ContextLoadArgs { |
| 70 | config_file_path, |
| 71 | output_format, |
| 72 | no_color, |
| 73 | region, |
| 74 | profile, |
| 75 | }: ContextLoadArgs, |
| 76 | ) -> Result<Context, Error> { |
| 77 | let config_file_path = match config_file_path { |
| 78 | None => ConfigFile::default_path()?, |
| 79 | Some(path) => path, |
| 80 | }; |
| 81 | let config_file = ConfigFile::load(config_file_path).await?; |
| 82 | Ok(Context { |
| 83 | config_file, |
| 84 | output_formatter: OutputFormatter::new(output_format, no_color), |
| 85 | region, |
| 86 | profile, |
| 87 | }) |
| 88 | } |
| 89 | |
| 90 | /// Retrieves the admin endpoint from the configuration file. |
| 91 | /// |