Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
23 changes: 23 additions & 0 deletions src/azure-cli/azure/cli/command_modules/monitor/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,15 @@
az monitor log-analytics workspace table create --resource-group MyResourceGroup --workspace-name MyWorkspace -n MyTable_CL --retention-time 45 --columns MyColumn1=string TimeGenerated=datetime
"""

helps['monitor log-analytics workspace table migrate'] = """
type: command
short-summary: Migrate a Log Analytics table from support of the Data Collector API and Custom Fields features to support of Data Collection Rule-based Custom Logs.
examples:
- name: Migrate a Log Analytics workspace table.
text: |
az monitor log-analytics workspace table migrate --resource-group MyResourceGroup --workspace-name MyWorkspace -n MyTable_CL
"""

helps['monitor log-analytics workspace table search-job'] = """
type: group
short-summary: Manage tables for log analytics workspace search results table.
Expand All @@ -1136,6 +1145,20 @@
az monitor log-analytics workspace table search-job create --resource-group MyResourceGroup --workspace-name MyWorkspace -n MyTable_SRCH --retention-time 45 --search-query "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"
"""

helps['monitor log-analytics workspace table restore'] = """
type: group
short-summary: Manage tables for log analytics workspace restore logs table.
"""

helps['monitor log-analytics workspace table restore create'] = """
type: command
short-summary: Create a Log Analytics workspace restore logs table. The table name needs to end with '_RST'.
examples:
- name: Create a Log Analytics workspace restore logs table.
text: |
az monitor log-analytics workspace table restore create --resource-group MyResourceGroup --workspace-name MyWorkspace -n MyTable_RST --start-restore-time "Sat, 28 Aug 2021 05:29:18 GMT" --end-restore-time "Sat, 28 Aug 2021 08:29:18 GMT" --restore-source-table MyTable
"""


helps['monitor log-analytics workspace table update'] = """
type: command
Expand Down
5 changes: 5 additions & 0 deletions src/azure-cli/azure/cli/command_modules/monitor/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,11 @@ def load_arguments(self, _):
c.argument('start_search_time', arg_type=get_datetime_type(help='Datetime format.'))
c.argument('end_search_time', arg_type=get_datetime_type(help='Datetime format.'))

with self.argument_context('monitor log-analytics workspace table restore create') as c:
c.argument('start_restore_time', arg_type=get_datetime_type(help='Datetime format.'))
c.argument('end_restore_time', arg_type=get_datetime_type(help='Datetime format.'))
c.argument('restore_source_table', help='The table to restore data from.')

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')
Expand Down
4 changes: 4 additions & 0 deletions src/azure-cli/azure/cli/command_modules/monitor/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,16 @@ def load_command_table(self, _):
g.show_command('show', 'get')
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('migrate', 'migrate')
g.command('delete', 'begin_delete', supports_no_wait=True, confirmation=True)
g.wait_command('wait')

with self.command_group('monitor log-analytics workspace table search-job', 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.custom_command('create', 'create_log_analytics_workspace_table_search_job', supports_no_wait=True)

with self.command_group('monitor log-analytics workspace table restore', 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.custom_command('create', 'create_log_analytics_workspace_table_restore', supports_no_wait=True)

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:
g.command('list', 'list_by_workspace')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from azure.cli.command_modules.monitor._client_factory import _log_analytics_client_factory
from azure.cli.core.commands.transform import _parse_id
from azure.mgmt.loganalytics.models import WorkspaceSkuNameEnum, Workspace, WorkspaceSku, WorkspaceCapping, Table,\
Schema, Column, SearchResults, ColumnTypeEnum
Schema, Column, SearchResults, RestoredLogs, ColumnTypeEnum
from azure.cli.core.util import sdk_no_wait
from azure.cli.core.azclierror import ArgumentUsageError, InvalidArgumentValueError, RequiredArgumentMissingError
from knack.util import CLIError
Expand Down Expand Up @@ -194,6 +194,17 @@ def create_log_analytics_workspace_table_search_job(client, resource_group_name,
workspace_name, table_name, table)


def create_log_analytics_workspace_table_restore(client, resource_group_name, workspace_name, table_name,
start_restore_time, end_restore_time, restore_source_table,
no_wait=False):
restored_logs = RestoredLogs(start_restore_time=start_restore_time,
end_restore_time=end_restore_time,
source_table=restore_source_table)
table = Table(restored_logs=restored_logs)
return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name,
workspace_name, table_name, table)


def update_log_analytics_workspace_table(client, resource_group_name, workspace_name, table_name, columns=[],
retention_in_days=None, total_retention_in_days=None, plan=None,
description=None, no_wait=False):
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/requirements.py3.Darwin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ azure-mgmt-iothub==2.1.0
azure-mgmt-iothubprovisioningservices==1.0.0
azure-mgmt-keyvault==9.3.0
azure-mgmt-kusto==0.3.0
azure-mgmt-loganalytics==13.0.0b1
azure-mgmt-loganalytics==13.0.0b2
azure-mgmt-managementgroups==1.0.0
azure-mgmt-maps==2.0.0
azure-mgmt-marketplaceordering==1.1.0
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/requirements.py3.Linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ azure-mgmt-iothub==2.1.0
azure-mgmt-iothubprovisioningservices==1.0.0
azure-mgmt-keyvault==9.3.0
azure-mgmt-kusto==0.3.0
azure-mgmt-loganalytics==13.0.0b1
azure-mgmt-loganalytics==13.0.0b2
azure-mgmt-managementgroups==1.0.0
azure-mgmt-maps==2.0.0
azure-mgmt-marketplaceordering==1.1.0
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/requirements.py3.windows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ azure-mgmt-iothub==2.1.0
azure-mgmt-iothubprovisioningservices==1.0.0
azure-mgmt-keyvault==9.3.0
azure-mgmt-kusto==0.3.0
azure-mgmt-loganalytics==13.0.0b1
azure-mgmt-loganalytics==13.0.0b2
azure-mgmt-managementgroups==1.0.0
azure-mgmt-maps==2.0.0
azure-mgmt-marketplaceordering==1.1.0
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
'azure-mgmt-iothubprovisioningservices~=1.0.0',
'azure-mgmt-keyvault==9.3.0',
'azure-mgmt-kusto~=0.3.0',
'azure-mgmt-loganalytics~=13.0.0b1',
'azure-mgmt-loganalytics~=13.0.0b2',
'azure-mgmt-managedservices~=1.0',
'azure-mgmt-managementgroups~=1.0.0',
'azure-mgmt-maps~=2.0.0',
Expand Down