secrets¶
Secrets 资源的模型和管理器。
- class Secret(attrs: Mapping[str, Any] | None = None, client: APIClient | None = None, collection: Manager | None = None, podman_client: PodmanClient | None = None)[source]¶
-
向 Podman 服务注册的 Secret 的详细信息和配置。
初始化 PodmanResource 的基类。
- 参数:
attrs – Podman 服务资源属性的映射。
client – Podman 服务的配置连接。
collection – 此类资源的管理器,为了兼容性命名为 collection
podman_client – 配置为连接到 Podman 对象的 PodmanClient()。
- reload(**kwargs) None ¶
从服务刷新此对象的数据。
- 关键字参数:
compatible (bool) – 使用 Docker 兼容端点
- remove(all: bool | None = None)[source]¶
删除 Secret。
- 参数:
all – 为 True 时,删除所有 Secret。
- 抛出:
NotFound – 当 Secret 不存在时
APIError – 当服务返回错误时
- property id¶
返回对象的标识符。
- 类型:
str
- property name¶
Secret 的名称。
- 类型:
str
- property short_id¶
返回截断的标识符。当包含在 id 中时,保留“sha256”。
不尝试确保返回的值对所有资源都具有语义意义。
- 类型:
str
- class SecretsManager(client: APIClient)[source]¶
基类:
Manager
Secrets 资源的专用管理器。
初始化 SecretsManager 对象。
- 参数:
client – 连接到 Podman 服务。
- create(name: str, data: bytes, labels: Mapping[str, Any] | None = None, driver: str | None = None) Secret [source]¶
创建 Secret。
- 参数:
name – Secret 的用户定义名称。
data – 要向 Podman 服务注册的 Secret。
labels – 忽略。
driver – Secret 驱动程序。
- 抛出:
APIError – 服务返回错误时
- get(secret_id: str) Secret [source]¶
按名称或 ID 返回 Secret 的信息。
- 参数:
secret_id – Secret 的名称或 ID。
- 抛出:
NotFound – 当 Secret 不存在时
APIError – 当服务返回错误时
- list(**kwargs) list[Secret] [source]¶
报告 Secret。
- 关键字参数:
filters (dict[str, Any]) – 忽略。
- 抛出:
APIError – 当服务返回错误时
- prepare_model(attrs: PodmanResource | Mapping[str, Any]) PodmanResourceType ¶
从一组属性创建模型。