cloudos_cli.configure.configure¶
Classes
|
Class to manage configuration profiles for the CloudOS CLI. |
- class cloudos_cli.configure.configure.ConfigurationProfile(config_dir=None)[source]¶
Bases:
object
Class to manage configuration profiles for the CloudOS CLI. This class provides methods to create, list, remove, and load profiles from configuration files. It also allows setting a profile as the default profile. .. attribute:: config_dir
Directory where the configuration files are stored.
- type:
str
- credentials_file¶
Path to the credentials file.
- Type:
str
- config_file¶
Path to the config file.
- Type:
str
- check_if_profile_exists(profile_name)[source]¶
Check if a profile exists in the config file. Parameters: ———- profile_name : str
The name of the profile to check.
Returns:¶
- bool
True if the profile exists, False otherwise.
- create_profile_from_input(profile_name)[source]¶
Interactively create a profile in credentials and config files. Parameters: ———- profile_name : str
The name of the profile to create or update. If the profile already exists, the user will be prompted to update its parameters.
This method guides the user through an interactive process to input or update profile details such as API token, platform URL, workspace ID, project name, execution platform, repository provider, and workflow name. The profile can also be set as the default profile if desired. The API token is stored in the credentials file, while other settings are stored in the config file. If the profile already exists, existing values are pre-filled for convenience.
- determine_default_profile()[source]¶
Determine the default profile from the config file. Returns: ——- str
The name of the default profile, or None if no default is set.
- static get_param_value(ctx, param_value, param_name, default_value, required=False, missing_required_params=None)[source]¶
- load_profile(profile_name)[source]¶
Load a profile from the config and credentials files. Parameters: ———- profile_name : str
The name of the profile to load.
Returns:¶
- dict
A dictionary containing the profile details.
- load_profile_and_validate_data(ctx, init_profile, cloudos_url_default, profile, required_dict, apikey=None, cloudos_url=None, workspace_id=None, project_name=None, workflow_name=None, execution_platform=None, repository_platform=None, session_id=None, procurement_id=None)[source]¶
Load profile data and validate required parameters.
- Parameters:
ctx (click.Context) – The Click context object.
init_profile (str) – A default string to identify if any profile is available
cloudos_url_default (str) – The default cloudos URL to compare with the one from the profile
profile (str) – The profile name to load.
required_dict (dict) – A dictionary with param name as key and whether is required or not (as bool) as value.
apikey (string) – The values coming from the CLI to be compared with the profile
cloudos_url (string) – The values coming from the CLI to be compared with the profile
workspace_id (string) – The values coming from the CLI to be compared with the profile
project_name (string) – The values coming from the CLI to be compared with the profile
workflow_name (string) – The values coming from the CLI to be compared with the profile
execution_platform (string) – The values coming from the CLI to be compared with the profile
repository_platform (string) – The values coming from the CLI to be compared with the profile
session_id (string) – The values coming from the CLI to be compared with the profile
- Returns:
A dictionary containing the loaded and validated parameters.
- Return type:
dict