Skip to content
This repository was archived by the owner on Oct 19, 2023. It is now read-only.

Commit bf7f2f8

Browse files
proppyGerrit Code Review
authored andcommitted
Merge "google-assistant-sdk/devicetool: add delete command" into eap-device-actions
2 parents a736160 + 067985e commit bf7f2f8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

google-assistant-sdk/googlesamples/assistant/grpc/devicetool.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,24 @@ def get(ctx, resource, id):
282282
click.echo(r.text)
283283

284284

285+
@cli.command()
286+
@click.option('--model', 'resource', flag_value='deviceModels', required=True,
287+
help='Enter the identifier for an existing device model.')
288+
@click.option('--device', 'resource', flag_value='devices', required=True,
289+
help='Enter the identifier for an existing device instance.')
290+
@click.argument('id')
291+
@click.pass_context
292+
def delete(ctx, resource, id):
293+
"""Delete given device model or instance.
294+
"""
295+
session = ctx.obj['SESSION']
296+
url = '/'.join([ctx.obj['API_URL'], resource, id])
297+
r = session.delete(url)
298+
if r.status_code != 200:
299+
raise failed_request_exception('failed to delete resource', r)
300+
click.echo(r.text)
301+
302+
285303
@cli.command()
286304
@click.option('--model', 'resource', flag_value='deviceModels', required=True)
287305
@click.option('--device', 'resource', flag_value='devices', required=True)

0 commit comments

Comments
 (0)