[docs]classStatus:"""CFNgin status base class. Attributes: name: Name of the status. code: Status code. reason: Reason for the status. """code:intname:strreason:str|None
[docs]def__init__(self,name:str,code:int,reason:str|None=None)->None:"""Instantiate class. Args: name: Name of the status. code: Status code. reason: Reason for the status. """self.name=nameself.code=codeself.reason=reasonorgetattr(self,"reason",None)
def_comparison(self,operator_:Callable[[Any,Any],bool],other:Any)->bool:"""Compare self to another object. Args: operator_: Operator for the comparison. other: The other object to compare to self. Raises: NotImplemented: other does not have ``code`` attribute. """ifhasattr(other,"code"):returnoperator_(self.code,other.code)returnNotImplemented
[docs]def__eq__(self,other:object)->bool:"""Compare if self is equal to another object."""returnself._comparison(operator.eq,other)
[docs]def__ne__(self,other:object)->bool:"""Compare if self is not equal to another object."""returnself._comparison(operator.ne,other)
[docs]def__lt__(self,other:Any)->bool:"""Compare if self is less than another object."""returnself._comparison(operator.lt,other)
[docs]def__gt__(self,other:Any)->bool:"""Compare if self is greater than another object."""returnself._comparison(operator.gt,other)
[docs]def__le__(self,other:Any)->bool:"""Compare if self is less than or equal to another object."""returnself._comparison(operator.le,other)
[docs]def__ge__(self,other:Any)->bool:"""Compare if self is greater than equal to another object."""returnself._comparison(operator.ge,other)
[docs]classCompleteStatus(Status):"""Status name of 'complete' with code of '2'."""
[docs]def__init__(self,reason:str|None=None)->None:"""Instantiate class. Args: reason: Reason for the status. """super().__init__("complete",2,reason)
[docs]classFailedStatus(Status):"""Status name of 'failed' with code of '4'."""
[docs]def__init__(self,reason:str|None=None)->None:"""Instantiate class. Args: reason: Reason for the status. """super().__init__("failed",4,reason)
[docs]classPendingStatus(Status):"""Status name of 'pending' with code of '0'."""
[docs]def__init__(self,reason:str|None=None)->None:"""Instantiate class. Args: reason: Reason for the status. """super().__init__("pending",0,reason)
[docs]classSkippedStatus(Status):"""Status name of 'skipped' with code of '3'."""
[docs]def__init__(self,reason:str|None=None)->None:"""Instantiate class. Args: reason: Reason for the status. """super().__init__("skipped",3,reason)
[docs]classSubmittedStatus(Status):"""Status name of 'submitted' with code of '1'."""
[docs]def__init__(self,reason:str|None=None)->None:"""Instantiate class. Args: reason: Reason for the status. """super().__init__("submitted",1,reason)
[docs]classDidNotChangeStatus(SkippedStatus):"""Skipped status with a reason of 'nochange'."""reason="nochange"
[docs]classDoesNotExistInCloudFormation(SkippedStatus):"""Skipped status with a reason of 'does not exist in cloudformation'."""reason="does not exist in cloudformation"
[docs]classNotSubmittedStatus(SkippedStatus):"""Skipped status with a reason of 'disabled'."""reason="disabled"
[docs]classNotUpdatedStatus(SkippedStatus):"""Skipped status with a reason of 'locked'."""reason="locked"