Skip to content

Commit

Permalink
[Aladdin] Parse generated examples into commands' _help.py (#11716)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jianhui Harold authored Feb 13, 2020
1 parent d3beab8 commit 800e711
Show file tree
Hide file tree
Showing 8 changed files with 762 additions and 265 deletions.
9 changes: 6 additions & 3 deletions src/azure-cli/azure/cli/command_modules/cloud/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
short-summary: Set the active cloud.
examples:
- name: Set the active cloud. (autogenerated)
text: az cloud set --name MyRegisteredCloud
text: |
az cloud set --name MyRegisteredCloud
crafted: true
"""

Expand All @@ -47,7 +48,8 @@
short-summary: Unregister a cloud.
examples:
- name: Unregister a cloud. (autogenerated)
text: az cloud unregister --name MyRegisteredCloud
text: |
az cloud unregister --name MyRegisteredCloud
crafted: true
"""

Expand All @@ -56,6 +58,7 @@
short-summary: Update the configuration of a cloud.
examples:
- name: Update the configuration of a cloud. (autogenerated)
text: az cloud update --profile latest
text: |
az cloud update --profile latest
crafted: true
"""
15 changes: 10 additions & 5 deletions src/azure-cli/azure/cli/command_modules/keyvault/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@
long-summary: Default permissions are created for the current user or service principal unless the `--no-self-perms` flag is specified.
examples:
- name: Create a key vault. (autogenerated)
text: az keyvault create --location westus2 --name MyKeyVault --resource-group MyResourceGroup
text: |
az keyvault create --location westus2 --name MyKeyVault --resource-group MyResourceGroup
crafted: true
"""

Expand All @@ -125,7 +126,8 @@
short-summary: Delete a key vault.
examples:
- name: Delete a key vault. (autogenerated)
text: az keyvault delete --name MyKeyVault --resource-group MyResourceGroup
text: |
az keyvault delete --name MyKeyVault --resource-group MyResourceGroup
crafted: true
"""

Expand Down Expand Up @@ -175,7 +177,8 @@
long-summary: Recovers a previously deleted key vault for which soft delete was enabled.
examples:
- name: Recover a key vault. (autogenerated)
text: az keyvault recover --location westus2 --name MyKeyVault --resource-group MyResourceGroup
text: |
az keyvault recover --location westus2 --name MyKeyVault --resource-group MyResourceGroup
crafted: true
"""

Expand All @@ -194,7 +197,8 @@
short-summary: Show details of a key vault.
examples:
- name: Show details of a key vault. (autogenerated)
text: az keyvault show --name MyKeyVault
text: |
az keyvault show --name MyKeyVault
crafted: true
"""

Expand Down Expand Up @@ -257,6 +261,7 @@
short-summary: Update the properties of a key vault.
examples:
- name: Update the properties of a key vault. (autogenerated)
text: az keyvault update --enabled-for-disk-encryption true --name MyKeyVault --resource-group MyResourceGroup
text: |
az keyvault update --enabled-for-disk-encryption true --name MyKeyVault --resource-group MyResourceGroup
crafted: true
"""
106 changes: 82 additions & 24 deletions src/azure-cli/azure/cli/command_modules/monitor/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
short-summary: The short name of the action group
examples:
- name: Create a new action group (autogenerated)
text: az monitor action-group create --action webhook https://alerts.contoso.com apiKey={APIKey} type=HighCPU --name MyActionGroup --resource-group MyResourceGroup
text: |
az monitor action-group create --action webhook https://alerts.contoso.com apiKey={APIKey} type=HighCPU --name MyActionGroup --resource-group MyResourceGroup
crafted: true
"""

Expand All @@ -82,7 +83,8 @@
short-summary: Show the details of an action group
examples:
- name: Show the details of an action group (commonly used with --output and --query). (autogenerated)
text: az monitor action-group show --name MyActionGroup --resource-group MyResourceGroup
text: |
az monitor action-group show --name MyActionGroup --resource-group MyResourceGroup
crafted: true
"""

