Deployment Diagram¶
c4.diagrams.deployment.DeploymentDiagram ¶
Bases: Diagram
Represents a C4 Deployment Diagram.
A deployment diagram shows how software systems and containers are mapped onto infrastructure nodes, such as servers, devices, or cloud services.
c4.diagrams.deployment.Node ¶
Bases: Boundary
Represents a deployment node in the C4 model.
A Node is a container for deployment elements and can optionally include a sprite for visual representation (e.g., server icon, cloud logo).
Nodes can be nested, and manage their own child elements.
__init__ ¶
__init__(
label: Required[str] = REQUIRED,
description: str | None = None,
type_: str | None = None,
sprite: str | None = None,
tags: list[str] | None = None,
link: str | None = None,
alias: Maybe[str] = MISSING,
) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
Required[str]
|
Display label shown on the diagram. |
REQUIRED
|
description
|
str | None
|
Optional description shown in the rendered diagram. |
None
|
type_
|
str | None
|
Optional classifier for the node (e.g., "database"). |
None
|
sprite
|
str | None
|
Optional sprite name to visually represent the node. |
None
|
tags
|
list[str] | None
|
Optional tags for styling or grouping. |
None
|
link
|
str | None
|
Optional hyperlink associated with the node. |
None
|
alias
|
Maybe[str]
|
Optional identifier for the node. |
MISSING
|
set_property_header ¶
set_property_header(*args: str) -> Self
Sets the column headers for the element's property table.
This must be called either before adding any property rows, or the header length must match the number of values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*args
|
str
|
Column names to use as the property header. |
()
|
Returns:
| Type | Description |
|---|---|
Self
|
The updated diagram element. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If header length does not match the number of values. |
without_property_header ¶
without_property_header() -> Self
Disables the rendering of the header row in the property table.
Returns:
| Type | Description |
|---|---|
Self
|
The updated diagram element. |
add_property ¶
add_property(*args: str) -> Self
Adds a row to the property table.
The number of arguments must match the number of header columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*args
|
str
|
Values for each column in the property row. |
()
|
Returns:
| Type | Description |
|---|---|
Self
|
The updated diagram element. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the number of values does not match the header length. |
c4.diagrams.deployment.NodeLeft ¶
Bases: Node
Represents a deployment node aligned to the left in the diagram layout.
Typically used for directional positioning in deployment views.
c4.diagrams.deployment.NodeRight ¶
Bases: Node
Represents a deployment node aligned to the right in the diagram layout.
Useful for controlling horizontal positioning in deployment diagrams.
c4.diagrams.deployment.DeploymentNode ¶
Bases: Node
Represents a deployment-specific node in the C4 model.
Used to group containers or systems that are deployed together on a specific machine or environment (e.g., EC2 instance, on-prem server).
c4.diagrams.deployment.DeploymentNodeLeft ¶
Bases: DeploymentNode
Represents a deployment node aligned to the left in the diagram layout.
Inherits both deployment semantics and directional positioning.
c4.diagrams.deployment.DeploymentNodeRight ¶
Bases: DeploymentNode
Represents a deployment node aligned to the right in the diagram layout.
Useful for organizing infrastructure visually with directional context.