pods_manager

PodmanResource manager subclassed for Networks.

class PodsManager(client: APIClient = None)[source]

Bases: Manager

Specialized Manager for Pod resources.

Initialize Manager() object.

Parameters:

client – APIClient() configured to connect to Podman service.

create(name: str, **kwargs) Pod[source]

Create a Pod.

Keyword Arguments:

See (API documentation) – https://docs.podman.io/en/latest/_static/api.html#operation/CreatePod] for complete list of keywords.

exists(key: str) bool[source]

Returns True, when pod exists.

get(pod_id: str) Pod[source]

Return information for Pod by name or id.

Parameters:

pod_id – Pod name or id.

Raises:
  • NotFound – when network does not exist

  • APIError – when error returned by service

list(**kwargs) List[Pod][source]

Report on pods.

Keyword Arguments:

filters (Mapping[str, str]) –

Criteria for listing pods. Available filters:

  • ctr-ids (List[str]): List of container ids to filter by.

  • ctr-names (List[str]): List of container names to filter by.

  • ctr-number (List[int]): list pods with given number of containers.

  • ctr-status (List[str]): List pods with containers in given state. Legal values are: “created”, “running”, “paused”, “stopped”, “exited”, or “unknown”

  • id (str) - List pod with this id.

  • name (str) - List pod with this name.

  • status (List[str]): List pods in given state. Legal values are: “created”, “running”, “paused”, “stopped”, “exited”, or “unknown”

  • label (List[str]): List pods with given labels.

  • network (List[str]): List pods associated with given Network Ids (not Names).

Raises:

APIError – when an error returned by service

prepare_model(attrs: PodmanResource | Mapping[str, Any]) PodmanResourceType

Create a model from a set of attributes.

prune(filters: Dict[str, str] | None = None) Dict[str, Any][source]

Delete unused Pods.

Returns:

  • PodsDeleted (List[str]): List of pod ids deleted.

  • SpaceReclaimed (int): Always zero.

Return type:

Dictionary Keys

Raises:

APIError – when service reports error

remove(pod_id: Pod | str, force: bool | None = None) None[source]

Delete pod.

Parameters:
  • pod_id – Identifier of Pod to delete.

  • force – When True, stop and delete all containers in pod before deleting pod.

Raises:
  • NotFound – when pod not found

  • APIError – when service reports an error

Notes

Podman only.

stats(**kwargs) List[Dict[str, Any]] | Iterator[List[Dict[str, Any]]][source]

Resource usage statistics for the containers in pods.

Keyword Arguments:
  • all (bool) – Provide statistics for all running pods.

  • name (Union[str, List[str]]) – Pods to include in report.

  • stream (bool) – Stream statistics until cancelled. Default: False.

  • decode (bool) – If True, response will be decoded into dict. Default: False.

Raises:
  • NotFound – when pod not found

  • APIError – when service reports an error

property resource

prepare_model() will create Pod classes.

Type:

Type[Pod]