Expand Down Expand Up @@ -133,7 +135,8 @@
short-summary: Remove receivers from the action group. Accept space-separated list of receiver names.
examples:
- name: Update an action group (autogenerated)
text: az monitor action-group update --name MyActionGroup --resource-group MyResourceGroup --set retentionPolicy.days=365 --subscription MySubscription
text: |
az monitor action-group update --name MyActionGroup --resource-group MyResourceGroup --set retentionPolicy.days=365 --subscription MySubscription
crafted: true
"""

Expand Down Expand Up @@ -313,7 +316,8 @@
text: >
az monitor activity-log alert update -n {AlertName} -g {ResourceGroup} --enable false
- name: Update the details of this activity log alert (autogenerated)
text: az monitor activity-log alert update --enabled true --name MyActivityLogAlerts --resource-group MyResourceGroup --subscription MySubscription
text: |
az monitor activity-log alert update --enabled true --name MyActivityLogAlerts --resource-group MyResourceGroup --subscription MySubscription
crafted: true
"""

Expand Down Expand Up @@ -405,7 +409,8 @@
short-summary: Delete an alert rule.
examples:
- name: Delete an alert rule. (autogenerated)
text: az monitor alert delete --name MyAlertRule --resource-group MyResourceGroup
text: |
az monitor alert delete --name MyAlertRule --resource-group MyResourceGroup
crafted: true
"""

Expand All @@ -414,7 +419,8 @@
short-summary: List alert rules in a resource group.
examples:
- name: List alert rules in a resource group. (autogenerated)
text: az monitor alert list --resource-group MyResourceGroup
text: |
az monitor alert list --resource-group MyResourceGroup
crafted: true
"""

Expand All @@ -423,7 +429,8 @@
short-summary: List all incidents for an alert rule.
examples:
- name: List all incidents for an alert rule. (autogenerated)
text: az monitor alert list-incidents --resource-group MyResourceGroup --rule-name MyRule
text: |
az monitor alert list-incidents --resource-group MyResourceGroup --rule-name MyRule
crafted: true
"""

Expand All @@ -432,7 +439,8 @@
short-summary: Show an alert rule.
examples:
- name: Show an alert rule. (autogenerated)
text: az monitor alert show --name MyAlertRule --resource-group MyResourceGroup
text: |
az monitor alert show --name MyAlertRule --resource-group MyResourceGroup
crafted: true
"""

Expand Down Expand Up @@ -484,10 +492,12 @@
Time span over which to apply --aggregation, in nDnHnMnS shorthand or full ISO8601 format.
examples:
- name: Update a classic metric-based alert rule. (autogenerated)
text: az monitor alert update --email-service-owners true --name MyAlertRule --resource-group MyResourceGroup
text: |
az monitor alert update --email-service-owners true --name MyAlertRule --resource-group MyResourceGroup
crafted: true
- name: Update a classic metric-based alert rule. (autogenerated)
text: az monitor alert update --name MyAlertRule --remove-action email [email protected] --resource-group MyResourceGroup
text: |
az monitor alert update --name MyAlertRule --remove-action email [email protected] --resource-group MyResourceGroup
crafted: true
"""

Expand Down Expand Up @@ -527,7 +537,8 @@
text: >
az monitor autoscale create -g {myrg} --resource {resource-id} --count 4
- name: Create new autoscale settings. (autogenerated)
text: az monitor autoscale create --count 3 --max-count 5 --min-count 2 --name MyAutoscaleSettings --resource myScaleSet --resource-group MyResourceGroup --resource-type Microsoft.Compute/virtualMachineScaleSets
text: |
az monitor autoscale create --count 3 --max-count 5 --min-count 2 --name MyAutoscaleSettings --resource myScaleSet --resource-group MyResourceGroup --resource-type Microsoft.Compute/virtualMachineScaleSets
crafted: true
"""

