google.cloud.forseti.actions.action_config_validator module

Actions configuration validator.

exception ActionTypeDoesntExist[source]

Bases: google.cloud.forseti.actions.action_config_validator.Error

ActionTypeDoesntExist.

exception ConfigLoadError[source]

Bases: google.cloud.forseti.actions.action_config_validator.Error

ConfigLoadError.

exception ConfigParseError(errors)[source]

Bases: google.cloud.forseti.actions.action_config_validator.Error

ConfigParseError.

CUSTOM_ERROR_MSG = 'Found {0} errors in the config.'
exception DuplicateActionIdError(action_id)[source]

Bases: google.cloud.forseti.actions.action_config_validator.Error

DuplicateActionIdError.

CUSTOM_ERROR_MSG = 'Found duplicate action id: {0}'
exception EmptyActionTrigger[source]

Bases: google.cloud.forseti.actions.action_config_validator.Error

EmptyActionType.

exception EmptyActionType[source]

Bases: google.cloud.forseti.actions.action_config_validator.Error

EmptyActionType.

exception Error[source]

Bases: exceptions.Exception

Base Error class.

exception MissingRequiredActionField[source]

Bases: google.cloud.forseti.actions.action_config_validator.Error

MissingRequiredActionField.

exception TriggerDoesntExist[source]

Bases: google.cloud.forseti.actions.action_config_validator.Error

ActionTypeDoesntExist.

_check_action_type(action)[source]

Validates the action type.

Parameters:action (dict) – An action dictionary.
Returns:If the action type doesn’t exist.
Return type:ActionTypeDoesntExist
_check_trigger(action)[source]

Validates the triggers.

Parameters:action (dict) – An action dictionary.
Returns:If the trigger type doesn’t exist or the trigger is missing.
Return type:Error
_load_actions(config)[source]

Loads the actions actions from the config.

Parameters:config (dict) – A dictionary configuration.
Returns:A tuple of the actions and errors.
Return type:Tuple
_load_and_validate_yaml(path)[source]

Loads the configuration from a path.

Parameters:path (str) – The path the the configuration.
Returns:The loaded configuration dictionary.
Return type:dict
Raises:ConfigLoadError – If the config cannot be loaded.
validate(actions_config_path)[source]

Validates the actions config.

Action configuration validation: 1. Config is a valid yaml file. 2. Each action has an id and it is unique. 3. Check each action for:

  1. An action type.
  2. That the action type is valid.
  3. A trigger.
  4. That the trigger is valid.
Parameters:actions_config_path (str) – The actions configuration path.
Returns:The dict configuration.
Return type:dict
Raises:ConfigLoadError – If the config cannot be loaded.