You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.3 KiB
43 lines
1.3 KiB
from enum import Enum
|
|
|
|
|
|
class ObjectType(Enum):
|
|
Command = "command"
|
|
ContactGroup = "contactgroup"
|
|
Contact = "contact"
|
|
HostDependency = "hostdependency"
|
|
HostEscalation = "hostescalation"
|
|
HostGroup = "hostgroup"
|
|
Host = "host"
|
|
ServiceDependency = "servicedependency"
|
|
ServiceEscalation = "serviceescalation"
|
|
ServiceGroup = "servicegroup"
|
|
Service = "service"
|
|
TimePeriod = "timeperiod"
|
|
Nil = "nil"
|
|
|
|
|
|
class Object:
|
|
def __init__(self,
|
|
config_file: str = str(),
|
|
directives: list[tuple[str, str]] = list(),
|
|
line_no: int = 0,
|
|
type: ObjectType = ObjectType.Nil):
|
|
self.m_config_file: str = config_file
|
|
self.m_directives: list[tuple[str, str]] = directives
|
|
self.m_line_no: int = line_no
|
|
self.m_type: ObjectType = type
|
|
|
|
def __str__(self):
|
|
string = "{}:\n\t{}: {}\n".format(self.m_config_file, self.m_line_no,
|
|
self.m_type)
|
|
for dir in self.m_directives:
|
|
string += "\t\t{}: {}\n".format(dir[0], dir[1])
|
|
return string
|
|
|
|
def get_type(self) -> ObjectType:
|
|
return self.m_type
|
|
|
|
def get_directives(self) -> list[tuple[str, str]]:
|
|
return self.m_directives
|