Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 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
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ interactions:
User-Agent:
- AZURECLI/2.31.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.2 (Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-with-glibc2.29)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001/providers/Microsoft.OperationalInsights/workspaces/wprkspace000003?api-version=2021-06-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001/providers/Microsoft.OperationalInsights/workspaces/wprkspace000003?api-version=2021-12-01-preview
response:
body:
string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\":
Expand Down Expand Up @@ -121,7 +121,7 @@ interactions:
User-Agent:
- AZURECLI/2.31.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.2 (Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-with-glibc2.29)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001/providers/Microsoft.OperationalInsights/workspaces/wprkspace000003?api-version=2021-06-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001/providers/Microsoft.OperationalInsights/workspaces/wprkspace000003?api-version=2021-12-01-preview
response:
body:
string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ interactions:
User-Agent:
- AZURECLI/2.31.0 azsdk-python-mgmt-loganalytics/12.0.0 Python/3.8.9 (Windows-10-10.0.22000-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001/providers/Microsoft.OperationalInsights/workspaces/cliaksworkspace000003?api-version=2021-06-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001/providers/Microsoft.OperationalInsights/workspaces/cliaksworkspace000003?api-version=2021-12-01-preview
response:
body:
string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\":
Expand Down Expand Up @@ -121,7 +121,7 @@ interactions:
User-Agent:
- AZURECLI/2.31.0 azsdk-python-mgmt-loganalytics/12.0.0 Python/3.8.9 (Windows-10-10.0.22000-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001/providers/Microsoft.OperationalInsights/workspaces/cliaksworkspace000003?api-version=2021-06-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001/providers/Microsoft.OperationalInsights/workspaces/cliaksworkspace000003?api-version=2021-12-01-preview
response:
body:
string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ interactions:
User-Agent:
- AZURECLI/2.29.0 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.7.2 (Windows-10-10.0.19041-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/hdicli-000001/providers/Microsoft.OperationalInsights/workspaces/testws000003?api-version=2021-06-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/hdicli-000001/providers/Microsoft.OperationalInsights/workspaces/testws000003?api-version=2021-12-01-preview
response:
body:
string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2964,7 +2964,7 @@ interactions:
User-Agent:
- AZURECLI/2.29.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.7.2 (Windows-10-10.0.19041-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/hdicli-000001/providers/Microsoft.OperationalInsights/workspaces/testws000003?api-version=2021-06-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/hdicli-000001/providers/Microsoft.OperationalInsights/workspaces/testws000003?api-version=2021-12-01-preview
response:
body:
string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\":
Expand Down
39 changes: 37 additions & 2 deletions src/azure-cli/azure/cli/command_modules/monitor/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,15 +1107,47 @@
az monitor log-analytics workspace table show --resource-group MyResourceGroup --workspace-name MyWorkspace -n MyTable
"""

helps['monitor log-analytics workspace table create'] = """
type: command
short-summary: Create a Log Analytics workspace table. The table name needs to end with these strings(_CL,_SRCH,_RST).
examples:
- name: Create a Log Analytics workspace custom log table.
text: |
az monitor log-analytics workspace table create --resource-group MyResourceGroup --workspace-name MyWorkspace -n MyTable_CL --retention-time 45 --columns MyColumn1=string TimeGenerated=datetime
- name: Create a Log Analytics workspace search result table.
text: |
az monitor log-analytics workspace table create --resource-group MyResourceGroup --workspace-name MyWorkspace -n MyTable_SRCH --retention-time 45 --search "Heartbeat | where SourceSystem != '' | project SourceSystem" --limit 1000 --start-search-time "Sat, 28 Aug 2021 05:29:18 GMT" --end-search-time "Sat, 28 Aug 2021 08:29:18 GMT"
- name: Create a Log Analytics workspace restored logs table.
text: |
az monitor log-analytics workspace table create --resource-group MyResourceGroup --workspace-name MyWorkspace -n MyTable_RST --retention-time 45 --start-restore-time "Sat, 28 Aug 2021 05:29:18 GMT" --end-restore-time "Sat, 28 Aug 2021 08:29:18 GMT"
"""

helps['monitor log-analytics workspace table update'] = """
type: command
short-summary: Update the properties of a Log Analytics workspace table, currently only support updating retention time.
short-summary: Update the properties of a Log Analytics workspace table.
examples:
- name: Update the retention time of a Log Analytics workspace table
- name: Update the properties of a Log Analytics workspace table.
text: |
az monitor log-analytics workspace table update --resource-group MyResourceGroup --workspace-name MyWorkspace -n MyTable --retention-time 30
"""

helps['monitor log-analytics workspace table delete'] = """
type: command
short-summary: Delete a Log Analytics workspace table.
examples:
- name: Delete a Log Analytics workspace table.
text: |
az monitor log-analytics workspace table delete --resource-group MyResourceGroup --workspace-name MyWorkspace -n MyTable
"""

helps['monitor log-analytics workspace table wait'] = """
type: command
short-summary: Place the CLI in a waiting state until a condition of the workspace table is met.
examples:
- name: Pause executing next line of CLI script until the workspace table is successfully provisioned.
text: az monitor log-analytics workspace table wait -n MyTable -g MyResourceGroup --workspace-name MyWorkspace --created
"""

helps['monitor log-analytics workspace pack'] = """
type: group
short-summary: Manage intelligent packs for log analytics workspace.
Expand Down Expand Up @@ -1164,6 +1196,9 @@
text: |
az monitor log-analytics workspace update --resource-group myresourcegroup --retention-time 30 --workspace-name myworkspace
crafted: true
- name: Update the defaultDataCollectionRuleResourceId of the workspace
text: |
az monitor log-analytics workspace update --resource-group myresourcegroup --workspace-name myworkspace --data-collection-rule "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dcrName}".
"""

helps['monitor log-analytics workspace linked-service'] = """
Expand Down
28 changes: 27 additions & 1 deletion src/azure-cli/azure/cli/command_modules/monitor/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ def load_arguments(self, _):
arg_type=get_enum_type(PublicNetworkAccessType))
c.argument('force', options_list=['--force', '-f'], arg_type=get_three_state_flag())

with self.argument_context('monitor log-analytics workspace update') as c:
c.argument('default_data_collection_rule_resource_id', options_list='--data-collection-rule', help='The resource ID of the default Data Collection Rule to use for this workspace. Expected format is /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dcrName}.')

with self.argument_context('monitor log-analytics workspace pack') as c:
c.argument('intelligence_pack_name', options_list=['--name', '-n'])
c.argument('workspace_name', options_list='--workspace-name')
Expand All @@ -440,7 +443,30 @@ def load_arguments(self, _):
with self.argument_context('monitor log-analytics workspace table') as c:
c.argument('table_name', name_arg_type, help='Name of the table.')
c.argument('workspace_name', options_list='--workspace-name')
c.argument('retention_in_days', options_list='--retention-time', help='The data table data retention in days, between 30 and 730. Setting this property to null will default to the workspace', type=int, required=True)
c.argument('retention_in_days', type=int, options_list='--retention-time', help='The data table data retention in days, between 30 and 730. Setting this property to null will default to the workspace')

with self.argument_context('monitor log-analytics workspace table create') as c:
from azure.mgmt.loganalytics.models import TablePlanEnum
c.argument('columns', nargs='+', help='A list of table custom columns.Extracts multiple space-separated colunms in colunm_name=colunm_type format')
c.argument('plan', arg_type=get_enum_type(TablePlanEnum), help='The table plan. Possible values include: "Basic", "Analytics".')
c.argument('total_retention_in_days', type=int, options_list='--total-retention-time', help='The table data total retention in days, between 4 and 2555. Setting this property to null will default to table retention.')
c.argument('description', help='Schema description.')
c.argument('query', options_list=['--search'], help='Search job query.')
c.argument('limit', type=int, help='Limit the search job to return up to specified number of rows.')
c.argument('start_search_time', arg_type=get_datetime_type(help='The timestamp to start the search from (UTC).'))
c.argument('end_search_time', arg_type=get_datetime_type(help='The timestamp to end the search by (UTC).'))
c.argument('search_description', help='Search results table\'s Description.')
c.argument('start_restore_time', arg_type=get_datetime_type(help='The timestamp to start the restore from (UTC).'))
c.argument('end_restore_time', arg_type=get_datetime_type(help='The timestamp to end the restore by (UTC).'))

with self.argument_context('monitor log-analytics workspace table update') as c:
from azure.mgmt.loganalytics.models import TablePlanEnum
c.argument('columns', nargs='+', help='A list of table custom columns.Extracts multiple space-separated colunms in colunm_name=colunm_type format')
c.argument('plan', arg_type=get_enum_type(TablePlanEnum), help='The table plan. Possible values include: "Basic", "Analytics".')
c.argument('total_retention_in_days', type=int, options_list='--total-retention-time', help='The table data total retention in days, between 4 and 2555. Setting this property to null will default to table retention.')
c.argument('description', help='Table description.')
c.argument('start_restore_time', arg_type=get_datetime_type(help='The timestamp to start the restore from (UTC).'))
c.argument('end_restore_time', arg_type=get_datetime_type(help='The timestamp to end the restore by (UTC).'))
# endregion

# region Log Analytics Workspace Data Export
Expand Down
7 changes: 5 additions & 2 deletions src/azure-cli/azure/cli/command_modules/monitor/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,13 @@ def load_command_table(self, _):
g.command('list-management-groups', 'list', command_type=log_analytics_workspace_management_groups_sdk)
g.command('get-shared-keys', 'get_shared_keys', command_type=log_analytics_workspace_shared_keys_sdk)

with self.command_group('monitor log-analytics workspace table', log_analytics_workspace_table_sdk, custom_command_type=log_analytics_workspace_custom, client_factory=cf_log_analytics_workspace_tables) as g:
with self.command_group('monitor log-analytics workspace table', log_analytics_workspace_table_sdk, custom_command_type=log_analytics_workspace_custom, client_factory=cf_log_analytics_workspace_tables, is_preview=True) as g:
g.command('list', 'list_by_workspace')
g.show_command('show', 'get')
g.custom_command('update', 'update_log_analytics_workspace_table')
g.custom_command('create', 'create_log_analytics_workspace_table', supports_no_wait=True)
g.custom_command('update', 'update_log_analytics_workspace_table', supports_no_wait=True)
g.command('delete', 'begin_delete', supports_no_wait=True, confirmation=True)
g.wait_command('wait')

with self.command_group('monitor log-analytics workspace data-export', log_analytics_workspace_data_exports_sdk,
custom_command_type=log_analytics_workspace_custom) as g:
Expand Down
Loading