|
|
|
@ -37,6 +37,7 @@ from typing import (
|
|
|
|
|
Sequence,
|
|
|
|
|
TypeAlias,
|
|
|
|
|
TypedDict,
|
|
|
|
|
cast,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
from attrs import define, field
|
|
|
|
@ -90,6 +91,16 @@ class ComposeVolumeDef(TypedDict, total=False):
|
|
|
|
|
name: PublicVolumeName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VolumeInspectDef(TypedDict):
|
|
|
|
|
Name: PublicVolumeName
|
|
|
|
|
Driver: str
|
|
|
|
|
Mountpoint: str
|
|
|
|
|
CreatedAt: str # ISO
|
|
|
|
|
Labels: LabelDict
|
|
|
|
|
Scope: str
|
|
|
|
|
Options: Mapping
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# === constants
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -321,6 +332,25 @@ class ComposeVolume:
|
|
|
|
|
"name", PublicVolumeName(f"{self.compose.project_name}_{self.name}")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@cached_property
|
|
|
|
|
def backup_config(self) -> VolumeBackupConfig:
|
|
|
|
|
return VolumeBackupConfig.from_labels(self.inspect()["Labels"])
|
|
|
|
|
|
|
|
|
|
def inspect(self) -> VolumeInspectDef:
|
|
|
|
|
return cast(
|
|
|
|
|
VolumeInspectDef,
|
|
|
|
|
self.compose.podman.exec.exec_cmd(
|
|
|
|
|
command=CommandArgs(
|
|
|
|
|
[
|
|
|
|
|
"volume",
|
|
|
|
|
"inspect",
|
|
|
|
|
self.public_name,
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
check=True,
|
|
|
|
|
).to_json(),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def parse_labels(labels: LabelDict) -> LabelDict:
|
|
|
|
|
ret = dict[str, str]()
|
|
|
|
|