aria.cli

CLI package.

aria.cli.color

Terminal colorization utilities.

class aria.cli.color.ColorSpec(fore=None, back=None, style=None)

Bases: object

It is possible to provide fore, back and style arguments. each could be either the color is lower case letter, or the actual color from Colorama.

class aria.cli.color.Colors

Bases: object

Back = <colorama.ansi.AnsiBack object>
Fore = <colorama.ansi.AnsiFore object>
Style = <colorama.ansi.AnsiStyle object>
class aria.cli.color.StringStylizer(str_, color_spec=None)

Bases: object

color(color_spec)
format(*args, **kwargs)
highlight(pattern, schema)
replace(old, new, **kwargs)

aria.cli.csar

Support for the CSAR (Cloud Service ARchive) packaging specification.

See the TOSCA Simple Profile v1.0 cos01 specification

aria.cli.csar.is_csar_archive(source)
aria.cli.csar.read(source, destination=None, logger=None)
aria.cli.csar.write(service_template_path, destination, logger)

aria.cli.defaults

Various CLI default values.

aria.cli.defaults.SERVICE_TEMPLATE_FILENAME = 'service_template.yaml'

Default service template filename

aria.cli.defaults.SORT_DESCENDING = False

Default sort descending

aria.cli.defaults.TASK_MAX_ATTEMPTS = 30

Default task max attempts

aria.cli.defaults.TASK_RETRY_INTERVAL = 30

Default task retry interval

aria.cli.exceptions

CLI exceptions.

exception aria.cli.exceptions.AriaCliError

Bases: aria.exceptions.AriaError

aria.cli.execution_logging

Formatting for executions sub-commands.

aria.cli.execution_logging.log(item, mark_pattern=None, *args, **kwargs)
aria.cli.execution_logging.log_list(iterator, mark_pattern=None)
aria.cli.execution_logging.stylize_log(item, mark_pattern)

aria.cli.helptexts

Gathers all CLI command help texts in one place.

aria.cli.inputs

Helpers for validating and coercing service template inputs.

aria.cli.inputs.inputs_to_dict(resources)

Returns a dictionary of inputs

Parameters:resources

can be:

  • list of files
  • single file
  • directory containing multiple input files
  • key1=value1;key2=value2 pairs string.
  • string formatted as JSON/YAML
  • wildcard based string (e.g. *-inputs.yaml)

aria.cli.logger

Centralized logging configuration and formatting.

class aria.cli.logger.Logging(config)

Bases: object

is_high_verbose_level()
log_file
logger
verbosity_level
class aria.cli.logger.ModelLogIterator(model_storage, execution_id, filters=None, sort=None, offset=0)

Bases: object

aria.cli.main

Executable entry point into the CLI.

aria.cli.main.main()

aria.cli.service_template_utils

Loading mechanism for service templates.

aria.cli.service_template_utils.get(source, service_template_filename)

Get a source and return a path to the main service template file

The behavior based on then source argument content is:

  • local .yaml file: return the file
  • local archive (.csar, .zip, .tar, .tar.gz, and .tar.bz2): extract it locally and return path service template file
  • URL: download and get service template from downloaded archive
  • GitHub repo: download and get service template from downloaded archive
Parameters:
  • source (basestring) – path/URL/GitHub repo to archive/service-template file
  • service_template_filename (basestring) – path to service template if source is a non-CSAR archive with CSAR archives, this is read from the metadata file)
Returns:

path to main service template file

Return type:

basestring

aria.cli.table

Tabular formatting utilities.

aria.cli.table.print_data(columns, items, header_text, column_formatters=None, col_max_width=None, defaults=None)

Prints data in a tabular form.

Parameters:
  • columns (iterable of basestring) – columns of the table, e.g. ['id','name']
  • items – each element must have keys or attributes corresponding to the columns items, e.g. [{'id':'123', 'name':'Pete'}]
  • column_formatters ({basestring: function}) – maps column name to formatter, a function that may manipulate the string values printed for this column, e.g. {'created_at': timestamp_formatter}
  • col_max_width (int) – maximum width of table
  • defaults ({basestring: basestring}) – default values for keys that don’t exist in the data itself, e.g. {'serviceId':'123'}
aria.cli.table.timestamp_formatter(value)
aria.cli.table.trim_formatter_generator(max_length)

aria.cli.utils

Miscellaneous CLI utilities.

aria.cli.utils.check_overriding_storage_exceptions(e, model_class, name)

Checks whether the storage exception is a known type where we’d like to override the exception message; If so, it raises a new error. Otherwise it simply returns.

aria.cli.utils.download_file(url)
aria.cli.utils.generate_progress_handler(file_path, action='', max_bar_length=80)

Returns a function that prints a progress bar in the terminal.

Parameters:
  • file_path – the name of the file being transferred
  • action – uploading/downloading
  • max_bar_length – maximum allowed length of the bar
Returns:

configured print_progress function

aria.cli.utils.get_parameter_templates_as_string(parameter_templates)
aria.cli.utils.storage_sort_param(sort_by, descending)

aria.cli.config

CLI configuration package.

aria.cli.config.config

CLI configuration mechanism.

class aria.cli.config.config.CliConfig(config_path)

Bases: object

class Logging(logging)

Bases: object

class Execution(execution_logging)

Bases: object

colors
colors_enabled
formats
execution
filename
loggers
classmethod create_config(workdir)
logging

aria.cli.core

CLI core package.

aria.cli.core.aria

Enhancements and ARIA-specific conveniences for Click.

class aria.cli.core.aria.AliasedGroup(*args, **kwargs)

Bases: click.core.Group

get_command(ctx, cmd_name)
resolve_command(ctx, args)

Override clicks resolve_command method and appends Did you mean … suggestions to the raised exception message.

class aria.cli.core.aria.MutuallyExclusiveOption(*args, **kwargs)

Bases: click.core.Option

handle_parse_result(ctx, opts, args)
class aria.cli.core.aria.Options

Bases: object

The options API is nicer when you use each option by calling @aria.options.some_option instead of @aria.some_option.

Note that some options are attributes and some are static methods. The reason for that is that we want to be explicit regarding how a developer sees an option. If it can receive arguments, it’s a method - if not, it’s an attribute.

static execution_id(required=False)
static force(help)
static inputs(help)
static mark_pattern()
static service_id(required=False)
static service_name(required=False)
static service_template_id(required=False)
static service_template_name(required=False)
static service_template_path(required=False)
static sort_by(default='created_at')
static task_max_attempts(default=30)
static task_retry_interval(default=30)
static verbose(expose_value=False)
aria.cli.core.aria.argument(*args, **kwargs)

Make Click arguments specific to ARIA.

This exists purely for aesthetic reasons, otherwise some decorators are called @click.something instead of @aria.something

aria.cli.core.aria.command(*args, **kwargs)

Make Click commands ARIA specific.

This exists purely for aesthetic reasons, otherwise some decorators are called @click.something instead of @aria.something.

aria.cli.core.aria.group(name)

Allow to create a group with a default click context and a class for Click’s didyoueamn without having to repeat it for every group.

aria.cli.core.aria.inputs_callback(ctx, param, value)

Allow to pass any inputs we provide to a command as processed inputs instead of having to call inputs_to_dict inside the command.

@aria.options.inputs already calls this callback so that every time you use the option it returns the inputs as a dictionary.

aria.cli.core.aria.mutually_exclusive_option(*param_decls, **attrs)

Decorator for mutually exclusive options.

This decorator works similarly to click.option, but supports an extra mutually_exclusive argument, which is a list of argument names with which the option is mutually exclusive.

You can optionally also supply mutuality_description and mutuality_error to override the default messages.

NOTE: All mutually exclusive options must use this. It’s not enough to use it in just one of the options.

aria.cli.core.aria.pass_context(func)

Make click context ARIA specific.

This exists purely for aesthetic reasons, otherwise some decorators are called @click.something instead of @aria.something.

aria.cli.core.aria.pass_logger(func)

Simply passes the logger to a command.

aria.cli.core.aria.pass_model_storage(func)

Simply passes the model storage to a command.

aria.cli.core.aria.pass_plugin_manager(func)

Simply passes the plugin manager to a command.

aria.cli.core.aria.pass_resource_storage(func)

Simply passes the resource storage to a command.

aria.cli.core.aria.set_cli_except_hook()
aria.cli.core.aria.set_verbosity_level(ctx, param, value)
aria.cli.core.aria.show_version(ctx, param, value)