Skip to content

Commit

Permalink
deprecate --plan-publisher, --name, --plan-product and add --solution…
Browse files Browse the repository at this point in the history
…-type for create (Azure#1680)
  • Loading branch information
zhoxing-ms authored Jul 10, 2020
1 parent 348445d commit 545fc11
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 174 deletions.
6 changes: 5 additions & 1 deletion src/log-analytics-solution/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

0.1.1
+++++++++++++++
* deprecate --plan-publisher, --name, --plan-product and add --solution-type for create

0.1.0
++++++
+++++++++++++++
* Initial release.
4 changes: 1 addition & 3 deletions src/log-analytics-solution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ Manage Log Analytics Solution: [more info](https://docs.microsoft.com/en-us/azur
```
az monitor log-analytics solution create \
--resource-group MyResourceGroup \
--name Containers({SolutionName}) \
--plan-publisher Microsoft \
--plan-product "OMSGallery/Containers" \
--solution-type Containers \
--workspace "/subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/ \
Microsoft.OperationalInsights/workspaces/{WorkspaceName}" \
--tags key=value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
type: command
short-summary: Create a log-analytics solution.
examples:
- name: Create a log-analytics solution for the plan product of OMSGallery/Containers
- name: Create a log-analytics solution of type Containers
text: |-
az monitor log-analytics solution create --resource-group MyResourceGroup \\
--name Containers({SolutionName}) --tags key=value \\
--plan-publisher Microsoft --plan-product "OMSGallery/Containers" \\
--solution-type Containers --tags key=value \\
--workspace "/subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/ \\
Microsoft.OperationalInsights/workspaces/{WorkspaceName}"
"""
Expand Down
21 changes: 14 additions & 7 deletions src/log-analytics-solution/azext_log_analytics_solution/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,27 @@
from ._validators import validate_workspace_resource_id

solution_name = CLIArgumentType(options_list=['--name', '-n'],
help='Name of the log-analytics solution. For Microsoft published solution it '
'should be in the format of solutionType(workspaceName). SolutionType part is '
'case sensitive. For third party solution, it can be anything.')
help='Name of the log-analytics solution. It should be in the format of '
'solutionType(workspaceName). SolutionType part is case sensitive. ')


def load_arguments(self, _):

with self.argument_context('monitor log-analytics solution create') as c:
c.ignore('location')
c.argument('solution_name', solution_name)
c.argument('solution_type', options_list=['--solution-type', '-t'],
help='Type of the log-analytics solution. The most used are: SecurityCenterFree, Security, Updates, '
'ContainerInsights, ServiceMap, AzureActivity, ChangeTracking, VMInsights, SecurityInsights, '
'NetworkMonitoring, SQLVulnerabilityAssessment, SQLAdvancedThreatProtection, AntiMalware, '
'AzureAutomation, LogicAppsManagement, SQLDataClassification')
c.argument('solution_name', solution_name, deprecate_info=c.deprecate(hide=True))
c.argument('tags', tags_type)
c.argument('plan_publisher', help='Publisher name of the plan for solution. For gallery solution, it is Microsoft.')
c.argument('plan_product', help='Product name of the plan for solution. '
'For Microsoft published gallery solution it should be in the format of OMSGallery/<solutionType>. This is case sensitive.')
c.argument('plan_publisher',
help='Publisher name of the plan for solution. For gallery solution, it is Microsoft.',
deprecate_info=c.deprecate(hide=True))
c.argument('plan_product',
help='Product name of the plan for solution. It should be in the format of OMSGallery/<solutionType>. This is case sensitive.',
deprecate_info=c.deprecate(hide=True))
c.argument('workspace_resource_id', options_list=['--workspace', '-w'],
validator=validate_workspace_resource_id,
help='The name or resource ID of the log analytics workspace with which the solution will be linked.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ def validate_workspace_resource_id(cmd, namespace):

# The location of solution is the same as the location of the workspace
namespace.location = workspaces.location

namespace.solution_name = namespace.solution_type + "(" + workspace_param['resource_name'] + ")"
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

def create_monitor_log_analytics_solution(client,
resource_group_name,
solution_name,
plan_publisher,
plan_product,
solution_type,
workspace_resource_id,
location,
solution_name=None,
plan_publisher=None,
plan_product=None,
tags=None,
no_wait=False):

Expand All @@ -29,8 +30,8 @@ def create_monitor_log_analytics_solution(client,
},
"plan": {
"name": solution_name,
"product": plan_product,
"publisher": plan_publisher,
"product": "OMSGallery/" + solution_type,
"publisher": "Microsoft",
"promotion_code": ""
}
}
Expand Down
Loading

0 comments on commit 545fc11

Please sign in to comment.