This commit is contained in:
@@ -72,15 +72,24 @@ class CloudClient:
|
||||
workflow_definition_id: str | None = None,
|
||||
driver_type: str | None = None,
|
||||
capability_tags: list[str] | None = None,
|
||||
target_host_id: str | None = None,
|
||||
target_device_id: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
payload: dict[str, Any] = {
|
||||
"goal": goal,
|
||||
"workflow_definition_id": workflow_definition_id,
|
||||
}
|
||||
if driver_type is not None or capability_tags is not None:
|
||||
if (
|
||||
driver_type is not None
|
||||
or capability_tags is not None
|
||||
or target_host_id is not None
|
||||
or target_device_id is not None
|
||||
):
|
||||
payload["constraints"] = {
|
||||
"driver_type": driver_type,
|
||||
"capability_tags": list(capability_tags or []),
|
||||
"target_host_id": target_host_id,
|
||||
"target_device_id": target_device_id,
|
||||
}
|
||||
resp = self._request("POST", "/tasks", json=payload)
|
||||
return resp.json()
|
||||
@@ -209,6 +218,28 @@ class CloudClient:
|
||||
def revoke_user_sessions(self, user_id: str) -> None:
|
||||
self._request("DELETE", f"/users/{user_id}/sessions")
|
||||
|
||||
# ------------------------------------------------------------- governance
|
||||
|
||||
def get_user_submission_policy(self, user_id: str) -> dict[str, Any]:
|
||||
return self._request("GET", f"/users/{user_id}/submission-policy").json()
|
||||
|
||||
def update_user_submission_policy(
|
||||
self, user_id: str, **policy: Any
|
||||
) -> dict[str, Any]:
|
||||
return self._request(
|
||||
"PUT", f"/users/{user_id}/submission-policy", json=policy
|
||||
).json()
|
||||
|
||||
def get_host_governance_policy(self, host_id: str) -> dict[str, Any]:
|
||||
return self._request("GET", f"/hosts/{host_id}/governance-policy").json()
|
||||
|
||||
def update_host_governance_policy(
|
||||
self, host_id: str, **policy: Any
|
||||
) -> dict[str, Any]:
|
||||
return self._request(
|
||||
"PUT", f"/hosts/{host_id}/governance-policy", json=policy
|
||||
).json()
|
||||
|
||||
# ------------------------------------------------------------------ helpers
|
||||
|
||||
def _url(self, path: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user