Container Diagram¶
c4.diagrams.container.ContainerDiagram ¶
c4.diagrams.container.Container ¶
Bases: Element
Represents an application or service container in a C4 Container diagram.
A container can be a web application, API, worker, or any executable unit of deployment. It may optionally include technology and shape hints.
__init__ ¶
__init__(
label: Required[str] = REQUIRED,
description: str | None = None,
technology: str | None = None,
extensions: ElementExtensions | None = None,
plantuml: ContainerExtensions | None = None,
alias: Maybe[str] = MISSING,
) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
Required[str]
|
Display name for the container. Required. |
REQUIRED
|
description
|
str | None
|
Optional description of the container's purpose. |
None
|
technology
|
str | None
|
Optional technology stack used by the container. |
None
|
extensions
|
ElementExtensions | None
|
Backend-specific extension data. |
None
|
plantuml
|
ContainerExtensions | None
|
PlantUML-specific extension data. |
None
|
alias
|
Maybe[str]
|
Unique identifier for the container. If not provided, it is autogenerated from the label. |
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.container.ContainerDb ¶
Bases: ElementWithTechnology
Represents a container specifically modeled as a database.
__init__ ¶
__init__(
label: Required[str] = REQUIRED,
description: str | None = None,
technology: str | None = None,
extensions: ElementExtensions | None = None,
plantuml: ContainerStorageExtensions | None = None,
alias: Maybe[str] = MISSING,
) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
Required[str]
|
Display name for the container database. Required. |
REQUIRED
|
description
|
str | None
|
Optional description text. |
None
|
technology
|
str | None
|
Optional technology stack used by the container. |
None
|
extensions
|
ElementExtensions | None
|
Backend-specific extension data. |
None
|
plantuml
|
ContainerStorageExtensions | None
|
PlantUML-specific extension data. |
None
|
alias
|
Maybe[str]
|
Unique identifier for the container database. If not provided, it is autogenerated from the label. |
MISSING
|
c4.diagrams.container.ContainerQueue ¶
Bases: ElementWithTechnology
Represents a container modeled as a message queue or event broker.
__init__ ¶
__init__(
label: Required[str] = REQUIRED,
description: str | None = None,
technology: str | None = None,
extensions: ElementExtensions | None = None,
plantuml: ContainerStorageExtensions | None = None,
alias: Maybe[str] = MISSING,
) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
Required[str]
|
Display name for the container queue. Required. |
REQUIRED
|
description
|
str | None
|
Optional description text. |
None
|
technology
|
str | None
|
Optional technology stack used by the container. |
None
|
extensions
|
ElementExtensions | None
|
Backend-specific extension data. |
None
|
plantuml
|
ContainerStorageExtensions | None
|
PlantUML-specific extension data. |
None
|
alias
|
Maybe[str]
|
Unique identifier for the container queue. If not provided, it is autogenerated from the label. |
MISSING
|
c4.diagrams.container.ContainerExt ¶
c4.diagrams.container.ContainerDbExt ¶
c4.diagrams.container.ContainerQueueExt ¶
c4.diagrams.container.ContainerBoundary ¶
Bases: Boundary
Represents a boundary grouping containers within a system.
__init__ ¶
__init__(
label: Required[str] = REQUIRED,
description: str | None = None,
extensions: ElementExtensions | None = None,
plantuml: BoundaryExtensions | None = None,
mermaid: BoundaryExtensions | None = None,
alias: Maybe[str] = MISSING,
) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
Required[str]
|
Display name for the boundary. Required. |
REQUIRED
|
description
|
str | None
|
Optional human-readable description of the boundary. |
None
|
extensions
|
ElementExtensions | None
|
Backend-specific extension data. |
None
|
plantuml
|
BoundaryExtensions | None
|
PlantUML-specific extension data. |
None
|
mermaid
|
BoundaryExtensions | None
|
Mermaid-specific extension data. |
None
|
alias
|
Maybe[str]
|
Unique identifier for the boundary. If not provided, it is autogenerated from the label. |
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. |