Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/azure-cli/azure/cli/command_modules/vm/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,13 +1003,15 @@ def auto_shutdown_vm(cmd, resource_group_name, vm_name, off=None, email=None, we
raise CLIError('usage error: --time is a required parameter')
daily_recurrence = {'time': time}
notification_settings = None
if webhook:
if email:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this service behavior? If no, this will be breaking change to end users: adding a required param for email.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the webhook parameter is also required if the user needs to set --email. This issue is that the user doesn't know the settings -- email needs to be set -- webhook. I make this change to prompt the user that both parameters must exist at the same time for them to take effect

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we allow webhook and no email?

if not webhook:
raise CLIError('usage error: --webhook is a required parameter when --email exists')
notification_settings = {
'emailRecipient': email,
'webhookUrl': webhook,
'timeInMinutes': 30,
'status': 'Enabled'
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

schedule = Schedule(status='Enabled',
target_resource_id=vm_id,
daily_recurrence=daily_recurrence,
Expand Down