uac_cli.utils package

Submodules

uac_cli.utils.config module

uac_cli.utils.config._ensure_uac_dir()[source]
uac_cli.utils.config._load_yaml(path: Path, label: str) Optional[dict][source]

Read and parse a YAML file, raising a ClickException on parse errors.

uac_cli.utils.config.ask_profile(profile)[source]
uac_cli.utils.config.get_default_view() str[source]

Return ‘json’ or ‘table’, defaulting to ‘json’ when not configured.

uac_cli.utils.config.get_table_settings() dict[source]

Return table settings merged with hardcoded defaults, with validation.

uac_cli.utils.config.get_view_columns(command: tuple) Optional[list][source]

Look up output_options.table_columns for the command tuple and return the column list, or None.

uac_cli.utils.config.migrate_profiles_to_config() None[source]

One-time migration: profiles.yml → config.yml. Leaves profiles.yml intact.

uac_cli.utils.config.read_config() Optional[dict][source]

Return the profiles dict, or None if no config exists or profiles is empty.

uac_cli.utils.config.read_config_file() Optional[dict][source]

Read ~/.uac/config.yml, returning the full document or None.

uac_cli.utils.config.read_profile(profile_name: str) Optional[dict][source]

Return a single profile. Prefers config.yml, falls back to profiles.yml.

uac_cli.utils.config.write_config_file(cfg: dict, silent: bool = False) None[source]

Write the full config document to ~/.uac/config.yml.

uac_cli.utils.config.write_profile(profile_name: str, profile: dict) None[source]

Write a profile into config.yml, creating the file with defaults if needed.

uac_cli.utils.options module

uac_cli.utils.options._parse_table_format(ctx, param, value)[source]

uac_cli.utils.process module

uac_cli.utils.process.add_payload_value(vars_dict, _input, binary)[source]

Modify vars_dict with payload data extracted from _input.

If _input is non-binary, it is read as a dictionary. Values in vars_dict (from command line arguments) are converted and used to overwrite corresponding keys in the payload dictionary.

If _input is binary, the raw data is stored directly under the “data” key in vars_dict.

Parameters:
  • vars_dict (dict) – Dictionary of existing key-value pairs.

  • _input (file-like or None) – Optional input stream with data to be added.

  • binary (bool) – Flag indicating if _input is binary data.

Note: Command Line keys will only overwrite existing keys in the payload; new keys will NOT be added.

uac_cli.utils.process.create_payload(args)[source]
uac_cli.utils.process.get_keyname(data, key)[source]
uac_cli.utils.process.get_nested_value(data, dotted_key)[source]

Traverse nested dicts using dot notation (e.g., ‘name.label’).

uac_cli.utils.process.input_value_parsing(value)[source]
uac_cli.utils.process.print_json_table(data, fieldnames, columns_source='defaults')[source]

Converts JSON data into a formatted table and prints it using rich.

Parameters:
  • data – List of dictionaries representing the JSON data.

  • fieldnames – List of field name strings to include in the table (in desired order).

  • columns_source – Where fieldnames originated — “flag”, “config”, or “defaults”.

uac_cli.utils.process.process_input(args, _input=None, binary=False)[source]

Processes input arguments (including argument file) into a dictionary of key-value pairs.

Converts a list of “key=value” strings into a dictionary.If an argument file exists, reads additional key-value pairs from it, adding keys not present.

If _input is provided and the keys “retain_sys_ids” or “retainSysIds” are absent, adds “retain_sys_ids” = “true”. Then calls add_payload_value to overwrite duplicate keys.

Parameters:
  • args (list of str) – Command line arguments as “key=value” strings.

  • _input (optional) – Input stream supplying JSON or binary payload.

  • binary (bool) – Whether _input is binary data.

Returns:

Dictionary of all parsed and merged key-value pairs.

Return type:

dict

uac_cli.utils.process.process_output(output, select, response, text=False, binary=False, table=None, table_fields=None, command=None)[source]
uac_cli.utils.process.snake_to_camel(snake_case_str)[source]

Converts a snake_case string to camelCase.

Parameters:

snake_case_str – The string in snake_case format.

Returns:

The converted string in camelCase format.

Module contents