runway.cfngin.hooks.protocols module

Protocols for structural typing.

For more information on protocols, refer to PEP 544.

class runway.cfngin.hooks.protocols.CfnginHookArgsProtocol[source]

Bases: typing_extensions.Protocol

Protocol for CFNgin hook arguments class.

This class defines a structural interface for all CFNgin hook argument classes. It is recommended to use the provided base class in place of this when authoring a new argument class.

abstract get(__name: str) Optional[Any][source]
abstract get(__name: str, __default: Union[Any, runway.cfngin.hooks.protocols._T]) Union[Any, runway.cfngin.hooks.protocols._T]

Safely get the value of an attribute.

Parameters
  • name – Attribute name to return the value for.

  • default – Value to return if attribute is not found.

__init__(*args, **kwargs)
__new__(**kwargs)
class runway.cfngin.hooks.protocols.CfnginHookProtocol[source]

Bases: typing_extensions.Protocol

Protocol for CFNgin hooks.

This class defines a structural interface for all CFNgin hook classes. Classes used for hooks do not need to subclass this hook. They only need to implement a similar interface. While not required, it is still acceptable to subclass this class for full type checking of a hook class.

args: runway.cfngin.hooks.protocols.CfnginHookArgsProtocol

Arguments passed to the hook and parsed into an object.

abstract __init__(context: runway.context.CfnginContext, **_kwargs: Any) None[source]

Structural __init__ method.

This should not be called. Pylint will erroneously warn about “super-init-not-called” if using this class as a subclass. This should be disabled in-line until the bug reports for this issue is resolved.

abstract post_deploy() Any[source]

Run during the post_deploy stage.

Returns

A “truthy” value if the hook was successful or a “falsy” value if the hook failed.

__new__(**kwargs)
abstract post_destroy() Any[source]

Run during the post_destroy stage.

Returns

A “truthy” value if the hook was successful or a “falsy” value if the hook failed.

abstract pre_deploy() Any[source]

Run during the pre_deploy stage.

Returns

A “truthy” value if the hook was successful or a “falsy” value if the hook failed.

abstract pre_destroy() Any[source]

Run during the pre_destroy stage.

Returns

A “truthy” value if the hook was successful or a “falsy” value if the hook failed.