mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-23 10:05:08 +02:00
fix(cli): look up a deployment by exact name instead of a paged search
This commit is contained in:
@@ -491,8 +491,8 @@ def _source_of(resource: object) -> str | None:
|
||||
def find_deployment_by_name(
|
||||
client: HostBackendClient, name: str
|
||||
) -> ExistingDeployment | None:
|
||||
for resource in client.list_deployments(name_contains=name):
|
||||
if resource.get("name") == name and resource.get("id"):
|
||||
for resource in client.list_deployments(name=name):
|
||||
if resource.get("id"):
|
||||
return ExistingDeployment(str(resource["id"]), _source_of(resource))
|
||||
return None
|
||||
|
||||
|
||||
@@ -189,14 +189,13 @@ class HostBackendClient:
|
||||
payload["secrets"] = secrets
|
||||
return self._request("POST", "/v2/deployments", payload)
|
||||
|
||||
def list_deployments(self, name_contains: str = "") -> list[dict[str, Any]]:
|
||||
return _resources(
|
||||
self._request(
|
||||
"GET",
|
||||
"/v2/deployments",
|
||||
params={"name_contains": name_contains},
|
||||
)
|
||||
def list_deployments(
|
||||
self, *, name: str | None = None, name_contains: str | None = None
|
||||
) -> list[dict[str, Any]]:
|
||||
params = (
|
||||
{"name": name} if name is not None else {"name_contains": name_contains}
|
||||
)
|
||||
return _resources(self._request("GET", "/v2/deployments", params=params))
|
||||
|
||||
def list_listeners(self) -> list[dict[str, Any]]:
|
||||
return _resources(
|
||||
|
||||
Reference in New Issue
Block a user