Expand Down Expand Up @@ -592,14 +603,19 @@
az monitor autoscale profile create -g {myrg} --autoscale-name {name} -n weeekend \\
--copy-rules default --min-count 1 --count 2 --max-count 2 \\
--recurrence week sat sun --timezone "Pacific Standard Time"
- name: Create a fixed or recurring autoscale profile. (autogenerated)
text: |
az monitor autoscale profile create --autoscale-name MyAutoscale --count 2 --end 2018-12-26 --name Christmas --recurrence week sat sun --resource-group MyResourceGroup --start 2018-12-24 --timezone "Pacific Standard Time"
crafted: true
"""

helps['monitor autoscale profile delete'] = """
type: command
short-summary: Delete an autoscale profile.
examples:
- name: Delete an autoscale profile. (autogenerated)
text: az monitor autoscale profile delete --autoscale-name MyAutoscale --name MyAutoscaleProfile --resource-group MyResourceGroup
text: |
az monitor autoscale profile delete --autoscale-name MyAutoscale --name MyAutoscaleProfile --resource-group MyResourceGroup
crafted: true
"""

Expand All @@ -608,7 +624,8 @@
short-summary: List autoscale profiles.
examples:
- name: List autoscale profiles. (autogenerated)
text: az monitor autoscale profile list --autoscale-name MyAutoscale --resource-group MyResourceGroup
text: |
az monitor autoscale profile list --autoscale-name MyAutoscale --resource-group MyResourceGroup
crafted: true
"""

Expand Down Expand Up @@ -684,7 +701,8 @@
short-summary: List autoscale rules for a profile.
examples:
- name: List autoscale rules for a profile. (autogenerated)
text: az monitor autoscale rule list --autoscale-name MyAutoscale --profile-name MyProfile --resource-group MyResourceGroup
text: |
az monitor autoscale rule list --autoscale-name MyAutoscale --profile-name MyProfile --resource-group MyResourceGroup
crafted: true
"""

Expand All @@ -693,7 +711,8 @@
short-summary: Show autoscale setting details.
examples:
- name: Show autoscale setting details. (autogenerated)
text: az monitor autoscale show --name MyAutoscaleSettings --resource-group MyResourceGroup
text: |
az monitor autoscale show --name MyAutoscaleSettings --resource-group MyResourceGroup
crafted: true
"""

Expand Down Expand Up @@ -726,7 +745,8 @@
az monitor autoscale update -g {myrg} -n {autoscale-name} \\
--remove-action email [email protected]
- name: Update autoscale settings. (autogenerated)
text: az monitor autoscale update --count 3 --email-administrator true --enabled true --max-count 5 --min-count 2 --name MyAutoscaleSettings --resource-group MyResourceGroup --tags key[=value]
text: |
az monitor autoscale update --count 3 --email-administrator true --enabled true --max-count 5 --min-count 2 --name MyAutoscaleSettings --resource-group MyResourceGroup --tags key[=value]
crafted: true
"""

Expand All @@ -740,7 +760,8 @@
short-summary: Updates an autoscale setting.
examples:
- name: Updates an autoscale setting. (autogenerated)
text: az monitor autoscale-settings update --name MyAutoscaleSetting --resource-group MyResourceGroup --set retentionPolicy.days=365
text: |
az monitor autoscale-settings update --name MyAutoscaleSetting --resource-group MyResourceGroup --set retentionPolicy.days=365
crafted: true
"""

Expand Down Expand Up @@ -826,7 +847,8 @@
short-summary: Update diagnostic settings.
examples:
- name: Update diagnostic settings. (autogenerated)
text: az monitor diagnostic-settings update --name MyDiagnosticSetting --resource myScaleSet --set retentionPolicy.days=365
text: |
az monitor diagnostic-settings update --name MyDiagnosticSetting --resource myScaleSet --set retentionPolicy.days=365
crafted: true
"""

Expand All @@ -851,6 +873,11 @@
helps['monitor log-analytics workspace delete'] = """
type: command
short-summary: Delete a workspace instance.
examples:
- name: Delete a workspace instance. (autogenerated)
text: |
az monitor log-analytics workspace delete --resource-group MyResourceGroup --workspace-name MyWorkspace
crafted: true
"""

helps['monitor log-analytics workspace get-schema'] = """
Expand All @@ -859,11 +886,21 @@
long-summary: >
Schema represents the internal structure of the workspace, which can be used during the query.
For more information, visit: https://docs.microsoft.com/en-us/rest/api/loganalytics/workspaces%202015-03-20/getschema
examples:
- name: Get the schema for a given workspace. (autogenerated)
text: |
az monitor log-analytics workspace get-schema --resource-group MyResourceGroup --workspace-name MyWorkspace
crafted: true
"""

helps['monitor log-analytics workspace get-shared-keys'] = """
type: command
short-summary: Get the shared keys for a workspace.
examples:
- name: Get the shared keys for a workspace. (autogenerated)
text: |
az monitor log-analytics workspace get-shared-keys --resource-group MyResourceGroup --workspace-name MyWorkspace
crafted: true
"""

helps['monitor log-analytics workspace list'] = """
Expand All @@ -874,11 +911,21 @@
helps['monitor log-analytics workspace list-management-groups'] = """
type: command
short-summary: Get a list of management groups connected to a workspace.
examples:
- name: Get a list of management groups connected to a workspace. (autogenerated)
text: |
az monitor log-analytics workspace list-management-groups --resource-group MyResourceGroup --workspace-name MyWorkspace
crafted: true
"""

