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,
sprite: str | None = None,
tags: list[str] | None = None,
link: str | None = None,
base_shape: str | None = None,
alias: Maybe[str] = MISSING,
) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
Required[str]
|
Human-readable name of the container. |
REQUIRED
|
description
|
str | None
|
Optional description of the container's purpose. |
None
|
technology
|
str | None
|
The technology stack used by the container. |
None
|
sprite
|
str | None
|
Optional sprite identifier for visual representation. |
None
|
tags
|
list[str] | None
|
Optional tags for styling or grouping. |
None
|
link
|
str | None
|
Optional URL for external documentation or navigation. |
None
|
base_shape
|
str | None
|
Optional base shape override for rendering. |
None
|
alias
|
Maybe[str]
|
Unique identifier for the container. |
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 ¶
c4.diagrams.container.ContainerQueue ¶
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,
tags: list[str] | None = None,
link: str | None = None,
alias: Maybe[str] = MISSING,
) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
Required[str]
|
Displayed label of the boundary. Defaults to |
REQUIRED
|
description
|
str | None
|
Optional human-readable description of the boundary. |
None
|
tags
|
list[str] | None
|
Optional tags for styling or grouping. |
None
|
link
|
str | None
|
URL associated with the boundary for navigation or documentation. |
None
|
alias
|
Maybe[str]
|
Unique identifier for the boundary. |
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. |