Config (autotransform.config.config)¶
The Config represents settings that control how AutoTransform operates.
- class autotransform.config.config.Config(*, component_directory: Optional[str] = None, github_token: Optional[str] = None, github_base_url: Optional[str] = None, jenkins_user: Optional[str] = None, jenkins_token: Optional[str] = None, jenkins_base_url: Optional[str] = None, local_runner: Optional[Runner] = None, remote_runner: Optional[Runner] = None, repo_override: Optional[Repo] = None)¶
Bases:
ComponentModel
A collection of settings for configuring the functionality of AutoTransform.
- component_directory¶
The directory where custom component JSON files are located. If not provided, autotransform/ will be used. Defaults to None.
- Type:
Optional[str], optional
- github_token¶
The Github token to use for authentication. Defaults to None.
- Type:
Optional[str], optional
- github_base_url¶
The base URL for API requests to Github. Used for Github Enterprise. Defaults to None.
- Type:
Optional[str], optional
- jenkins_user¶
The Jenkins username for authentication. Defaults to None.
- Type:
Optional[str], optional
- jenkins_token¶
The Jenkins token to use for authentication. Defaults to None.
- Type:
Optional[str], optional
- jenkins_base_url¶
The base URL for requests to Jenkins. Defaults to None.
- Type:
Optional[str], optional
- remote_runner¶
The runner to use for remote runs. Defaults to None.
- Type:
Optional[Runner], optional
- repo_override¶
A repo to use in place of any schema repos. Defaults to None.
- Type:
Optional[Repo], optional
- component_directory: Optional[str]¶
- static from_console(prev_config: Optional[Config] = None, simple: bool = False, use_github: Optional[bool] = None, use_jenkins: Optional[bool] = None, user_config: bool = False) Tuple[Config, bool, bool] ¶
Gets a Config using console inputs.
- Parameters:
prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.
simple (bool, optional) – Whether to use the simple setup. Defaults to False.
use_github (bool, optional) – Whether to use Github or not. Defaults to None.
use_jenkins (bool, optional) – Whether to use Jenkins or not. Defaults to None.
user_config (bool, optional) – Whether this configuration is for a user level Config. Defaults to False.
- Returns:
The input Config and whether it uses Github and Jenkins.
- Return type:
Tuple[Config, bool, bool]
- static from_data(data: Dict[str, Any]) Config ¶
Produces an instance of the Config from decoded data.
- Parameters:
data (Mapping[str, Any]) – The JSON decoded data.
- Returns:
An instance of the Config.
- Return type:
- static from_json(config_json: str) Config ¶
Builds a Config from JSON encoded values.
- Parameters:
config_json (str) – The JSON encoded Config.
- Returns:
The Config from the JSON.
- Return type:
- static get_component_directory_from_console(prev_config: Optional[Config] = None, simple: bool = False) Optional[str] ¶
Gets the component directory using console inputs.
- Parameters:
prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.
simple (bool, optional) – Whether to use the simple setup. Defaults to False.
- Returns:
The component directory.
- Return type:
Optional[str]
- static get_github_base_url_from_console(prev_config: Optional[Config] = None, simple: bool = False) Optional[str] ¶
Gets the Github base URL using console inputs.
- Parameters:
prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.
simple (bool, optional) – Whether to use the simple setup. Defaults to False.
- Returns:
The Github base URL.
- Return type:
Optional[str]
- static get_github_token_from_console(prev_config: Optional[Config] = None, simple: bool = False, user_config: bool = False) Optional[str] ¶
Gets the Github token using console inputs.
- Parameters:
prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.
simple (bool, optional) – Whether to use the simple setup. Defaults to False.
user_config (bool, optional) – Whether this configuration is for a user level Config. Defaults to False.
- Returns:
The Github token.
- Return type:
Optional[str]
- static get_jenkins_base_url_from_console(prev_config: Optional[Config] = None, simple: bool = False) Optional[str] ¶
Gets the Jenkins base URL using console inputs.
- Parameters:
prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.
simple (bool, optional) – Whether to use the simple setup. Defaults to False.
- Returns:
The Jenkins base URL.
- Return type:
Optional[str]
- static get_jenkins_token_from_console(prev_config: Optional[Config] = None, simple: bool = False, user_config: bool = False) Optional[str] ¶
Gets the Jenkins token using console inputs.
- Parameters:
prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.
simple (bool, optional) – Whether to use the simple setup. Defaults to False.
user_config (bool, optional) – Whether this configuration is for a user level Config. Defaults to False.
- Returns:
The Jenkins token.
- Return type:
Optional[str]
- static get_jenkins_user_from_console(prev_config: Optional[Config] = None, simple: bool = False) Optional[str] ¶
Gets the Jenkins user using console inputs.
- Parameters:
prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.
simple (bool, optional) – Whether to use the simple setup. Defaults to False.
- Returns:
The Jenkins user.
- Return type:
Optional[str]
- static get_local_runner_from_console(prev_config: Optional[Config] = None, simple: bool = False) Optional[Runner] ¶
Gets the local runner using console inputs.
- static get_remote_runner_from_console(prev_config: Optional[Config] = None, use_github: bool = False, use_jenkins: bool = False, simple: bool = False) Optional[Runner] ¶
Gets the remote runner using console inputs.
- Parameters:
prev_config (Optional[Config], optional) – Previously input Config. Defaults to None.
use_github (bool, optional) – Whether to use Github or not. Defaults to False.
use_jenkins (bool, optional) – Whether to use Jenkins or not. Defaults to False.
simple (bool, optional) – Whether to use the simple setup. Defaults to False.
- Returns:
The local runner.
- Return type:
Optional[Runner]
- static get_repo_override_from_console(prev_config: Optional[Config] = None, simple: bool = False) Optional[Repo] ¶
Gets the repo override using console inputs.
- github_base_url: Optional[str]¶
- github_token: Optional[str]¶
- jenkins_base_url: Optional[str]¶
- jenkins_token: Optional[str]¶
- jenkins_user: Optional[str]¶
- merge(other: Config) Config ¶
Merges the Config with another Config. Settings in the other Config will override those in this Config.
- static read(file_path: str) Config ¶
Reads the Config from a JSON encoded file.
- Parameters:
file_path (str) – The path where the JSON for the Config is located.
- Returns:
The Config from the file.
- Return type:
- write(file_path: str) None ¶
Writes the Config to a file as JSON.
- Parameters:
file_path (str) – The file to write the Config to.