diff --git a/src/scheduled-query/HISTORY.rst b/src/scheduled-query/HISTORY.rst index caadcc3874..76e75c74ba 100644 --- a/src/scheduled-query/HISTORY.rst +++ b/src/scheduled-query/HISTORY.rst @@ -2,6 +2,14 @@ Release History =============== +0.4.0 +++++++ +* Add `--skip-query-validation` parameter +* Add `--check-ws-alerts-storage` parameter +* Add `--auto-mitigate` parameter +* [Breaking Change] `--actions` are split into `--action-groups` and `--custom-properties` +* [Breaking Change] the default value of `--mute-actions-duration` is changed to None + 0.3.1 ++++++ * Support query placeholder for `--condition` parameter. diff --git a/src/scheduled-query/azext_scheduled_query/__init__.py b/src/scheduled-query/azext_scheduled_query/__init__.py index d7894bdc73..c716523418 100644 --- a/src/scheduled-query/azext_scheduled_query/__init__.py +++ b/src/scheduled-query/azext_scheduled_query/__init__.py @@ -16,8 +16,7 @@ def __init__(self, cli_ctx=None): scheduled_query_custom = CliCommandType( operations_tmpl='azext_scheduled_query.custom#{}', client_factory=cf_scheduled_query) - super(ScheduledQueryCommandsLoader, self).__init__(cli_ctx=cli_ctx, - custom_command_type=scheduled_query_custom) + super().__init__(cli_ctx=cli_ctx, custom_command_type=scheduled_query_custom) def load_command_table(self, args): from azext_scheduled_query.commands import load_command_table diff --git a/src/scheduled-query/azext_scheduled_query/_actions.py b/src/scheduled-query/azext_scheduled_query/_actions.py index 9417edfb8e..5bb28b881d 100644 --- a/src/scheduled-query/azext_scheduled_query/_actions.py +++ b/src/scheduled-query/azext_scheduled_query/_actions.py @@ -39,12 +39,9 @@ def __call__(self, parser, namespace, values, option_string=None): for item in ['time_aggregation', 'threshold', 'operator']: if not getattr(scheduled_query_condition, item, None): raise InvalidArgumentValueError(usage) - except (AttributeError, TypeError, KeyError): - raise InvalidArgumentValueError(usage) - super(ScheduleQueryConditionAction, self).__call__(parser, - namespace, - scheduled_query_condition, - option_string) + except (AttributeError, TypeError, KeyError) as e: + raise InvalidArgumentValueError(usage) from e + super().__call__(parser, namespace, scheduled_query_condition, option_string) class ScheduleQueryConditionQueryAction(argparse.Action): @@ -65,9 +62,9 @@ def __call__(self, parser, namespace, values, option_string=None): class ScheduleQueryAddAction(argparse._AppendAction): def __call__(self, parser, namespace, values, option_string=None): - from azext_scheduled_query.vendored_sdks.azure_mgmt_scheduled_query.models import Action - action = Action( - action_group_id=values[0], - web_hook_properties=dict(x.split('=', 1) for x in values[1:]) if len(values) > 1 else None + from azext_scheduled_query.vendored_sdks.azure_mgmt_scheduled_query.models import Actions + action = Actions( + action_groups=values[0], + custom_properties=dict(x.split('=', 1) for x in values[1:]) if len(values) > 1 else None ) - super(ScheduleQueryAddAction, self).__call__(parser, namespace, action, option_string) + super().__call__(parser, namespace, action, option_string) diff --git a/src/scheduled-query/azext_scheduled_query/_client_factory.py b/src/scheduled-query/azext_scheduled_query/_client_factory.py index 736646ac84..9063ba9edc 100644 --- a/src/scheduled-query/azext_scheduled_query/_client_factory.py +++ b/src/scheduled-query/azext_scheduled_query/_client_factory.py @@ -6,5 +6,5 @@ def cf_scheduled_query(cli_ctx, *_): from azure.cli.core.commands.client_factory import get_mgmt_service_client - from .vendored_sdks.azure_mgmt_scheduled_query._monitor_client import MonitorClient - return get_mgmt_service_client(cli_ctx, MonitorClient).scheduled_query_rules + from .vendored_sdks.azure_mgmt_scheduled_query._monitor_management_client import MonitorManagementClient + return get_mgmt_service_client(cli_ctx, MonitorManagementClient).scheduled_query_rules diff --git a/src/scheduled-query/azext_scheduled_query/_help.py b/src/scheduled-query/azext_scheduled_query/_help.py index f68aa7f4db..dfbbe52c19 100644 --- a/src/scheduled-query/azext_scheduled_query/_help.py +++ b/src/scheduled-query/azext_scheduled_query/_help.py @@ -16,12 +16,14 @@ type: command short-summary: Create a scheduled query. parameters: - - name: --action -a - short-summary: Add an action group and optional webhook properties to fire when the alert is triggered. + - name: --action-groups + short-summary: Action Group resource Ids to invoke when the alert fires. long-summary: | - Usage: --action ACTION_GROUP_NAME_OR_ID [KEY=VAL [KEY=VAL ...]] - - Multiple action groups can be specified by using more than one `--action` argument. + Usage: --action-groups ACTION_GROUP_NAME_OR_ID [NAME_OR_ID,...] + - name: --custom-properties + short-summary: The properties of an alert payload. + long-summary: | + Usage: --custom-properties ALERT_PAYLOAD_PROPERTIES [KEY=VAL,KEY=VAL ...] - name: --condition short-summary: The condition which triggers the rule. long-summary: | @@ -44,12 +46,14 @@ type: command short-summary: Update a scheduled query. parameters: - - name: --action -a - short-summary: Add an action group and optional webhook properties to fire when the alert is triggered. + - name: --action-groups + short-summary: Action Group resource Ids to invoke when the alert fires. long-summary: | - Usage: --action ACTION_GROUP_NAME_OR_ID [KEY=VAL [KEY=VAL ...]] - - Multiple action groups can be specified by using more than one `--action` argument. + Usage: --action-groups ACTION_GROUP_NAME_OR_ID [NAME_OR_ID,...] + - name: --custom-properties + short-summary: The properties of an alert payload. + long-summary: | + Usage: --custom-properties ALERT_PAYLOAD_PROPERTIES [KEY=VAL,KEY=VAL ...] - name: --condition short-summary: The condition which triggers the rule. long-summary: | diff --git a/src/scheduled-query/azext_scheduled_query/_params.py b/src/scheduled-query/azext_scheduled_query/_params.py index 6ac9b1c3d7..ffb8925b16 100644 --- a/src/scheduled-query/azext_scheduled_query/_params.py +++ b/src/scheduled-query/azext_scheduled_query/_params.py @@ -6,9 +6,9 @@ from azure.cli.core.commands.parameters import tags_type, get_three_state_flag from azure.cli.command_modules.monitor.actions import get_period_type -from azure.cli.command_modules.monitor.validators import get_action_group_validator +from azext_scheduled_query._validators import validate_custom_properties from knack.arguments import CLIArgumentType -from ._actions import ScheduleQueryConditionAction, ScheduleQueryAddAction, ScheduleQueryConditionQueryAction +from ._actions import ScheduleQueryConditionAction, ScheduleQueryConditionQueryAction def load_arguments(self, _): @@ -16,6 +16,11 @@ def load_arguments(self, _): from azure.cli.core.commands.validators import get_default_location_from_resource_group name_arg_type = CLIArgumentType(options_list=['--name', '-n'], metavar='NAME') + custom_properties_arg_type = CLIArgumentType( + validator=validate_custom_properties, + options_list=['--custom-properties'], + nargs='*', + help='The properties of an alert payload.') with self.argument_context('monitor scheduled-query') as c: c.argument('rule_name', name_arg_type, id_part='name', help='Name of the scheduled query rule.') c.argument('location', validator=get_default_location_from_resource_group) @@ -35,4 +40,12 @@ def load_arguments(self, _): c.argument('mute_actions_duration', type=get_period_type(as_timedelta=True), options_list=['--mute-actions-duration', '--mad'], help='Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired.') - c.argument('actions', options_list=['--action', '-a'], action=ScheduleQueryAddAction, nargs='+', validator=get_action_group_validator('actions')) + c.argument('action_groups', options_list=['--action-groups'], nargs='+', help='Action Group resource Ids to invoke when the alert fires.') + c.argument('custom_properties', custom_properties_arg_type) + c.argument('auto_mitigate', arg_type=get_three_state_flag(), + help='The flag that indicates whether the alert should be automatically resolved or not. The default is true.') + c.argument('skip_query_validation', arg_type=get_three_state_flag(), + help='The flag which indicates whether the provided query should be validated or not.') + c.argument('check_workspace_alerts_storage', options_list=['--check-ws-alerts-storage', '--cwas'], + arg_type=get_three_state_flag(), + help="The flag which indicates whether this scheduled query rule should be stored in the customer's storage.") diff --git a/src/scheduled-query/azext_scheduled_query/_validators.py b/src/scheduled-query/azext_scheduled_query/_validators.py new file mode 100644 index 0000000000..aa59a43b97 --- /dev/null +++ b/src/scheduled-query/azext_scheduled_query/_validators.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +def validate_tag(string): + result = {} + if string: + comps = string.split('=', 1) + result = {comps[0]: comps[1]} if len(comps) > 1 else {string: ''} + return result + + +def validate_custom_properties(ns): + if isinstance(ns.custom_properties, list): + custom_properties_dict = {} + for item in ns.custom_properties: + custom_properties_dict.update(validate_tag(item)) + ns.custom_properties = custom_properties_dict diff --git a/src/scheduled-query/azext_scheduled_query/custom.py b/src/scheduled-query/azext_scheduled_query/custom.py index 105eaaa40a..2dc739c53a 100644 --- a/src/scheduled-query/azext_scheduled_query/custom.py +++ b/src/scheduled-query/azext_scheduled_query/custom.py @@ -25,27 +25,52 @@ def _build_criteria(condition, condition_query): return ScheduledQueryRuleCriteria(all_of=condition) -def create_scheduled_query(client, resource_group_name, rule_name, scopes, condition, condition_query=None, - disabled=False, description=None, tags=None, location=None, - actions=None, severity=2, window_size='5m', evaluation_frequency='5m', - target_resource_type=None, mute_actions_duration='PT30M'): - from .vendored_sdks.azure_mgmt_scheduled_query.models import ScheduledQueryRuleResource +def create_scheduled_query(client, + resource_group_name, + rule_name, + scopes, + condition, + action_groups=None, + custom_properties=None, + condition_query=None, + disabled=False, + description=None, + tags=None, + location=None, + severity=2, + window_size='5m', + evaluation_frequency='5m', + target_resource_type=None, + mute_actions_duration=None, + auto_mitigate=True, + skip_query_validation=False, + check_workspace_alerts_storage=False): criteria = _build_criteria(condition, condition_query) - kwargs = { - 'description': description, - 'severity': severity, - 'enabled': not disabled, - 'scopes': scopes, - 'evaluation_frequency': evaluation_frequency, - 'window_size': window_size, - 'criteria': criteria, - 'target_resource_types': [target_resource_type] if target_resource_type else None, - 'actions': actions, - 'tags': tags, - 'location': location, - 'mute_actions_duration': mute_actions_duration - } - return client.create_or_update(resource_group_name, rule_name, ScheduledQueryRuleResource(**kwargs)) + parameters = {} + actions = {} + actions['action_groups'] = action_groups if action_groups is not None else [] + actions['custom_properties'] = custom_properties if custom_properties is not None else {} + parameters['actions'] = actions + parameters['scopes'] = scopes + parameters['criteria'] = criteria + if actions is not None: + parameters['actions'] = actions + parameters['enabled'] = not disabled + if description is not None: + parameters['description'] = description + if tags is not None: + parameters['tags'] = tags + if location is not None: + parameters['location'] = location + parameters['severity'] = severity + parameters['window_size'] = window_size + parameters['evaluation_frequency'] = evaluation_frequency + parameters['target_resource_types'] = [target_resource_type] if target_resource_type else None + parameters['mute_actions_duration'] = mute_actions_duration + parameters['auto_mitigate'] = auto_mitigate + parameters['skip_query_validation'] = skip_query_validation + parameters['check_workspace_alerts_storage_configured'] = check_workspace_alerts_storage + return client.create_or_update(resource_group_name=resource_group_name, rule_name=rule_name, parameters=parameters) def list_scheduled_query(client, resource_group_name=None): @@ -54,19 +79,43 @@ def list_scheduled_query(client, resource_group_name=None): return client.list_by_subscription() -def update_scheduled_query(cmd, instance, tags=None, disabled=False, condition=None, condition_query=None, - description=None, actions=None, severity=None, window_size=None, - evaluation_frequency=None, mute_actions_duration=None): +def update_scheduled_query(cmd, + instance, + tags=None, + disabled=None, + condition=None, + action_groups=None, + custom_properties=None, + condition_query=None, + description=None, + severity=None, + window_size=None, + evaluation_frequency=None, + mute_actions_duration=None, + target_resource_type=None, + auto_mitigate=None, + skip_query_validation=None, + check_workspace_alerts_storage=None + ): with cmd.update_context(instance) as c: c.set_param('tags', tags) c.set_param('enabled', not disabled) c.set_param('description', description) - c.set_param('actions', actions) + c.set_param('actions.action_groups', action_groups) + c.set_param('actions.custom_properties', custom_properties) c.set_param('severity', severity) c.set_param('window_size', window_size) c.set_param('evaluation_frequency', evaluation_frequency) c.set_param('mute_actions_duration', mute_actions_duration) + c.set_param('target_resource_type', target_resource_type) + c.set_param('auto_mitigate', auto_mitigate) + c.set_param('skip_query_validation', skip_query_validation) + c.set_param('check_workspace_alerts_storage_configured', check_workspace_alerts_storage) if condition is not None: criteria = _build_criteria(condition, condition_query) c.set_param('criteria', criteria) + if disabled is not None: + c.set_param('enabled', not disabled) + if auto_mitigate is not None: + c.set_param('auto_mitigate', auto_mitigate) return instance diff --git a/src/scheduled-query/azext_scheduled_query/tests/latest/recordings/test_scheduled_query.yaml b/src/scheduled-query/azext_scheduled_query/tests/latest/recordings/test_scheduled_query.yaml index 921922c9dd..ec3a359df3 100644 --- a/src/scheduled-query/azext_scheduled_query/tests/latest/recordings/test_scheduled_query.yaml +++ b/src/scheduled-query/azext_scheduled_query/tests/latest/recordings/test_scheduled_query.yaml @@ -13,21 +13,21 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001?api-version=2021-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001","name":"cli_test_scheduled_query000001","type":"Microsoft.Resources/resourceGroups","location":"eastus","tags":{"product":"azurecli","cause":"automation","date":"2021-08-05T02:24:05Z","StorageType":"Standard_LRS","type":"test"},"properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001","name":"cli_test_scheduled_query000001","type":"Microsoft.Resources/resourceGroups","location":"eastus","tags":{"product":"azurecli","cause":"automation","date":"2021-08-13T02:27:22Z"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '471' + - '428' content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:24:17 GMT + - Fri, 13 Aug 2021 02:27:28 GMT expires: - '-1' pragma: @@ -107,13 +107,13 @@ interactions: content-type: - text/plain; charset=utf-8 date: - - Thu, 05 Aug 2021 02:24:18 GMT + - Fri, 13 Aug 2021 02:27:29 GMT etag: - W/"54bceef15b892f2aa7f4c2145a49f1b5e33608722acdbb47933d7b6cbebbd7f4" expires: - - Thu, 05 Aug 2021 02:29:18 GMT + - Fri, 13 Aug 2021 02:32:29 GMT source-age: - - '250' + - '270' strict-transport-security: - max-age=31536000 vary: @@ -127,15 +127,15 @@ interactions: x-content-type-options: - nosniff x-fastly-request-id: - - eb28d712723b71be86d157bcb7b46391aa5d18cc + - ad890af6384503585aebf0b6809659de3ea28531 x-frame-options: - deny x-github-request-id: - - 3CA4:7300:F32DF:1D80CA:610A8A9B + - DF62:256E:3681:A077:6115C90F x-served-by: - - cache-qpg1222-QPG + - cache-qpg1280-QPG x-timer: - - S1628130259.939250,VS0,VE0 + - S1628821649.123927,VS0,VE1 x-xss-protection: - 1; mode=block status: @@ -155,7 +155,7 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-azure-mgmt-network/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-network/19.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/virtualNetworks?api-version=2018-01-01 response: @@ -169,7 +169,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:24:19 GMT + - Fri, 13 Aug 2021 02:27:28 GMT expires: - '-1' pragma: @@ -197,7 +197,7 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002?api-version=2020-10-01 response: @@ -213,7 +213,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:24:20 GMT + - Fri, 13 Aug 2021 02:27:30 GMT expires: - '-1' pragma: @@ -241,21 +241,21 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001?api-version=2021-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001","name":"cli_test_scheduled_query000001","type":"Microsoft.Resources/resourceGroups","location":"eastus","tags":{"product":"azurecli","cause":"automation","date":"2021-08-05T02:24:05Z","StorageType":"Standard_LRS","type":"test"},"properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001","name":"cli_test_scheduled_query000001","type":"Microsoft.Resources/resourceGroups","location":"eastus","tags":{"product":"azurecli","cause":"automation","date":"2021-08-13T02:27:22Z"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '471' + - '428' content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:24:20 GMT + - Fri, 13 Aug 2021 02:27:30 GMT expires: - '-1' pragma: @@ -289,22 +289,22 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002?api-version=2020-10-01 response: body: string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\": - \"34e7e180-aa74-498c-859d-5302835b9b2d\",\r\n \"provisioningState\": \"Creating\",\r\n + \"b592e84d-2dc5-496a-8e88-645ee1f0ebff\",\r\n \"provisioningState\": \"Creating\",\r\n \ \"sku\": {\r\n \"name\": \"pergb2018\",\r\n \"lastSkuUpdate\": - \"Thu, 05 Aug 2021 02:24:28 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n + \"Fri, 13 Aug 2021 02:27:39 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n \ \"features\": {\r\n \"legacy\": 0,\r\n \"searchVersion\": 1,\r\n \ \"enableLogAccessUsingOnlyResourcePermissions\": true\r\n },\r\n \ \"workspaceCapping\": {\r\n \"dailyQuotaGb\": -1.0,\r\n \"quotaNextResetTime\": - \"Thu, 05 Aug 2021 07:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n + \"Fri, 13 Aug 2021 18:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n \ },\r\n \"publicNetworkAccessForIngestion\": \"Enabled\",\r\n \"publicNetworkAccessForQuery\": - \"Enabled\",\r\n \"createdDate\": \"Thu, 05 Aug 2021 02:24:28 GMT\",\r\n - \ \"modifiedDate\": \"Thu, 05 Aug 2021 02:24:28 GMT\"\r\n },\r\n \"id\": + \"Enabled\",\r\n \"createdDate\": \"Fri, 13 Aug 2021 02:27:39 GMT\",\r\n + \ \"modifiedDate\": \"Fri, 13 Aug 2021 02:27:39 GMT\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/microsoft.operationalinsights/workspaces/clitest000002\",\r\n \ \"name\": \"clitest000002\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces\",\r\n \ \"location\": \"eastus\"\r\n}" @@ -316,7 +316,7 @@ interactions: content-type: - application/json date: - - Thu, 05 Aug 2021 02:24:29 GMT + - Fri, 13 Aug 2021 02:27:40 GMT pragma: - no-cache server: @@ -348,22 +348,22 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002?api-version=2020-10-01 response: body: string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\": - \"34e7e180-aa74-498c-859d-5302835b9b2d\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \"b592e84d-2dc5-496a-8e88-645ee1f0ebff\",\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"sku\": {\r\n \"name\": \"pergb2018\",\r\n \"lastSkuUpdate\": - \"Thu, 05 Aug 2021 02:24:28 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n + \"Fri, 13 Aug 2021 02:27:39 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n \ \"features\": {\r\n \"legacy\": 0,\r\n \"searchVersion\": 1,\r\n \ \"enableLogAccessUsingOnlyResourcePermissions\": true\r\n },\r\n \ \"workspaceCapping\": {\r\n \"dailyQuotaGb\": -1.0,\r\n \"quotaNextResetTime\": - \"Thu, 05 Aug 2021 07:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n + \"Fri, 13 Aug 2021 18:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n \ },\r\n \"publicNetworkAccessForIngestion\": \"Enabled\",\r\n \"publicNetworkAccessForQuery\": - \"Enabled\",\r\n \"createdDate\": \"Thu, 05 Aug 2021 02:24:28 GMT\",\r\n - \ \"modifiedDate\": \"Thu, 05 Aug 2021 02:24:28 GMT\"\r\n },\r\n \"id\": + \"Enabled\",\r\n \"createdDate\": \"Fri, 13 Aug 2021 02:27:39 GMT\",\r\n + \ \"modifiedDate\": \"Fri, 13 Aug 2021 02:27:40 GMT\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/microsoft.operationalinsights/workspaces/clitest000002\",\r\n \ \"name\": \"clitest000002\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces\",\r\n \ \"location\": \"eastus\"\r\n}" @@ -375,7 +375,7 @@ interactions: content-type: - application/json date: - - Thu, 05 Aug 2021 02:24:59 GMT + - Fri, 13 Aug 2021 02:28:10 GMT pragma: - no-cache server: @@ -422,7 +422,7 @@ interactions: "protectedSettings": {"workspaceKey": "[listKeys(parameters(''workspaceId''), ''2015-11-01-preview'').primarySharedKey]"}}, "name": "myvm1/OmsAgentForLinux", "location": "eastus", "dependsOn": ["Microsoft.Compute/virtualMachines/myvm1"]}, - {"apiVersion": "2021-03-01", "type": "Microsoft.Compute/virtualMachines", "name": + {"apiVersion": "2021-04-01", "type": "Microsoft.Compute/virtualMachines", "name": "myvm1", "location": "eastus", "tags": {}, "dependsOn": ["Microsoft.Network/networkInterfaces/myvm1VMNic"], "properties": {"hardwareProfile": {"vmSize": "Standard_DS1_v2"}, "networkProfile": {"networkInterfaces": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic", @@ -430,10 +430,10 @@ interactions: "fromImage", "name": null, "caching": "ReadWrite", "managedDisk": {"storageAccountType": null}}, "imageReference": {"publisher": "Canonical", "offer": "UbuntuServer", "sku": "18.04-LTS", "version": "latest"}}, "osProfile": {"computerName": "myvm1", - "adminUsername": "kairu", "linuxConfiguration": {"disablePasswordAuthentication": - true, "ssh": {"publicKeys": [{"keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDPMuHNzSd64J+szP6o1PrORXVyLcT0rnY1jkPNXt2taPECh5LJ1GFUbV/T8NphlT+jkgd6Q8DokO3x/IZ7gIVIO9CFsLUWAcvB0IGSRnIEK4MXIYFrHh45STacrSO+K1trflLXb2S8a4CNyZOuRja2w5+ggt+jSluGmoT19Os5pVv7Slh/Z536r60i/mA2MJhhwLWe9njCfhxCUAffOMD0tQgFCrieAB/fwNEYqmWNX4VWSbpO+1qfJzTl6SwRoFv9Z/v3szgexwHazlsUqlD1ALAcf6qnQcSh9VvqUZJpLW9vfOPkMGMKQdHTK0MbsrivLu41hg4yWyhC9yDmkNhGJAFgaYAJMdYuHH3GSX2xofP9HrN0PG4V+oVxL89St2mXrKlbNryZCtoOnw05ugEPiLmDCav8vZyRfz4/OQLq2yHUrkavU5R2PRFSfoBNrk894+5Cvr3eW7IEbl014ikiFMLhtRairBBeZhrdGbaMAsgaa5e6AfA5m2820Hf8sf8= - kairu@microsoft.com\n", "path": "/home/kairu/.ssh/authorized_keys"}]}}}}}], - "outputs": {}}, "parameters": {"workspaceId": {"value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/microsoft.operationalinsights/workspaces/clitest000002"}}, + "adminUsername": "v-jingszhang", "linuxConfiguration": {"disablePasswordAuthentication": + true, "ssh": {"publicKeys": [{"keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDL2PtV5sp++a43U/dRJ2Fyjso9qDFNbWEnbYk7mA4CfXy0gvxm65oYVd90JysNmGBF/89hIvCTN3ul4aEIuPkzywozRbdyWiJngSd/7OrNBJzpQQSjsGXwoVNDRAJSzlvuQVUR2vwBHeN2xMIvufSvzO3LGI3xcSIWIYlSvU9urnV+Pefd4T6x/OXgTpE02AgMWOspdZTzg0ZKsSU3sG5nYSNoq+8qrHQSXLbLLdWzz5lYKe8p64fQC/xhXrNa3/Nw5vy8YGsyqGueM/Rj6gCI+ivgBlQg908Aa50yQLvwsMLIKxhgPlj73Am8zm27PS3DKVjkr0nTjbEp/3FzZnyB", + "path": "/home/v-jingszhang/.ssh/authorized_keys"}]}}}}}], "outputs": {}}, "parameters": + {"workspaceId": {"value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/microsoft.operationalinsights/workspaces/clitest000002"}}, "mode": "incremental"}}' headers: Accept: @@ -445,29 +445,29 @@ interactions: Connection: - keep-alive Content-Length: - - '4593' + - '4413' Content-Type: - application/json ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2021-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/vm_deploy_q5lPd83ihyQ2MYRDJogmBuOfU44KJ39F","name":"vm_deploy_q5lPd83ihyQ2MYRDJogmBuOfU44KJ39F","type":"Microsoft.Resources/deployments","properties":{"templateHash":"8202278835615348124","parameters":{"workspaceId":{"type":"SecureString"}},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2021-08-05T02:25:05.2101536Z","duration":"PT2.6395523S","correlationId":"bbd29873-e0a2-4e03-9605-ab6c8d6d6346","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["eastus"]},{"resourceType":"networkSecurityGroups","locations":["eastus"]},{"resourceType":"publicIPAddresses","locations":["eastus"]},{"resourceType":"networkInterfaces","locations":["eastus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines/extensions","locations":["eastus"]},{"resourceType":"virtualMachines","locations":["eastus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/virtualNetworks/myvm1VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"myvm1VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkSecurityGroups/myvm1NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"myvm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/publicIPAddresses/myvm1PublicIP","resourceType":"Microsoft.Network/publicIPAddresses","resourceName":"myvm1PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"myvm1VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"myvm1"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.operationalinsights/workspaces/clitest000002","resourceType":"microsoft.operationalinsights/workspaces","resourceName":"clitest000002","apiVersion":"2015-11-01-preview"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.operationalinsights/workspaces/clitest000002","resourceType":"microsoft.operationalinsights/workspaces","resourceName":"clitest000002","actionName":"listKeys","apiVersion":"2015-11-01-preview"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1/extensions/OmsAgentForLinux","resourceType":"Microsoft.Compute/virtualMachines/extensions","resourceName":"myvm1/OmsAgentForLinux"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"myvm1VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"myvm1"}]}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/vm_deploy_VzhdXwfUsaPaPOjurqGAEXuPOiTkgvLv","name":"vm_deploy_VzhdXwfUsaPaPOjurqGAEXuPOiTkgvLv","type":"Microsoft.Resources/deployments","properties":{"templateHash":"14958276402317583836","parameters":{"workspaceId":{"type":"SecureString"}},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2021-08-13T02:28:16.8219031Z","duration":"PT2.8240266S","correlationId":"fa3022e9-2358-47b9-84b1-5a7a6cd22523","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["eastus"]},{"resourceType":"networkSecurityGroups","locations":["eastus"]},{"resourceType":"publicIPAddresses","locations":["eastus"]},{"resourceType":"networkInterfaces","locations":["eastus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines/extensions","locations":["eastus"]},{"resourceType":"virtualMachines","locations":["eastus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/virtualNetworks/myvm1VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"myvm1VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkSecurityGroups/myvm1NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"myvm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/publicIPAddresses/myvm1PublicIP","resourceType":"Microsoft.Network/publicIPAddresses","resourceName":"myvm1PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"myvm1VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"myvm1"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.operationalinsights/workspaces/clitest000002","resourceType":"microsoft.operationalinsights/workspaces","resourceName":"clitest000002","apiVersion":"2015-11-01-preview"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.operationalinsights/workspaces/clitest000002","resourceType":"microsoft.operationalinsights/workspaces","resourceName":"clitest000002","actionName":"listKeys","apiVersion":"2015-11-01-preview"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1/extensions/OmsAgentForLinux","resourceType":"Microsoft.Compute/virtualMachines/extensions","resourceName":"myvm1/OmsAgentForLinux"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"myvm1VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"myvm1"}]}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/vm_deploy_q5lPd83ihyQ2MYRDJogmBuOfU44KJ39F/operationStatuses/08585734765829070364?api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/vm_deploy_VzhdXwfUsaPaPOjurqGAEXuPOiTkgvLv/operationStatuses/08585727851914797639?api-version=2021-04-01 cache-control: - no-cache content-length: - - '4226' + - '4227' content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:25:05 GMT + - Fri, 13 Aug 2021 02:28:17 GMT expires: - '-1' pragma: @@ -495,9 +495,9 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585734765829070364?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585727851914797639?api-version=2021-04-01 response: body: string: '{"status":"Running"}' @@ -509,7 +509,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:25:37 GMT + - Fri, 13 Aug 2021 02:28:48 GMT expires: - '-1' pragma: @@ -537,9 +537,9 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585734765829070364?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585727851914797639?api-version=2021-04-01 response: body: string: '{"status":"Running"}' @@ -551,7 +551,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:26:07 GMT + - Fri, 13 Aug 2021 02:29:18 GMT expires: - '-1' pragma: @@ -579,9 +579,93 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585734765829070364?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585727851914797639?api-version=2021-04-01 + response: + body: + string: '{"status":"Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 13 Aug 2021 02:29:49 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --nsg-rule --workspace --generate-ssh-keys + User-Agent: + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585727851914797639?api-version=2021-04-01 + response: + body: + string: '{"status":"Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 13 Aug 2021 02:30:20 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --nsg-rule --workspace --generate-ssh-keys + User-Agent: + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585727851914797639?api-version=2021-04-01 response: body: string: '{"status":"Succeeded"}' @@ -593,7 +677,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:26:38 GMT + - Fri, 13 Aug 2021 02:30:50 GMT expires: - '-1' pragma: @@ -621,21 +705,21 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2021-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/vm_deploy_q5lPd83ihyQ2MYRDJogmBuOfU44KJ39F","name":"vm_deploy_q5lPd83ihyQ2MYRDJogmBuOfU44KJ39F","type":"Microsoft.Resources/deployments","properties":{"templateHash":"8202278835615348124","parameters":{"workspaceId":{"type":"SecureString"}},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2021-08-05T02:26:38.127072Z","duration":"PT1M35.5564707S","correlationId":"bbd29873-e0a2-4e03-9605-ab6c8d6d6346","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["eastus"]},{"resourceType":"networkSecurityGroups","locations":["eastus"]},{"resourceType":"publicIPAddresses","locations":["eastus"]},{"resourceType":"networkInterfaces","locations":["eastus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines/extensions","locations":["eastus"]},{"resourceType":"virtualMachines","locations":["eastus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/virtualNetworks/myvm1VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"myvm1VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkSecurityGroups/myvm1NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"myvm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/publicIPAddresses/myvm1PublicIP","resourceType":"Microsoft.Network/publicIPAddresses","resourceName":"myvm1PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"myvm1VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"myvm1"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.operationalinsights/workspaces/clitest000002","resourceType":"microsoft.operationalinsights/workspaces","resourceName":"clitest000002","apiVersion":"2015-11-01-preview"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.operationalinsights/workspaces/clitest000002","resourceType":"microsoft.operationalinsights/workspaces","resourceName":"clitest000002","actionName":"listKeys","apiVersion":"2015-11-01-preview"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1/extensions/OmsAgentForLinux","resourceType":"Microsoft.Compute/virtualMachines/extensions","resourceName":"myvm1/OmsAgentForLinux"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"myvm1VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"myvm1"}],"outputs":{},"outputResources":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1/extensions/OmsAgentForLinux"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkSecurityGroups/myvm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/publicIPAddresses/myvm1PublicIP"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/virtualNetworks/myvm1VNET"}]}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/vm_deploy_VzhdXwfUsaPaPOjurqGAEXuPOiTkgvLv","name":"vm_deploy_VzhdXwfUsaPaPOjurqGAEXuPOiTkgvLv","type":"Microsoft.Resources/deployments","properties":{"templateHash":"14958276402317583836","parameters":{"workspaceId":{"type":"SecureString"}},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2021-08-13T02:30:39.610909Z","duration":"PT2M25.6130325S","correlationId":"fa3022e9-2358-47b9-84b1-5a7a6cd22523","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["eastus"]},{"resourceType":"networkSecurityGroups","locations":["eastus"]},{"resourceType":"publicIPAddresses","locations":["eastus"]},{"resourceType":"networkInterfaces","locations":["eastus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines/extensions","locations":["eastus"]},{"resourceType":"virtualMachines","locations":["eastus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/virtualNetworks/myvm1VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"myvm1VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkSecurityGroups/myvm1NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"myvm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/publicIPAddresses/myvm1PublicIP","resourceType":"Microsoft.Network/publicIPAddresses","resourceName":"myvm1PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"myvm1VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"myvm1"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.operationalinsights/workspaces/clitest000002","resourceType":"microsoft.operationalinsights/workspaces","resourceName":"clitest000002","apiVersion":"2015-11-01-preview"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.operationalinsights/workspaces/clitest000002","resourceType":"microsoft.operationalinsights/workspaces","resourceName":"clitest000002","actionName":"listKeys","apiVersion":"2015-11-01-preview"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1/extensions/OmsAgentForLinux","resourceType":"Microsoft.Compute/virtualMachines/extensions","resourceName":"myvm1/OmsAgentForLinux"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"myvm1VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"myvm1"}],"outputs":{},"outputResources":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1/extensions/OmsAgentForLinux"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkSecurityGroups/myvm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/publicIPAddresses/myvm1PublicIP"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/virtualNetworks/myvm1VNET"}]}}' headers: cache-control: - no-cache content-length: - - '5532' + - '5533' content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:26:38 GMT + - Fri, 13 Aug 2021 02:30:51 GMT expires: - '-1' pragma: @@ -663,52 +747,51 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-azure-mgmt-compute/22.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-compute/22.1.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1?$expand=instanceView&api-version=2021-03-01 response: body: string: "{\r\n \"name\": \"myvm1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1\",\r\n \ \"type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n - \ \"tags\": {},\r\n \"properties\": {\r\n \"vmId\": \"74530c8c-bc4a-426c-a19d-13a10a302bca\",\r\n + \ \"tags\": {},\r\n \"properties\": {\r\n \"vmId\": \"bdc70fcf-8b00-469c-a24d-30518f579aff\",\r\n \ \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\n },\r\n \ \"storageProfile\": {\r\n \"imageReference\": {\r\n \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\",\r\n \"sku\": \"18.04-LTS\",\r\n \"version\": \"latest\",\r\n \"exactVersion\": \"18.04.202107200\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": - \"Linux\",\r\n \"name\": \"myvm1_disk1_a27b3e5dd2514024b1fb26c3ed3bc4dd\",\r\n + \"Linux\",\r\n \"name\": \"myvm1_disk1_5ba5ab2fb25845e1908b787f7e07d82e\",\r\n \ \"createOption\": \"FromImage\",\r\n \"caching\": \"ReadWrite\",\r\n \ \"managedDisk\": {\r\n \"storageAccountType\": \"Premium_LRS\",\r\n - \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/disks/myvm1_disk1_a27b3e5dd2514024b1fb26c3ed3bc4dd\"\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/disks/myvm1_disk1_5ba5ab2fb25845e1908b787f7e07d82e\"\r\n \ },\r\n \"diskSizeGB\": 30,\r\n \"deleteOption\": \"Detach\"\r\n \ },\r\n \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n - \ \"computerName\": \"myvm1\",\r\n \"adminUsername\": \"kairu\",\r\n + \ \"computerName\": \"myvm1\",\r\n \"adminUsername\": \"v-jingszhang\",\r\n \ \"linuxConfiguration\": {\r\n \"disablePasswordAuthentication\": true,\r\n \"ssh\": {\r\n \"publicKeys\": [\r\n {\r\n - \ \"path\": \"/home/kairu/.ssh/authorized_keys\",\r\n \"keyData\": - \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDPMuHNzSd64J+szP6o1PrORXVyLcT0rnY1jkPNXt2taPECh5LJ1GFUbV/T8NphlT+jkgd6Q8DokO3x/IZ7gIVIO9CFsLUWAcvB0IGSRnIEK4MXIYFrHh45STacrSO+K1trflLXb2S8a4CNyZOuRja2w5+ggt+jSluGmoT19Os5pVv7Slh/Z536r60i/mA2MJhhwLWe9njCfhxCUAffOMD0tQgFCrieAB/fwNEYqmWNX4VWSbpO+1qfJzTl6SwRoFv9Z/v3szgexwHazlsUqlD1ALAcf6qnQcSh9VvqUZJpLW9vfOPkMGMKQdHTK0MbsrivLu41hg4yWyhC9yDmkNhGJAFgaYAJMdYuHH3GSX2xofP9HrN0PG4V+oVxL89St2mXrKlbNryZCtoOnw05ugEPiLmDCav8vZyRfz4/OQLq2yHUrkavU5R2PRFSfoBNrk894+5Cvr3eW7IEbl014ikiFMLhtRairBBeZhrdGbaMAsgaa5e6AfA5m2820Hf8sf8= - kairu@microsoft.com\\n\"\r\n }\r\n ]\r\n },\r\n - \ \"provisionVMAgent\": true,\r\n \"patchSettings\": {\r\n \"patchMode\": - \"ImageDefault\",\r\n \"assessmentMode\": \"ImageDefault\"\r\n }\r\n - \ },\r\n \"secrets\": [],\r\n \"allowExtensionOperations\": - true,\r\n \"requireGuestProvisionSignal\": true\r\n },\r\n \"networkProfile\": - {\"networkInterfaces\":[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic\"}]},\r\n + \ \"path\": \"/home/v-jingszhang/.ssh/authorized_keys\",\r\n \"keyData\": + \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDL2PtV5sp++a43U/dRJ2Fyjso9qDFNbWEnbYk7mA4CfXy0gvxm65oYVd90JysNmGBF/89hIvCTN3ul4aEIuPkzywozRbdyWiJngSd/7OrNBJzpQQSjsGXwoVNDRAJSzlvuQVUR2vwBHeN2xMIvufSvzO3LGI3xcSIWIYlSvU9urnV+Pefd4T6x/OXgTpE02AgMWOspdZTzg0ZKsSU3sG5nYSNoq+8qrHQSXLbLLdWzz5lYKe8p64fQC/xhXrNa3/Nw5vy8YGsyqGueM/Rj6gCI+ivgBlQg908Aa50yQLvwsMLIKxhgPlj73Am8zm27PS3DKVjkr0nTjbEp/3FzZnyB\"\r\n + \ }\r\n ]\r\n },\r\n \"provisionVMAgent\": + true,\r\n \"patchSettings\": {\r\n \"patchMode\": \"ImageDefault\",\r\n + \ \"assessmentMode\": \"ImageDefault\"\r\n }\r\n },\r\n + \ \"secrets\": [],\r\n \"allowExtensionOperations\": true,\r\n \"requireGuestProvisionSignal\": + true\r\n },\r\n \"networkProfile\": {\"networkInterfaces\":[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic\"}]},\r\n \ \"provisioningState\": \"Succeeded\",\r\n \"instanceView\": {\r\n \"computerName\": \"myvm1\",\r\n \"osName\": \"ubuntu\",\r\n \"osVersion\": \"18.04\",\r\n \ \"vmAgent\": {\r\n \"vmAgentVersion\": \"2.3.1.1\",\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \"level\": \"Info\",\r\n \"displayStatus\": \"Ready\",\r\n \ \"message\": \"Guest Agent is running\",\r\n \"time\": - \"2021-08-05T02:26:34+00:00\"\r\n }\r\n ],\r\n \"extensionHandlers\": + \"2021-08-13T02:30:35+00:00\"\r\n }\r\n ],\r\n \"extensionHandlers\": [\r\n {\r\n \"type\": \"Microsoft.EnterpriseCloud.Monitoring.OmsAgentForLinux\",\r\n \ \"typeHandlerVersion\": \"1.13.35\",\r\n \"status\": {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"Ready\",\r\n \"message\": \"Plugin enabled\"\r\n }\r\n }\r\n ]\r\n },\r\n - \ \"disks\": [\r\n {\r\n \"name\": \"myvm1_disk1_a27b3e5dd2514024b1fb26c3ed3bc4dd\",\r\n + \ \"disks\": [\r\n {\r\n \"name\": \"myvm1_disk1_5ba5ab2fb25845e1908b787f7e07d82e\",\r\n \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning - succeeded\",\r\n \"time\": \"2021-08-05T02:25:26.3560193+00:00\"\r\n + succeeded\",\r\n \"time\": \"2021-08-13T02:28:42.8804033+00:00\"\r\n \ }\r\n ]\r\n }\r\n ],\r\n \"extensions\": [\r\n {\r\n \"name\": \"OmsAgentForLinux\",\r\n \"type\": \"Microsoft.EnterpriseCloud.Monitoring.OmsAgentForLinux\",\r\n \"typeHandlerVersion\": @@ -719,7 +802,7 @@ interactions: \ \"hyperVGeneration\": \"V1\",\r\n \"statuses\": [\r\n {\r\n \ \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\",\r\n - \ \"time\": \"2021-08-05T02:26:37.7940623+00:00\"\r\n },\r\n + \ \"time\": \"2021-08-13T02:30:38.006282+00:00\"\r\n },\r\n \ {\r\n \"code\": \"PowerState/running\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\n }\r\n \ ]\r\n }\r\n },\r\n \"resources\": [\r\n {\r\n \"name\": @@ -728,17 +811,17 @@ interactions: \"eastus\",\r\n \"properties\": {\r\n \"autoUpgradeMinorVersion\": true,\r\n \"provisioningState\": \"Succeeded\",\r\n \"publisher\": \"Microsoft.EnterpriseCloud.Monitoring\",\r\n \"type\": \"OmsAgentForLinux\",\r\n - \ \"typeHandlerVersion\": \"1.0\",\r\n \"settings\": {\"workspaceId\":\"34e7e180-aa74-498c-859d-5302835b9b2d\",\"stopOnMultipleConnections\":\"true\"}\r\n + \ \"typeHandlerVersion\": \"1.0\",\r\n \"settings\": {\"workspaceId\":\"b592e84d-2dc5-496a-8e88-645ee1f0ebff\",\"stopOnMultipleConnections\":\"true\"}\r\n \ }\r\n }\r\n ]\r\n}" headers: cache-control: - no-cache content-length: - - '5713' + - '5532' content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:26:40 GMT + - Fri, 13 Aug 2021 02:30:52 GMT expires: - '-1' pragma: @@ -755,7 +838,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;3991,Microsoft.Compute/LowCostGet30Min;31976 + - Microsoft.Compute/LowCostGet3Min;3987,Microsoft.Compute/LowCostGet30Min;31959 status: code: 200 message: OK @@ -773,18 +856,18 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-azure-mgmt-network/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-network/19.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic?api-version=2018-01-01 response: body: string: "{\r\n \"name\": \"myvm1VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic\",\r\n - \ \"etag\": \"W/\\\"f134a8a0-4a2e-44dc-8b63-476aa4582727\\\"\",\r\n \"location\": + \ \"etag\": \"W/\\\"6987e672-63cc-46cc-add0-e3ea9df536f4\\\"\",\r\n \"location\": \"eastus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": - \"Succeeded\",\r\n \"resourceGuid\": \"ecbc9096-d1e9-4788-a85e-46ce89af4469\",\r\n + \"Succeeded\",\r\n \"resourceGuid\": \"c41ed55e-4998-4c89-bc86-2b6b8b4ccdb5\",\r\n \ \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigmyvm1\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic/ipConfigurations/ipconfigmyvm1\",\r\n - \ \"etag\": \"W/\\\"f134a8a0-4a2e-44dc-8b63-476aa4582727\\\"\",\r\n + \ \"etag\": \"W/\\\"6987e672-63cc-46cc-add0-e3ea9df536f4\\\"\",\r\n \ \"type\": \"Microsoft.Network/networkInterfaces/ipConfigurations\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\": @@ -793,8 +876,8 @@ interactions: \ },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"internalDomainNameSuffix\": - \"gkttxu1lyyyefkjyl3sajofztc.bx.internal.cloudapp.net\"\r\n },\r\n \"macAddress\": - \"00-22-48-1E-02-C9\",\r\n \"enableAcceleratedNetworking\": false,\r\n + \"g1jbnjcztsfehiwowli5jxlgig.bx.internal.cloudapp.net\"\r\n },\r\n \"macAddress\": + \"00-22-48-1D-A2-3F\",\r\n \"enableAcceleratedNetworking\": false,\r\n \ \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\": {\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkSecurityGroups/myvm1NSG\"\r\n \ },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \"id\": @@ -808,9 +891,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:26:41 GMT + - Fri, 13 Aug 2021 02:30:53 GMT etag: - - W/"f134a8a0-4a2e-44dc-8b63-476aa4582727" + - W/"6987e672-63cc-46cc-add0-e3ea9df536f4" expires: - '-1' pragma: @@ -827,7 +910,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 4f914c21-9a69-4afb-8bb9-241471849d1c + - 1133f0e9-8132-439b-8c3f-13785c9ecdab status: code: 200 message: OK @@ -845,16 +928,16 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-azure-mgmt-network/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-network/19.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/publicIPAddresses/myvm1PublicIP?api-version=2018-01-01 response: body: string: "{\r\n \"name\": \"myvm1PublicIP\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/publicIPAddresses/myvm1PublicIP\",\r\n - \ \"etag\": \"W/\\\"9ae50cef-b510-4b27-a7e0-e4aff2fe26bc\\\"\",\r\n \"location\": + \ \"etag\": \"W/\\\"0be9cfae-4aac-4961-a79b-7566d5a1cc4e\\\"\",\r\n \"location\": \"eastus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": - \"Succeeded\",\r\n \"resourceGuid\": \"394a3494-4168-4405-b832-ff65288e1846\",\r\n - \ \"ipAddress\": \"40.114.79.71\",\r\n \"publicIPAddressVersion\": \"IPv4\",\r\n + \"Succeeded\",\r\n \"resourceGuid\": \"63e43d99-2d03-4d1c-b30d-210ce0dce296\",\r\n + \ \"ipAddress\": \"20.185.37.136\",\r\n \"publicIPAddressVersion\": \"IPv4\",\r\n \ \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\": 4,\r\n \"ipTags\": [],\r\n \"ipConfiguration\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic/ipConfigurations/ipconfigmyvm1\"\r\n \ }\r\n },\r\n \"type\": \"Microsoft.Network/publicIPAddresses\",\r\n @@ -863,13 +946,13 @@ interactions: cache-control: - no-cache content-length: - - '1004' + - '1005' content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:26:41 GMT + - Fri, 13 Aug 2021 02:30:53 GMT etag: - - W/"9ae50cef-b510-4b27-a7e0-e4aff2fe26bc" + - W/"0be9cfae-4aac-4961-a79b-7566d5a1cc4e" expires: - '-1' pragma: @@ -886,7 +969,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 012aa918-08ac-4d24-97a5-823a6fd9d4d1 + - 237a24d3-401c-4877-bc8f-77d1b620917a status: code: 200 message: OK @@ -908,12 +991,12 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/dataSources/DataSource_LinuxPerformanceCollection_88888888-0000-0000-0000-000000000001?api-version=2020-08-01 response: body: - string: '{"kind":"LinuxPerformanceCollection","properties":{"state":"Enabled"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/datasources/DataSource_LinuxPerformanceCollection_88888888-0000-0000-0000-000000000001","etag":"W/\"datetime''2021-08-05T02%3A26%3A43.9228957Z''\"","name":"DataSource_LinuxPerformanceCollection_88888888-0000-0000-0000-000000000001","type":"Microsoft.OperationalInsights/workspaces/datasources"}' + string: '{"kind":"LinuxPerformanceCollection","properties":{"state":"Enabled"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/datasources/DataSource_LinuxPerformanceCollection_88888888-0000-0000-0000-000000000001","etag":"W/\"datetime''2021-08-13T02%3A30%3A54.9258500Z''\"","name":"DataSource_LinuxPerformanceCollection_88888888-0000-0000-0000-000000000001","type":"Microsoft.OperationalInsights/workspaces/datasources"}' headers: cache-control: - no-cache @@ -922,7 +1005,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:26:44 GMT + - Fri, 13 Aug 2021 02:30:55 GMT expires: - '-1' pragma: @@ -938,7 +1021,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' x-powered-by: - ASP.NET status: @@ -965,14 +1048,14 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/dataSources/DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000002?api-version=2020-08-01 response: body: string: '{"kind":"LinuxPerformanceObject","properties":{"instanceName":"*","intervalSeconds":10,"objectName":"Memory","performanceCounters":[{"counterName":"Available MBytes Memory"},{"counterName":"% Used Memory"},{"counterName":"% Used Swap - Space"}]},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/datasources/DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000002","etag":"W/\"datetime''2021-08-05T02%3A26%3A44.6059319Z''\"","name":"DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000002","type":"Microsoft.OperationalInsights/workspaces/datasources"}' + Space"}]},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/datasources/DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000002","etag":"W/\"datetime''2021-08-13T02%3A30%3A55.6702903Z''\"","name":"DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000002","type":"Microsoft.OperationalInsights/workspaces/datasources"}' headers: cache-control: - no-cache @@ -981,7 +1064,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:26:44 GMT + - Fri, 13 Aug 2021 02:30:55 GMT expires: - '-1' pragma: @@ -997,7 +1080,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1197' x-powered-by: - ASP.NET status: @@ -1023,13 +1106,13 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/dataSources/DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000003?api-version=2020-08-01 response: body: string: '{"kind":"LinuxPerformanceObject","properties":{"instanceName":"*","intervalSeconds":10,"objectName":"Processor","performanceCounters":[{"counterName":"% - Processor Time"},{"counterName":"% Privileged Time"}]},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/datasources/DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000003","etag":"W/\"datetime''2021-08-05T02%3A26%3A45.2207459Z''\"","name":"DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000003","type":"Microsoft.OperationalInsights/workspaces/datasources"}' + Processor Time"},{"counterName":"% Privileged Time"}]},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/datasources/DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000003","etag":"W/\"datetime''2021-08-13T02%3A30%3A56.3579003Z''\"","name":"DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000003","type":"Microsoft.OperationalInsights/workspaces/datasources"}' headers: cache-control: - no-cache @@ -1038,7 +1121,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:26:45 GMT + - Fri, 13 Aug 2021 02:30:56 GMT expires: - '-1' pragma: @@ -1054,7 +1137,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1197' + - '1196' x-powered-by: - ASP.NET status: @@ -1082,7 +1165,7 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/dataSources/DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000004?api-version=2020-08-01 response: @@ -1090,7 +1173,7 @@ interactions: string: '{"kind":"LinuxPerformanceObject","properties":{"instanceName":"*","intervalSeconds":10,"objectName":"Logical Disk","performanceCounters":[{"counterName":"% Used Inodes"},{"counterName":"Free Megabytes"},{"counterName":"% Used Space"},{"counterName":"Disk Transfers/sec"},{"counterName":"Disk - Reads/sec"},{"counterName":"Disk Writes/sec"}]},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/datasources/DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000004","etag":"W/\"datetime''2021-08-05T02%3A26%3A45.8755844Z''\"","name":"DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000004","type":"Microsoft.OperationalInsights/workspaces/datasources"}' + Reads/sec"},{"counterName":"Disk Writes/sec"}]},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/datasources/DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000004","etag":"W/\"datetime''2021-08-13T02%3A30%3A57.0604291Z''\"","name":"DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000004","type":"Microsoft.OperationalInsights/workspaces/datasources"}' headers: cache-control: - no-cache @@ -1099,7 +1182,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:26:46 GMT + - Fri, 13 Aug 2021 02:30:57 GMT expires: - '-1' pragma: @@ -1115,7 +1198,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1196' + - '1195' x-powered-by: - ASP.NET status: @@ -1141,13 +1224,13 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/dataSources/DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000005?api-version=2020-08-01 response: body: string: '{"kind":"LinuxPerformanceObject","properties":{"instanceName":"*","intervalSeconds":10,"objectName":"Network","performanceCounters":[{"counterName":"Total - Bytes Transmitted"},{"counterName":"Total Bytes Received"}]},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/datasources/DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000005","etag":"W/\"datetime''2021-08-05T02%3A26%3A46.6123705Z''\"","name":"DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000005","type":"Microsoft.OperationalInsights/workspaces/datasources"}' + Bytes Transmitted"},{"counterName":"Total Bytes Received"}]},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/datasources/DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000005","etag":"W/\"datetime''2021-08-13T02%3A30%3A57.7956829Z''\"","name":"DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000005","type":"Microsoft.OperationalInsights/workspaces/datasources"}' headers: cache-control: - no-cache @@ -1156,7 +1239,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:26:46 GMT + - Fri, 13 Aug 2021 02:30:57 GMT expires: - '-1' pragma: @@ -1172,7 +1255,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1195' + - '1194' x-powered-by: - ASP.NET status: @@ -1196,12 +1279,12 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/dataSources/DataSource_LinuxSyslogCollection_88888888-0000-0000-0000-000000000006?api-version=2020-08-01 response: body: - string: '{"kind":"LinuxSyslogCollection","properties":{"state":"Enabled"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/datasources/DataSource_LinuxSyslogCollection_88888888-0000-0000-0000-000000000006","etag":"W/\"datetime''2021-08-05T02%3A26%3A47.3248828Z''\"","name":"DataSource_LinuxSyslogCollection_88888888-0000-0000-0000-000000000006","type":"Microsoft.OperationalInsights/workspaces/datasources"}' + string: '{"kind":"LinuxSyslogCollection","properties":{"state":"Enabled"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/datasources/DataSource_LinuxSyslogCollection_88888888-0000-0000-0000-000000000006","etag":"W/\"datetime''2021-08-13T02%3A30%3A58.5189599Z''\"","name":"DataSource_LinuxSyslogCollection_88888888-0000-0000-0000-000000000006","type":"Microsoft.OperationalInsights/workspaces/datasources"}' headers: cache-control: - no-cache @@ -1210,7 +1293,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:26:47 GMT + - Fri, 13 Aug 2021 02:30:58 GMT expires: - '-1' pragma: @@ -1226,7 +1309,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1194' + - '1193' x-powered-by: - ASP.NET status: @@ -1251,12 +1334,12 @@ interactions: ParameterSetName: - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-mgmt-loganalytics/11.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/dataSources/DataSource_LinuxSyslog_88888888-0000-0000-0000-000000000007?api-version=2020-08-01 response: body: - string: '{"kind":"LinuxSyslog","properties":{"syslogName":"syslog","syslogSeverities":[{"severity":"notice"},{"severity":"info"},{"severity":"debug"}]},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/datasources/DataSource_LinuxSyslog_88888888-0000-0000-0000-000000000007","etag":"W/\"datetime''2021-08-05T02%3A26%3A48.0500848Z''\"","name":"DataSource_LinuxSyslog_88888888-0000-0000-0000-000000000007","type":"Microsoft.OperationalInsights/workspaces/datasources"}' + string: '{"kind":"LinuxSyslog","properties":{"syslogName":"syslog","syslogSeverities":[{"severity":"notice"},{"severity":"info"},{"severity":"debug"}]},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002/datasources/DataSource_LinuxSyslog_88888888-0000-0000-0000-000000000007","etag":"W/\"datetime''2021-08-13T02%3A30%3A59.2730824Z''\"","name":"DataSource_LinuxSyslog_88888888-0000-0000-0000-000000000007","type":"Microsoft.OperationalInsights/workspaces/datasources"}' headers: cache-control: - no-cache @@ -1265,7 +1348,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:26:48 GMT + - Fri, 13 Aug 2021 02:30:59 GMT expires: - '-1' pragma: @@ -1281,7 +1364,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1193' + - '1192' x-powered-by: - ASP.NET status: @@ -1301,21 +1384,21 @@ interactions: ParameterSetName: - -g -n --scopes --condition --condition-query --description User-Agent: - - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001?api-version=2021-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001","name":"cli_test_scheduled_query000001","type":"Microsoft.Resources/resourceGroups","location":"eastus","tags":{"product":"azurecli","cause":"automation","date":"2021-08-05T02:24:05Z","StorageType":"Standard_LRS","type":"test"},"properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001","name":"cli_test_scheduled_query000001","type":"Microsoft.Resources/resourceGroups","location":"eastus","tags":{"product":"azurecli","cause":"automation","date":"2021-08-13T02:27:22Z"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '471' + - '428' content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:29:50 GMT + - Fri, 13 Aug 2021 02:34:00 GMT expires: - '-1' pragma: @@ -1334,9 +1417,10 @@ interactions: 2, "enabled": true, "scopes": ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1"], "evaluationFrequency": "PT5M", "windowSize": "PT5M", "criteria": {"allOf": [{"query": "union Event, Syslog | where TimeGenerated > ago(1h)", "timeAggregation": "Count", - "dimensions": [], "operator": "GreaterThan", "threshold": 360, "failingPeriods": - {"numberOfEvaluationPeriods": 1, "minFailingPeriodsToAlert": 1}}]}, "muteActionsDuration": - "PT30M"}}' + "dimensions": [], "operator": "GreaterThan", "threshold": 360.0, "failingPeriods": + {"numberOfEvaluationPeriods": 1, "minFailingPeriodsToAlert": 1}}]}, "actions": + {"actionGroups": [], "customProperties": {}}, "checkWorkspaceAlertsStorageConfigured": + false, "skipQueryValidation": false, "autoMitigate": true}}' headers: Accept: - application/json @@ -1347,32 +1431,29 @@ interactions: Connection: - keep-alive Content-Length: - - '656' + - '783' Content-Type: - - application/json; charset=utf-8 + - application/json ParameterSetName: - -g -n --scopes --condition --condition-query --description User-Agent: - - python/3.8.10 (Windows-10-10.0.19043-SP0) msrest/0.6.21 msrest_azure/0.6.3 - azure-mgmt-monitor/2020-05-01-preview Azure-SDK-For-Python AZURECLI/2.27.0 - accept-language: - - en-US + - AZURECLI/2.27.0 azsdk-python-mgmt-monitor/1.0.0b1 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq01?api-version=2020-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq01?api-version=2021-02-01-preview response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq01","name":"sq01","type":"microsoft.insights/scheduledqueryrules","location":"eastus","properties":{"description":"Test + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq01","name":"sq01","type":"microsoft.insights/scheduledqueryrules","location":"eastus","systemData":{"createdBy":"v-jingszhang@microsoft.com","createdByType":"User","createdAt":"2021-08-13T02:34:06.7668957Z","lastModifiedBy":"v-jingszhang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-08-13T02:34:06.7668957Z"},"properties":{"description":"Test rule","severity":2,"enabled":true,"evaluationFrequency":"PT5M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1"],"windowSize":"PT5M","criteria":{"allOf":[{"query":"union - Event, Syslog | where TimeGenerated > ago(1h)","timeAggregation":"Count","dimensions":[],"operator":"GreaterThan","threshold":360.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"muteActionsDuration":"PT30M"}}' + Event, Syslog | where TimeGenerated > ago(1h)","timeAggregation":"Count","dimensions":[],"operator":"GreaterThan","threshold":360.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"autoMitigate":true,"checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}' headers: cache-control: - no-cache content-length: - - '891' + - '1199' content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:30:02 GMT + - Fri, 13 Aug 2021 02:34:14 GMT expires: - '-1' pragma: @@ -1390,7 +1471,7 @@ interactions: x-rate-limit-remaining: - '14' x-rate-limit-reset: - - '2021-08-05T02:30:55.9582546Z' + - '2021-08-13T02:35:06.7749703Z' status: code: 201 message: Created @@ -1408,21 +1489,21 @@ interactions: ParameterSetName: - -g -n --scopes --condition --description User-Agent: - - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001?api-version=2021-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001","name":"cli_test_scheduled_query000001","type":"Microsoft.Resources/resourceGroups","location":"eastus","tags":{"product":"azurecli","cause":"automation","date":"2021-08-05T02:24:05Z","StorageType":"Standard_LRS","type":"test"},"properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001","name":"cli_test_scheduled_query000001","type":"Microsoft.Resources/resourceGroups","location":"eastus","tags":{"product":"azurecli","cause":"automation","date":"2021-08-13T02:27:22Z"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '471' + - '428' content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:30:04 GMT + - Fri, 13 Aug 2021 02:34:15 GMT expires: - '-1' pragma: @@ -1442,8 +1523,9 @@ interactions: "evaluationFrequency": "PT5M", "windowSize": "PT5M", "criteria": {"allOf": [{"query": "union Event, Syslog | where TimeGenerated > ago(1h)", "timeAggregation": "Count", "resourceIdColumn": "_ResourceId", "dimensions": [], "operator": "GreaterThan", - "threshold": 360, "failingPeriods": {"numberOfEvaluationPeriods": 1, "minFailingPeriodsToAlert": - 1}}]}, "muteActionsDuration": "PT30M"}}' + "threshold": 360.0, "failingPeriods": {"numberOfEvaluationPeriods": 1, "minFailingPeriodsToAlert": + 1}}]}, "actions": {"actionGroups": [], "customProperties": {}}, "checkWorkspaceAlertsStorageConfigured": + false, "skipQueryValidation": false, "autoMitigate": true}}' headers: Accept: - application/json @@ -1454,32 +1536,29 @@ interactions: Connection: - keep-alive Content-Length: - - '641' + - '768' Content-Type: - - application/json; charset=utf-8 + - application/json ParameterSetName: - -g -n --scopes --condition --description User-Agent: - - python/3.8.10 (Windows-10-10.0.19043-SP0) msrest/0.6.21 msrest_azure/0.6.3 - azure-mgmt-monitor/2020-05-01-preview Azure-SDK-For-Python AZURECLI/2.27.0 - accept-language: - - en-US + - AZURECLI/2.27.0 azsdk-python-mgmt-monitor/1.0.0b1 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq02?api-version=2020-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq02?api-version=2021-02-01-preview response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq02","name":"sq02","type":"microsoft.insights/scheduledqueryrules","location":"eastus","properties":{"description":"Test + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq02","name":"sq02","type":"microsoft.insights/scheduledqueryrules","location":"eastus","systemData":{"createdBy":"v-jingszhang@microsoft.com","createdByType":"User","createdAt":"2021-08-13T02:34:18.3768984Z","lastModifiedBy":"v-jingszhang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-08-13T02:34:18.3768984Z"},"properties":{"description":"Test rule","severity":2,"enabled":true,"evaluationFrequency":"PT5M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001"],"windowSize":"PT5M","criteria":{"allOf":[{"query":"union - Event, Syslog | where TimeGenerated > ago(1h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"GreaterThan","threshold":360.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"muteActionsDuration":"PT30M"}}' + Event, Syslog | where TimeGenerated > ago(1h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"GreaterThan","threshold":360.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"autoMitigate":true,"checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}' headers: cache-control: - no-cache content-length: - - '874' + - '1182' content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:30:17 GMT + - Fri, 13 Aug 2021 02:34:22 GMT expires: - '-1' pragma: @@ -1491,13 +1570,13 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' x-rate-limit-limit: - 1m x-rate-limit-remaining: - '14' x-rate-limit-reset: - - '2021-08-05T02:31:09.8768560Z' + - '2021-08-13T02:35:18.3837161Z' status: code: 201 message: Created @@ -1516,26 +1595,23 @@ interactions: - -g -n --condition --condition-query --description --severity --disabled --evaluation-frequency --window-size User-Agent: - - python/3.8.10 (Windows-10-10.0.19043-SP0) msrest/0.6.21 msrest_azure/0.6.3 - azure-mgmt-monitor/2020-05-01-preview Azure-SDK-For-Python AZURECLI/2.27.0 - accept-language: - - en-US + - AZURECLI/2.27.0 azsdk-python-mgmt-monitor/1.0.0b1 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq01?api-version=2020-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq01?api-version=2021-02-01-preview response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq01","name":"sq01","type":"microsoft.insights/scheduledqueryrules","location":"eastus","properties":{"description":"Test + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq01","name":"sq01","type":"microsoft.insights/scheduledqueryrules","location":"eastus","systemData":{"createdBy":"v-jingszhang@microsoft.com","createdByType":"User","createdAt":"2021-08-13T02:34:06.7668957Z","lastModifiedBy":"v-jingszhang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-08-13T02:34:06.7668957Z"},"properties":{"description":"Test rule","severity":2,"enabled":true,"evaluationFrequency":"PT5M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1"],"windowSize":"PT5M","criteria":{"allOf":[{"query":"union - Event, Syslog | where TimeGenerated > ago(1h)","timeAggregation":"Count","dimensions":[],"operator":"GreaterThan","threshold":360.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"muteActionsDuration":"PT30M"}}' + Event, Syslog | where TimeGenerated > ago(1h)","timeAggregation":"Count","dimensions":[],"operator":"GreaterThan","threshold":360.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"autoMitigate":true,"checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}' headers: cache-control: - no-cache content-length: - - '891' + - '1199' content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:30:18 GMT + - Fri, 13 Aug 2021 02:34:23 GMT expires: - '-1' pragma: @@ -1559,8 +1635,9 @@ interactions: "evaluationFrequency": "PT10M", "windowSize": "PT10M", "criteria": {"allOf": [{"query": "union Event | where TimeGenerated > ago(2h)", "timeAggregation": "Count", "resourceIdColumn": "_ResourceId", "dimensions": [], "operator": "LessThan", - "threshold": 260, "failingPeriods": {"numberOfEvaluationPeriods": 3, "minFailingPeriodsToAlert": - 2}}]}, "muteActionsDuration": "PT30M"}}' + "threshold": 260.0, "failingPeriods": {"numberOfEvaluationPeriods": 3, "minFailingPeriodsToAlert": + 2}}]}, "checkWorkspaceAlertsStorageConfigured": false, "skipQueryValidation": + false, "autoMitigate": true}}' headers: Accept: - application/json @@ -1571,33 +1648,145 @@ interactions: Connection: - keep-alive Content-Length: - - '685' + - '755' Content-Type: - - application/json; charset=utf-8 + - application/json ParameterSetName: - -g -n --condition --condition-query --description --severity --disabled --evaluation-frequency --window-size User-Agent: - - python/3.8.10 (Windows-10-10.0.19043-SP0) msrest/0.6.21 msrest_azure/0.6.3 - azure-mgmt-monitor/2020-05-01-preview Azure-SDK-For-Python AZURECLI/2.27.0 - accept-language: - - en-US + - AZURECLI/2.27.0 azsdk-python-mgmt-monitor/1.0.0b1 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq01?api-version=2020-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq01?api-version=2021-02-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq01","name":"sq01","type":"microsoft.insights/scheduledqueryrules","location":"eastus","systemData":{"createdBy":"v-jingszhang@microsoft.com","createdByType":"User","createdAt":"2021-08-13T02:34:06.7668957Z","lastModifiedBy":"v-jingszhang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-08-13T02:34:24.411898Z"},"properties":{"description":"Test + rule 2","severity":4,"enabled":false,"evaluationFrequency":"PT10M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1"],"windowSize":"PT10M","criteria":{"allOf":[{"query":"union + Event | where TimeGenerated > ago(2h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"LessThan","threshold":260.0,"failingPeriods":{"numberOfEvaluationPeriods":3,"minFailingPeriodsToAlert":2}}]},"autoMitigate":true,"checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}' + headers: + cache-control: + - no-cache + content-length: + - '1225' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 13 Aug 2021 02:34:25 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-rate-limit-limit: + - 1m + x-rate-limit-remaining: + - '13' + x-rate-limit-reset: + - '2021-08-13T02:35:06.7749703Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor scheduled-query update + Connection: + - keep-alive + ParameterSetName: + - -g -n --mad --auto-mitigate --skip-query-validation + User-Agent: + - AZURECLI/2.27.0 azsdk-python-mgmt-monitor/1.0.0b1 Python/3.8.9 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq01?api-version=2021-02-01-preview response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq01","name":"sq01","type":"microsoft.insights/scheduledqueryrules","location":"eastus","properties":{"description":"Test + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq01","name":"sq01","type":"microsoft.insights/scheduledqueryrules","location":"eastus","systemData":{"createdBy":"v-jingszhang@microsoft.com","createdByType":"User","createdAt":"2021-08-13T02:34:06.7668957Z","lastModifiedBy":"v-jingszhang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-08-13T02:34:24.411898Z"},"properties":{"description":"Test rule 2","severity":4,"enabled":false,"evaluationFrequency":"PT10M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1"],"windowSize":"PT10M","criteria":{"allOf":[{"query":"union - Event | where TimeGenerated > ago(2h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"LessThan","threshold":260.0,"failingPeriods":{"numberOfEvaluationPeriods":3,"minFailingPeriodsToAlert":2}}]},"muteActionsDuration":"PT30M"}}' + Event | where TimeGenerated > ago(2h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"LessThan","threshold":260.0,"failingPeriods":{"numberOfEvaluationPeriods":3,"minFailingPeriodsToAlert":2}}]},"autoMitigate":true,"checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}' headers: cache-control: - no-cache content-length: - - '918' + - '1225' content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:30:22 GMT + - Fri, 13 Aug 2021 02:34:26 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus", "properties": {"description": "Test rule 2", "severity": + 4, "enabled": true, "scopes": ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1"], + "evaluationFrequency": "PT10M", "windowSize": "PT10M", "criteria": {"allOf": + [{"query": "union Event | where TimeGenerated > ago(2h)", "timeAggregation": + "Count", "resourceIdColumn": "_ResourceId", "dimensions": [], "operator": "LessThan", + "threshold": 260.0, "failingPeriods": {"numberOfEvaluationPeriods": 3, "minFailingPeriodsToAlert": + 2}}]}, "muteActionsDuration": "PT30M", "checkWorkspaceAlertsStorageConfigured": + false, "skipQueryValidation": true, "autoMitigate": false}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor scheduled-query update + Connection: + - keep-alive + Content-Length: + - '786' + Content-Type: + - application/json + ParameterSetName: + - -g -n --mad --auto-mitigate --skip-query-validation + User-Agent: + - AZURECLI/2.27.0 azsdk-python-mgmt-monitor/1.0.0b1 Python/3.8.9 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq01?api-version=2021-02-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq01","name":"sq01","type":"microsoft.insights/scheduledqueryrules","location":"eastus","systemData":{"createdBy":"v-jingszhang@microsoft.com","createdByType":"User","createdAt":"2021-08-13T02:34:06.7668957Z","lastModifiedBy":"v-jingszhang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-08-13T02:34:27.6640127Z"},"properties":{"description":"Test + rule 2","severity":4,"enabled":true,"evaluationFrequency":"PT10M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1"],"windowSize":"PT10M","criteria":{"allOf":[{"query":"union + Event | where TimeGenerated > ago(2h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"LessThan","threshold":260.0,"failingPeriods":{"numberOfEvaluationPeriods":3,"minFailingPeriodsToAlert":2}}]},"autoMitigate":false,"muteActionsDuration":"PT30M","checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":true}}' + headers: + cache-control: + - no-cache + content-length: + - '1255' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 13 Aug 2021 02:34:31 GMT expires: - '-1' pragma: @@ -1619,7 +1808,333 @@ interactions: x-rate-limit-remaining: - '14' x-rate-limit-reset: - - '2021-08-05T02:31:18.9870248Z' + - '2021-08-13T02:35:28.2983691Z' + status: + code: 200 + message: OK +- request: + body: '{"location": "global", "properties": {"groupShortName": "clitest3gwg3", + "enabled": true, "emailReceivers": [], "smsReceivers": [], "webhookReceivers": + [], "itsmReceivers": [], "azureAppPushReceivers": [], "automationRunbookReceivers": + [], "voiceReceivers": [], "logicAppReceivers": [], "azureFunctionReceivers": + [], "armRoleReceivers": []}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor action-group create + Connection: + - keep-alive + Content-Length: + - '340' + Content-Type: + - application/json + ParameterSetName: + - -n -g + User-Agent: + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-monitor/2.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/actionGroups/clitest000003?api-version=2019-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/actionGroups/clitest000003","type":"Microsoft.Insights/ActionGroups","name":"clitest000003","location":"Global","kind":null,"tags":null,"properties":{"groupShortName":"clitest3gwg3","enabled":true,"emailReceivers":[],"smsReceivers":[],"webhookReceivers":[],"itsmReceivers":[],"azureAppPushReceivers":[],"automationRunbookReceivers":[],"voiceReceivers":[],"logicAppReceivers":[],"azureFunctionReceivers":[],"armRoleReceivers":[]},"identity":null}' + headers: + cache-control: + - no-cache + content-length: + - '638' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 13 Aug 2021 02:34:41 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '24' + status: + code: 201 + message: Created +- request: + body: '{"location": "global", "properties": {"groupShortName": "clitest3cfsd", + "enabled": true, "emailReceivers": [], "smsReceivers": [], "webhookReceivers": + [], "itsmReceivers": [], "azureAppPushReceivers": [], "automationRunbookReceivers": + [], "voiceReceivers": [], "logicAppReceivers": [], "azureFunctionReceivers": + [], "armRoleReceivers": []}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor action-group create + Connection: + - keep-alive + Content-Length: + - '340' + Content-Type: + - application/json + ParameterSetName: + - -n -g + User-Agent: + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-monitor/2.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/actionGroups/clitest000004?api-version=2019-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/actionGroups/clitest000004","type":"Microsoft.Insights/ActionGroups","name":"clitest000004","location":"Global","kind":null,"tags":null,"properties":{"groupShortName":"clitest3cfsd","enabled":true,"emailReceivers":[],"smsReceivers":[],"webhookReceivers":[],"itsmReceivers":[],"azureAppPushReceivers":[],"automationRunbookReceivers":[],"voiceReceivers":[],"logicAppReceivers":[],"azureFunctionReceivers":[],"armRoleReceivers":[]},"identity":null}' + headers: + cache-control: + - no-cache + content-length: + - '638' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 13 Aug 2021 02:34:47 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '24' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor scheduled-query create + Connection: + - keep-alive + ParameterSetName: + - -g -n --scopes --condition --description --action-groups --custom-properties + User-Agent: + - AZURECLI/2.27.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.9 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001","name":"cli_test_scheduled_query000001","type":"Microsoft.Resources/resourceGroups","location":"eastus","tags":{"product":"azurecli","cause":"automation","date":"2021-08-13T02:27:22Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '428' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 13 Aug 2021 02:34:48 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus", "properties": {"description": "Test rule", "severity": + 2, "enabled": true, "scopes": ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001"], + "evaluationFrequency": "PT5M", "windowSize": "PT5M", "criteria": {"allOf": [{"query": + "union Event, Syslog | where TimeGenerated > ago(1h)", "timeAggregation": "Count", + "resourceIdColumn": "_ResourceId", "dimensions": [], "operator": "GreaterThan", + "threshold": 360.0, "failingPeriods": {"numberOfEvaluationPeriods": 1, "minFailingPeriodsToAlert": + 1}}]}, "actions": {"actionGroups": ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/actionGroups/clitest000003"], + "customProperties": {"k1": "v1"}}, "checkWorkspaceAlertsStorageConfigured": + false, "skipQueryValidation": false, "autoMitigate": true}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor scheduled-query create + Connection: + - keep-alive + Content-Length: + - '985' + Content-Type: + - application/json + ParameterSetName: + - -g -n --scopes --condition --description --action-groups --custom-properties + User-Agent: + - AZURECLI/2.27.0 azsdk-python-mgmt-monitor/1.0.0b1 Python/3.8.9 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq03?api-version=2021-02-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq03","name":"sq03","type":"microsoft.insights/scheduledqueryrules","location":"eastus","systemData":{"createdBy":"v-jingszhang@microsoft.com","createdByType":"User","createdAt":"2021-08-13T02:34:55.7368901Z","lastModifiedBy":"v-jingszhang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-08-13T02:34:55.7368901Z"},"properties":{"description":"Test + rule","severity":2,"enabled":true,"evaluationFrequency":"PT5M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001"],"windowSize":"PT5M","criteria":{"allOf":[{"query":"union + Event, Syslog | where TimeGenerated > ago(1h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"GreaterThan","threshold":360.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"autoMitigate":true,"actions":{"actionGroups":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/actionGroups/clitest000003"],"customProperties":{"k1":"v1"}},"checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}' + headers: + cache-control: + - no-cache + content-length: + - '1450' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 13 Aug 2021 02:34:59 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-rate-limit-limit: + - 1m + x-rate-limit-remaining: + - '14' + x-rate-limit-reset: + - '2021-08-13T02:35:55.9873765Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor scheduled-query update + Connection: + - keep-alive + ParameterSetName: + - -g -n --action-groups --custom-properties + User-Agent: + - AZURECLI/2.27.0 azsdk-python-mgmt-monitor/1.0.0b1 Python/3.8.9 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq03?api-version=2021-02-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq03","name":"sq03","type":"microsoft.insights/scheduledqueryrules","location":"eastus","systemData":{"createdBy":"v-jingszhang@microsoft.com","createdByType":"User","createdAt":"2021-08-13T02:34:55.7368901Z","lastModifiedBy":"v-jingszhang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-08-13T02:34:55.7368901Z"},"properties":{"description":"Test + rule","severity":2,"enabled":true,"evaluationFrequency":"PT5M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001"],"windowSize":"PT5M","criteria":{"allOf":[{"query":"union + Event, Syslog | where TimeGenerated > ago(1h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"GreaterThan","threshold":360.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"autoMitigate":true,"actions":{"actionGroups":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/actionGroups/clitest000003"],"customProperties":{"k1":"v1"}},"checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}' + headers: + cache-control: + - no-cache + content-length: + - '1450' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 13 Aug 2021 02:35:00 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus", "properties": {"description": "Test rule", "severity": + 2, "enabled": true, "scopes": ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001"], + "evaluationFrequency": "PT5M", "windowSize": "PT5M", "criteria": {"allOf": [{"query": + "union Event, Syslog | where TimeGenerated > ago(1h)", "timeAggregation": "Count", + "resourceIdColumn": "_ResourceId", "dimensions": [], "operator": "GreaterThan", + "threshold": 360.0, "failingPeriods": {"numberOfEvaluationPeriods": 1, "minFailingPeriodsToAlert": + 1}}]}, "actions": {"actionGroups": ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/actionGroups/clitest000004"], + "customProperties": {"k2": "v2"}}, "checkWorkspaceAlertsStorageConfigured": + false, "skipQueryValidation": false, "autoMitigate": true}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor scheduled-query update + Connection: + - keep-alive + Content-Length: + - '985' + Content-Type: + - application/json + ParameterSetName: + - -g -n --action-groups --custom-properties + User-Agent: + - AZURECLI/2.27.0 azsdk-python-mgmt-monitor/1.0.0b1 Python/3.8.9 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq03?api-version=2021-02-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq03","name":"sq03","type":"microsoft.insights/scheduledqueryrules","location":"eastus","systemData":{"createdBy":"v-jingszhang@microsoft.com","createdByType":"User","createdAt":"2021-08-13T02:34:55.7368901Z","lastModifiedBy":"v-jingszhang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-08-13T02:35:01.6019148Z"},"properties":{"description":"Test + rule","severity":2,"enabled":true,"evaluationFrequency":"PT5M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001"],"windowSize":"PT5M","criteria":{"allOf":[{"query":"union + Event, Syslog | where TimeGenerated > ago(1h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"GreaterThan","threshold":360.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"autoMitigate":true,"actions":{"actionGroups":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/actionGroups/clitest000004"],"customProperties":{"k2":"v2"}},"checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}' + headers: + cache-control: + - no-cache + content-length: + - '1450' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 13 Aug 2021 02:35:03 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1196' + x-rate-limit-limit: + - 1m + x-rate-limit-remaining: + - '14' + x-rate-limit-reset: + - '2021-08-13T02:36:01.6075341Z' status: code: 200 message: OK @@ -1637,26 +2152,23 @@ interactions: ParameterSetName: - -g -n User-Agent: - - python/3.8.10 (Windows-10-10.0.19043-SP0) msrest/0.6.21 msrest_azure/0.6.3 - azure-mgmt-monitor/2020-05-01-preview Azure-SDK-For-Python AZURECLI/2.27.0 - accept-language: - - en-US + - AZURECLI/2.27.0 azsdk-python-mgmt-monitor/1.0.0b1 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq01?api-version=2020-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq01?api-version=2021-02-01-preview response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq01","name":"sq01","type":"microsoft.insights/scheduledqueryrules","location":"eastus","properties":{"description":"Test - rule 2","severity":4,"enabled":false,"evaluationFrequency":"PT10M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1"],"windowSize":"PT10M","criteria":{"allOf":[{"query":"union - Event | where TimeGenerated > ago(2h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"LessThan","threshold":260.0,"failingPeriods":{"numberOfEvaluationPeriods":3,"minFailingPeriodsToAlert":2}}]},"muteActionsDuration":"PT30M"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq01","name":"sq01","type":"microsoft.insights/scheduledqueryrules","location":"eastus","systemData":{"createdBy":"v-jingszhang@microsoft.com","createdByType":"User","createdAt":"2021-08-13T02:34:06.7668957Z","lastModifiedBy":"v-jingszhang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-08-13T02:34:27.6640127Z"},"properties":{"description":"Test + rule 2","severity":4,"enabled":true,"evaluationFrequency":"PT10M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1"],"windowSize":"PT10M","criteria":{"allOf":[{"query":"union + Event | where TimeGenerated > ago(2h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"LessThan","threshold":260.0,"failingPeriods":{"numberOfEvaluationPeriods":3,"minFailingPeriodsToAlert":2}}]},"autoMitigate":false,"muteActionsDuration":"PT30M","checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":true}}' headers: cache-control: - no-cache content-length: - - '918' + - '1255' content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:30:22 GMT + - Fri, 13 Aug 2021 02:35:04 GMT expires: - '-1' pragma: @@ -1688,28 +2200,27 @@ interactions: ParameterSetName: - -g User-Agent: - - python/3.8.10 (Windows-10-10.0.19043-SP0) msrest/0.6.21 msrest_azure/0.6.3 - azure-mgmt-monitor/2020-05-01-preview Azure-SDK-For-Python AZURECLI/2.27.0 - accept-language: - - en-US + - AZURECLI/2.27.0 azsdk-python-mgmt-monitor/1.0.0b1 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules?api-version=2020-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules?api-version=2021-02-01-preview response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq01","name":"sq01","type":"microsoft.insights/scheduledqueryrules","location":"eastus","properties":{"description":"Test - rule 2","severity":4,"enabled":false,"evaluationFrequency":"PT10M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1"],"windowSize":"PT10M","criteria":{"allOf":[{"query":"union - Event | where TimeGenerated > ago(2h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"LessThan","threshold":260.0,"failingPeriods":{"numberOfEvaluationPeriods":3,"minFailingPeriodsToAlert":2}}]},"muteActionsDuration":"PT30M"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq02","name":"sq02","type":"microsoft.insights/scheduledqueryrules","location":"eastus","properties":{"description":"Test + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq01","name":"sq01","type":"microsoft.insights/scheduledqueryrules","location":"eastus","systemData":{"createdBy":"v-jingszhang@microsoft.com","createdByType":"User","createdAt":"2021-08-13T02:34:06.7668957Z","lastModifiedBy":"v-jingszhang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-08-13T02:34:27.6640127Z"},"properties":{"description":"Test + rule 2","severity":4,"enabled":true,"evaluationFrequency":"PT10M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1"],"windowSize":"PT10M","criteria":{"allOf":[{"query":"union + Event | where TimeGenerated > ago(2h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"LessThan","threshold":260.0,"failingPeriods":{"numberOfEvaluationPeriods":3,"minFailingPeriodsToAlert":2}}]},"autoMitigate":false,"muteActionsDuration":"PT30M","checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":true}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq02","name":"sq02","type":"microsoft.insights/scheduledqueryrules","location":"eastus","systemData":{"createdBy":"v-jingszhang@microsoft.com","createdByType":"User","createdAt":"2021-08-13T02:34:18.3768984Z","lastModifiedBy":"v-jingszhang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-08-13T02:34:18.3768984Z"},"properties":{"description":"Test rule","severity":2,"enabled":true,"evaluationFrequency":"PT5M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001"],"windowSize":"PT5M","criteria":{"allOf":[{"query":"union - Event, Syslog | where TimeGenerated > ago(1h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"GreaterThan","threshold":360.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"muteActionsDuration":"PT30M"}}]}' + Event, Syslog | where TimeGenerated > ago(1h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"GreaterThan","threshold":360.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"autoMitigate":true,"checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq03","name":"sq03","type":"microsoft.insights/scheduledqueryrules","location":"eastus","systemData":{"createdBy":"v-jingszhang@microsoft.com","createdByType":"User","createdAt":"2021-08-13T02:34:55.7368901Z","lastModifiedBy":"v-jingszhang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-08-13T02:35:01.6019148Z"},"properties":{"description":"Test + rule","severity":2,"enabled":true,"evaluationFrequency":"PT5M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001"],"windowSize":"PT5M","criteria":{"allOf":[{"query":"union + Event, Syslog | where TimeGenerated > ago(1h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"GreaterThan","threshold":360.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"autoMitigate":true,"actions":{"actionGroups":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/actionGroups/clitest000004"],"customProperties":{"k2":"v2"}},"checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}]}' headers: cache-control: - no-cache content-length: - - '1805' + - '3901' content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:30:24 GMT + - Fri, 13 Aug 2021 02:35:05 GMT expires: - '-1' pragma: @@ -1739,28 +2250,27 @@ interactions: Connection: - keep-alive User-Agent: - - python/3.8.10 (Windows-10-10.0.19043-SP0) msrest/0.6.21 msrest_azure/0.6.3 - azure-mgmt-monitor/2020-05-01-preview Azure-SDK-For-Python AZURECLI/2.27.0 - accept-language: - - en-US + - AZURECLI/2.27.0 azsdk-python-mgmt-monitor/1.0.0b1 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Insights/scheduledQueryRules?api-version=2020-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Insights/scheduledQueryRules?api-version=2021-02-01-preview response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq01","name":"sq01","type":"microsoft.insights/scheduledqueryrules","location":"eastus","properties":{"description":"Test - rule 2","severity":4,"enabled":false,"evaluationFrequency":"PT10M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1"],"windowSize":"PT10M","criteria":{"allOf":[{"query":"union - Event | where TimeGenerated > ago(2h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"LessThan","threshold":260.0,"failingPeriods":{"numberOfEvaluationPeriods":3,"minFailingPeriodsToAlert":2}}]},"muteActionsDuration":"PT30M"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq02","name":"sq02","type":"microsoft.insights/scheduledqueryrules","location":"eastus","properties":{"description":"Test + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq01","name":"sq01","type":"microsoft.insights/scheduledqueryrules","location":"eastus","systemData":{"createdBy":"v-jingszhang@microsoft.com","createdByType":"User","createdAt":"2021-08-13T02:34:06.7668957Z","lastModifiedBy":"v-jingszhang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-08-13T02:34:27.6640127Z"},"properties":{"description":"Test + rule 2","severity":4,"enabled":true,"evaluationFrequency":"PT10M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1"],"windowSize":"PT10M","criteria":{"allOf":[{"query":"union + Event | where TimeGenerated > ago(2h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"LessThan","threshold":260.0,"failingPeriods":{"numberOfEvaluationPeriods":3,"minFailingPeriodsToAlert":2}}]},"autoMitigate":false,"muteActionsDuration":"PT30M","checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":true}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq02","name":"sq02","type":"microsoft.insights/scheduledqueryrules","location":"eastus","systemData":{"createdBy":"v-jingszhang@microsoft.com","createdByType":"User","createdAt":"2021-08-13T02:34:18.3768984Z","lastModifiedBy":"v-jingszhang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-08-13T02:34:18.3768984Z"},"properties":{"description":"Test + rule","severity":2,"enabled":true,"evaluationFrequency":"PT5M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001"],"windowSize":"PT5M","criteria":{"allOf":[{"query":"union + Event, Syslog | where TimeGenerated > ago(1h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"GreaterThan","threshold":360.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"autoMitigate":true,"checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/scheduledqueryrules/sq03","name":"sq03","type":"microsoft.insights/scheduledqueryrules","location":"eastus","systemData":{"createdBy":"v-jingszhang@microsoft.com","createdByType":"User","createdAt":"2021-08-13T02:34:55.7368901Z","lastModifiedBy":"v-jingszhang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-08-13T02:35:01.6019148Z"},"properties":{"description":"Test rule","severity":2,"enabled":true,"evaluationFrequency":"PT5M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001"],"windowSize":"PT5M","criteria":{"allOf":[{"query":"union - Event, Syslog | where TimeGenerated > ago(1h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"GreaterThan","threshold":360.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"muteActionsDuration":"PT30M"}}]}' + Event, Syslog | where TimeGenerated > ago(1h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"GreaterThan","threshold":360.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"autoMitigate":true,"actions":{"actionGroups":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/microsoft.insights/actionGroups/clitest000004"],"customProperties":{"k2":"v2"}},"checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}]}' headers: cache-control: - no-cache content-length: - - '1805' + - '3901' content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:30:24 GMT + - Fri, 13 Aug 2021 02:35:06 GMT expires: - '-1' pragma: @@ -1794,12 +2304,9 @@ interactions: ParameterSetName: - -g -n -y User-Agent: - - python/3.8.10 (Windows-10-10.0.19043-SP0) msrest/0.6.21 msrest_azure/0.6.3 - azure-mgmt-monitor/2020-05-01-preview Azure-SDK-For-Python AZURECLI/2.27.0 - accept-language: - - en-US + - AZURECLI/2.27.0 azsdk-python-mgmt-monitor/1.0.0b1 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq01?api-version=2020-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq01?api-version=2021-02-01-preview response: body: string: '' @@ -1809,7 +2316,7 @@ interactions: content-length: - '0' date: - - Thu, 05 Aug 2021 02:30:35 GMT + - Fri, 13 Aug 2021 02:35:16 GMT expires: - '-1' pragma: @@ -1839,12 +2346,9 @@ interactions: ParameterSetName: - -g -n User-Agent: - - python/3.8.10 (Windows-10-10.0.19043-SP0) msrest/0.6.21 msrest_azure/0.6.3 - azure-mgmt-monitor/2020-05-01-preview Azure-SDK-For-Python AZURECLI/2.27.0 - accept-language: - - en-US + - AZURECLI/2.27.0 azsdk-python-mgmt-monitor/1.0.0b1 Python/3.8.9 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq01?api-version=2020-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Insights/scheduledQueryRules/sq01?api-version=2021-02-01-preview response: body: string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.Insights/scheduledqueryrules/sq01'' @@ -1858,7 +2362,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 05 Aug 2021 02:30:37 GMT + - Fri, 13 Aug 2021 02:35:16 GMT expires: - '-1' pragma: diff --git a/src/scheduled-query/azext_scheduled_query/tests/latest/test_scheduled_query_scenario.py b/src/scheduled-query/azext_scheduled_query/tests/latest/test_scheduled_query_scenario.py index 2f0cacee8e..d7d8090940 100644 --- a/src/scheduled-query/azext_scheduled_query/tests/latest/test_scheduled_query_scenario.py +++ b/src/scheduled-query/azext_scheduled_query/tests/latest/test_scheduled_query_scenario.py @@ -22,9 +22,12 @@ def test_scheduled_query(self, resource_group): self.kwargs.update({ 'name1': 'sq01', 'name2': 'sq02', + 'name3': 'sq03', 'rg': resource_group, 'vm': 'myvm1', - 'ws': self.create_random_name('clitest', 20) + 'ws': self.create_random_name('clitest', 20), + 'action_group1': self.create_random_name('clitest', 20), + 'action_group2': self.create_random_name('clitest', 20) }) with mock.patch('azure.cli.command_modules.vm.custom._gen_guid', side_effect=self.create_guid): vm = self.cmd('vm create -n {vm} -g {rg} --image UbuntuLTS --nsg-rule None --workspace {ws} --generate-ssh-keys').get_output_in_json() @@ -46,7 +49,12 @@ def test_scheduled_query(self, resource_group): self.check('criteria.allOf[0].timeAggregation', 'Count'), self.check('criteria.allOf[0].operator', 'GreaterThan'), self.check('criteria.allOf[0].failingPeriods.minFailingPeriodsToAlert', 1), - self.check('criteria.allOf[0].failingPeriods.numberOfEvaluationPeriods', 1) + self.check('criteria.allOf[0].failingPeriods.numberOfEvaluationPeriods', 1), + self.check('criteria.allOf[0].failingPeriods.minFailingPeriodsToAlert', 1), + self.check('criteria.allOf[0].failingPeriods.numberOfEvaluationPeriods', 1), + self.check('autoMitigate', True), + self.check('skipQueryValidation', False), + self.check('checkWorkspaceAlertsStorageConfigured', False) ]) self.cmd('monitor scheduled-query create -g {rg} -n {name2} --scopes {rg_id} --condition "count \'union Event, Syslog | where TimeGenerated > ago(1h)\' > 360 resource id _ResourceId" --description "Test rule"', checks=[ @@ -68,13 +76,33 @@ def test_scheduled_query(self, resource_group): self.check('criteria.allOf[0].failingPeriods.minFailingPeriodsToAlert', 2), self.check('criteria.allOf[0].failingPeriods.numberOfEvaluationPeriods', 3) ]) + self.cmd('monitor scheduled-query update -g {rg} -n {name1} --mad PT30M --auto-mitigate False --skip-query-validation True', + checks=[ + self.check('skipQueryValidation', True), + self.check('muteActionsDuration', '0:30:00'), + self.check('autoMitigate', False) + ]) + action_group_1 = self.cmd('monitor action-group create -n {action_group1} -g {rg}').get_output_in_json() + action_group_2 = self.cmd('monitor action-group create -n {action_group2} -g {rg}').get_output_in_json() + self.kwargs.update({ + 'action_group_id_1': action_group_1['id'], + 'action_group_id_2': action_group_2['id'] + }) + self.cmd('monitor scheduled-query create -g {rg} -n {name3} --scopes {rg_id} --condition "count \'union Event, Syslog | where TimeGenerated > ago(1h)\' > 360 resource id _ResourceId" --description "Test rule" --action-groups {action_group_id_1} --custom-properties k1=v1', checks=[ + self.check('actions.actionGroups', [action_group_1['id']]), + self.check('actions.customProperties', {'k1':'v1'}) + ]) + self.cmd('monitor scheduled-query update -g {rg} -n {name3} --action-groups {action_group_id_2} --custom-properties k2=v2', checks=[ + self.check('actions.actionGroups', [action_group_2['id']]), + self.check('actions.customProperties', {'k2':'v2'}) + ]) self.cmd('monitor scheduled-query show -g {rg} -n {name1}', checks=[ self.check('name', '{name1}') ]) self.cmd('monitor scheduled-query list -g {rg}', checks=[ - self.check('length(@)', 2) + self.check('length(@)', 3) ]) self.cmd('monitor scheduled-query list', checks=[ diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/__init__.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/__init__.py index 940dc04698..d824795100 100644 --- a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/__init__.py +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/__init__.py @@ -1,19 +1,19 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import MonitorClientConfiguration -from ._monitor_client import MonitorClient -__all__ = ['MonitorClient', 'MonitorClientConfiguration'] - -from .version import VERSION +from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION __version__ = VERSION +__all__ = ['MonitorManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/_configuration.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/_configuration.py index b3de8cc8b8..7ce16fb9f2 100644 --- a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/_configuration.py +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/_configuration.py @@ -1,48 +1,71 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class MonitorManagementClientConfiguration(Configuration): + """Configuration for MonitorManagementClient. -class MonitorClientConfiguration(AzureConfiguration): - """Configuration for MonitorClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: The Azure subscription Id. + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' - - super(MonitorClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True + super(MonitorManagementClientConfiguration, self).__init__(**kwargs) - self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2021-02-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/_monitor_client.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/_monitor_client.py deleted file mode 100644 index 9126e1c0d2..0000000000 --- a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/_monitor_client.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer - -from ._configuration import MonitorClientConfiguration -from .operations import ScheduledQueryRulesOperations -from . import models - - -class MonitorClient(SDKClient): - """Monitor Management Client - - :ivar config: Configuration for client. - :vartype config: MonitorClientConfiguration - - :ivar scheduled_query_rules: ScheduledQueryRules operations - :vartype scheduled_query_rules: azure.mgmt.monitor.v2020_05_01_preview.operations.ScheduledQueryRulesOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: The Azure subscription Id. - :type subscription_id: str - :param str base_url: Service URL - """ - - def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = MonitorClientConfiguration(credentials, subscription_id, base_url) - super(MonitorClient, self).__init__(self.config.credentials, self.config) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2020-05-01-preview' - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - - self.scheduled_query_rules = ScheduledQueryRulesOperations( - self._client, self.config, self._serialize, self._deserialize) diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/_monitor_management_client.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/_monitor_management_client.py new file mode 100644 index 0000000000..5dbe0e76d8 --- /dev/null +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/_monitor_management_client.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import MonitorManagementClientConfiguration +from .operations import ScheduledQueryRulesOperations +from . import models + + +class MonitorManagementClient(object): + """Monitor Management Client. + + :ivar scheduled_query_rules: ScheduledQueryRulesOperations operations + :vartype scheduled_query_rules: $(python-base-namespace).v2021_02_preview.operations.ScheduledQueryRulesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.scheduled_query_rules = ScheduledQueryRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> MonitorManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/version.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/_version.py similarity index 82% rename from src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/version.py rename to src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/_version.py index fc729cd319..e5754a47ce 100644 --- a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/version.py +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/_version.py @@ -1,13 +1,9 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2020-05-01-preview" - +VERSION = "1.0.0b1" diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/aio/__init__.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/aio/__init__.py new file mode 100644 index 0000000000..96ce9b45c0 --- /dev/null +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient'] diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/aio/_configuration.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/aio/_configuration.py new file mode 100644 index 0000000000..0e2854d9ff --- /dev/null +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class MonitorManagementClientConfiguration(Configuration): + """Configuration for MonitorManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-02-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/aio/_monitor_management_client.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/aio/_monitor_management_client.py new file mode 100644 index 0000000000..78e116427b --- /dev/null +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/aio/_monitor_management_client.py @@ -0,0 +1,81 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import MonitorManagementClientConfiguration +from .operations import ScheduledQueryRulesOperations +from .. import models + + +class MonitorManagementClient(object): + """Monitor Management Client. + + :ivar scheduled_query_rules: ScheduledQueryRulesOperations operations + :vartype scheduled_query_rules: $(python-base-namespace).v2021_02_preview.aio.operations.ScheduledQueryRulesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.scheduled_query_rules = ScheduledQueryRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "MonitorManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/aio/operations/__init__.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/aio/operations/__init__.py new file mode 100644 index 0000000000..f677702ed3 --- /dev/null +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/aio/operations/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._scheduled_query_rules_operations import ScheduledQueryRulesOperations + +__all__ = [ + 'ScheduledQueryRulesOperations', +] diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/aio/operations/_scheduled_query_rules_operations.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/aio/operations/_scheduled_query_rules_operations.py new file mode 100644 index 0000000000..8a75626115 --- /dev/null +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/aio/operations/_scheduled_query_rules_operations.py @@ -0,0 +1,433 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ScheduledQueryRulesOperations: + """ScheduledQueryRulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ScheduledQueryRuleResourceCollection"]: + """Retrieve a scheduled query rule definitions in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScheduledQueryRuleResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ScheduledQueryRuleResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ScheduledQueryRuleResourceCollection"]: + """Retrieve scheduled query rule definitions in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScheduledQueryRuleResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ScheduledQueryRuleResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore + + async def get( + self, + resource_group_name: str, + rule_name: str, + **kwargs: Any + ) -> "_models.ScheduledQueryRuleResource": + """Retrieve an scheduled query rule definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScheduledQueryRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + rule_name: str, + parameters: "_models.ScheduledQueryRuleResource", + **kwargs: Any + ) -> "_models.ScheduledQueryRuleResource": + """Creates or updates a scheduled query rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to create or update. + :type parameters: ~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScheduledQueryRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScheduledQueryRuleResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + rule_name: str, + parameters: "_models.ScheduledQueryRuleResourcePatch", + **kwargs: Any + ) -> "_models.ScheduledQueryRuleResource": + """Update a scheduled query rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to update. + :type parameters: ~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleResourcePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScheduledQueryRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScheduledQueryRuleResourcePatch') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a scheduled query rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/__init__.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/__init__.py index cfb5507417..fccf4920f8 100644 --- a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/__init__.py +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/__init__.py @@ -1,68 +1,70 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: - from ._models_py3 import Action - from ._models_py3 import AzureEntityResource + from ._models_py3 import Actions from ._models_py3 import Condition from ._models_py3 import ConditionFailingPeriods from ._models_py3 import Dimension from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorContract, ErrorContractException + from ._models_py3 import ErrorContract from ._models_py3 import ErrorResponse - from ._models_py3 import ProxyResource from ._models_py3 import Resource from ._models_py3 import ScheduledQueryRuleCriteria from ._models_py3 import ScheduledQueryRuleResource + from ._models_py3 import ScheduledQueryRuleResourceCollection from ._models_py3 import ScheduledQueryRuleResourcePatch + from ._models_py3 import SystemData from ._models_py3 import TrackedResource except (SyntaxError, ImportError): - from ._models import Action - from ._models import AzureEntityResource - from ._models import Condition - from ._models import ConditionFailingPeriods - from ._models import Dimension - from ._models import ErrorAdditionalInfo - from ._models import ErrorContract, ErrorContractException - from ._models import ErrorResponse - from ._models import ProxyResource - from ._models import Resource - from ._models import ScheduledQueryRuleCriteria - from ._models import ScheduledQueryRuleResource - from ._models import ScheduledQueryRuleResourcePatch - from ._models import TrackedResource -from ._paged_models import ScheduledQueryRuleResourcePaged -from ._monitor_client_enums import ( - TimeAggregation, - DimensionOperator, + from ._models import Actions # type: ignore + from ._models import Condition # type: ignore + from ._models import ConditionFailingPeriods # type: ignore + from ._models import Dimension # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorContract # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import Resource # type: ignore + from ._models import ScheduledQueryRuleCriteria # type: ignore + from ._models import ScheduledQueryRuleResource # type: ignore + from ._models import ScheduledQueryRuleResourceCollection # type: ignore + from ._models import ScheduledQueryRuleResourcePatch # type: ignore + from ._models import SystemData # type: ignore + from ._models import TrackedResource # type: ignore + +from ._monitor_management_client_enums import ( + AlertSeverity, ConditionOperator, + CreatedByType, + DimensionOperator, + Kind, + TimeAggregation, ) __all__ = [ - 'Action', - 'AzureEntityResource', + 'Actions', 'Condition', 'ConditionFailingPeriods', 'Dimension', 'ErrorAdditionalInfo', - 'ErrorContract', 'ErrorContractException', + 'ErrorContract', 'ErrorResponse', - 'ProxyResource', 'Resource', 'ScheduledQueryRuleCriteria', 'ScheduledQueryRuleResource', + 'ScheduledQueryRuleResourceCollection', 'ScheduledQueryRuleResourcePatch', + 'SystemData', 'TrackedResource', - 'ScheduledQueryRuleResourcePaged', - 'TimeAggregation', - 'DimensionOperator', + 'AlertSeverity', 'ConditionOperator', + 'CreatedByType', + 'DimensionOperator', + 'Kind', + 'TimeAggregation', ] diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_models.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_models.py index c5e78eef7c..ba9ddba351 100644 --- a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_models.py +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_models.py @@ -1,160 +1,71 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class Action(Model): +class Actions(msrest.serialization.Model): """Actions to invoke when the alert fires. - :param action_group_id: Action Group resource Id to invoke when the alert - fires. - :type action_group_id: str - :param web_hook_properties: The properties of a webhook object. - :type web_hook_properties: dict[str, str] + :param action_groups: Action Group resource Ids to invoke when the alert fires. + :type action_groups: list[str] + :param custom_properties: The properties of an alert payload. + :type custom_properties: dict[str, str] """ _attribute_map = { - 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, - 'web_hook_properties': {'key': 'webHookProperties', 'type': '{str}'}, + 'action_groups': {'key': 'actionGroups', 'type': '[str]'}, + 'custom_properties': {'key': 'customProperties', 'type': '{str}'}, } - def __init__(self, **kwargs): - super(Action, self).__init__(**kwargs) - self.action_group_id = kwargs.get('action_group_id', None) - self.web_hook_properties = kwargs.get('web_hook_properties', None) + def __init__( + self, + **kwargs + ): + super(Actions, self).__init__(**kwargs) + self.action_groups = kwargs.get('action_groups', None) + self.custom_properties = kwargs.get('custom_properties', None) -class Resource(Model): - """Resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class AzureEntityResource(Resource): - """The resource model definition for a Azure Resource Manager resource with an - etag. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(AzureEntityResource, self).__init__(**kwargs) - self.etag = None - - -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class Condition(Model): +class Condition(msrest.serialization.Model): """A condition of the scheduled query rule. - All required parameters must be populated in order to send to Azure. - - :param query: Log query alert + :param query: Log query alert. :type query: str - :param time_aggregation: Required. Aggregation type. Possible values - include: 'Count', 'Average', 'Minimum', 'Maximum', 'Total' + :param time_aggregation: Aggregation type. Relevant and required only for rules of the kind + LogAlert. Possible values include: "Count", "Average", "Minimum", "Maximum", "Total". :type time_aggregation: str or - ~azure.mgmt.monitor.v2020_05_01_preview.models.TimeAggregation - :param metric_measure_column: The column containing the metric measure - number. + ~$(python-base-namespace).v2021_02_preview.models.TimeAggregation + :param metric_measure_column: The column containing the metric measure number. Relevant only + for rules of the kind LogAlert. :type metric_measure_column: str - :param resource_id_column: The column containing the resource id. The - content of the column must be a uri formatted as resource id + :param resource_id_column: The column containing the resource id. The content of the column + must be a uri formatted as resource id. Relevant only for rules of the kind LogAlert. :type resource_id_column: str - :param dimensions: List of Dimensions conditions - :type dimensions: - list[~azure.mgmt.monitor.v2020_05_01_preview.models.Dimension] - :param operator: Required. The criteria operator. Possible values include: - 'Equals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - 'LessThanOrEqual' - :type operator: str or - ~azure.mgmt.monitor.v2020_05_01_preview.models.ConditionOperator - :param threshold: Required. the criteria threshold value that activates - the alert. - :type threshold: int - :param failing_periods: The minimum number of violations required within - the selected lookback time window required to raise an alert. + :param dimensions: List of Dimensions conditions. + :type dimensions: list[~$(python-base-namespace).v2021_02_preview.models.Dimension] + :param operator: The criteria operator. Relevant and required only for rules of the kind + LogAlert. Possible values include: "Equals", "GreaterThan", "GreaterThanOrEqual", "LessThan", + "LessThanOrEqual". + :type operator: str or ~$(python-base-namespace).v2021_02_preview.models.ConditionOperator + :param threshold: the criteria threshold value that activates the alert. Relevant and required + only for rules of the kind LogAlert. + :type threshold: float + :param failing_periods: The minimum number of violations required within the selected lookback + time window required to raise an alert. Relevant only for rules of the kind LogAlert. :type failing_periods: - ~azure.mgmt.monitor.v2020_05_01_preview.models.ConditionFailingPeriods + ~$(python-base-namespace).v2021_02_preview.models.ConditionFailingPeriods + :param metric_name: The name of the metric to be sent. Relevant and required only for rules of + the kind LogToMetric. + :type metric_name: str """ - _validation = { - 'time_aggregation': {'required': True}, - 'operator': {'required': True}, - 'threshold': {'required': True}, - } - _attribute_map = { 'query': {'key': 'query', 'type': 'str'}, 'time_aggregation': {'key': 'timeAggregation', 'type': 'str'}, @@ -162,11 +73,15 @@ class Condition(Model): 'resource_id_column': {'key': 'resourceIdColumn', 'type': 'str'}, 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, 'operator': {'key': 'operator', 'type': 'str'}, - 'threshold': {'key': 'threshold', 'type': 'int'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, 'failing_periods': {'key': 'failingPeriods', 'type': 'ConditionFailingPeriods'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Condition, self).__init__(**kwargs) self.query = kwargs.get('query', None) self.time_aggregation = kwargs.get('time_aggregation', None) @@ -176,46 +91,46 @@ def __init__(self, **kwargs): self.operator = kwargs.get('operator', None) self.threshold = kwargs.get('threshold', None) self.failing_periods = kwargs.get('failing_periods', None) + self.metric_name = kwargs.get('metric_name', None) -class ConditionFailingPeriods(Model): - """The minimum number of violations required within the selected lookback time - window required to raise an alert. +class ConditionFailingPeriods(msrest.serialization.Model): + """The minimum number of violations required within the selected lookback time window required to raise an alert. Relevant only for rules of the kind LogAlert. - :param number_of_evaluation_periods: The number of aggregated lookback - points. The lookback time window is calculated based on the aggregation - granularity (windowSize) and the selected number of aggregated points. - Default value is 1 - :type number_of_evaluation_periods: int - :param min_failing_periods_to_alert: The number of violations to trigger - an alert. Should be smaller or equal to numberOfEvaluationPeriods. Default - value is 1 - :type min_failing_periods_to_alert: int + :param number_of_evaluation_periods: The number of aggregated lookback points. The lookback + time window is calculated based on the aggregation granularity (windowSize) and the selected + number of aggregated points. Default value is 1. + :type number_of_evaluation_periods: long + :param min_failing_periods_to_alert: The number of violations to trigger an alert. Should be + smaller or equal to numberOfEvaluationPeriods. Default value is 1. + :type min_failing_periods_to_alert: long """ _attribute_map = { - 'number_of_evaluation_periods': {'key': 'numberOfEvaluationPeriods', 'type': 'int'}, - 'min_failing_periods_to_alert': {'key': 'minFailingPeriodsToAlert', 'type': 'int'}, + 'number_of_evaluation_periods': {'key': 'numberOfEvaluationPeriods', 'type': 'long'}, + 'min_failing_periods_to_alert': {'key': 'minFailingPeriodsToAlert', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConditionFailingPeriods, self).__init__(**kwargs) - self.number_of_evaluation_periods = kwargs.get('number_of_evaluation_periods', None) - self.min_failing_periods_to_alert = kwargs.get('min_failing_periods_to_alert', None) + self.number_of_evaluation_periods = kwargs.get('number_of_evaluation_periods', 1) + self.min_failing_periods_to_alert = kwargs.get('min_failing_periods_to_alert', 1) -class Dimension(Model): +class Dimension(msrest.serialization.Model): """Dimension splitting and filtering definition. All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the dimension + :param name: Required. Name of the dimension. :type name: str - :param operator: Required. Operator for dimension values. Possible values - include: 'Include', 'Exclude' - :type operator: str or - ~azure.mgmt.monitor.v2020_05_01_preview.models.DimensionOperator - :param values: Required. List of dimension values + :param operator: Required. Operator for dimension values. Possible values include: "Include", + "Exclude". + :type operator: str or ~$(python-base-namespace).v2021_02_preview.models.DimensionOperator + :param values: Required. List of dimension values. :type values: list[str] """ @@ -231,23 +146,25 @@ class Dimension(Model): 'values': {'key': 'values', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.operator = kwargs.get('operator', None) - self.values = kwargs.get('values', None) + self.name = kwargs['name'] + self.operator = kwargs['operator'] + self.values = kwargs['values'] -class ErrorAdditionalInfo(Model): +class ErrorAdditionalInfo(msrest.serialization.Model): """The resource management error additional info. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: object + :vartype info: any """ _validation = { @@ -260,45 +177,38 @@ class ErrorAdditionalInfo(Model): 'info': {'key': 'info', 'type': 'object'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None -class ErrorContract(Model): +class ErrorContract(msrest.serialization.Model): """Describes the format of Error response. :param error: The error details. - :type error: ~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorResponse + :type error: ~$(python-base-namespace).v2021_02_preview.models.ErrorResponse """ _attribute_map = { 'error': {'key': 'error', 'type': 'ErrorResponse'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ErrorContract, self).__init__(**kwargs) self.error = kwargs.get('error', None) -class ErrorContractException(HttpOperationError): - """Server responsed with exception of type: 'ErrorContract'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ErrorContractException, self).__init__(deserialize, response, 'ErrorContract', *args) - +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). -class ErrorResponse(Model): - """The resource management error response. - - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: The error code. :vartype code: str @@ -307,11 +217,10 @@ class ErrorResponse(Model): :ivar target: The error target. :vartype target: str :ivar details: The error details. - :vartype details: - list[~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorResponse] + :vartype details: list[~$(python-base-namespace).v2021_02_preview.models.ErrorResponse] :ivar additional_info: The error additional info. :vartype additional_info: - list[~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorAdditionalInfo] + list[~$(python-base-namespace).v2021_02_preview.models.ErrorAdditionalInfo] """ _validation = { @@ -330,7 +239,10 @@ class ErrorResponse(Model): 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ErrorResponse, self).__init__(**kwargs) self.code = None self.message = None @@ -339,20 +251,18 @@ def __init__(self, **kwargs): self.additional_info = None -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -368,47 +278,53 @@ class ProxyResource(Resource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): - super(ProxyResource, self).__init__(**kwargs) + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class ScheduledQueryRuleCriteria(Model): +class ScheduledQueryRuleCriteria(msrest.serialization.Model): """The rule criteria that defines the conditions of the scheduled query rule. - :param all_of: A list of conditions to evaluate against the specified - scopes - :type all_of: - list[~azure.mgmt.monitor.v2020_05_01_preview.models.Condition] + :param all_of: A list of conditions to evaluate against the specified scopes. + :type all_of: list[~$(python-base-namespace).v2021_02_preview.models.Condition] """ _attribute_map = { 'all_of': {'key': 'allOf', 'type': '[Condition]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ScheduledQueryRuleCriteria, self).__init__(**kwargs) self.all_of = kwargs.get('all_of', None) class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives + :param location: Required. The geo-location where the resource lives. :type location: str """ @@ -427,65 +343,97 @@ class TrackedResource(Resource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) - self.location = kwargs.get('location', None) + self.location = kwargs['location'] class ScheduledQueryRuleResource(TrackedResource): """The scheduled query rule resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives + :param location: Required. The geo-location where the resource lives. :type location: str + :param kind: Indicates the type of scheduled query rule. The default is LogAlert. Possible + values include: "LogAlert", "LogToMetric". + :type kind: str or ~$(python-base-namespace).v2021_02_preview.models.Kind + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :ivar system_data: SystemData of ScheduledQueryRule. + :vartype system_data: ~$(python-base-namespace).v2021_02_preview.models.SystemData + :ivar created_with_api_version: The api-version used when creating this alert rule. + :vartype created_with_api_version: str + :ivar is_legacy_log_analytics_rule: True if alert rule is legacy Log Analytic rule. + :vartype is_legacy_log_analytics_rule: bool :param description: The description of the scheduled query rule. :type description: str - :param severity: Severity of the alert. Should be an integer between - [0-4]. Value of 0 is severest - :type severity: int - :param enabled: The flag which indicates whether this scheduled query rule - is enabled. Value should be true or false + :param display_name: The display name of the alert rule. + :type display_name: str + :param severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is + severest. Relevant and required only for rules of the kind LogAlert. Possible values include: + 0, 1, 2, 3, 4. + :type severity: str or ~$(python-base-namespace).v2021_02_preview.models.AlertSeverity + :param enabled: The flag which indicates whether this scheduled query rule is enabled. Value + should be true or false. :type enabled: bool - :param scopes: The list of resource id's that this scheduled query rule is - scoped to. + :param scopes: The list of resource id's that this scheduled query rule is scoped to. :type scopes: list[str] - :param evaluation_frequency: How often the scheduled query rule is - evaluated represented in ISO 8601 duration format. - :type evaluation_frequency: timedelta - :param window_size: The period of time (in ISO 8601 duration format) on - which the Alert query will be executed (bin size). - :type window_size: timedelta - :param target_resource_types: List of resource type of the target - resource(s) on which the alert is created/updated. For example if the - scope is a resource group and targetResourceTypes is - Microsoft.Compute/virtualMachines, then a different alert will be fired - for each virtual machine in the resource group which meet the alert - criteria + :param evaluation_frequency: How often the scheduled query rule is evaluated represented in ISO + 8601 duration format. Relevant and required only for rules of the kind LogAlert. + :type evaluation_frequency: ~datetime.timedelta + :param window_size: The period of time (in ISO 8601 duration format) on which the Alert query + will be executed (bin size). Relevant and required only for rules of the kind LogAlert. + :type window_size: ~datetime.timedelta + :param override_query_time_range: If specified then overrides the query time range (default is + WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + :type override_query_time_range: ~datetime.timedelta + :param target_resource_types: List of resource type of the target resource(s) on which the + alert is created/updated. For example if the scope is a resource group and targetResourceTypes + is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual + machine in the resource group which meet the alert criteria. Relevant only for rules of the + kind LogAlert. :type target_resource_types: list[str] - :param criteria: The rule criteria that defines the conditions of the - scheduled query rule. - :type criteria: - ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleCriteria - :param mute_actions_duration: Mute actions for the chosen period of time - (in ISO 8601 duration format) after the alert is fired. - :type mute_actions_duration: timedelta - :param actions: - :type actions: list[~azure.mgmt.monitor.v2020_05_01_preview.models.Action] + :param criteria: The rule criteria that defines the conditions of the scheduled query rule. + :type criteria: ~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleCriteria + :param mute_actions_duration: Mute actions for the chosen period of time (in ISO 8601 duration + format) after the alert is fired. Relevant only for rules of the kind LogAlert. + :type mute_actions_duration: ~datetime.timedelta + :param actions: Actions to invoke when the alert fires. + :type actions: ~$(python-base-namespace).v2021_02_preview.models.Actions + :ivar is_workspace_alerts_storage_configured: The flag which indicates whether this scheduled + query rule has been configured to be stored in the customer's storage. The default is false. + :vartype is_workspace_alerts_storage_configured: bool + :param check_workspace_alerts_storage_configured: The flag which indicates whether this + scheduled query rule should be stored in the customer's storage. The default is false. Relevant + only for rules of the kind LogAlert. + :type check_workspace_alerts_storage_configured: bool + :param skip_query_validation: The flag which indicates whether the provided query should be + validated or not. The default is false. Relevant only for rules of the kind LogAlert. + :type skip_query_validation: bool + :param auto_mitigate: The flag that indicates whether the alert should be automatically + resolved or not. The default is true. Relevant only for rules of the kind LogAlert. + :type auto_mitigate: bool """ _validation = { @@ -493,6 +441,11 @@ class ScheduledQueryRuleResource(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'created_with_api_version': {'readonly': True}, + 'is_legacy_log_analytics_rule': {'readonly': True}, + 'is_workspace_alerts_storage_configured': {'readonly': True}, } _attribute_map = { @@ -501,96 +454,228 @@ class ScheduledQueryRuleResource(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'created_with_api_version': {'key': 'properties.createdWithApiVersion', 'type': 'str'}, + 'is_legacy_log_analytics_rule': {'key': 'properties.isLegacyLogAnalyticsRule', 'type': 'bool'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'severity': {'key': 'properties.severity', 'type': 'int'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'override_query_time_range': {'key': 'properties.overrideQueryTimeRange', 'type': 'duration'}, 'target_resource_types': {'key': 'properties.targetResourceTypes', 'type': '[str]'}, 'criteria': {'key': 'properties.criteria', 'type': 'ScheduledQueryRuleCriteria'}, 'mute_actions_duration': {'key': 'properties.muteActionsDuration', 'type': 'duration'}, - 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + 'actions': {'key': 'properties.actions', 'type': 'Actions'}, + 'is_workspace_alerts_storage_configured': {'key': 'properties.isWorkspaceAlertsStorageConfigured', 'type': 'bool'}, + 'check_workspace_alerts_storage_configured': {'key': 'properties.checkWorkspaceAlertsStorageConfigured', 'type': 'bool'}, + 'skip_query_validation': {'key': 'properties.skipQueryValidation', 'type': 'bool'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ScheduledQueryRuleResource, self).__init__(**kwargs) + self.kind = kwargs.get('kind', None) + self.etag = None + self.system_data = None + self.created_with_api_version = None + self.is_legacy_log_analytics_rule = None self.description = kwargs.get('description', None) + self.display_name = kwargs.get('display_name', None) self.severity = kwargs.get('severity', None) self.enabled = kwargs.get('enabled', None) self.scopes = kwargs.get('scopes', None) self.evaluation_frequency = kwargs.get('evaluation_frequency', None) self.window_size = kwargs.get('window_size', None) + self.override_query_time_range = kwargs.get('override_query_time_range', None) self.target_resource_types = kwargs.get('target_resource_types', None) self.criteria = kwargs.get('criteria', None) self.mute_actions_duration = kwargs.get('mute_actions_duration', None) self.actions = kwargs.get('actions', None) + self.is_workspace_alerts_storage_configured = None + self.check_workspace_alerts_storage_configured = kwargs.get('check_workspace_alerts_storage_configured', None) + self.skip_query_validation = kwargs.get('skip_query_validation', None) + self.auto_mitigate = kwargs.get('auto_mitigate', None) -class ScheduledQueryRuleResourcePatch(Model): +class ScheduledQueryRuleResourceCollection(msrest.serialization.Model): + """Represents a collection of scheduled query rule resources. + + :param value: The values for the scheduled query rule resources. + :type value: list[~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScheduledQueryRuleResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScheduledQueryRuleResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ScheduledQueryRuleResourcePatch(msrest.serialization.Model): """The scheduled query rule resource for patch operations. - :param tags: Resource tags + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :ivar created_with_api_version: The api-version used when creating this alert rule. + :vartype created_with_api_version: str + :ivar is_legacy_log_analytics_rule: True if alert rule is legacy Log Analytic rule. + :vartype is_legacy_log_analytics_rule: bool :param description: The description of the scheduled query rule. :type description: str - :param severity: Severity of the alert. Should be an integer between - [0-4]. Value of 0 is severest - :type severity: int - :param enabled: The flag which indicates whether this scheduled query rule - is enabled. Value should be true or false + :param display_name: The display name of the alert rule. + :type display_name: str + :param severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is + severest. Relevant and required only for rules of the kind LogAlert. Possible values include: + 0, 1, 2, 3, 4. + :type severity: str or ~$(python-base-namespace).v2021_02_preview.models.AlertSeverity + :param enabled: The flag which indicates whether this scheduled query rule is enabled. Value + should be true or false. :type enabled: bool - :param scopes: The list of resource id's that this scheduled query rule is - scoped to. + :param scopes: The list of resource id's that this scheduled query rule is scoped to. :type scopes: list[str] - :param evaluation_frequency: How often the scheduled query rule is - evaluated represented in ISO 8601 duration format. - :type evaluation_frequency: timedelta - :param window_size: The period of time (in ISO 8601 duration format) on - which the Alert query will be executed (bin size). - :type window_size: timedelta - :param target_resource_types: List of resource type of the target - resource(s) on which the alert is created/updated. For example if the - scope is a resource group and targetResourceTypes is - Microsoft.Compute/virtualMachines, then a different alert will be fired - for each virtual machine in the resource group which meet the alert - criteria + :param evaluation_frequency: How often the scheduled query rule is evaluated represented in ISO + 8601 duration format. Relevant and required only for rules of the kind LogAlert. + :type evaluation_frequency: ~datetime.timedelta + :param window_size: The period of time (in ISO 8601 duration format) on which the Alert query + will be executed (bin size). Relevant and required only for rules of the kind LogAlert. + :type window_size: ~datetime.timedelta + :param override_query_time_range: If specified then overrides the query time range (default is + WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + :type override_query_time_range: ~datetime.timedelta + :param target_resource_types: List of resource type of the target resource(s) on which the + alert is created/updated. For example if the scope is a resource group and targetResourceTypes + is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual + machine in the resource group which meet the alert criteria. Relevant only for rules of the + kind LogAlert. :type target_resource_types: list[str] - :param criteria: The rule criteria that defines the conditions of the - scheduled query rule. - :type criteria: - ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleCriteria - :param mute_actions_duration: Mute actions for the chosen period of time - (in ISO 8601 duration format) after the alert is fired. - :type mute_actions_duration: timedelta - :param actions: - :type actions: list[~azure.mgmt.monitor.v2020_05_01_preview.models.Action] + :param criteria: The rule criteria that defines the conditions of the scheduled query rule. + :type criteria: ~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleCriteria + :param mute_actions_duration: Mute actions for the chosen period of time (in ISO 8601 duration + format) after the alert is fired. Relevant only for rules of the kind LogAlert. + :type mute_actions_duration: ~datetime.timedelta + :param actions: Actions to invoke when the alert fires. + :type actions: ~$(python-base-namespace).v2021_02_preview.models.Actions + :ivar is_workspace_alerts_storage_configured: The flag which indicates whether this scheduled + query rule has been configured to be stored in the customer's storage. The default is false. + :vartype is_workspace_alerts_storage_configured: bool + :param check_workspace_alerts_storage_configured: The flag which indicates whether this + scheduled query rule should be stored in the customer's storage. The default is false. Relevant + only for rules of the kind LogAlert. + :type check_workspace_alerts_storage_configured: bool + :param skip_query_validation: The flag which indicates whether the provided query should be + validated or not. The default is false. Relevant only for rules of the kind LogAlert. + :type skip_query_validation: bool + :param auto_mitigate: The flag that indicates whether the alert should be automatically + resolved or not. The default is true. Relevant only for rules of the kind LogAlert. + :type auto_mitigate: bool """ + _validation = { + 'created_with_api_version': {'readonly': True}, + 'is_legacy_log_analytics_rule': {'readonly': True}, + 'is_workspace_alerts_storage_configured': {'readonly': True}, + } + _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, + 'created_with_api_version': {'key': 'properties.createdWithApiVersion', 'type': 'str'}, + 'is_legacy_log_analytics_rule': {'key': 'properties.isLegacyLogAnalyticsRule', 'type': 'bool'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'severity': {'key': 'properties.severity', 'type': 'int'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'override_query_time_range': {'key': 'properties.overrideQueryTimeRange', 'type': 'duration'}, 'target_resource_types': {'key': 'properties.targetResourceTypes', 'type': '[str]'}, 'criteria': {'key': 'properties.criteria', 'type': 'ScheduledQueryRuleCriteria'}, 'mute_actions_duration': {'key': 'properties.muteActionsDuration', 'type': 'duration'}, - 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + 'actions': {'key': 'properties.actions', 'type': 'Actions'}, + 'is_workspace_alerts_storage_configured': {'key': 'properties.isWorkspaceAlertsStorageConfigured', 'type': 'bool'}, + 'check_workspace_alerts_storage_configured': {'key': 'properties.checkWorkspaceAlertsStorageConfigured', 'type': 'bool'}, + 'skip_query_validation': {'key': 'properties.skipQueryValidation', 'type': 'bool'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ScheduledQueryRuleResourcePatch, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) + self.created_with_api_version = None + self.is_legacy_log_analytics_rule = None self.description = kwargs.get('description', None) + self.display_name = kwargs.get('display_name', None) self.severity = kwargs.get('severity', None) self.enabled = kwargs.get('enabled', None) self.scopes = kwargs.get('scopes', None) self.evaluation_frequency = kwargs.get('evaluation_frequency', None) self.window_size = kwargs.get('window_size', None) + self.override_query_time_range = kwargs.get('override_query_time_range', None) self.target_resource_types = kwargs.get('target_resource_types', None) self.criteria = kwargs.get('criteria', None) self.mute_actions_duration = kwargs.get('mute_actions_duration', None) self.actions = kwargs.get('actions', None) + self.is_workspace_alerts_storage_configured = None + self.check_workspace_alerts_storage_configured = kwargs.get('check_workspace_alerts_storage_configured', None) + self.skip_query_validation = kwargs.get('skip_query_validation', None) + self.auto_mitigate = kwargs.get('auto_mitigate', None) + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~$(python-base-namespace).v2021_02_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or + ~$(python-base-namespace).v2021_02_preview.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_models_py3.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_models_py3.py index e9d2d10799..2bf58582df 100644 --- a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_models_py3.py +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_models_py3.py @@ -1,160 +1,79 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +import datetime +from typing import Dict, List, Optional, Union +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class Action(Model): - """Actions to invoke when the alert fires. - - :param action_group_id: Action Group resource Id to invoke when the alert - fires. - :type action_group_id: str - :param web_hook_properties: The properties of a webhook object. - :type web_hook_properties: dict[str, str] - """ - - _attribute_map = { - 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, - 'web_hook_properties': {'key': 'webHookProperties', 'type': '{str}'}, - } +from ._monitor_management_client_enums import * - def __init__(self, *, action_group_id: str=None, web_hook_properties=None, **kwargs) -> None: - super(Action, self).__init__(**kwargs) - self.action_group_id = action_group_id - self.web_hook_properties = web_hook_properties +class Actions(msrest.serialization.Model): + """Actions to invoke when the alert fires. -class Resource(Model): - """Resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - :vartype type: str + :param action_groups: Action Group resource Ids to invoke when the alert fires. + :type action_groups: list[str] + :param custom_properties: The properties of an alert payload. + :type custom_properties: dict[str, str] """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + 'action_groups': {'key': 'actionGroups', 'type': '[str]'}, + 'custom_properties': {'key': 'customProperties', 'type': '{str}'}, } - def __init__(self, **kwargs) -> None: - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class AzureEntityResource(Resource): - """The resource model definition for a Azure Resource Manager resource with an - etag. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ + def __init__( + self, + *, + action_groups: Optional[List[str]] = None, + custom_properties: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Actions, self).__init__(**kwargs) + self.action_groups = action_groups + self.custom_properties = custom_properties - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - def __init__(self, **kwargs) -> None: - super(AzureEntityResource, self).__init__(**kwargs) - self.etag = None - - -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class Condition(Model): +class Condition(msrest.serialization.Model): """A condition of the scheduled query rule. - All required parameters must be populated in order to send to Azure. - - :param query: Log query alert + :param query: Log query alert. :type query: str - :param time_aggregation: Required. Aggregation type. Possible values - include: 'Count', 'Average', 'Minimum', 'Maximum', 'Total' + :param time_aggregation: Aggregation type. Relevant and required only for rules of the kind + LogAlert. Possible values include: "Count", "Average", "Minimum", "Maximum", "Total". :type time_aggregation: str or - ~azure.mgmt.monitor.v2020_05_01_preview.models.TimeAggregation - :param metric_measure_column: The column containing the metric measure - number. + ~$(python-base-namespace).v2021_02_preview.models.TimeAggregation + :param metric_measure_column: The column containing the metric measure number. Relevant only + for rules of the kind LogAlert. :type metric_measure_column: str - :param resource_id_column: The column containing the resource id. The - content of the column must be a uri formatted as resource id + :param resource_id_column: The column containing the resource id. The content of the column + must be a uri formatted as resource id. Relevant only for rules of the kind LogAlert. :type resource_id_column: str - :param dimensions: List of Dimensions conditions - :type dimensions: - list[~azure.mgmt.monitor.v2020_05_01_preview.models.Dimension] - :param operator: Required. The criteria operator. Possible values include: - 'Equals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - 'LessThanOrEqual' - :type operator: str or - ~azure.mgmt.monitor.v2020_05_01_preview.models.ConditionOperator - :param threshold: Required. the criteria threshold value that activates - the alert. - :type threshold: int - :param failing_periods: The minimum number of violations required within - the selected lookback time window required to raise an alert. + :param dimensions: List of Dimensions conditions. + :type dimensions: list[~$(python-base-namespace).v2021_02_preview.models.Dimension] + :param operator: The criteria operator. Relevant and required only for rules of the kind + LogAlert. Possible values include: "Equals", "GreaterThan", "GreaterThanOrEqual", "LessThan", + "LessThanOrEqual". + :type operator: str or ~$(python-base-namespace).v2021_02_preview.models.ConditionOperator + :param threshold: the criteria threshold value that activates the alert. Relevant and required + only for rules of the kind LogAlert. + :type threshold: float + :param failing_periods: The minimum number of violations required within the selected lookback + time window required to raise an alert. Relevant only for rules of the kind LogAlert. :type failing_periods: - ~azure.mgmt.monitor.v2020_05_01_preview.models.ConditionFailingPeriods + ~$(python-base-namespace).v2021_02_preview.models.ConditionFailingPeriods + :param metric_name: The name of the metric to be sent. Relevant and required only for rules of + the kind LogToMetric. + :type metric_name: str """ - _validation = { - 'time_aggregation': {'required': True}, - 'operator': {'required': True}, - 'threshold': {'required': True}, - } - _attribute_map = { 'query': {'key': 'query', 'type': 'str'}, 'time_aggregation': {'key': 'timeAggregation', 'type': 'str'}, @@ -162,11 +81,25 @@ class Condition(Model): 'resource_id_column': {'key': 'resourceIdColumn', 'type': 'str'}, 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, 'operator': {'key': 'operator', 'type': 'str'}, - 'threshold': {'key': 'threshold', 'type': 'int'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, 'failing_periods': {'key': 'failingPeriods', 'type': 'ConditionFailingPeriods'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, } - def __init__(self, *, time_aggregation, operator, threshold: int, query: str=None, metric_measure_column: str=None, resource_id_column: str=None, dimensions=None, failing_periods=None, **kwargs) -> None: + def __init__( + self, + *, + query: Optional[str] = None, + time_aggregation: Optional[Union[str, "TimeAggregation"]] = None, + metric_measure_column: Optional[str] = None, + resource_id_column: Optional[str] = None, + dimensions: Optional[List["Dimension"]] = None, + operator: Optional[Union[str, "ConditionOperator"]] = None, + threshold: Optional[float] = None, + failing_periods: Optional["ConditionFailingPeriods"] = None, + metric_name: Optional[str] = None, + **kwargs + ): super(Condition, self).__init__(**kwargs) self.query = query self.time_aggregation = time_aggregation @@ -176,46 +109,49 @@ def __init__(self, *, time_aggregation, operator, threshold: int, query: str=Non self.operator = operator self.threshold = threshold self.failing_periods = failing_periods + self.metric_name = metric_name -class ConditionFailingPeriods(Model): - """The minimum number of violations required within the selected lookback time - window required to raise an alert. +class ConditionFailingPeriods(msrest.serialization.Model): + """The minimum number of violations required within the selected lookback time window required to raise an alert. Relevant only for rules of the kind LogAlert. - :param number_of_evaluation_periods: The number of aggregated lookback - points. The lookback time window is calculated based on the aggregation - granularity (windowSize) and the selected number of aggregated points. - Default value is 1 - :type number_of_evaluation_periods: int - :param min_failing_periods_to_alert: The number of violations to trigger - an alert. Should be smaller or equal to numberOfEvaluationPeriods. Default - value is 1 - :type min_failing_periods_to_alert: int + :param number_of_evaluation_periods: The number of aggregated lookback points. The lookback + time window is calculated based on the aggregation granularity (windowSize) and the selected + number of aggregated points. Default value is 1. + :type number_of_evaluation_periods: long + :param min_failing_periods_to_alert: The number of violations to trigger an alert. Should be + smaller or equal to numberOfEvaluationPeriods. Default value is 1. + :type min_failing_periods_to_alert: long """ _attribute_map = { - 'number_of_evaluation_periods': {'key': 'numberOfEvaluationPeriods', 'type': 'int'}, - 'min_failing_periods_to_alert': {'key': 'minFailingPeriodsToAlert', 'type': 'int'}, + 'number_of_evaluation_periods': {'key': 'numberOfEvaluationPeriods', 'type': 'long'}, + 'min_failing_periods_to_alert': {'key': 'minFailingPeriodsToAlert', 'type': 'long'}, } - def __init__(self, *, number_of_evaluation_periods: int=None, min_failing_periods_to_alert: int=None, **kwargs) -> None: + def __init__( + self, + *, + number_of_evaluation_periods: Optional[int] = 1, + min_failing_periods_to_alert: Optional[int] = 1, + **kwargs + ): super(ConditionFailingPeriods, self).__init__(**kwargs) self.number_of_evaluation_periods = number_of_evaluation_periods self.min_failing_periods_to_alert = min_failing_periods_to_alert -class Dimension(Model): +class Dimension(msrest.serialization.Model): """Dimension splitting and filtering definition. All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the dimension + :param name: Required. Name of the dimension. :type name: str - :param operator: Required. Operator for dimension values. Possible values - include: 'Include', 'Exclude' - :type operator: str or - ~azure.mgmt.monitor.v2020_05_01_preview.models.DimensionOperator - :param values: Required. List of dimension values + :param operator: Required. Operator for dimension values. Possible values include: "Include", + "Exclude". + :type operator: str or ~$(python-base-namespace).v2021_02_preview.models.DimensionOperator + :param values: Required. List of dimension values. :type values: list[str] """ @@ -231,23 +167,29 @@ class Dimension(Model): 'values': {'key': 'values', 'type': '[str]'}, } - def __init__(self, *, name: str, operator, values, **kwargs) -> None: + def __init__( + self, + *, + name: str, + operator: Union[str, "DimensionOperator"], + values: List[str], + **kwargs + ): super(Dimension, self).__init__(**kwargs) self.name = name self.operator = operator self.values = values -class ErrorAdditionalInfo(Model): +class ErrorAdditionalInfo(msrest.serialization.Model): """The resource management error additional info. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: object + :vartype info: any """ _validation = { @@ -260,45 +202,40 @@ class ErrorAdditionalInfo(Model): 'info': {'key': 'info', 'type': 'object'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None -class ErrorContract(Model): +class ErrorContract(msrest.serialization.Model): """Describes the format of Error response. :param error: The error details. - :type error: ~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorResponse + :type error: ~$(python-base-namespace).v2021_02_preview.models.ErrorResponse """ _attribute_map = { 'error': {'key': 'error', 'type': 'ErrorResponse'}, } - def __init__(self, *, error=None, **kwargs) -> None: + def __init__( + self, + *, + error: Optional["ErrorResponse"] = None, + **kwargs + ): super(ErrorContract, self).__init__(**kwargs) self.error = error -class ErrorContractException(HttpOperationError): - """Server responsed with exception of type: 'ErrorContract'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - super(ErrorContractException, self).__init__(deserialize, response, 'ErrorContract', *args) - - -class ErrorResponse(Model): - """The resource management error response. - - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: The error code. :vartype code: str @@ -307,11 +244,10 @@ class ErrorResponse(Model): :ivar target: The error target. :vartype target: str :ivar details: The error details. - :vartype details: - list[~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorResponse] + :vartype details: list[~$(python-base-namespace).v2021_02_preview.models.ErrorResponse] :ivar additional_info: The error additional info. :vartype additional_info: - list[~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorAdditionalInfo] + list[~$(python-base-namespace).v2021_02_preview.models.ErrorAdditionalInfo] """ _validation = { @@ -330,7 +266,10 @@ class ErrorResponse(Model): 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ErrorResponse, self).__init__(**kwargs) self.code = None self.message = None @@ -339,20 +278,18 @@ def __init__(self, **kwargs) -> None: self.additional_info = None -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -368,47 +305,55 @@ class ProxyResource(Resource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: - super(ProxyResource, self).__init__(**kwargs) + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class ScheduledQueryRuleCriteria(Model): +class ScheduledQueryRuleCriteria(msrest.serialization.Model): """The rule criteria that defines the conditions of the scheduled query rule. - :param all_of: A list of conditions to evaluate against the specified - scopes - :type all_of: - list[~azure.mgmt.monitor.v2020_05_01_preview.models.Condition] + :param all_of: A list of conditions to evaluate against the specified scopes. + :type all_of: list[~$(python-base-namespace).v2021_02_preview.models.Condition] """ _attribute_map = { 'all_of': {'key': 'allOf', 'type': '[Condition]'}, } - def __init__(self, *, all_of=None, **kwargs) -> None: + def __init__( + self, + *, + all_of: Optional[List["Condition"]] = None, + **kwargs + ): super(ScheduledQueryRuleCriteria, self).__init__(**kwargs) self.all_of = all_of class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives + :param location: Required. The geo-location where the resource lives. :type location: str """ @@ -427,7 +372,13 @@ class TrackedResource(Resource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, *, location: str, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -436,56 +387,85 @@ def __init__(self, *, location: str, tags=None, **kwargs) -> None: class ScheduledQueryRuleResource(TrackedResource): """The scheduled query rule resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives + :param location: Required. The geo-location where the resource lives. :type location: str + :param kind: Indicates the type of scheduled query rule. The default is LogAlert. Possible + values include: "LogAlert", "LogToMetric". + :type kind: str or ~$(python-base-namespace).v2021_02_preview.models.Kind + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :ivar system_data: SystemData of ScheduledQueryRule. + :vartype system_data: ~$(python-base-namespace).v2021_02_preview.models.SystemData + :ivar created_with_api_version: The api-version used when creating this alert rule. + :vartype created_with_api_version: str + :ivar is_legacy_log_analytics_rule: True if alert rule is legacy Log Analytic rule. + :vartype is_legacy_log_analytics_rule: bool :param description: The description of the scheduled query rule. :type description: str - :param severity: Severity of the alert. Should be an integer between - [0-4]. Value of 0 is severest - :type severity: int - :param enabled: The flag which indicates whether this scheduled query rule - is enabled. Value should be true or false + :param display_name: The display name of the alert rule. + :type display_name: str + :param severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is + severest. Relevant and required only for rules of the kind LogAlert. Possible values include: + 0, 1, 2, 3, 4. + :type severity: str or ~$(python-base-namespace).v2021_02_preview.models.AlertSeverity + :param enabled: The flag which indicates whether this scheduled query rule is enabled. Value + should be true or false. :type enabled: bool - :param scopes: The list of resource id's that this scheduled query rule is - scoped to. + :param scopes: The list of resource id's that this scheduled query rule is scoped to. :type scopes: list[str] - :param evaluation_frequency: How often the scheduled query rule is - evaluated represented in ISO 8601 duration format. - :type evaluation_frequency: timedelta - :param window_size: The period of time (in ISO 8601 duration format) on - which the Alert query will be executed (bin size). - :type window_size: timedelta - :param target_resource_types: List of resource type of the target - resource(s) on which the alert is created/updated. For example if the - scope is a resource group and targetResourceTypes is - Microsoft.Compute/virtualMachines, then a different alert will be fired - for each virtual machine in the resource group which meet the alert - criteria + :param evaluation_frequency: How often the scheduled query rule is evaluated represented in ISO + 8601 duration format. Relevant and required only for rules of the kind LogAlert. + :type evaluation_frequency: ~datetime.timedelta + :param window_size: The period of time (in ISO 8601 duration format) on which the Alert query + will be executed (bin size). Relevant and required only for rules of the kind LogAlert. + :type window_size: ~datetime.timedelta + :param override_query_time_range: If specified then overrides the query time range (default is + WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + :type override_query_time_range: ~datetime.timedelta + :param target_resource_types: List of resource type of the target resource(s) on which the + alert is created/updated. For example if the scope is a resource group and targetResourceTypes + is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual + machine in the resource group which meet the alert criteria. Relevant only for rules of the + kind LogAlert. :type target_resource_types: list[str] - :param criteria: The rule criteria that defines the conditions of the - scheduled query rule. - :type criteria: - ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleCriteria - :param mute_actions_duration: Mute actions for the chosen period of time - (in ISO 8601 duration format) after the alert is fired. - :type mute_actions_duration: timedelta - :param actions: - :type actions: list[~azure.mgmt.monitor.v2020_05_01_preview.models.Action] + :param criteria: The rule criteria that defines the conditions of the scheduled query rule. + :type criteria: ~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleCriteria + :param mute_actions_duration: Mute actions for the chosen period of time (in ISO 8601 duration + format) after the alert is fired. Relevant only for rules of the kind LogAlert. + :type mute_actions_duration: ~datetime.timedelta + :param actions: Actions to invoke when the alert fires. + :type actions: ~$(python-base-namespace).v2021_02_preview.models.Actions + :ivar is_workspace_alerts_storage_configured: The flag which indicates whether this scheduled + query rule has been configured to be stored in the customer's storage. The default is false. + :vartype is_workspace_alerts_storage_configured: bool + :param check_workspace_alerts_storage_configured: The flag which indicates whether this + scheduled query rule should be stored in the customer's storage. The default is false. Relevant + only for rules of the kind LogAlert. + :type check_workspace_alerts_storage_configured: bool + :param skip_query_validation: The flag which indicates whether the provided query should be + validated or not. The default is false. Relevant only for rules of the kind LogAlert. + :type skip_query_validation: bool + :param auto_mitigate: The flag that indicates whether the alert should be automatically + resolved or not. The default is true. Relevant only for rules of the kind LogAlert. + :type auto_mitigate: bool """ _validation = { @@ -493,6 +473,11 @@ class ScheduledQueryRuleResource(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'created_with_api_version': {'readonly': True}, + 'is_legacy_log_analytics_rule': {'readonly': True}, + 'is_workspace_alerts_storage_configured': {'readonly': True}, } _attribute_map = { @@ -501,96 +486,273 @@ class ScheduledQueryRuleResource(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'created_with_api_version': {'key': 'properties.createdWithApiVersion', 'type': 'str'}, + 'is_legacy_log_analytics_rule': {'key': 'properties.isLegacyLogAnalyticsRule', 'type': 'bool'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'severity': {'key': 'properties.severity', 'type': 'int'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'override_query_time_range': {'key': 'properties.overrideQueryTimeRange', 'type': 'duration'}, 'target_resource_types': {'key': 'properties.targetResourceTypes', 'type': '[str]'}, 'criteria': {'key': 'properties.criteria', 'type': 'ScheduledQueryRuleCriteria'}, 'mute_actions_duration': {'key': 'properties.muteActionsDuration', 'type': 'duration'}, - 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + 'actions': {'key': 'properties.actions', 'type': 'Actions'}, + 'is_workspace_alerts_storage_configured': {'key': 'properties.isWorkspaceAlertsStorageConfigured', 'type': 'bool'}, + 'check_workspace_alerts_storage_configured': {'key': 'properties.checkWorkspaceAlertsStorageConfigured', 'type': 'bool'}, + 'skip_query_validation': {'key': 'properties.skipQueryValidation', 'type': 'bool'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, } - def __init__(self, *, location: str, tags=None, description: str=None, severity: int=None, enabled: bool=None, scopes=None, evaluation_frequency=None, window_size=None, target_resource_types=None, criteria=None, mute_actions_duration=None, actions=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + kind: Optional[Union[str, "Kind"]] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + severity: Optional[Union[int, "AlertSeverity"]] = None, + enabled: Optional[bool] = None, + scopes: Optional[List[str]] = None, + evaluation_frequency: Optional[datetime.timedelta] = None, + window_size: Optional[datetime.timedelta] = None, + override_query_time_range: Optional[datetime.timedelta] = None, + target_resource_types: Optional[List[str]] = None, + criteria: Optional["ScheduledQueryRuleCriteria"] = None, + mute_actions_duration: Optional[datetime.timedelta] = None, + actions: Optional["Actions"] = None, + check_workspace_alerts_storage_configured: Optional[bool] = None, + skip_query_validation: Optional[bool] = None, + auto_mitigate: Optional[bool] = None, + **kwargs + ): super(ScheduledQueryRuleResource, self).__init__(tags=tags, location=location, **kwargs) + self.kind = kind + self.etag = None + self.system_data = None + self.created_with_api_version = None + self.is_legacy_log_analytics_rule = None self.description = description + self.display_name = display_name self.severity = severity self.enabled = enabled self.scopes = scopes self.evaluation_frequency = evaluation_frequency self.window_size = window_size + self.override_query_time_range = override_query_time_range self.target_resource_types = target_resource_types self.criteria = criteria self.mute_actions_duration = mute_actions_duration self.actions = actions + self.is_workspace_alerts_storage_configured = None + self.check_workspace_alerts_storage_configured = check_workspace_alerts_storage_configured + self.skip_query_validation = skip_query_validation + self.auto_mitigate = auto_mitigate -class ScheduledQueryRuleResourcePatch(Model): +class ScheduledQueryRuleResourceCollection(msrest.serialization.Model): + """Represents a collection of scheduled query rule resources. + + :param value: The values for the scheduled query rule resources. + :type value: list[~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScheduledQueryRuleResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["ScheduledQueryRuleResource"]] = None, + **kwargs + ): + super(ScheduledQueryRuleResourceCollection, self).__init__(**kwargs) + self.value = value + + +class ScheduledQueryRuleResourcePatch(msrest.serialization.Model): """The scheduled query rule resource for patch operations. - :param tags: Resource tags + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :ivar created_with_api_version: The api-version used when creating this alert rule. + :vartype created_with_api_version: str + :ivar is_legacy_log_analytics_rule: True if alert rule is legacy Log Analytic rule. + :vartype is_legacy_log_analytics_rule: bool :param description: The description of the scheduled query rule. :type description: str - :param severity: Severity of the alert. Should be an integer between - [0-4]. Value of 0 is severest - :type severity: int - :param enabled: The flag which indicates whether this scheduled query rule - is enabled. Value should be true or false + :param display_name: The display name of the alert rule. + :type display_name: str + :param severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is + severest. Relevant and required only for rules of the kind LogAlert. Possible values include: + 0, 1, 2, 3, 4. + :type severity: str or ~$(python-base-namespace).v2021_02_preview.models.AlertSeverity + :param enabled: The flag which indicates whether this scheduled query rule is enabled. Value + should be true or false. :type enabled: bool - :param scopes: The list of resource id's that this scheduled query rule is - scoped to. + :param scopes: The list of resource id's that this scheduled query rule is scoped to. :type scopes: list[str] - :param evaluation_frequency: How often the scheduled query rule is - evaluated represented in ISO 8601 duration format. - :type evaluation_frequency: timedelta - :param window_size: The period of time (in ISO 8601 duration format) on - which the Alert query will be executed (bin size). - :type window_size: timedelta - :param target_resource_types: List of resource type of the target - resource(s) on which the alert is created/updated. For example if the - scope is a resource group and targetResourceTypes is - Microsoft.Compute/virtualMachines, then a different alert will be fired - for each virtual machine in the resource group which meet the alert - criteria + :param evaluation_frequency: How often the scheduled query rule is evaluated represented in ISO + 8601 duration format. Relevant and required only for rules of the kind LogAlert. + :type evaluation_frequency: ~datetime.timedelta + :param window_size: The period of time (in ISO 8601 duration format) on which the Alert query + will be executed (bin size). Relevant and required only for rules of the kind LogAlert. + :type window_size: ~datetime.timedelta + :param override_query_time_range: If specified then overrides the query time range (default is + WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + :type override_query_time_range: ~datetime.timedelta + :param target_resource_types: List of resource type of the target resource(s) on which the + alert is created/updated. For example if the scope is a resource group and targetResourceTypes + is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual + machine in the resource group which meet the alert criteria. Relevant only for rules of the + kind LogAlert. :type target_resource_types: list[str] - :param criteria: The rule criteria that defines the conditions of the - scheduled query rule. - :type criteria: - ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleCriteria - :param mute_actions_duration: Mute actions for the chosen period of time - (in ISO 8601 duration format) after the alert is fired. - :type mute_actions_duration: timedelta - :param actions: - :type actions: list[~azure.mgmt.monitor.v2020_05_01_preview.models.Action] + :param criteria: The rule criteria that defines the conditions of the scheduled query rule. + :type criteria: ~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleCriteria + :param mute_actions_duration: Mute actions for the chosen period of time (in ISO 8601 duration + format) after the alert is fired. Relevant only for rules of the kind LogAlert. + :type mute_actions_duration: ~datetime.timedelta + :param actions: Actions to invoke when the alert fires. + :type actions: ~$(python-base-namespace).v2021_02_preview.models.Actions + :ivar is_workspace_alerts_storage_configured: The flag which indicates whether this scheduled + query rule has been configured to be stored in the customer's storage. The default is false. + :vartype is_workspace_alerts_storage_configured: bool + :param check_workspace_alerts_storage_configured: The flag which indicates whether this + scheduled query rule should be stored in the customer's storage. The default is false. Relevant + only for rules of the kind LogAlert. + :type check_workspace_alerts_storage_configured: bool + :param skip_query_validation: The flag which indicates whether the provided query should be + validated or not. The default is false. Relevant only for rules of the kind LogAlert. + :type skip_query_validation: bool + :param auto_mitigate: The flag that indicates whether the alert should be automatically + resolved or not. The default is true. Relevant only for rules of the kind LogAlert. + :type auto_mitigate: bool """ + _validation = { + 'created_with_api_version': {'readonly': True}, + 'is_legacy_log_analytics_rule': {'readonly': True}, + 'is_workspace_alerts_storage_configured': {'readonly': True}, + } + _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, + 'created_with_api_version': {'key': 'properties.createdWithApiVersion', 'type': 'str'}, + 'is_legacy_log_analytics_rule': {'key': 'properties.isLegacyLogAnalyticsRule', 'type': 'bool'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'severity': {'key': 'properties.severity', 'type': 'int'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'override_query_time_range': {'key': 'properties.overrideQueryTimeRange', 'type': 'duration'}, 'target_resource_types': {'key': 'properties.targetResourceTypes', 'type': '[str]'}, 'criteria': {'key': 'properties.criteria', 'type': 'ScheduledQueryRuleCriteria'}, 'mute_actions_duration': {'key': 'properties.muteActionsDuration', 'type': 'duration'}, - 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + 'actions': {'key': 'properties.actions', 'type': 'Actions'}, + 'is_workspace_alerts_storage_configured': {'key': 'properties.isWorkspaceAlertsStorageConfigured', 'type': 'bool'}, + 'check_workspace_alerts_storage_configured': {'key': 'properties.checkWorkspaceAlertsStorageConfigured', 'type': 'bool'}, + 'skip_query_validation': {'key': 'properties.skipQueryValidation', 'type': 'bool'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, } - def __init__(self, *, tags=None, description: str=None, severity: int=None, enabled: bool=None, scopes=None, evaluation_frequency=None, window_size=None, target_resource_types=None, criteria=None, mute_actions_duration=None, actions=None, **kwargs) -> None: + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + severity: Optional[Union[int, "AlertSeverity"]] = None, + enabled: Optional[bool] = None, + scopes: Optional[List[str]] = None, + evaluation_frequency: Optional[datetime.timedelta] = None, + window_size: Optional[datetime.timedelta] = None, + override_query_time_range: Optional[datetime.timedelta] = None, + target_resource_types: Optional[List[str]] = None, + criteria: Optional["ScheduledQueryRuleCriteria"] = None, + mute_actions_duration: Optional[datetime.timedelta] = None, + actions: Optional["Actions"] = None, + check_workspace_alerts_storage_configured: Optional[bool] = None, + skip_query_validation: Optional[bool] = None, + auto_mitigate: Optional[bool] = None, + **kwargs + ): super(ScheduledQueryRuleResourcePatch, self).__init__(**kwargs) self.tags = tags + self.created_with_api_version = None + self.is_legacy_log_analytics_rule = None self.description = description + self.display_name = display_name self.severity = severity self.enabled = enabled self.scopes = scopes self.evaluation_frequency = evaluation_frequency self.window_size = window_size + self.override_query_time_range = override_query_time_range self.target_resource_types = target_resource_types self.criteria = criteria self.mute_actions_duration = mute_actions_duration self.actions = actions + self.is_workspace_alerts_storage_configured = None + self.check_workspace_alerts_storage_configured = check_workspace_alerts_storage_configured + self.skip_query_validation = skip_query_validation + self.auto_mitigate = auto_mitigate + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~$(python-base-namespace).v2021_02_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or + ~$(python-base-namespace).v2021_02_preview.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_monitor_client_enums.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_monitor_client_enums.py deleted file mode 100644 index 93fa54eb85..0000000000 --- a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_monitor_client_enums.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum - - -class TimeAggregation(str, Enum): - - count = "Count" - average = "Average" - minimum = "Minimum" - maximum = "Maximum" - total = "Total" - - -class DimensionOperator(str, Enum): - - include = "Include" - exclude = "Exclude" - - -class ConditionOperator(str, Enum): - - equals = "Equals" - greater_than = "GreaterThan" - greater_than_or_equal = "GreaterThanOrEqual" - less_than = "LessThan" - less_than_or_equal = "LessThanOrEqual" diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_monitor_management_client_enums.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_monitor_management_client_enums.py new file mode 100644 index 0000000000..89555e1c18 --- /dev/null +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_monitor_management_client_enums.py @@ -0,0 +1,81 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, int, Enum)): + """Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and + required only for rules of the kind LogAlert. + """ + + ZERO = 0 + ONE = 1 + TWO = 2 + THREE = 3 + FOUR = 4 + +class ConditionOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The criteria operator. Relevant and required only for rules of the kind LogAlert. + """ + + EQUALS = "Equals" + GREATER_THAN = "GreaterThan" + GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" + LESS_THAN = "LessThan" + LESS_THAN_OR_EQUAL = "LessThanOrEqual" + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class DimensionOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Operator for dimension values + """ + + INCLUDE = "Include" + EXCLUDE = "Exclude" + +class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Indicates the type of scheduled query rule. The default is LogAlert. + """ + + LOG_ALERT = "LogAlert" + LOG_TO_METRIC = "LogToMetric" + +class TimeAggregation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Aggregation type. Relevant and required only for rules of the kind LogAlert. + """ + + COUNT = "Count" + AVERAGE = "Average" + MINIMUM = "Minimum" + MAXIMUM = "Maximum" + TOTAL = "Total" diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_paged_models.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_paged_models.py deleted file mode 100644 index f84d254075..0000000000 --- a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_paged_models.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class ScheduledQueryRuleResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`ScheduledQueryRuleResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ScheduledQueryRuleResource]'} - } - - def __init__(self, *args, **kwargs): - - super(ScheduledQueryRuleResourcePaged, self).__init__(*args, **kwargs) diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/operations/__init__.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/operations/__init__.py index c8cedc13e4..f677702ed3 100644 --- a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/operations/__init__.py +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/operations/__init__.py @@ -1,12 +1,9 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._scheduled_query_rules_operations import ScheduledQueryRulesOperations diff --git a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/operations/_scheduled_query_rules_operations.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/operations/_scheduled_query_rules_operations.py index 448838fbdc..00f969c1da 100644 --- a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/operations/_scheduled_query_rules_operations.py +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/operations/_scheduled_query_rules_operations.py @@ -1,423 +1,443 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ScheduledQueryRulesOperations(object): """ScheduledQueryRulesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2021_02_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-05-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-05-01-preview" - - self.config = config + self._config = config def list_by_subscription( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ScheduledQueryRuleResourceCollection"] """Retrieve a scheduled query rule definitions in a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ScheduledQueryRuleResource - :rtype: - ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResourcePaged[~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResource] - :raises: - :class:`ErrorContractException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScheduledQueryRuleResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_subscription.metadata['url'] + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ScheduledQueryRuleResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ErrorContractException(self._deserialize, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ScheduledQueryRuleResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules'} + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ScheduledQueryRuleResourceCollection"] """Retrieve scheduled query rule definitions in a resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ScheduledQueryRuleResource - :rtype: - ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResourcePaged[~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResource] - :raises: - :class:`ErrorContractException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScheduledQueryRuleResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ScheduledQueryRuleResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ErrorContractException(self._deserialize, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ScheduledQueryRuleResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore def get( - self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ScheduledQueryRuleResource" """Retrieve an scheduled query rule definition. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param rule_name: The name of the rule. :type rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ScheduledQueryRuleResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorContractException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScheduledQueryRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ScheduledQueryRuleResource', response) + deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore def create_or_update( - self, resource_group_name, rule_name, parameters, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + rule_name, # type: str + parameters, # type: "_models.ScheduledQueryRuleResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ScheduledQueryRuleResource" """Creates or updates a scheduled query rule. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param rule_name: The name of the rule. :type rule_name: str :param parameters: The parameters of the rule to create or update. - :type parameters: - ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ScheduledQueryRuleResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorContractException` + :type parameters: ~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScheduledQueryRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['url'] + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'ScheduledQueryRuleResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScheduledQueryRuleResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ScheduledQueryRuleResource', response) + deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('ScheduledQueryRuleResource', response) + deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore def update( - self, resource_group_name, rule_name, parameters, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + rule_name, # type: str + parameters, # type: "_models.ScheduledQueryRuleResourcePatch" + **kwargs # type: Any + ): + # type: (...) -> "_models.ScheduledQueryRuleResource" """Update a scheduled query rule. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param rule_name: The name of the rule. :type rule_name: str :param parameters: The parameters of the rule to update. - :type parameters: - ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResourcePatch - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ScheduledQueryRuleResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.monitor.v2020_05_01_preview.models.ScheduledQueryRuleResource - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorContractException` + :type parameters: ~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleResourcePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScheduledQueryRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_02_preview.models.ScheduledQueryRuleResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScheduledQueryRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'ScheduledQueryRuleResourcePatch') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScheduledQueryRuleResourcePatch') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ScheduledQueryRuleResource', response) + deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore def delete( - self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes a scheduled query rule. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param rule_name: The name of the rule. :type rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorContractException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore diff --git a/src/scheduled-query/setup.py b/src/scheduled-query/setup.py index b8ff2e55dd..d2a0e6f04d 100644 --- a/src/scheduled-query/setup.py +++ b/src/scheduled-query/setup.py @@ -16,7 +16,7 @@ # TODO: Confirm this is the right version number you want and it matches your # HISTORY.rst entry. -VERSION = '0.3.1' +VERSION = '0.4.0' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers