azureenergylabelercli package

Submodules

azureenergylabelercli.azureenergylabelercli module

Main code for azureenergylabelercli.

azureenergylabelercli.azureenergylabelercli.comma_delimited_list(argument, sep=',')[source]

Takes a str, splits based on character and returns a list.

azureenergylabelercli.azureenergylabelercli.get_arguments()[source]

Gets us the cli arguments.

Returns the args as parsed from the argsparser.

azureenergylabelercli.azureenergylabelercli.get_subscription_reporting_data(tenant_id, subscription_id, export_all_data_flag, frameworks, log_level, disable_spinner)[source]

Gets the reporting data for a single account.

Parameters:
  • tenant_id – Tenant Id of the tenant

  • subscription_id – The ID of the subscription to get reporting on.

  • export_all_data_flag – If set all data is going to be exported, else only basic reporting.

  • frameworks – The frameworks to include in scoring.

  • log_level – The log level set.

  • disable_spinner – The spinner will be disabled while retrieving the findings.

Returns:

report_data, exporter_arguments

azureenergylabelercli.azureenergylabelercli.get_tenant_reporting_data(tenant_id, allowed_subscription_ids, denied_subscription_ids, denied_resource_group_names, export_all_data_flag, frameworks, log_level, disable_spinner)[source]

Gets the reporting data for a landing zone.

Parameters:
  • tenant_id – Tenant Id of the tenant

  • allowed_subscription_ids – The allowed subscription ids for tenant inclusion if any.

  • denied_subscription_ids – The denied subscription ids for tenant zone exclusion if any.

  • denied_resource_group_names – List of resource groups to exclude if any.

  • export_all_data_flag – If set all data is going to be exported, else only basic reporting.

  • frameworks – The frameworks to include in scoring.

  • log_level – The log level set.

  • disable_spinner – The spinner will be disabled while retrieving the findings.

Returns:

report_data, exporter_arguments

azureenergylabelercli.azureenergylabelercli.setup_logging(level, config_file=None)[source]

Sets up the logging.

Needs the args to get the log level supplied

Parameters:
  • level – At which level do we log

  • config_file – Configuration to use

azureenergylabelercli.azureenergylabelercli.wait_for_findings(method_name, method_argument, log_level, disable_spinner=False)[source]

If log level is not debug shows a spinner while the callable provided gets security hub findings.

Parameters:
  • method_name – The method to execute while waiting.

  • method_argument – The argument to pass to the method.

  • log_level – The log level as set by the user.

  • disable_spinner – The spinner will be disabled while retrieving the findings.

Returns:

A list of defender for cloud findings as retrieved by the callable.

Return type:

findings

azureenergylabelercli.azureenergylabelercliexceptions module

Custom exception code for azureenergylabelercli.

exception azureenergylabelercli.azureenergylabelercliexceptions.MissingRequiredArguments[source]

Bases: Exception

Missing a required argument.

exception azureenergylabelercli.azureenergylabelercliexceptions.MutuallyExclusiveArguments[source]

Bases: Exception

Mutually exclusive variables are set.

azureenergylabelercli.validators module

Main code for validators.

class azureenergylabelercli.validators.ValidatePath(option_strings, dest, nargs=None, **kwargs)[source]

Bases: Action

Validates a given path.

azureenergylabelercli.validators.azure_subscription_id(subscription_id)[source]

Setting a type for an subscription id argument.

azureenergylabelercli.validators.get_mutually_exclusive_args(arg1, arg2, required=False, msg=None)[source]

Test if multiple mutually exclusive arguments are provided.

Parameters:
  • arg1 (Any) – First argument to be checked

  • arg2 (Any) – Second argument to be checked

  • required (bool, optional) – Wether one argument is required. Defaults to False.

  • msg (str, optional) – Error message shown to the user. Defaults to None.

Raises:
Returns:

arg1 and arg2 after validation

Module contents

azureenergylabelercli package.

Import all parts from azureenergylabelercli here