Skip to content

Commit de5d489

Browse files
author
GitHub Copilot
committed
cognitiveservices agent status: add --only-show-status
1 parent 21701a0 commit de5d489

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/azure-cli/azure/cli/command_modules/cognitiveservices/_help.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,9 +664,14 @@
664664
short-summary: Get the status of a hosted agent deployment.
665665
long-summary: |
666666
Calls the agent container status endpoint and returns the raw service payload.
667+
parameters:
668+
- name: --only-show-status
669+
short-summary: Only return the status field.
667670
examples:
668671
- name: Get hosted agent deployment status.
669672
text: az cognitiveservices agent status --account-name myAccount --project-name myProject --name myAgent --agent-version 1
673+
- name: Get only the status field.
674+
text: az cognitiveservices agent status --account-name myAccount --project-name myProject --name myAgent --agent-version 1 --only-show-status
670675
"""
671676

672677
helps[

src/azure-cli/azure/cli/command_modules/cognitiveservices/_params.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,12 @@ def load_arguments(self, _):
393393
help="Cognitive Services hosted agent version",
394394
required=True,
395395
)
396+
c.argument(
397+
"only_show_status",
398+
options_list=["--only-show-status"],
399+
action="store_true",
400+
help="Only return the deployment status field.",
401+
)
396402

397403
with self.argument_context('cognitiveservices agent create') as c:
398404
c.argument(

src/azure-cli/azure/cli/command_modules/cognitiveservices/custom.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,9 +1399,13 @@ def agent_status(
13991399
project_name,
14001400
agent_name,
14011401
agent_version,
1402+
only_show_status=False,
14021403
): # pylint: disable=unused-argument
14031404
"""Get the status of a hosted agent deployment (default container)."""
1404-
return _get_agent_container_status(client, agent_name, agent_version)
1405+
payload = _get_agent_container_status(client, agent_name, agent_version)
1406+
if only_show_status:
1407+
return {"status": payload.get("status")}
1408+
return payload
14051409

14061410

14071411
def _get_resource_group_by_account_name(cmd, account_name):

0 commit comments

Comments
 (0)