Adding scaffold command in autoscale-settings#4
Conversation
tjprescott
left a comment
There was a problem hiding this comment.
Looks pretty good. Also, we'd definitely want to have (eventually) commands that would get a good default autoscale profile for the different things that can take one.
| @@ -0,0 +1,38 @@ | |||
| { | |||
| "autoscale_setting_resource_name": "autoscale setting resource name", | |||
There was a problem hiding this comment.
I'd recommend a name like "{MyAutoscaleSettings}"
| "tags": {}, | ||
| "profiles": [ | ||
| { | ||
| "name": "name of the profile", |
| { | ||
| "metric_trigger": { | ||
| "metric_name": "name of the metric", | ||
| "metric_resource_uri": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}/{subResourceName}", |
There was a problem hiding this comment.
Rec: "{FullyQualifiedAzureResourceID}"
| "rules": [ | ||
| { | ||
| "metric_trigger": { | ||
| "metric_name": "name of the metric", |
| "metric_name": "name of the metric", | ||
| "metric_resource_uri": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}/{subResourceName}", | ||
| "time_grain": "(duration in ISO8601 format)PT5M", | ||
| "statistic": "Average or Min or Max or Sum", |
| "scale_action": { | ||
| "direction": "None or Increase or Decrease", | ||
| "type": "ChangeCount or PercentChangeCount or ExactCount", | ||
| "value": "2 (number of instances that are involved in the scaling)", |
There was a problem hiding this comment.
Is value actually a string or do you just have a string because of the comment?
There was a problem hiding this comment.
this is defined as string in sdk so i got chance to add comment as well inside it :)
| } | ||
| ], | ||
| "notifications": [], | ||
| "enabled": false, |
There was a problem hiding this comment.
verified: this is a type bool
| def scaffold_autoscale_settings_parameters(client): # pylint: disable=unused-argument | ||
| '''Scaffold fully formed autoscale-settings' parameters as json template | ||
| ''' | ||
| return _load_autoscale_settings_prameres(AUTOSCALE_SETTINGS_PARAMETER_FILE_PATH) |
There was a problem hiding this comment.
silly typo... third time.. same word :)
| # Autoscale settings parameter scaffold file path | ||
| CURR_DIR = os.path.dirname(os.path.realpath(__file__)) | ||
| AUTOSCALE_SETTINGS_PARAMETER_FILE_PATH = os.path.join(CURR_DIR, | ||
| 'autoscale-parameters-template.json') |
There was a problem hiding this comment.
Since this is only used by one command, I would move this logic into that command.
There was a problem hiding this comment.
@tjprescott newbie question for python: If we move it inside method wouldn't it be initialized every time we call that command?
There was a problem hiding this comment.
Yes, but the way the CLI is designed you can only call the method once per process. Moving it would ensure it ONLY gets run when you use that specific command. That's why I recommended that.
There was a problem hiding this comment.
Perfect. Moved it inside the method :)
| with ServiceGroup(__name__, get_monitor_autoscale_settings_operation, | ||
| autoscale_settings_scaffold) as s: | ||
| with s.group('monitor autoscale-settings') as c: | ||
| c.command('scaffold', 'scaffold_autoscale_settings_parameters') |
There was a problem hiding this comment.
Command names need a verb, so perhaps something like "get-scaffold" or "get-parameters-template".
|
Updated based on the review feedback. Please have a look again when you get a chance. Thanks! |
|
Thanks for the review travis. |
Adding list command for all azure monitor data plane Adding help docs for az monitor data plane commands Adding commands for management place of Azure monitor service Updating azure-monitor-cli to azure-mgmt-monitor and azure-monitor sdk Using nargs to input list of metric-names Implement filter for metrics list command Implement filter and select in activity-logs command Implement filter and select for tenant-activity-logs command Adding scaffold command in autoscale-settings (#4) Adding unittests for custom monitor commands (#5) Rename expanded params and resolve bugs * Fix expand parameters bug in util to support any parameters * Adding --filters into activity-logs & tenant-activity-logs * Adding --ids support into alert-rules & autoscale-settings' show and delete commands * ignoring filter for alert-rules and autoscale-settings list
… plane (Azure#2534) * Adding basic structure for monitor service * Adding list command for all azure monitor data plane * Adding help docs for az monitor data plane commands * Adding commands for management place of Azure monitor service * Updating azure-monitor-cli to azure-mgmt-monitor and azure-monitor sdk * Using nargs to input list of metric-names * Implement filter for metrics list command * Implement filter and select in activity-logs command * Implement filter and select for tenant-activity-logs command * Adding scaffold command in autoscale-settings (#4) * Adding unittests for custom monitor commands (#5) * Rename expanded params and resolve bugs * Fix expand parameters bug in util to support any parameters * Adding --filters into activity-logs & tenant-activity-logs * Adding --ids support into alert-rules & autoscale-settings' show and delete commands * ignoring filter for alert-rules and autoscale-settings list * Help docs for all monitor commands to review * rename activity-logs to activity-log * Removing tenant-activity-logs command * Removing event-categories commands as less useful * Update version to 0.0.1b1+dev * Renamed service-dignostic-settings to diagnostic-settings * update help for review * Update unittests for filters * Renaming parameter_abc into parameter * marking metric-names as required parameter for metrics list * Removing help.json from the review
Help
Get Scaffold json template to be filled-in:
Use json file for creating atuoscale-settings profile
@troydai @tjprescott @derekbekoe Please review the PR when you get a chance. Thanks!
Also please advise if the location of the scaffold command or template file doesn't seem appropriate.