Skip to content

Commit 98d6fed

Browse files
committed
Add skeleton commands for cognitiveservices agents operations.
1 parent 9a57ac3 commit 98d6fed

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,3 +214,15 @@ def load_arguments(self, _):
214214
with self.argument_context('cognitiveservices account commitment-plan', arg_group='Next CommitmentPeriod') as c:
215215
c.argument('next_count', help='Cognitive Services account commitment plan next commitment period count.')
216216
c.argument('next_tier', help='Cognitive Services account commitment plan next commitment period tier.')
217+
218+
with self.argument_context('cognitiveservices agent') as c:
219+
c.argument('agent_name', help='Cognitive Services hosted agent name')
220+
c.argument('agent_version', help='Cognitive Services hosted agent version')
221+
222+
with self.argument_context('cognitiveservices agent update') as c:
223+
c.argument('min_replica', help='Minimum number of replicas for horizontal scaling')
224+
c.argument('max_replica', help='Maximum number of replicas for horizontal scaling')
225+
c.argument('description', help='Description of the agent')
226+
227+
with self.argument_context('cognitiveservices agent delete') as c:
228+
c.argument('agent_version', help='Cognitive Services hosted agent version. If not provided, deletes all versions.', required=False)

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,11 @@ def load_command_table(self, _):
103103

104104
with self.command_group('cognitiveservices usage', usages_type) as g:
105105
g.command('list', 'list')
106+
107+
with self.command_group('cognitiveservices agent', client_factory=cf_accounts) as g:
108+
g.custom_command('update', 'agent_update')
109+
g.custom_command('stop', 'agent_stop')
110+
g.custom_command('start', 'agent_start')
111+
g.custom_command('delete-deployment', 'agent_delete_deployment')
112+
g.custom_command('delete', 'agent_delete')
113+
g.custom_command('list', 'agent_list')

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,3 +325,54 @@ def commitment_plan_create_or_update(
325325
plan.properties.next.count = next_count
326326
plan.properties.auto_renew = auto_renew
327327
return client.create_or_update(resource_group_name, account_name, commitment_plan_name, plan)
328+
329+
330+
def agent_update(client, account_name, agent_name, agent_version,
331+
min_replica=None, max_replica=None, description=None, tags=None):
332+
"""
333+
Update hosted agent deployment configuration.
334+
Updates horizontal scale configuration (min and max replica), agent meta-data such as description and tags.
335+
New version is not created for this update.
336+
"""
337+
raise NotImplementedError("agent_update command is not yet implemented")
338+
339+
340+
def agent_stop(client, account_name, agent_name, agent_version):
341+
"""
342+
Stop hosted agent deployment.
343+
"""
344+
raise NotImplementedError("agent_stop command is not yet implemented")
345+
346+
347+
def agent_start(client, account_name, agent_name, agent_version):
348+
"""
349+
Start hosted agent deployment.
350+
"""
351+
raise NotImplementedError("agent_start command is not yet implemented")
352+
353+
354+
def agent_delete_deployment(client, account_name, agent_name, agent_version):
355+
"""
356+
Delete hosted agent deployment.
357+
Deletes the agent deployment only, agent version associated with the deployment remains.
358+
"""
359+
raise NotImplementedError("agent_delete_deployment command is not yet implemented")
360+
361+
362+
def agent_delete(client, account_name, agent_name, agent_version=None):
363+
"""
364+
Delete hosted agent version or all versions.
365+
If agent_version is provided, deletes the agent instance and agent definition associated with that version.
366+
If agent_version is not provided, deletes all agent instances and agent definitions associated with the agent name.
367+
"""
368+
raise NotImplementedError("agent_delete command is not yet implemented")
369+
370+
371+
def agent_list(client, account_name, agent_name, agent_version=None):
372+
"""
373+
List hosted agent versions or deployments.
374+
If agent_version is not provided, lists all versions for an agent.
375+
If agent_version is provided, lists all deployments for that agent version.
376+
"""
377+
raise NotImplementedError("agent_list command is not yet implemented")
378+

0 commit comments

Comments
 (0)