|
|
@ -58,24 +58,50 @@ def C4Node(name, technology="", description="", type="Container", **kwargs):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def Container(name, technology="", description="", **kwargs):
|
|
|
|
def Container(name, technology="", description="", **kwargs):
|
|
|
|
return C4Node(name, technology=technology, description=description, type="Container")
|
|
|
|
container_attributes = {
|
|
|
|
|
|
|
|
"name": name,
|
|
|
|
|
|
|
|
"technology": technology,
|
|
|
|
|
|
|
|
"description": description,
|
|
|
|
|
|
|
|
"type": "Container",
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
container_attributes.update(kwargs)
|
|
|
|
|
|
|
|
return C4Node(**container_attributes)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def Database(name, technology="", description="", **kwargs):
|
|
|
|
def Database(name, technology="", description="", **kwargs):
|
|
|
|
return C4Node(name, technology=technology, description=description, type="Database", shape="cylinder", labelloc="b")
|
|
|
|
database_attributes = {
|
|
|
|
|
|
|
|
"name": name,
|
|
|
|
|
|
|
|
"technology": technology,
|
|
|
|
|
|
|
|
"description": description,
|
|
|
|
|
|
|
|
"type": "Database",
|
|
|
|
|
|
|
|
"shape": "cylinder",
|
|
|
|
|
|
|
|
"labelloc": "b",
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
database_attributes.update(kwargs)
|
|
|
|
|
|
|
|
return C4Node(**database_attributes)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def System(name, description="", external=False, **kwargs):
|
|
|
|
def System(name, description="", external=False, **kwargs):
|
|
|
|
type = "External System" if external else "System"
|
|
|
|
system_attributes = {
|
|
|
|
fillcolor = "gray60" if external else "dodgerblue4"
|
|
|
|
"name": name,
|
|
|
|
return C4Node(name, description=description, type=type, fillcolor=fillcolor)
|
|
|
|
"description": description,
|
|
|
|
|
|
|
|
"type": "External System" if external else "System",
|
|
|
|
|
|
|
|
"fillcolor": "gray60" if external else "dodgerblue4",
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
system_attributes.update(kwargs)
|
|
|
|
|
|
|
|
return C4Node(**system_attributes)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def Person(name, description="", external=False, **kwargs):
|
|
|
|
def Person(name, description="", external=False, **kwargs):
|
|
|
|
type = "External Person" if external else "Person"
|
|
|
|
person_attributes = {
|
|
|
|
fillcolor = "gray60" if external else "dodgerblue4"
|
|
|
|
"name": name,
|
|
|
|
style = "rounded,filled"
|
|
|
|
"description": description,
|
|
|
|
return C4Node(name, description=description, type=type, fillcolor=fillcolor, style=style)
|
|
|
|
"type": "External Person" if external else "Person",
|
|
|
|
|
|
|
|
"fillcolor": "gray60" if external else "dodgerblue4",
|
|
|
|
|
|
|
|
"style": "rounded,filled",
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
person_attributes.update(kwargs)
|
|
|
|
|
|
|
|
return C4Node(**person_attributes)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def SystemBoundary(name, **kwargs):
|
|
|
|
def SystemBoundary(name, **kwargs):
|
|
|
@ -90,8 +116,10 @@ def SystemBoundary(name, **kwargs):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def Relationship(label="", **kwargs):
|
|
|
|
def Relationship(label="", **kwargs):
|
|
|
|
edge_attribtues = {"style": "dashed", "color": "gray60"}
|
|
|
|
edge_attributes = {
|
|
|
|
if label:
|
|
|
|
"style": "dashed",
|
|
|
|
edge_attribtues.update({"label": _format_edge_label(label)})
|
|
|
|
"color": "gray60",
|
|
|
|
edge_attribtues.update(kwargs)
|
|
|
|
"label": _format_edge_label(label) if label else "",
|
|
|
|
return Edge(**edge_attribtues)
|
|
|
|
}
|
|
|
|
|
|
|
|
edge_attributes.update(kwargs)
|
|
|
|
|
|
|
|
return Edge(**edge_attributes)
|
|
|
|