helps['monitor log-analytics workspace list-usages'] = """
type: command
short-summary: Get a list of usage metrics for a workspace.
examples:
- name: Get a list of usage metrics for a workspace. (autogenerated)
text: |
az monitor log-analytics workspace list-usages --resource-group MyResourceGroup --workspace-name MyWorkspace
crafted: true
"""

helps['monitor log-analytics workspace pack'] = """
Expand All @@ -904,6 +951,11 @@
helps['monitor log-analytics workspace show'] = """
type: command
short-summary: Show a workspace instance.
examples:
- name: Show a workspace instance. (autogenerated)
text: |
az monitor log-analytics workspace show --resource-group MyResourceGroup --workspace-name MyWorkspace
crafted: true
"""

helps['monitor log-analytics workspace update'] = """
Expand Down Expand Up @@ -946,7 +998,8 @@
short-summary: Update a log profile.
examples:
- name: Update a log profile. (autogenerated)
text: az monitor log-profiles update --name MyLogProfile --set retentionPolicy.days=365
text: |
az monitor log-profiles update --name MyLogProfile --set retentionPolicy.days=365
crafted: true
"""

Expand Down Expand Up @@ -1006,7 +1059,8 @@
short-summary: Delete a metrics-based alert rule.
examples:
- name: Delete a metrics-based alert rule. (autogenerated)
text: az monitor metrics alert delete --name MyAlertRule --resource-group MyResourceGroup
text: |
az monitor metrics alert delete --name MyAlertRule --resource-group MyResourceGroup
crafted: true
"""

Expand All @@ -1015,7 +1069,8 @@
short-summary: List metric-based alert rules.
examples:
- name: List metric-based alert rules. (autogenerated)
text: az monitor metrics alert list --resource-group MyResourceGroup
text: |
az monitor metrics alert list --resource-group MyResourceGroup
crafted: true
"""

Expand All @@ -1024,7 +1079,8 @@
short-summary: Show a metrics-based alert rule.
examples:
- name: Show a metrics-based alert rule. (autogenerated)
text: az monitor metrics alert show --name MyAlertRule --resource-group MyResourceGroup
text: |
az monitor metrics alert show --name MyAlertRule --resource-group MyResourceGroup
crafted: true
"""

Expand Down Expand Up @@ -1056,7 +1112,8 @@
short-summary: Space-separated list of action group names to remove.
examples:
- name: Update a metric-based alert rule. (autogenerated)
text: az monitor metrics alert update --enabled true --name MyAlertRule --resource-group MyResourceGroup
text: |
az monitor metrics alert update --enabled true --name MyAlertRule --resource-group MyResourceGroup
crafted: true
"""

Expand Down Expand Up @@ -1135,6 +1192,7 @@
short-summary: Lists the metric definitions for the resource.
examples:
- name: Lists the metric definitions for the resource. (autogenerated)
text: az monitor metrics list-definitions --resource /subscriptions/{subscriptionID}/resourceGroups/Space1999/providers/Microsoft.Network/networkSecurityGroups/ADDS-NSG
text: |
az monitor metrics list-definitions --resource /subscriptions/{subscriptionID}/resourceGroups/Space1999/providers/Microsoft.Network/networkSecurityGroups/ADDS-NSG
crafted: true
"""
Loading

0 comments on commit 800e711

Please sign in to comment.