Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{monitor-control-service} Migrate sub cmds of az monitor data-collection rule #7799

Merged
merged 3 commits into from
Jul 17, 2024
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
4 changes: 4 additions & 0 deletions src/monitor-control-service/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Release History
===============
1.2.0
++++++
* Update api-version to `2023-03-11` for sub cmds of `az monitor data-collection rule`

1.1.0
++++++
* Update api-version to `2023-03-11`
Expand Down
10 changes: 2 additions & 8 deletions src/monitor-control-service/azext_amcs/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,12 @@
# pylint: disable=unused-wildcard-import
# pylint: disable=unused-import

try:
from .manual._help import helps # pylint: disable=reimported
except ImportError as e:
if e.name.endswith('manual._help'):
pass
else:
raise e
from knack.help_files import helps


helps['monitor data-collection'] = '''
type: group
short-summary: Manage Monitor
short-summary: Manage data collection for monitor control service
'''

helps['monitor data-collection rule'] = """
Expand Down
103 changes: 1 addition & 102 deletions src/monitor-control-service/azext_amcs/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,10 @@
# pylint: disable=too-many-statements

from azure.cli.core.commands.parameters import (
tags_type,
resource_group_name_type,
get_enum_type
)
from azure.cli.core.commands.validators import (
validate_file_or_dict
)
from azext_amcs.action import (
AddDataFlows,
AddDestinationsLogAnalytics,
AddDestinationsAzureMonitorMetrics,
AddDataSourcesPerformanceCounters,
AddDataSourcesWindowsEventLogs,
AddDataSourcesSyslog
)
from azext_amcs._validators import validate_association_name_with_endpoint

from azext_amcs.vendored_sdks.amcs.models import KnownDataFlowStreams, KnownPerfCounterDataSourceStreams, \
KnownWindowsEventLogDataSourceStreams, KnownSyslogDataSourceStreams, \
KnownSyslogDataSourceFacilityNames, KnownSyslogDataSourceLogLevels
from azext_amcs._validators import validate_association_name_with_endpoint


def load_arguments(self, _): # pylint: disable=unused-argument
Expand All @@ -52,88 +36,3 @@ def load_arguments(self, _): # pylint: disable=unused-argument
type=str, help='The name of the data collection endpoint. The name is case insensitive.')
c.argument('resource_uri', options_list=['--resource', '--resource-uri'],
type=str, help='The identifier of the resource.')

with self.argument_context('monitor data-collection rule') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('data_collection_rule_name', options_list=['--name', '-n'], help='The name of the data '
'collection rule. The name is case insensitive.', id_part='name')
c.argument('tags', tags_type)
c.argument('description', help='Description of the data collection rule.')

c.argument('data_flows', action=AddDataFlows, options_list=['--data-flows'], arg_group="Data Flow",
nargs='+', help='The specification of data flows.')

c.argument('destinations__log_analytics', options_list=['--log-analytics'], arg_group="Destinations",
action=AddDestinationsLogAnalytics, nargs='+', help='List of Log Analytics destinations.')
c.argument('destinations__azure_monitor_metrics', options_list=['--monitor-metrics'], arg_group="Destinations",
action=AddDestinationsAzureMonitorMetrics, nargs='+', help='Azure Monitor Metrics destination.')

c.argument('data_sources__performance_counters', options_list=['--performance-counters'],
arg_group="Data Sources", action=AddDataSourcesPerformanceCounters, nargs='+',
help='The list of performance counter data source configurations.')
c.argument('data_sources__windows_event_logs', options_list=['--windows-event-logs'], arg_group="Data Sources",
action=AddDataSourcesWindowsEventLogs, nargs='+', help='The list of Windows Event Log data source '
'configurations.')
c.argument('data_sources__syslog', options_list=['--syslog'], arg_group="Data Sources",
action=AddDataSourcesSyslog, nargs='+', help='The list of Syslog data source configurations.')
c.argument('data_sources__extensions', options_list=['--extensions'], arg_group="Data Sources",
type=validate_file_or_dict, help='The list of Azure VM extension data source configurations. '
'Expected value: json-string/@json-file.')

with self.argument_context('monitor data-collection rule data-flow') as c:
c.argument('data_collection_rule_name', options_list=['--rule-name'], id_part=None)
c.argument('streams', options_list=['--streams'], arg_type=get_enum_type(KnownDataFlowStreams),
nargs='+', help='List of streams for this data flow.')
c.argument('destinations', options_list=['--destinations'], nargs='+',
help='List of destinations for this data flow.')

with self.argument_context('monitor data-collection rule log-analytics') as c:
c.argument('data_collection_rule_name', options_list=['--rule-name'], id_part=None)
c.argument('name', options_list=['--name', '-n'],
help='A friendly name for the destination. This name should be unique across all destinations '
'(regardless of type) within the data collection rule.')
c.argument('workspace_resource_id', options_list=['--resource-id'],
help='The resource ID of the Log Analytics workspace.')

with self.argument_context('monitor data-collection rule performance-counter') as c:
c.argument('data_collection_rule_name', options_list=['--rule-name'], id_part=None)
c.argument('name', options_list=['--name', '-n'],
help='A friendly name for the data source. This name should be unique across all data sources '
'(regardless of type) within the data collection rule.')
c.argument('streams', options_list=['--streams'], arg_type=get_enum_type(KnownPerfCounterDataSourceStreams),
nargs='+', help='List of streams that this data source will be sent to. A stream '
'indicates what schema will be used for this data and usually what table in Log Analytics the data '
'will be sent to.')
c.argument('sampling_frequency_in_seconds', options_list=['--sampling-frequency'], type=int,
help='The number of seconds between consecutive counter measurements (samples).')
c.argument('counter_specifiers', options_list=['--counter-specifiers'], nargs='+',
help="A list of specifier names of the performance counters you want to collect."
"Use a wildcard (*) to collect a counter for all instances. "
"To get a list of performance counters on Windows, run the command 'typeperf'.")

with self.argument_context('monitor data-collection rule windows-event-log') as c:
c.argument('data_collection_rule_name', options_list=['--rule-name'], id_part=None)
c.argument('name', options_list=['--name', '-n'],
help='A friendly name for the data source. This name should be unique across all data sources '
'(regardless of type) within the data collection rule.')
c.argument('streams', options_list=['--streams'], arg_type=get_enum_type(KnownWindowsEventLogDataSourceStreams),
nargs='+', help='List of streams that this data source will be sent to. A stream '
'indicates what schema will be used for this data and usually what table in Log Analytics the data '
'will be sent to.')
c.argument('x_path_queries', options_list=['--x-path-queries'], nargs='+',
help='A list of Windows Event Log queries in XPATH format.')

with self.argument_context('monitor data-collection rule syslog') as c:
c.argument('data_collection_rule_name', options_list=['--rule-name'], id_part=None)
c.argument('name', options_list=['--name', '-n'],
help='A friendly name for the data source. This name should be unique across all data sources '
'(regardless of type) within the data collection rule.')
c.argument('streams', options_list=['--streams'], arg_type=get_enum_type(KnownSyslogDataSourceStreams),
nargs='+', help='List of streams that this data source will be sent to. A stream '
'indicates what schema will be used for this data and usually what table in Log Analytics the data '
'will be sent to.')
c.argument('facility_names', options_list=['--facility-names'],
arg_type=get_enum_type(KnownSyslogDataSourceFacilityNames), nargs='+',
help='The list of facility names.')
c.argument('log_levels', options_list=['--log-levels'], arg_type=get_enum_type(KnownSyslogDataSourceLogLevels),
nargs='+', help='The log levels to collect.')
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"monitor data-collection rule data-flow",
)
class __CMDGroup(AAZCommandGroup):
"""Manage data flows.
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
from ._add import *
from ._list import *
Loading
Loading