Clusters¶
barbara.resources.clusters.ClustersResource ¶
ClustersResource(client: BarbaraClient)
list ¶
list(
*,
search: Optional[str] = None,
size: Optional[int] = None,
) -> List[Cluster]
Returns a single page — use paginate() for total or to
page through more clusters than the server's default page size.
update ¶
update(cluster_id: str, name: str) -> None
No documented response body — call get() afterwards if you need it.
create ¶
create(
name: str,
primary_node: Dict[str, Any],
*,
secondary_nodes: Optional[List[Dict[str, Any]]] = None,
enable_cluster_volumes: bool = False,
virtual_ip_enabled: bool = False,
id_vrr: Optional[int] = None,
password: Optional[str] = None,
virtual_ip: Optional[str] = None,
sync_time: Optional[float] = None,
multicast: bool = False,
default_addr_pool: Optional[List[str]] = None,
subnet_size: Optional[int] = None,
) -> None
primary_node and each item of secondary_nodes are the raw
per-node VRRP/swarm config dicts the API expects (nodeId,
labels as base64 JSON, advertiseAddr, ...) — this method
doesn't reshape them, since cluster networking config is inherently
node-specific. password (VRRP password) is base64-encoded
internally.
join_node ¶
join_node(
cluster_id: str,
node_id: str,
*,
labels: Dict[str, str],
restrict_swarm_traffic_to_interface: bool,
advertise_addr: str,
iface: Optional[str] = None,
unicast_ip: Optional[str] = None,
swarm_iface: Optional[str] = None,
priority: Optional[float] = None,
track_interfaces: Optional[List[str]] = None,
) -> None
labels is a plain {key: value} mapping — JSON+base64-encoded
internally, matching the convention documented on the endpoint.
update_node_config ¶
update_node_config(
cluster_id: str, node_id: str, labels: Dict[str, str]
) -> None
labels is a plain {key: value} mapping — JSON+base64-encoded
internally.
create_swarm_volume ¶
create_swarm_volume(
cluster_id: str, volume_name: str
) -> None
volume_name is base64-encoded internally.
delete_swarm_volume ¶
delete_swarm_volume(
cluster_id: str, volume_id: str
) -> None
volume_id is an internal _id, not the volume name — see
NodesResource.list_docker_volumes for the equivalent lookup at
node scope.
list_global_secrets ¶
list_global_secrets(
cluster_id: str,
) -> List[Dict[str, Any]]
secrets is a single object per cluster ({"secretList": [...],
"lastUpdated": ...}), not an array — the actual per-secret list is
secrets.secretList.