ConditionalStep (autotransform.step.conditional)

Conditions

Conditions are used by ConditionalStep to determine whether to take an Action. Provides a generic way for creating Steps that take action conditionally.

ConditionalStep

The implementation for the ConditionalStep.

class autotransform.step.conditional.ConditionalStep(*, actions: List[Action], condition: Condition, continue_if_passed: bool = False)

Bases: Step

A step which takes action based on whether a particular condition is passed. Allows for creating customized steps based on different Change attributes readily through JSON.

actions

The Actions to perform if the Condition passes.

Type:

List[Action]

condition

The condition to check.

Type:

Condition

continue_if_passed

Whether to continue on to the next step after performing the action if the condition passes. Defaults to False.

Type:

bool, optional

name

The name of the component.

Type:

ClassVar[StepName]

actions: List[Action]
condition: Condition
continue_if_passed: bool
continue_management(change: Change) bool

Checks if management should be continued after this Step when Actions were provided.

Parameters:

change (Change) – The Change the Step is running against.

Returns:

Whether to continue management.

Return type:

bool

classmethod from_data(data: Dict[str, Any]) ConditionalStep

Produces an instance of the component from decoded data.

Parameters:

data (Mapping[str, Any]) – The JSON decoded data.

Returns:

An instance of the component.

Return type:

ConditionalStep

get_actions(change: Change) List[Action]

Checks the Change against the provided Condition and returns the appropriate Actions based on whether or not the Condition is passed. If no Actions are returned, the Step is skipped.

Parameters:

change (Change) – The Change the Step is running against.

Returns:

The Actions the Step wants to take.

Return type:

List[Action]

name: ClassVar[StepName] = 'conditional'