diff --git a/src/scheduled-query/HISTORY.rst b/src/scheduled-query/HISTORY.rst index 57fc16e0718..caadcc38744 100644 --- a/src/scheduled-query/HISTORY.rst +++ b/src/scheduled-query/HISTORY.rst @@ -2,13 +2,10 @@ Release History =============== -0.3.0 +0.3.1 ++++++ * Support query placeholder for `--condition` parameter. * Add `--condition-query` parameter to support query placeholder. -* Add `--skip-query-validation` parameter -* Add `--check-ws-alerts-storage` parameter -* [Breaking Change] the default value of `--mute-actions-duration` is changed to None, as alert `--auto-mitigate` is supported 0.2.2 ++++++ diff --git a/src/scheduled-query/azext_scheduled_query/_client_factory.py b/src/scheduled-query/azext_scheduled_query/_client_factory.py index 9063ba9edc9..736646ac843 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_management_client import MonitorManagementClient - return get_mgmt_service_client(cli_ctx, MonitorManagementClient).scheduled_query_rules + from .vendored_sdks.azure_mgmt_scheduled_query._monitor_client import MonitorClient + return get_mgmt_service_client(cli_ctx, MonitorClient).scheduled_query_rules diff --git a/src/scheduled-query/azext_scheduled_query/_params.py b/src/scheduled-query/azext_scheduled_query/_params.py index 3d091a1ff3b..6ac9b1c3d79 100644 --- a/src/scheduled-query/azext_scheduled_query/_params.py +++ b/src/scheduled-query/azext_scheduled_query/_params.py @@ -4,7 +4,7 @@ # -------------------------------------------------------------------------------------------- # pylint: disable=line-too-long -from azure.cli.core.commands.parameters import tags_type, get_three_state_flag, get_enum_type +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 knack.arguments import CLIArgumentType @@ -23,7 +23,6 @@ def load_arguments(self, _): c.argument('severity', type=int, help='Severity of the alert from 0 (critical) to 4 (verbose).') c.argument('window_size', type=get_period_type(), help='Time over which to aggregate metrics in "##h##m##s" format.') c.argument('evaluation_frequency', type=get_period_type(), help='Frequency with which to evaluate the rule in "##h##m##s" format.') - c.argument('display_name', help='The display name of the alert rule') c.argument('condition', options_list=['--condition'], action=ScheduleQueryConditionAction, nargs='+') c.argument('condition_query', options_list=['--condition-query'], nargs='+', action=ScheduleQueryConditionQueryAction, help='Query deteils to replace the placeholders in `--condition` argument.') c.argument('description', help='Free-text description of the rule.') @@ -37,6 +36,3 @@ def load_arguments(self, _): 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('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/custom.py b/src/scheduled-query/azext_scheduled_query/custom.py index 6957d12401e..105eaaa40a1 100644 --- a/src/scheduled-query/azext_scheduled_query/custom.py +++ b/src/scheduled-query/azext_scheduled_query/custom.py @@ -26,14 +26,12 @@ def _build_criteria(condition, condition_query): def create_scheduled_query(client, resource_group_name, rule_name, scopes, condition, condition_query=None, - disabled=False, description=None, tags=None, location=None, display_name=None, - auto_mitigate=True, skip_query_validation=False, check_workspace_alerts_storage=False, + 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=None): + target_resource_type=None, mute_actions_duration='PT30M'): from .vendored_sdks.azure_mgmt_scheduled_query.models import ScheduledQueryRuleResource criteria = _build_criteria(condition, condition_query) kwargs = { - 'display_name': display_name, 'description': description, 'severity': severity, 'enabled': not disabled, @@ -45,10 +43,7 @@ def create_scheduled_query(client, resource_group_name, rule_name, scopes, condi 'actions': actions, 'tags': tags, 'location': location, - 'mute_actions_duration': mute_actions_duration, - 'check_workspace_alerts_storage_configured': check_workspace_alerts_storage, - 'skip_query_validation': skip_query_validation, - 'auto_mitigate': auto_mitigate, + 'mute_actions_duration': mute_actions_duration } return client.create_or_update(resource_group_name, rule_name, ScheduledQueryRuleResource(**kwargs)) @@ -59,19 +54,12 @@ def list_scheduled_query(client, resource_group_name=None): return client.list_by_subscription() -def update_scheduled_query(cmd, instance, tags=None, disabled=None, condition=None, condition_query=None, - description=None, actions=None, severity=None, window_size=None, display_name=None, - auto_mitigate=None, evaluation_frequency=None, mute_actions_duration=None, - skip_query_validation=None, check_workspace_alerts_storage=None): +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): with cmd.update_context(instance) as c: c.set_param('tags', tags) - c.set_param('display_name', display_name) - if disabled is not None: - c.set_param('enabled', not disabled) - if auto_mitigate is not None: - 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) + c.set_param('enabled', not disabled) c.set_param('description', description) c.set_param('actions', actions) c.set_param('severity', severity) 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 0aeea247cd8..d4dd10b823f 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 @@ -11,14 +11,14 @@ interactions: Connection: - keep-alive ParameterSetName: - - -n -g --image --admin-username --generate-ssh-keys + - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.25.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001?api-version=2020-10-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-05-31T07:15:05Z"},"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-06-22T12:23:28Z"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache @@ -27,7 +27,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:15:21 GMT + - Tue, 22 Jun 2021 12:23:32 GMT expires: - '-1' pragma: @@ -106,13 +106,13 @@ interactions: content-type: - text/plain; charset=utf-8 date: - - Mon, 31 May 2021 07:15:21 GMT + - Tue, 22 Jun 2021 12:23:33 GMT etag: - W/"540044b4084c3c314537f1baa1770f248628b2bc9ba0328f1004c33862e049da" expires: - - Mon, 31 May 2021 07:20:21 GMT + - Tue, 22 Jun 2021 12:28:33 GMT source-age: - - '78' + - '31' strict-transport-security: - max-age=31536000 vary: @@ -126,15 +126,15 @@ interactions: x-content-type-options: - nosniff x-fastly-request-id: - - 3988df4b57a6a19c38be4d70d0f19d636f1dddad + - 4030a858348c937d58268cde3d0fdcfc1c57974b x-frame-options: - deny x-github-request-id: - - 364C:7761:41B2CB:4E68E1:60B4418E + - B4A2:34FC:2EE16:54047:60D16694 x-served-by: - - cache-qpg1254-QPG + - cache-qpg1282-QPG x-timer: - - S1622445322.722691,VS0,VE1 + - S1624364613.024995,VS0,VE1 x-xss-protection: - 1; mode=block status: @@ -152,9 +152,9 @@ interactions: Connection: - keep-alive ParameterSetName: - - -n -g --image --admin-username --generate-ssh-keys + - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-network/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.25.0 azsdk-python-azure-mgmt-network/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-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: @@ -168,7 +168,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:15:21 GMT + - Tue, 22 Jun 2021 12:23:33 GMT expires: - '-1' pragma: @@ -182,40 +182,799 @@ interactions: status: code: 200 message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --nsg-rule --workspace --generate-ssh-keys + User-Agent: + - AZURECLI/2.25.0 azsdk-python-mgmt-loganalytics/8.0.0 Python/3.8.10 (Windows-10-10.0.19043-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-08-01 + response: + body: + string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.OperationalInsights/workspaces/clitest000002'' + under resource group ''cli_test_scheduled_query000001'' was not found. For + more details please go to https://aka.ms/ARMResourceNotFoundFix"}}' + headers: + cache-control: + - no-cache + content-length: + - '308' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 22 Jun 2021 12:23:34 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-failure-cause: + - gateway + status: + code: 404 + message: Not Found +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --nsg-rule --workspace --generate-ssh-keys + User-Agent: + - AZURECLI/2.25.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001?api-version=2020-10-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-06-22T12:23:28Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '428' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 22 Jun 2021 12:23:35 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": {"sku": {"name": "PerGB2018"}, "retentionInDays": + 30, "publicNetworkAccessForIngestion": "Enabled", "publicNetworkAccessForQuery": + "Enabled"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + Content-Length: + - '179' + Content-Type: + - application/json + ParameterSetName: + - -n -g --image --nsg-rule --workspace --generate-ssh-keys + User-Agent: + - AZURECLI/2.25.0 azsdk-python-mgmt-loganalytics/8.0.0 Python/3.8.10 (Windows-10-10.0.19043-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-08-01 + response: + body: + string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\": + \"35ba1cf4-f518-439d-9ee8-dc9382fdabbb\",\r\n \"provisioningState\": \"Creating\",\r\n + \ \"sku\": {\r\n \"name\": \"pergb2018\",\r\n \"lastSkuUpdate\": + \"Tue, 22 Jun 2021 12:23:40 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\": + \"Wed, 23 Jun 2021 02:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n + \ },\r\n \"publicNetworkAccessForIngestion\": \"Enabled\",\r\n \"publicNetworkAccessForQuery\": + \"Enabled\",\r\n \"createdDate\": \"Tue, 22 Jun 2021 12:23:40 GMT\",\r\n + \ \"modifiedDate\": \"Tue, 22 Jun 2021 12:23: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}" + headers: + cache-control: + - no-cache + content-length: + - '1133' + content-type: + - application/json + date: + - Tue, 22 Jun 2021 12:23:41 GMT + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 201 + message: Created +- 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.25.0 azsdk-python-mgmt-loganalytics/8.0.0 Python/3.8.10 (Windows-10-10.0.19043-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-08-01 + response: + body: + string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\": + \"35ba1cf4-f518-439d-9ee8-dc9382fdabbb\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"sku\": {\r\n \"name\": \"pergb2018\",\r\n \"lastSkuUpdate\": + \"Tue, 22 Jun 2021 12:23:40 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\": + \"Wed, 23 Jun 2021 02:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n + \ },\r\n \"publicNetworkAccessForIngestion\": \"Enabled\",\r\n \"publicNetworkAccessForQuery\": + \"Enabled\",\r\n \"createdDate\": \"Tue, 22 Jun 2021 12:23:40 GMT\",\r\n + \ \"modifiedDate\": \"Tue, 22 Jun 2021 12:23: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}" + headers: + cache-control: + - no-cache + content-length: + - '1134' + content-type: + - application/json + date: + - Tue, 22 Jun 2021 12:24:12 GMT + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK - request: body: '{"properties": {"template": {"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", "parameters": {}, "variables": {}, "resources": + "contentVersion": "1.0.0.0", "parameters": {"workspaceId": {"type": "securestring", + "metadata": {"description": "Secure workspaceId"}}}, "variables": {}, "resources": [{"name": "myvm1VNET", "type": "Microsoft.Network/virtualNetworks", "location": "eastus", "apiVersion": "2015-06-15", "dependsOn": [], "tags": {}, "properties": {"addressSpace": {"addressPrefixes": ["10.0.0.0/16"]}, "subnets": [{"name": "myvm1Subnet", "properties": {"addressPrefix": "10.0.0.0/24"}}]}}, {"type": "Microsoft.Network/networkSecurityGroups", "name": "myvm1NSG", "apiVersion": - "2015-06-15", "location": "eastus", "tags": {}, "dependsOn": [], "properties": - {"securityRules": [{"name": "default-allow-ssh", "properties": {"protocol": - "Tcp", "sourcePortRange": "*", "destinationPortRange": "22", "sourceAddressPrefix": - "*", "destinationAddressPrefix": "*", "access": "Allow", "priority": 1000, "direction": - "Inbound"}}]}}, {"apiVersion": "2018-01-01", "type": "Microsoft.Network/publicIPAddresses", - "name": "myvm1PublicIP", "location": "eastus", "tags": {}, "dependsOn": [], - "properties": {"publicIPAllocationMethod": null}}, {"apiVersion": "2015-06-15", - "type": "Microsoft.Network/networkInterfaces", "name": "myvm1VMNic", "location": - "eastus", "tags": {}, "dependsOn": ["Microsoft.Network/virtualNetworks/myvm1VNET", + "2015-06-15", "location": "eastus", "tags": {}, "dependsOn": []}, {"apiVersion": + "2018-01-01", "type": "Microsoft.Network/publicIPAddresses", "name": "myvm1PublicIP", + "location": "eastus", "tags": {}, "dependsOn": [], "properties": {"publicIPAllocationMethod": + null}}, {"apiVersion": "2015-06-15", "type": "Microsoft.Network/networkInterfaces", + "name": "myvm1VMNic", "location": "eastus", "tags": {}, "dependsOn": ["Microsoft.Network/virtualNetworks/myvm1VNET", "Microsoft.Network/networkSecurityGroups/myvm1NSG", "Microsoft.Network/publicIpAddresses/myvm1PublicIP"], "properties": {"ipConfigurations": [{"name": "ipconfigmyvm1", "properties": {"privateIPAllocationMethod": "Dynamic", "subnet": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/virtualNetworks/myvm1VNET/subnets/myvm1Subnet"}, "publicIPAddress": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/publicIPAddresses/myvm1PublicIP"}}}], "networkSecurityGroup": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkSecurityGroups/myvm1NSG"}}}, + {"type": "Microsoft.Compute/virtualMachines/extensions", "apiVersion": "2018-10-01", + "properties": {"publisher": "Microsoft.EnterpriseCloud.Monitoring", "type": + "OmsAgentForLinux", "typeHandlerVersion": "1.0", "autoUpgradeMinorVersion": + "true", "settings": {"workspaceId": "[reference(parameters(''workspaceId''), + ''2015-11-01-preview'').customerId]", "stopOnMultipleConnections": "true"}, + "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": "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"}]}, - "storageProfile": {"osDisk": {"createOption": "fromImage", "name": null, "caching": - "ReadWrite", "managedDisk": {"storageAccountType": null}}, "imageReference": - {"publisher": "Canonical", "offer": "UbuntuServer", "sku": "18.04-LTS", "version": - "latest"}}, "osProfile": {"computerName": "myvm1", "adminUsername": "clitest000002", - "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/clitest000002/.ssh/authorized_keys"}]}}}}}], - "outputs": {}}, "parameters": {}, "mode": "incremental"}}' + {"networkInterfaces": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/networkInterfaces/myvm1VMNic", + "properties": {"deleteOption": null}}]}, "storageProfile": {"osDisk": {"createOption": + "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 AAAAB3NzaC1yc2EAAAADAQABAAABgQC/+4SveJW8Wn+vIMzgKgDIauOhF2XRwqR4RJSrjQX8qodZntJ49dQSuaPT0AweyDVPS9TPXCXeGZMN+H+Y54Xj0Mgriau+Y4jPi2mUMKW0R93T5/Y1285JdE1YuXtnv27Xgc1g1lIfHJ5luWOi3sfC47j3AZvhE1NE69alemjIcQCIWlU0SyoZM1K+5hO3mBmZhR4BwuMJO9ruWITXx1t1GAvJgu+xtJNcVXW1ryTt6PvYk1OU5pNyIyNEFxD1Hhw8qOJ/R/jNcZ9wcjnykSqOI/NzNczz3GG2tLdu8gWEBZrpXy4vu9FoSamu3k+ADE6ArH06RM40FaSCNSegivEI4Y6HAjy3svPEU6Y+WvuGUfr0Lphefi7tFHZaEW08U0e6ERmwpFLtfMRWfdhn30ZRtiFDF/Gi4psXuTNPQrGyqc+KgmwCxEIVue8a3TAAVTaoK1JZXA/08IcUGNdhl6INAfHxXbaS15ptTXkqhO3rVL2ambJt8GxU3UTTymq3P20= + 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"}}, + "mode": "incremental"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + Content-Length: + - '4593' + Content-Type: + - application/json + ParameterSetName: + - -n -g --image --nsg-rule --workspace --generate-ssh-keys + User-Agent: + - AZURECLI/2.25.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-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=2020-10-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/vm_deploy_dl5eDTjXsAqdigGu5xqwYnWNh6EfH5nT","name":"vm_deploy_dl5eDTjXsAqdigGu5xqwYnWNh6EfH5nT","type":"Microsoft.Resources/deployments","properties":{"templateHash":"2425683351354235518","parameters":{"workspaceId":{"type":"SecureString"}},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2021-06-22T12:24:19.3172755Z","duration":"PT3.3838123S","correlationId":"290921a9-e8e4-4ba2-8629-13a4b3490599","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_dl5eDTjXsAqdigGu5xqwYnWNh6EfH5nT/operationStatuses/08585772422295441888?api-version=2020-10-01 + cache-control: + - no-cache + content-length: + - '4226' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 22 Jun 2021 12:24:20 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- 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.25.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-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/08585772422295441888?api-version=2020-10-01 + response: + body: + string: '{"status":"Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 22 Jun 2021 12:24:51 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.25.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-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/08585772422295441888?api-version=2020-10-01 + response: + body: + string: '{"status":"Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 22 Jun 2021 12:25:21 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.25.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-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/08585772422295441888?api-version=2020-10-01 + response: + body: + string: '{"status":"Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 22 Jun 2021 12:25:53 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.25.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-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/08585772422295441888?api-version=2020-10-01 + response: + body: + string: '{"status":"Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 22 Jun 2021 12:26:24 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.25.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-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/08585772422295441888?api-version=2020-10-01 + response: + body: + string: '{"status":"Succeeded"}' + headers: + cache-control: + - no-cache + content-length: + - '22' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 22 Jun 2021 12:26:54 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.25.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-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=2020-10-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/vm_deploy_dl5eDTjXsAqdigGu5xqwYnWNh6EfH5nT","name":"vm_deploy_dl5eDTjXsAqdigGu5xqwYnWNh6EfH5nT","type":"Microsoft.Resources/deployments","properties":{"templateHash":"2425683351354235518","parameters":{"workspaceId":{"type":"SecureString"}},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2021-06-22T12:26:46.9011249Z","duration":"PT2M30.9676617S","correlationId":"290921a9-e8e4-4ba2-8629-13a4b3490599","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: + - '5533' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 22 Jun 2021 12:26:55 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: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --nsg-rule --workspace --generate-ssh-keys + User-Agent: + - AZURECLI/2.25.0 azsdk-python-azure-mgmt-compute/21.0.0 Python/3.8.10 (Windows-10-10.0.19043-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\": \"02fb914c-ccce-41e3-9775-5b08c3e03cab\",\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.202106040\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": + \"Linux\",\r\n \"name\": \"myvm1_OsDisk_1_c63982fccf394540bcff719448dd5d09\",\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_OsDisk_1_c63982fccf394540bcff719448dd5d09\"\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 + \ \"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 AAAAB3NzaC1yc2EAAAADAQABAAABgQC/+4SveJW8Wn+vIMzgKgDIauOhF2XRwqR4RJSrjQX8qodZntJ49dQSuaPT0AweyDVPS9TPXCXeGZMN+H+Y54Xj0Mgriau+Y4jPi2mUMKW0R93T5/Y1285JdE1YuXtnv27Xgc1g1lIfHJ5luWOi3sfC47j3AZvhE1NE69alemjIcQCIWlU0SyoZM1K+5hO3mBmZhR4BwuMJO9ruWITXx1t1GAvJgu+xtJNcVXW1ryTt6PvYk1OU5pNyIyNEFxD1Hhw8qOJ/R/jNcZ9wcjnykSqOI/NzNczz3GG2tLdu8gWEBZrpXy4vu9FoSamu3k+ADE6ArH06RM40FaSCNSegivEI4Y6HAjy3svPEU6Y+WvuGUfr0Lphefi7tFHZaEW08U0e6ERmwpFLtfMRWfdhn30ZRtiFDF/Gi4psXuTNPQrGyqc+KgmwCxEIVue8a3TAAVTaoK1JZXA/08IcUGNdhl6INAfHxXbaS15ptTXkqhO3rVL2ambJt8GxU3UTTymq3P20= + 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 + \ \"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.0.2\",\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-06-22T12:26:44+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_OsDisk_1_c63982fccf394540bcff719448dd5d09\",\r\n + \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n + \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning + succeeded\",\r\n \"time\": \"2021-06-22T12:25:11.8400599+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\": + \"1.13.35\",\r\n \"statuses\": [\r\n {\r\n \"code\": + \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n + \ \"displayStatus\": \"Provisioning succeeded\",\r\n \"message\": + \"Enable succeeded\"\r\n }\r\n ]\r\n }\r\n ],\r\n + \ \"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-06-22T12:26:45.1682789+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\": + \"OmsAgentForLinux\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1/extensions/OmsAgentForLinux\",\r\n + \ \"type\": \"Microsoft.Compute/virtualMachines/extensions\",\r\n \"location\": + \"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\":\"35ba1cf4-f518-439d-9ee8-dc9382fdabbb\",\"stopOnMultipleConnections\":\"true\"}\r\n + \ }\r\n }\r\n ]\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '5722' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 22 Jun 2021 12:26:56 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/LowCostGet3Min;3991,Microsoft.Compute/LowCostGet30Min;31986 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --nsg-rule --workspace --generate-ssh-keys + User-Agent: + - AZURECLI/2.25.0 azsdk-python-azure-mgmt-network/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-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/\\\"54dc4102-b1de-416e-aba0-ed866a170a85\\\"\",\r\n \"location\": + \"eastus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": + \"Succeeded\",\r\n \"resourceGuid\": \"04de21a8-c23e-4667-80d3-a0d242db536e\",\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/\\\"54dc4102-b1de-416e-aba0-ed866a170a85\\\"\",\r\n + \ \"type\": \"Microsoft.Network/networkInterfaces/ipConfigurations\",\r\n + \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\": + \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/publicIPAddresses/myvm1PublicIP\"\r\n + \ },\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/virtualNetworks/myvm1VNET/subnets/myvm1Subnet\"\r\n + \ },\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\": + \"tdflqwqukrqefob1z444paacmd.bx.internal.cloudapp.net\"\r\n },\r\n \"macAddress\": + \"00-0D-3A-9B-84-A4\",\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\": + \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1\"\r\n + \ }\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '2588' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 22 Jun 2021 12:26:57 GMT + etag: + - W/"54dc4102-b1de-416e-aba0-ed866a170a85" + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-arm-service-request-id: + - 83677822-ae1a-40bb-b3eb-1c0f8d7f2ece + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --nsg-rule --workspace --generate-ssh-keys + User-Agent: + - AZURECLI/2.25.0 azsdk-python-azure-mgmt-network/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-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/\\\"2872af45-b116-4a83-82d7-a71719dac4cc\\\"\",\r\n \"location\": + \"eastus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": + \"Succeeded\",\r\n \"resourceGuid\": \"79a1adab-f126-4ab7-a97c-2d989436dcf1\",\r\n + \ \"ipAddress\": \"40.121.109.44\",\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 + \ \"sku\": {\r\n \"name\": \"Basic\"\r\n }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '1005' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 22 Jun 2021 12:26:58 GMT + etag: + - W/"2872af45-b116-4a83-82d7-a71719dac4cc" + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-arm-service-request-id: + - eb699540-a7a2-4541-8396-be13f0917c88 + status: + code: 200 + message: OK +- request: + body: '{"properties": {"state": "Enabled"}, "kind": "LinuxPerformanceCollection"}' headers: Accept: - application/json @@ -226,170 +985,229 @@ interactions: Connection: - keep-alive Content-Length: - - '3909' + - '74' Content-Type: - application/json ParameterSetName: - - -n -g --image --admin-username --generate-ssh-keys + - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.25.0 azsdk-python-mgmt-loganalytics/8.0.0 Python/3.8.10 (Windows-10-10.0.19043-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=2020-10-01 + 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: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/vm_deploy_e5CrJHr9gvsCUqV265EIUHSdWtgXBgob","name":"vm_deploy_e5CrJHr9gvsCUqV265EIUHSdWtgXBgob","type":"Microsoft.Resources/deployments","properties":{"templateHash":"2144961586233669823","parameters":{},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2021-05-31T07:15:27.6592981Z","duration":"PT2.9322305S","correlationId":"3661e5bb-6c6f-4548-ad03-8602c3bd7f1b","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","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.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: '{"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-06-22T12%3A26%3A59.2405092Z''\"","name":"DataSource_LinuxPerformanceCollection_88888888-0000-0000-0000-000000000001","type":"Microsoft.OperationalInsights/workspaces/datasources"}' headers: - azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/vm_deploy_e5CrJHr9gvsCUqV265EIUHSdWtgXBgob/operationStatuses/08585791615607505574?api-version=2020-10-01 cache-control: - no-cache content-length: - - '2766' + - '583' content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:15:28 GMT + - Tue, 22 Jun 2021 12:26:59 GMT expires: - '-1' pragma: - no-cache + server: + - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - '1199' + x-powered-by: + - ASP.NET status: - code: 201 - message: Created + code: 200 + message: OK - request: - body: null + body: '{"properties": {"instanceName": "*", "intervalSeconds": 10, "objectName": + "Memory", "performanceCounters": [{"counterName": "Available MBytes Memory"}, + {"counterName": "% Used Memory"}, {"counterName": "% Used Swap Space"}]}, "kind": + "LinuxPerformanceObject"}' headers: Accept: - - '*/*' + - application/json Accept-Encoding: - gzip, deflate CommandName: - vm create Connection: - keep-alive + Content-Length: + - '259' + Content-Type: + - application/json ParameterSetName: - - -n -g --image --admin-username --generate-ssh-keys + - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-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/08585791615607505574?api-version=2020-10-01 + - AZURECLI/2.25.0 azsdk-python-mgmt-loganalytics/8.0.0 Python/3.8.10 (Windows-10-10.0.19043-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: '{"status":"Running"}' + 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-06-22T12%3A26%3A59.9539568Z''\"","name":"DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000002","type":"Microsoft.OperationalInsights/workspaces/datasources"}' headers: cache-control: - no-cache content-length: - - '20' + - '749' content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:15:58 GMT + - Tue, 22 Jun 2021 12:26:59 GMT expires: - '-1' pragma: - no-cache + server: + - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked vary: - Accept-Encoding x-content-type-options: - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET status: code: 200 message: OK - request: - body: null + body: '{"properties": {"instanceName": "*", "intervalSeconds": 10, "objectName": + "Processor", "performanceCounters": [{"counterName": "% Processor Time"}, {"counterName": + "% Privileged Time"}]}, "kind": "LinuxPerformanceObject"}' headers: Accept: - - '*/*' + - application/json Accept-Encoding: - gzip, deflate CommandName: - vm create Connection: - keep-alive + Content-Length: + - '221' + Content-Type: + - application/json ParameterSetName: - - -n -g --image --admin-username --generate-ssh-keys + - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-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/08585791615607505574?api-version=2020-10-01 + - AZURECLI/2.25.0 azsdk-python-mgmt-loganalytics/8.0.0 Python/3.8.10 (Windows-10-10.0.19043-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: '{"status":"Succeeded"}' + 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-06-22T12%3A27%3A00.6418054Z''\"","name":"DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000003","type":"Microsoft.OperationalInsights/workspaces/datasources"}' headers: cache-control: - no-cache content-length: - - '22' + - '713' content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:16:30 GMT + - Tue, 22 Jun 2021 12:27:00 GMT expires: - '-1' pragma: - no-cache + server: + - Microsoft-IIS/10.0 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-powered-by: + - ASP.NET status: code: 200 message: OK - request: - body: null + body: '{"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"}]}, "kind": + "LinuxPerformanceObject"}' headers: Accept: - - '*/*' + - application/json Accept-Encoding: - gzip, deflate CommandName: - vm create Connection: - keep-alive + Content-Length: + - '361' + Content-Type: + - application/json ParameterSetName: - - -n -g --image --admin-username --generate-ssh-keys + - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-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=2020-10-01 + - AZURECLI/2.25.0 azsdk-python-mgmt-loganalytics/8.0.0 Python/3.8.10 (Windows-10-10.0.19043-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: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Resources/deployments/vm_deploy_e5CrJHr9gvsCUqV265EIUHSdWtgXBgob","name":"vm_deploy_e5CrJHr9gvsCUqV265EIUHSdWtgXBgob","type":"Microsoft.Resources/deployments","properties":{"templateHash":"2144961586233669823","parameters":{},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2021-05-31T07:16:07.8767825Z","duration":"PT43.1497149S","correlationId":"3661e5bb-6c6f-4548-ad03-8602c3bd7f1b","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","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.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.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: '{"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-06-22T12%3A27%3A01.3669794Z''\"","name":"DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000004","type":"Microsoft.OperationalInsights/workspaces/datasources"}' headers: cache-control: - no-cache content-length: - - '3841' + - '845' content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:16:30 GMT + - Tue, 22 Jun 2021 12:27:01 GMT expires: - '-1' pragma: - no-cache + server: + - Microsoft-IIS/10.0 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-powered-by: + - ASP.NET status: code: 200 message: OK - request: - body: null + body: '{"properties": {"instanceName": "*", "intervalSeconds": 10, "objectName": + "Network", "performanceCounters": [{"counterName": "Total Bytes Transmitted"}, + {"counterName": "Total Bytes Received"}]}, "kind": "LinuxPerformanceObject"}' headers: Accept: - application/json @@ -399,73 +1217,35 @@ interactions: - vm create Connection: - keep-alive + Content-Length: + - '229' + Content-Type: + - application/json ParameterSetName: - - -n -g --image --admin-username --generate-ssh-keys + - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-compute/21.0.0 Python/3.8.10 (Windows-10-10.0.19043-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 + - AZURECLI/2.25.0 azsdk-python-mgmt-loganalytics/8.0.0 Python/3.8.10 (Windows-10-10.0.19043-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: "{\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\": \"5b0d93be-28ae-4cda-a281-cab5451fbe65\",\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.202105120\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": - \"Linux\",\r\n \"name\": \"myvm1_disk1_11dcc83dd64243d3a96b4266b33ee5db\",\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_11dcc83dd64243d3a96b4266b33ee5db\"\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\": \"clitest000002\",\r\n - \ \"linuxConfiguration\": {\r\n \"disablePasswordAuthentication\": - true,\r\n \"ssh\": {\r\n \"publicKeys\": [\r\n {\r\n - \ \"path\": \"/home/clitest000002/.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 - \ \"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.2.54.2\",\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-05-31T07:16:18+00:00\"\r\n }\r\n ],\r\n \"extensionHandlers\": - []\r\n },\r\n \"disks\": [\r\n {\r\n \"name\": \"myvm1_disk1_11dcc83dd64243d3a96b4266b33ee5db\",\r\n - \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n - \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning - succeeded\",\r\n \"time\": \"2021-05-31T07:15:51.124142+00:00\"\r\n - \ }\r\n ]\r\n }\r\n ],\r\n \"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-05-31T07:16:06.8880256+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}" + 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-06-22T12%3A27%3A03.2755453Z''\"","name":"DataSource_LinuxPerformanceObject_88888888-0000-0000-0000-000000000005","type":"Microsoft.OperationalInsights/workspaces/datasources"}' headers: cache-control: - no-cache content-length: - - '4135' + - '721' content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:16:31 GMT + - Tue, 22 Jun 2021 12:27:03 GMT expires: - '-1' pragma: - no-cache server: - - Microsoft-HTTPAPI/2.0 - - Microsoft-HTTPAPI/2.0 + - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -474,70 +1254,52 @@ interactions: - Accept-Encoding x-content-type-options: - nosniff - x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;3993,Microsoft.Compute/LowCostGet30Min;31993 + x-ms-ratelimit-remaining-subscription-writes: + - '1195' + x-powered-by: + - ASP.NET status: code: 200 message: OK - request: - body: null + body: '{"properties": {"state": "Enabled"}, "kind": "LinuxSyslogCollection"}' headers: Accept: - - application/json, text/json + - application/json Accept-Encoding: - gzip, deflate CommandName: - vm create Connection: - keep-alive + Content-Length: + - '69' + Content-Type: + - application/json ParameterSetName: - - -n -g --image --admin-username --generate-ssh-keys + - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-network/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-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 + - AZURECLI/2.25.0 azsdk-python-mgmt-loganalytics/8.0.0 Python/3.8.10 (Windows-10-10.0.19043-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: "{\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/\\\"d43fbfae-3433-4b8b-b81a-9fcb92d3b35e\\\"\",\r\n \"location\": - \"eastus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": - \"Succeeded\",\r\n \"resourceGuid\": \"49b6cca7-3ad1-4329-83d5-a036c0efe2c7\",\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/\\\"d43fbfae-3433-4b8b-b81a-9fcb92d3b35e\\\"\",\r\n - \ \"type\": \"Microsoft.Network/networkInterfaces/ipConfigurations\",\r\n - \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n - \ \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\": - \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/publicIPAddresses/myvm1PublicIP\"\r\n - \ },\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Network/virtualNetworks/myvm1VNET/subnets/myvm1Subnet\"\r\n - \ },\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\": - \"qldl2rgjocdupolrmukv2znftc.bx.internal.cloudapp.net\"\r\n },\r\n \"macAddress\": - \"00-0D-3A-16-4E-AE\",\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\": - \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_scheduled_query000001/providers/Microsoft.Compute/virtualMachines/myvm1\"\r\n - \ }\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\n}" + 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-06-22T12%3A27%3A04.0435457Z''\"","name":"DataSource_LinuxSyslogCollection_88888888-0000-0000-0000-000000000006","type":"Microsoft.OperationalInsights/workspaces/datasources"}' headers: cache-control: - no-cache content-length: - - '2588' + - '568' content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:16:32 GMT - etag: - - W/"d43fbfae-3433-4b8b-b81a-9fcb92d3b35e" + - Tue, 22 Jun 2021 12:27:04 GMT expires: - '-1' pragma: - no-cache server: - - Microsoft-HTTPAPI/2.0 - - Microsoft-HTTPAPI/2.0 + - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -546,57 +1308,53 @@ interactions: - Accept-Encoding x-content-type-options: - nosniff - x-ms-arm-service-request-id: - - e5f2aa8c-0df8-43f8-8d97-825fdd88642b + x-ms-ratelimit-remaining-subscription-writes: + - '1194' + x-powered-by: + - ASP.NET status: code: 200 message: OK - request: - body: null + body: '{"properties": {"syslogName": "syslog", "syslogSeverities": [{"severity": + "notice"}, {"severity": "info"}, {"severity": "debug"}]}, "kind": "LinuxSyslog"}' headers: Accept: - - application/json, text/json + - application/json Accept-Encoding: - gzip, deflate CommandName: - vm create Connection: - keep-alive + Content-Length: + - '154' + Content-Type: + - application/json ParameterSetName: - - -n -g --image --admin-username --generate-ssh-keys + - -n -g --image --nsg-rule --workspace --generate-ssh-keys User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-network/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-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 + - AZURECLI/2.25.0 azsdk-python-mgmt-loganalytics/8.0.0 Python/3.8.10 (Windows-10-10.0.19043-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: "{\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/\\\"699030e3-9190-4735-9647-2f5278fde227\\\"\",\r\n \"location\": - \"eastus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": - \"Succeeded\",\r\n \"resourceGuid\": \"db71bbaa-ebbc-4b90-b06f-88598b4c7656\",\r\n - \ \"ipAddress\": \"52.186.121.232\",\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 - \ \"sku\": {\r\n \"name\": \"Basic\"\r\n }\r\n}" + 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-06-22T12%3A27%3A04.8035166Z''\"","name":"DataSource_LinuxSyslog_88888888-0000-0000-0000-000000000007","type":"Microsoft.OperationalInsights/workspaces/datasources"}' headers: cache-control: - no-cache content-length: - - '1006' + - '626' content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:16:32 GMT - etag: - - W/"699030e3-9190-4735-9647-2f5278fde227" + - Tue, 22 Jun 2021 12:27:04 GMT expires: - '-1' pragma: - no-cache server: - - Microsoft-HTTPAPI/2.0 - - Microsoft-HTTPAPI/2.0 + - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -605,8 +1363,10 @@ interactions: - Accept-Encoding x-content-type-options: - nosniff - x-ms-arm-service-request-id: - - 9e7596f8-ab05-4aab-a3c1-016457b91089 + x-ms-ratelimit-remaining-subscription-writes: + - '1193' + x-powered-by: + - ASP.NET status: code: 200 message: OK @@ -624,12 +1384,12 @@ interactions: ParameterSetName: - -g -n --scopes --condition --condition-query --description User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.25.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001?api-version=2020-10-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-05-31T07:15:05Z"},"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-06-22T12:23:28Z"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache @@ -638,7 +1398,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:16:35 GMT + - Tue, 22 Jun 2021 12:30:06 GMT expires: - '-1' pragma: @@ -657,9 +1417,9 @@ 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.0, "failingPeriods": - {"numberOfEvaluationPeriods": 1, "minFailingPeriodsToAlert": 1}}]}, "checkWorkspaceAlertsStorageConfigured": - false, "skipQueryValidation": false, "autoMitigate": true}}' + "dimensions": [], "operator": "GreaterThan", "threshold": 360, "failingPeriods": + {"numberOfEvaluationPeriods": 1, "minFailingPeriodsToAlert": 1}}]}, "muteActionsDuration": + "PT30M"}}' headers: Accept: - application/json @@ -670,29 +1430,32 @@ interactions: Connection: - keep-alive Content-Length: - - '726' + - '656' Content-Type: - - application/json + - application/json; charset=utf-8 ParameterSetName: - -g -n --scopes --condition --condition-query --description User-Agent: - - AZURECLI/2.24.0 azsdk-python-mgmt-monitor/unknown Python/3.8.10 (Windows-10-10.0.19043-SP0) + - 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.25.0 + accept-language: + - en-US 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 + 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 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","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}}]},"autoMitigate":true,"checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}' + Event, Syslog | where TimeGenerated > ago(1h)","timeAggregation":"Count","dimensions":[],"operator":"GreaterThan","threshold":360.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"muteActionsDuration":"PT30M"}}' headers: cache-control: - no-cache content-length: - - '955' + - '891' content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:16:47 GMT + - Tue, 22 Jun 2021 12:30:20 GMT expires: - '-1' pragma: @@ -716,40 +1479,33 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - monitor scheduled-query update + - monitor scheduled-query create Connection: - keep-alive ParameterSetName: - - -g -n --condition --condition-query --description --severity --disabled --evaluation-frequency - --window-size + - -g -n --scopes --condition --description User-Agent: - - AZURECLI/2.24.0 azsdk-python-mgmt-monitor/unknown Python/3.8.10 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.25.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Windows-10-10.0.19043-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 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_scheduled_query000001?api-version=2020-10-01 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","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}}]},"autoMitigate":true,"checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}' + 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-06-22T12:23:28Z"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '955' + - '428' content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:16:49 GMT + - Tue, 22 Jun 2021 12:30:22 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: @@ -758,48 +1514,49 @@ interactions: code: 200 message: OK - request: - body: '{"location": "eastus", "properties": {"description": "Test rule 2", "severity": - 4, "enabled": false, "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}}]}, "checkWorkspaceAlertsStorageConfigured": false, "skipQueryValidation": - false, "autoMitigate": true}}' + 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, "failingPeriods": {"numberOfEvaluationPeriods": 1, "minFailingPeriodsToAlert": + 1}}]}, "muteActionsDuration": "PT30M"}}' headers: Accept: - application/json Accept-Encoding: - gzip, deflate CommandName: - - monitor scheduled-query update + - monitor scheduled-query create Connection: - keep-alive Content-Length: - - '755' + - '641' Content-Type: - - application/json + - application/json; charset=utf-8 ParameterSetName: - - -g -n --condition --condition-query --description --severity --disabled --evaluation-frequency - --window-size + - -g -n --scopes --condition --description User-Agent: - - AZURECLI/2.24.0 azsdk-python-mgmt-monitor/unknown Python/3.8.10 (Windows-10-10.0.19043-SP0) + - 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.25.0 + accept-language: + - en-US 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 + 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 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}}]},"autoMitigate":true,"checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}' + 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 + 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"}}' headers: cache-control: - no-cache content-length: - - '982' + - '874' content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:16:52 GMT + - Tue, 22 Jun 2021 12:30:35 GMT expires: - '-1' pragma: @@ -808,17 +1565,13 @@ interactions: - 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: - - '1195' + - '1199' status: - code: 200 - message: OK + code: 201 + message: Created - request: body: null headers: @@ -831,25 +1584,29 @@ interactions: Connection: - keep-alive ParameterSetName: - - -g -n --mad --auto-mitigate + - -g -n --condition --condition-query --description --severity --disabled --evaluation-frequency + --window-size User-Agent: - - AZURECLI/2.24.0 azsdk-python-mgmt-monitor/unknown Python/3.8.10 (Windows-10-10.0.19043-SP0) + - 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.25.0 + accept-language: + - en-US 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 + 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 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}}]},"autoMitigate":true,"checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}' + 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"}}' headers: cache-control: - no-cache content-length: - - '982' + - '891' content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:16:53 GMT + - Tue, 22 Jun 2021 12:30:36 GMT expires: - '-1' pragma: @@ -873,9 +1630,8 @@ interactions: "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": false, "autoMitigate": false}}' + "threshold": 260, "failingPeriods": {"numberOfEvaluationPeriods": 3, "minFailingPeriodsToAlert": + 2}}]}, "muteActionsDuration": "PT30M"}}' headers: Accept: - application/json @@ -886,29 +1642,33 @@ interactions: Connection: - keep-alive Content-Length: - - '788' + - '685' Content-Type: - - application/json + - application/json; charset=utf-8 ParameterSetName: - - -g -n --mad --auto-mitigate + - -g -n --condition --condition-query --description --severity --disabled --evaluation-frequency + --window-size User-Agent: - - AZURECLI/2.24.0 azsdk-python-mgmt-monitor/unknown Python/3.8.10 (Windows-10-10.0.19043-SP0) + - 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.25.0 + accept-language: + - en-US 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 + 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 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}}]},"autoMitigate":false,"muteActionsDuration":"PT30M","checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}' + Event | where TimeGenerated > ago(2h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"LessThan","threshold":260.0,"failingPeriods":{"numberOfEvaluationPeriods":3,"minFailingPeriodsToAlert":2}}]},"muteActionsDuration":"PT30M"}}' headers: cache-control: - no-cache content-length: - - '1013' + - '918' content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:16:56 GMT + - Tue, 22 Jun 2021 12:30:41 GMT expires: - '-1' pragma: @@ -924,7 +1684,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' status: code: 200 message: OK @@ -942,23 +1702,26 @@ interactions: ParameterSetName: - -g -n User-Agent: - - AZURECLI/2.24.0 azsdk-python-mgmt-monitor/unknown Python/3.8.10 (Windows-10-10.0.19043-SP0) + - 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.25.0 + accept-language: + - en-US 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 + 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 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}}]},"autoMitigate":false,"muteActionsDuration":"PT30M","checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}' + Event | where TimeGenerated > ago(2h)","timeAggregation":"Count","dimensions":[],"resourceIdColumn":"_ResourceId","operator":"LessThan","threshold":260.0,"failingPeriods":{"numberOfEvaluationPeriods":3,"minFailingPeriodsToAlert":2}}]},"muteActionsDuration":"PT30M"}}' headers: cache-control: - no-cache content-length: - - '1013' + - '918' content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:16:56 GMT + - Tue, 22 Jun 2021 12:30:42 GMT expires: - '-1' pragma: @@ -990,23 +1753,28 @@ interactions: ParameterSetName: - -g User-Agent: - - AZURECLI/2.24.0 azsdk-python-mgmt-monitor/unknown Python/3.8.10 (Windows-10-10.0.19043-SP0) + - 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.25.0 + accept-language: + - en-US method: GET - 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 + 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 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}}]},"autoMitigate":false,"muteActionsDuration":"PT30M","checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}}]}' + 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 + 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"}}]}' headers: cache-control: - no-cache content-length: - - '1025' + - '1805' content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:16:58 GMT + - Tue, 22 Jun 2021 12:30:44 GMT expires: - '-1' pragma: @@ -1036,24 +1804,29 @@ interactions: Connection: - keep-alive User-Agent: - - AZURECLI/2.24.0 azsdk-python-mgmt-monitor/unknown Python/3.8.10 (Windows-10-10.0.19043-SP0) + - 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.25.0 + accept-language: + - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Insights/scheduledQueryRules?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Insights/scheduledQueryRules?api-version=2020-05-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}}]},"autoMitigate":false,"muteActionsDuration":"PT30M","checkWorkspaceAlertsStorageConfigured":false,"skipQueryValidation":false}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zhoxing-test/providers/microsoft.insights/scheduledqueryrules/zhoxing-test","name":"zhoxing-test","type":"microsoft.insights/scheduledqueryrules","location":"centralus","tags":{"hidden-link:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testece/providers/Microsoft.OperationalInsights/workspaces/mmeum-analytics-workspace-testece":""},"properties":{"displayName":"zhoxing-test","description":"","severity":3,"enabled":false,"evaluationFrequency":"PT5M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zhoxing-test/providers/microsoft.insights/components/zhoxing-test"],"windowSize":"PT5M","criteria":{"allOf":[{"query":"requests + 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 + 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"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zhoxing-test/providers/microsoft.insights/scheduledqueryrules/zhoxing-test","name":"zhoxing-test","type":"microsoft.insights/scheduledqueryrules","location":"centralus","tags":{"hidden-link:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testece/providers/Microsoft.OperationalInsights/workspaces/mmeum-analytics-workspace-testece":""},"properties":{"displayName":"zhoxing-test","description":"","severity":3,"enabled":false,"evaluationFrequency":"PT5M","scopes":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zhoxing-test/providers/microsoft.insights/components/zhoxing-test"],"windowSize":"PT5M","criteria":{"allOf":[{"query":"requests | where resultCode == \"500\"","timeAggregation":"Count","metricMeasureColumn":"","operator":"GreaterThan","threshold":5.0,"failingPeriods":{"numberOfEvaluationPeriods":1,"minFailingPeriodsToAlert":1}}]},"actions":[{"actionGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/default-activitylogalerts/providers/microsoft.insights/actiongroups/zhoxing-test"}]}}]}' headers: cache-control: - no-cache content-length: - - '2164' + - '2944' content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:16:59 GMT + - Tue, 22 Jun 2021 12:30:45 GMT expires: - '-1' pragma: @@ -1087,9 +1860,12 @@ interactions: ParameterSetName: - -g -n -y User-Agent: - - AZURECLI/2.24.0 azsdk-python-mgmt-monitor/unknown Python/3.8.10 (Windows-10-10.0.19043-SP0) + - 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.25.0 + accept-language: + - en-US 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=2021-02-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=2020-05-01-preview response: body: string: '' @@ -1099,7 +1875,7 @@ interactions: content-length: - '0' date: - - Mon, 31 May 2021 07:17:10 GMT + - Tue, 22 Jun 2021 12:30:54 GMT expires: - '-1' pragma: @@ -1129,9 +1905,12 @@ interactions: ParameterSetName: - -g -n User-Agent: - - AZURECLI/2.24.0 azsdk-python-mgmt-monitor/unknown Python/3.8.10 (Windows-10-10.0.19043-SP0) + - 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.25.0 + accept-language: + - en-US 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 + 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 response: body: string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.Insights/scheduledqueryrules/sq01'' @@ -1145,7 +1924,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 31 May 2021 07:17:10 GMT + - Tue, 22 Jun 2021 12:30:56 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 290867d0ee5..de247fe28e1 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 @@ -17,13 +17,17 @@ class Scheduled_queryScenarioTest(ScenarioTest): @ResourceGroupPreparer(name_prefix='cli_test_scheduled_query', location='eastus') def test_scheduled_query(self, resource_group): from azure.mgmt.core.tools import resource_id + import time + import mock self.kwargs.update({ 'name1': 'sq01', + 'name2': 'sq02', 'rg': resource_group, 'vm': 'myvm1', 'ws': self.create_random_name('clitest', 20) }) - vm = self.cmd('vm create -n {vm} -g {rg} --image UbuntuLTS --admin-username {ws} --generate-ssh-keys').get_output_in_json() + 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() self.kwargs.update({ 'vm_id': vm['id'], 'rg_id': resource_id(subscription=self.get_subscription_id(), @@ -31,6 +35,7 @@ def test_scheduled_query(self, resource_group): 'sub_id': resource_id(subscription=self.get_subscription_id(), resource_group=resource_group), }) + time.sleep(180) self.cmd('monitor scheduled-query create -g {rg} -n {name1} --scopes {vm_id} --condition "count \'placeholder_1\' > 360" --condition-query placeholder_1="union Event, Syslog | where TimeGenerated > ago(1h)" --description "Test rule"', checks=[ self.check('name', '{name1}'), @@ -41,10 +46,13 @@ 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('autoMitigate', True), - self.check('skipQueryValidation', False), - self.check('checkWorkspaceAlertsStorageConfigured', False) + self.check('criteria.allOf[0].failingPeriods.numberOfEvaluationPeriods', 1) + ]) + 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=[ + self.check('name', '{name2}'), + self.check('scopes[0]', '{rg_id}'), + self.check('severity', 2) ]) self.cmd('monitor scheduled-query update -g {rg} -n {name1} --condition "count \'placeholder_1\' < 260 resource id _ResourceId at least 2 violations out of 3 aggregated points" --condition-query placeholder_1="union Event | where TimeGenerated > ago(2h)" --description "Test rule 2" --severity 4 --disabled --evaluation-frequency 10m --window-size 10m', checks=[ @@ -60,17 +68,13 @@ 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', checks=[ - self.check('muteActionsDuration', '0:30:00'), - self.check('autoMitigate', False) - ]) 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(@)', 1) + self.check('length(@)', 2) ]) self.cmd('monitor scheduled-query list', checks=[ @@ -80,7 +84,7 @@ def test_scheduled_query(self, resource_group): self.cmd('monitor scheduled-query show -g {rg} -n {name1}') -class ScheduledQueryConditionTest(unittest.TestCase): +class ScheduledQueryCondtionTest(unittest.TestCase): def _build_namespace(self, name_or_id=None, resource_group=None, provider_namespace=None, parent=None, resource_type=None): 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 ccbeb512b0c..940dc046983 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,16 +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 ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._configuration import MonitorClientConfiguration +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient', 'MonitorClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION -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 feca4f041b5..b3de8cc8b8f 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,70 +1,48 @@ # 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 typing import TYPE_CHECKING +from .version import VERSION -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - - from azure.core.credentials import TokenCredential - -VERSION = "unknown" - -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 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. + :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, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + if not base_url: + base_url = 'https://management.azure.com' - 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) + super(MonitorClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True - 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) + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id 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 new file mode 100644 index 00000000000..9126e1c0d2c --- /dev/null +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/_monitor_client.py @@ -0,0 +1,49 @@ +# 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 deleted file mode 100644 index 45f59183835..00000000000 --- a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/_monitor_management_client.py +++ /dev/null @@ -1,88 +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 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_01_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/models/__init__.py b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/__init__.py index b7bb79bb497..cfb55074177 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,70 +1,68 @@ # 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 Condition from ._models_py3 import ConditionFailingPeriods from ._models_py3 import Dimension from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorContract + from ._models_py3 import ErrorContract, ErrorContractException 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 # 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, + 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, + ConditionOperator, ) __all__ = [ 'Action', + 'AzureEntityResource', 'Condition', 'ConditionFailingPeriods', 'Dimension', 'ErrorAdditionalInfo', - 'ErrorContract', + 'ErrorContract', 'ErrorContractException', 'ErrorResponse', + 'ProxyResource', 'Resource', 'ScheduledQueryRuleCriteria', 'ScheduledQueryRuleResource', - 'ScheduledQueryRuleResourceCollection', 'ScheduledQueryRuleResourcePatch', - 'SystemData', 'TrackedResource', - 'AlertSeverity', - 'ConditionOperator', - 'CreatedByType', - 'DimensionOperator', - 'Kind', + 'ScheduledQueryRuleResourcePaged', 'TimeAggregation', + 'DimensionOperator', + 'ConditionOperator', ] 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 d453278c3a5..c5e78eef7c5 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,19 +1,23 @@ # 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 azure.core.exceptions import HttpResponseError -import msrest.serialization +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError -class Action(msrest.serialization.Model): +class Action(Model): """Actions to invoke when the alert fires. - :param action_group_id: Action Group resource Id 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] @@ -24,48 +28,125 @@ class Action(msrest.serialization.Model): 'web_hook_properties': {'key': 'webHookProperties', 'type': '{str}'}, } - def __init__( - self, - **kwargs - ): + 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) -class Condition(msrest.serialization.Model): +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): """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. Relevant and required only for rules of - the kind LogAlert. Possible values include: "Count", "Average", "Minimum", "Maximum", "Total". + :param time_aggregation: Required. Aggregation type. Possible values + include: 'Count', 'Average', 'Minimum', 'Maximum', 'Total' :type time_aggregation: str or - ~$(python-base-namespace).v2021_02_01_preview.models.TimeAggregation - :param metric_measure_column: The column containing the metric measure number. Relevant only - for rules of the kind LogAlert. + ~azure.mgmt.monitor.v2020_05_01_preview.models.TimeAggregation + :param metric_measure_column: The column containing the metric measure + number. :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. Relevant only for rules of the kind LogAlert. + :param resource_id_column: The column containing the resource id. The + content of the column must be a uri formatted as resource id :type resource_id_column: str - :param dimensions: List of Dimensions conditions. - :type dimensions: list[~$(python-base-namespace).v2021_02_01_preview.models.Dimension] - :param operator: Required. 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_01_preview.models.ConditionOperator - :param threshold: Required. 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. + :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. :type failing_periods: - ~$(python-base-namespace).v2021_02_01_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 + ~azure.mgmt.monitor.v2020_05_01_preview.models.ConditionFailingPeriods """ _validation = { @@ -81,64 +162,60 @@ class Condition(msrest.serialization.Model): 'resource_id_column': {'key': 'resourceIdColumn', 'type': 'str'}, 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, 'operator': {'key': 'operator', 'type': 'str'}, - 'threshold': {'key': 'threshold', 'type': 'float'}, + 'threshold': {'key': 'threshold', 'type': 'int'}, '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['time_aggregation'] + self.time_aggregation = kwargs.get('time_aggregation', None) self.metric_measure_column = kwargs.get('metric_measure_column', None) self.resource_id_column = kwargs.get('resource_id_column', None) self.dimensions = kwargs.get('dimensions', None) - self.operator = kwargs['operator'] - self.threshold = kwargs['threshold'] + 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(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. +class ConditionFailingPeriods(Model): + """The minimum number of violations required within the selected lookback time + window required to raise an alert. - :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 + :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 """ _attribute_map = { - 'number_of_evaluation_periods': {'key': 'numberOfEvaluationPeriods', 'type': 'long'}, - 'min_failing_periods_to_alert': {'key': 'minFailingPeriodsToAlert', 'type': 'long'}, + 'number_of_evaluation_periods': {'key': 'numberOfEvaluationPeriods', 'type': 'int'}, + 'min_failing_periods_to_alert': {'key': 'minFailingPeriodsToAlert', 'type': 'int'}, } - def __init__( - self, - **kwargs - ): + def __init__(self, **kwargs): super(ConditionFailingPeriods, self).__init__(**kwargs) - 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) + 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) -class Dimension(msrest.serialization.Model): +class Dimension(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 ~$(python-base-namespace).v2021_02_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 + ~azure.mgmt.monitor.v2020_05_01_preview.models.DimensionOperator + :param values: Required. List of dimension values :type values: list[str] """ @@ -154,25 +231,23 @@ class Dimension(msrest.serialization.Model): 'values': {'key': 'values', 'type': '[str]'}, } - def __init__( - self, - **kwargs - ): + def __init__(self, **kwargs): super(Dimension, self).__init__(**kwargs) - self.name = kwargs['name'] - self.operator = kwargs['operator'] - self.values = kwargs['values'] + self.name = kwargs.get('name', None) + self.operator = kwargs.get('operator', None) + self.values = kwargs.get('values', None) -class ErrorAdditionalInfo(msrest.serialization.Model): +class ErrorAdditionalInfo(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: str + :vartype info: object """ _validation = { @@ -182,41 +257,48 @@ class ErrorAdditionalInfo(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'str'}, + '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(msrest.serialization.Model): +class ErrorContract(Model): """Describes the format of Error response. :param error: The error details. - :type error: ~$(python-base-namespace).v2021_02_01_preview.models.ErrorResponse + :type error: ~azure.mgmt.monitor.v2020_05_01_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 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 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) + - Variables are only populated by the server, and will be ignored when sending a request. +class ErrorResponse(Model): + """The resource management error response. + + Variables are only populated by the server, and will be ignored when + sending a request. :ivar code: The error code. :vartype code: str @@ -225,10 +307,11 @@ class ErrorResponse(msrest.serialization.Model): :ivar target: The error target. :vartype target: str :ivar details: The error details. - :vartype details: list[~$(python-base-namespace).v2021_02_01_preview.models.ErrorResponse] + :vartype details: + list[~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorResponse] :ivar additional_info: The error additional info. :vartype additional_info: - list[~$(python-base-namespace).v2021_02_01_preview.models.ErrorAdditionalInfo] + list[~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorAdditionalInfo] """ _validation = { @@ -247,10 +330,7 @@ class ErrorResponse(msrest.serialization.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 @@ -259,18 +339,20 @@ def __init__( self.additional_info = None -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. - 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. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. :vartype type: str """ @@ -286,53 +368,47 @@ class Resource(msrest.serialization.Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None + def __init__(self, **kwargs): + super(ProxyResource, self).__init__(**kwargs) -class ScheduledQueryRuleCriteria(msrest.serialization.Model): +class ScheduledQueryRuleCriteria(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[~$(python-base-namespace).v2021_02_01_preview.models.Condition] + :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] """ _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 an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for a ARM tracked top level 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. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. :vartype type: str - :param tags: A set of tags. Resource tags. + :param 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 """ @@ -351,97 +427,65 @@ 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['location'] + self.location = kwargs.get('location', 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. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. :vartype type: str - :param tags: A set of tags. Resource tags. + :param 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_01_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_01_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 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_01_preview.models.AlertSeverity - :param enabled: The flag which indicates whether this scheduled query rule is enabled. Value - should be true or false. + :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 :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. 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. + :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 :type target_resource_types: list[str] - :param criteria: The rule criteria that defines the conditions of the scheduled query rule. - :type criteria: ~$(python-base-namespace).v2021_02_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. 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: list[~$(python-base-namespace).v2021_02_01_preview.models.Action] - :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 + :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] """ _validation = { @@ -449,11 +493,6 @@ 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 = { @@ -462,230 +501,96 @@ 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]'}, - '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 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_01_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): +class ScheduledQueryRuleResourcePatch(Model): """The scheduled query rule resource for patch operations. - Variables are only populated by the server, and will be ignored when sending a request. - - :param tags: A set of tags. Resource tags. + :param 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 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_01_preview.models.AlertSeverity - :param enabled: The flag which indicates whether this scheduled query rule is enabled. Value - should be true or false. + :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 :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. 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. + :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 :type target_resource_types: list[str] - :param criteria: The rule criteria that defines the conditions of the scheduled query rule. - :type criteria: ~$(python-base-namespace).v2021_02_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. 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: list[~$(python-base-namespace).v2021_02_01_preview.models.Action] - :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 + :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] """ - _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]'}, - '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_01_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_01_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 7cb8fd39ad4..e9d2d107998 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,24 +1,23 @@ # 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. # -------------------------------------------------------------------------- -import datetime -from typing import Dict, List, Optional, Union +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError -from azure.core.exceptions import HttpResponseError -import msrest.serialization -from ._monitor_management_client_enums import * - - -class Action(msrest.serialization.Model): +class Action(Model): """Actions to invoke when the alert fires. - :param action_group_id: Action Group resource Id 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] @@ -29,51 +28,125 @@ class Action(msrest.serialization.Model): 'web_hook_properties': {'key': 'webHookProperties', 'type': '{str}'}, } - def __init__( - self, - *, - action_group_id: Optional[str] = None, - web_hook_properties: Optional[Dict[str, str]] = None, - **kwargs - ): + 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 Condition(msrest.serialization.Model): +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) -> 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 + """ + + _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): """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. Relevant and required only for rules of - the kind LogAlert. Possible values include: "Count", "Average", "Minimum", "Maximum", "Total". + :param time_aggregation: Required. Aggregation type. Possible values + include: 'Count', 'Average', 'Minimum', 'Maximum', 'Total' :type time_aggregation: str or - ~$(python-base-namespace).v2021_02_01_preview.models.TimeAggregation - :param metric_measure_column: The column containing the metric measure number. Relevant only - for rules of the kind LogAlert. + ~azure.mgmt.monitor.v2020_05_01_preview.models.TimeAggregation + :param metric_measure_column: The column containing the metric measure + number. :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. Relevant only for rules of the kind LogAlert. + :param resource_id_column: The column containing the resource id. The + content of the column must be a uri formatted as resource id :type resource_id_column: str - :param dimensions: List of Dimensions conditions. - :type dimensions: list[~$(python-base-namespace).v2021_02_01_preview.models.Dimension] - :param operator: Required. 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_01_preview.models.ConditionOperator - :param threshold: Required. 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. + :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. :type failing_periods: - ~$(python-base-namespace).v2021_02_01_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 + ~azure.mgmt.monitor.v2020_05_01_preview.models.ConditionFailingPeriods """ _validation = { @@ -89,25 +162,11 @@ class Condition(msrest.serialization.Model): 'resource_id_column': {'key': 'resourceIdColumn', 'type': 'str'}, 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, 'operator': {'key': 'operator', 'type': 'str'}, - 'threshold': {'key': 'threshold', 'type': 'float'}, + 'threshold': {'key': 'threshold', 'type': 'int'}, 'failing_periods': {'key': 'failingPeriods', 'type': 'ConditionFailingPeriods'}, - 'metric_name': {'key': 'metricName', 'type': 'str'}, } - def __init__( - self, - *, - time_aggregation: Union[str, "TimeAggregation"], - operator: Union[str, "ConditionOperator"], - threshold: float, - query: Optional[str] = None, - metric_measure_column: Optional[str] = None, - resource_id_column: Optional[str] = None, - dimensions: Optional[List["Dimension"]] = None, - failing_periods: Optional["ConditionFailingPeriods"] = None, - metric_name: Optional[str] = None, - **kwargs - ): + 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: super(Condition, self).__init__(**kwargs) self.query = query self.time_aggregation = time_aggregation @@ -117,49 +176,46 @@ def __init__( self.operator = operator self.threshold = threshold self.failing_periods = failing_periods - self.metric_name = metric_name -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. +class ConditionFailingPeriods(Model): + """The minimum number of violations required within the selected lookback time + window required to raise an alert. - :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 + :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 """ _attribute_map = { - 'number_of_evaluation_periods': {'key': 'numberOfEvaluationPeriods', 'type': 'long'}, - 'min_failing_periods_to_alert': {'key': 'minFailingPeriodsToAlert', 'type': 'long'}, + 'number_of_evaluation_periods': {'key': 'numberOfEvaluationPeriods', 'type': 'int'}, + 'min_failing_periods_to_alert': {'key': 'minFailingPeriodsToAlert', 'type': 'int'}, } - def __init__( - self, - *, - number_of_evaluation_periods: Optional[int] = 1, - min_failing_periods_to_alert: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, number_of_evaluation_periods: int=None, min_failing_periods_to_alert: int=None, **kwargs) -> None: 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(msrest.serialization.Model): +class Dimension(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 ~$(python-base-namespace).v2021_02_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 + ~azure.mgmt.monitor.v2020_05_01_preview.models.DimensionOperator + :param values: Required. List of dimension values :type values: list[str] """ @@ -175,29 +231,23 @@ class Dimension(msrest.serialization.Model): 'values': {'key': 'values', 'type': '[str]'}, } - def __init__( - self, - *, - name: str, - operator: Union[str, "DimensionOperator"], - values: List[str], - **kwargs - ): + def __init__(self, *, name: str, operator, values, **kwargs) -> None: super(Dimension, self).__init__(**kwargs) self.name = name self.operator = operator self.values = values -class ErrorAdditionalInfo(msrest.serialization.Model): +class ErrorAdditionalInfo(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: str + :vartype info: object """ _validation = { @@ -207,43 +257,48 @@ class ErrorAdditionalInfo(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, } - def __init__( - self, - **kwargs - ): + def __init__(self, **kwargs) -> None: super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None -class ErrorContract(msrest.serialization.Model): +class ErrorContract(Model): """Describes the format of Error response. :param error: The error details. - :type error: ~$(python-base-namespace).v2021_02_01_preview.models.ErrorResponse + :type error: ~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorResponse """ _attribute_map = { 'error': {'key': 'error', 'type': 'ErrorResponse'}, } - def __init__( - self, - *, - error: Optional["ErrorResponse"] = None, - **kwargs - ): + def __init__(self, *, error=None, **kwargs) -> None: super(ErrorContract, self).__init__(**kwargs) self.error = error -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 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) - Variables are only populated by the server, and will be ignored when sending a request. + +class ErrorResponse(Model): + """The resource management error response. + + Variables are only populated by the server, and will be ignored when + sending a request. :ivar code: The error code. :vartype code: str @@ -252,10 +307,11 @@ class ErrorResponse(msrest.serialization.Model): :ivar target: The error target. :vartype target: str :ivar details: The error details. - :vartype details: list[~$(python-base-namespace).v2021_02_01_preview.models.ErrorResponse] + :vartype details: + list[~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorResponse] :ivar additional_info: The error additional info. :vartype additional_info: - list[~$(python-base-namespace).v2021_02_01_preview.models.ErrorAdditionalInfo] + list[~azure.mgmt.monitor.v2020_05_01_preview.models.ErrorAdditionalInfo] """ _validation = { @@ -274,10 +330,7 @@ class ErrorResponse(msrest.serialization.Model): 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } - def __init__( - self, - **kwargs - ): + def __init__(self, **kwargs) -> None: super(ErrorResponse, self).__init__(**kwargs) self.code = None self.message = None @@ -286,18 +339,20 @@ def __init__( self.additional_info = None -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. - 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. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. :vartype type: str """ @@ -313,55 +368,47 @@ class Resource(msrest.serialization.Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None + def __init__(self, **kwargs) -> None: + super(ProxyResource, self).__init__(**kwargs) -class ScheduledQueryRuleCriteria(msrest.serialization.Model): +class ScheduledQueryRuleCriteria(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[~$(python-base-namespace).v2021_02_01_preview.models.Condition] + :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] """ _attribute_map = { 'all_of': {'key': 'allOf', 'type': '[Condition]'}, } - def __init__( - self, - *, - all_of: Optional[List["Condition"]] = None, - **kwargs - ): + def __init__(self, *, all_of=None, **kwargs) -> None: super(ScheduledQueryRuleCriteria, self).__init__(**kwargs) self.all_of = all_of class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for a ARM tracked top level 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. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. :vartype type: str - :param tags: A set of tags. Resource tags. + :param 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 """ @@ -380,13 +427,7 @@ class TrackedResource(Resource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags=None, **kwargs) -> None: super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -395,85 +436,56 @@ def __init__( 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. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. :vartype type: str - :param tags: A set of tags. Resource tags. + :param 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_01_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_01_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 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_01_preview.models.AlertSeverity - :param enabled: The flag which indicates whether this scheduled query rule is enabled. Value - should be true or false. + :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 :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. 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. + :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 :type target_resource_types: list[str] - :param criteria: The rule criteria that defines the conditions of the scheduled query rule. - :type criteria: ~$(python-base-namespace).v2021_02_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. 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: list[~$(python-base-namespace).v2021_02_01_preview.models.Action] - :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 + :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] """ _validation = { @@ -481,11 +493,6 @@ 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 = { @@ -494,275 +501,96 @@ 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]'}, - '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: Optional[Dict[str, str]] = None, - kind: Optional[Union[str, "Kind"]] = None, - description: Optional[str] = None, - display_name: Optional[str] = None, - severity: Optional[Union[float, "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[List["Action"]] = None, - check_workspace_alerts_storage_configured: Optional[bool] = None, - skip_query_validation: Optional[bool] = None, - auto_mitigate: Optional[bool] = None, - **kwargs - ): + 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: 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 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_01_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): +class ScheduledQueryRuleResourcePatch(Model): """The scheduled query rule resource for patch operations. - Variables are only populated by the server, and will be ignored when sending a request. - - :param tags: A set of tags. Resource tags. + :param 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 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_01_preview.models.AlertSeverity - :param enabled: The flag which indicates whether this scheduled query rule is enabled. Value - should be true or false. + :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 :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. 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. + :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 :type target_resource_types: list[str] - :param criteria: The rule criteria that defines the conditions of the scheduled query rule. - :type criteria: ~$(python-base-namespace).v2021_02_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. 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: list[~$(python-base-namespace).v2021_02_01_preview.models.Action] - :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 + :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] """ - _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]'}, - '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: Optional[Dict[str, str]] = None, - description: Optional[str] = None, - display_name: Optional[str] = None, - severity: Optional[Union[float, "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[List["Action"]] = None, - check_workspace_alerts_storage_configured: Optional[bool] = None, - skip_query_validation: Optional[bool] = None, - auto_mitigate: Optional[bool] = None, - **kwargs - ): + 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: 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_01_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_01_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 new file mode 100644 index 00000000000..93fa54eb856 --- /dev/null +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_monitor_client_enums.py @@ -0,0 +1,36 @@ +# 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 deleted file mode 100644 index 161a4ad83b7..00000000000 --- a/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_monitor_management_client_enums.py +++ /dev/null @@ -1,81 +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, 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, float, 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 new file mode 100644 index 00000000000..f84d254075a --- /dev/null +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/models/_paged_models.py @@ -0,0 +1,27 @@ +# 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 f677702ed3d..c8cedc13e4d 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,9 +1,12 @@ # 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 0a62242f6c8..448838fbdc5 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,443 +1,423 @@ # 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 -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 +import uuid +from msrest.pipeline import ClientRawResponse -from .. import models as _models +from .. import 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 this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - :ivar models: Alias to model classes used in this operation group. - :type models: ~$(python-base-namespace).v2021_02_01_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._config = config + self.api_version = "2020-05-01-preview" + + self.config = config def list_by_subscription( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ScheduledQueryRuleResourceCollection"] + self, custom_headers=None, raw=False, **operation_config): """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.paging.ItemPaged[~$(python-base-namespace).v2021_02_01_preview.models.ScheduledQueryRuleResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :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` """ - 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 + url = self.list_by_subscription.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, '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') + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.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 + query_parameters = {} - 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) + # 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) + return request - def get_next(next_link=None): + def internal_paging(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response + response = self._client.send(request, stream=False, **operation_config) 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) + raise models.ErrorContractException(self._deserialize, response) - return pipeline_response + return response - return ItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore + # 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'} def list_by_resource_group( - self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ScheduledQueryRuleResourceCollection"] + self, resource_group_name, custom_headers=None, raw=False, **operation_config): """Retrieve scheduled query rule definitions in a resource group. - :param resource_group_name: The name of the resource group. The name is case insensitive. + :param resource_group_name: The name of the resource group. :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.paging.ItemPaged[~$(python-base-namespace).v2021_02_01_preview.models.ScheduledQueryRuleResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :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` """ - 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 + url = self.list_by_resource_group.metadata['url'] 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, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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') + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.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 + query_parameters = {} - 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) + # 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) + return request - def get_next(next_link=None): + def internal_paging(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response + response = self._client.send(request, stream=False, **operation_config) 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) + raise models.ErrorContractException(self._deserialize, response) - return pipeline_response + return response - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore + # 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'} def get( - self, - resource_group_name, # type: str - rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ScheduledQueryRuleResource" + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): """Retrieve an scheduled query rule definition. - :param resource_group_name: The name of the resource group. The name is case insensitive. + :param resource_group_name: The name of the resource group. :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_01_preview.models.ScheduledQueryRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :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` """ - 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 + url = self.get.metadata['url'] 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, pattern=r'^[-\w\._\(\)]+$'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + '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') } 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') + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - + 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) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response + response = self._client.send(request, stream=False, **operation_config) 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) + raise models.ErrorContractException(self._deserialize, response) - deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ScheduledQueryRuleResource', response) - if cls: - return cls(pipeline_response, deserialized, {}) + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} def create_or_update( - self, - resource_group_name, # type: str - rule_name, # type: str - parameters, # type: "_models.ScheduledQueryRuleResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ScheduledQueryRuleResource" + self, resource_group_name, rule_name, parameters, custom_headers=None, raw=False, **operation_config): """Creates or updates a scheduled query rule. - :param resource_group_name: The name of the resource group. The name is case insensitive. + :param resource_group_name: The name of the resource group. :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_01_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_01_preview.models.ScheduledQueryRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :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` """ - 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 + url = self.create_or_update.metadata['url'] 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, pattern=r'^[-\w\._\(\)]+$'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + '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') } 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') + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.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] + 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') - 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 + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) 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) + raise models.ErrorContractException(self._deserialize, response) + deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) - + deserialized = self._deserialize('ScheduledQueryRuleResource', response) if response.status_code == 201: - deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) + deserialized = self._deserialize('ScheduledQueryRuleResource', response) - if cls: - return cls(pipeline_response, deserialized, {}) + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} def update( - self, - resource_group_name, # type: str - rule_name, # type: str - parameters, # type: "_models.ScheduledQueryRuleResourcePatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.ScheduledQueryRuleResource" + self, resource_group_name, rule_name, parameters, custom_headers=None, raw=False, **operation_config): """Update a scheduled query rule. - :param resource_group_name: The name of the resource group. The name is case insensitive. + :param resource_group_name: The name of the resource group. :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_01_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_01_preview.models.ScheduledQueryRuleResource - :raises: ~azure.core.exceptions.HttpResponseError + :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` """ - 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 + url = self.update.metadata['url'] 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, pattern=r'^[-\w\._\(\)]+$'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + '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') } 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') + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.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] + 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') - 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 + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) 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) + raise models.ErrorContractException(self._deserialize, response) - deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ScheduledQueryRuleResource', response) - if cls: - return cls(pipeline_response, deserialized, {}) + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} def delete( - self, - resource_group_name, # type: str - rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): """Deletes a scheduled query rule. - :param resource_group_name: The name of the resource group. The name is case insensitive. + :param resource_group_name: The name of the resource group. :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 + :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` """ - 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 + url = self.delete.metadata['url'] 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, pattern=r'^[-\w\._\(\)]+$'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + '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') } 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') + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - + 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 request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response + response = self._client.send(request, stream=False, **operation_config) 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, {}) + raise models.ErrorContractException(self._deserialize, response) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} 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 new file mode 100644 index 00000000000..fc729cd3194 --- /dev/null +++ b/src/scheduled-query/azext_scheduled_query/vendored_sdks/azure_mgmt_scheduled_query/version.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. +# -------------------------------------------------------------------------- + +VERSION = "2020-05-01-preview" + diff --git a/src/scheduled-query/setup.py b/src/scheduled-query/setup.py index c01e5f1f5e8..b8ff2e55dd0 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.0' +VERSION = '0.3.1' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers