Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ interactions:
ParameterSetName:
- -n -g --query -o
User-Agent:
- AZURECLI/2.23.0 azsdk-python-azure-mgmt-storage/17.1.0 Python/3.7.7 (Windows-10-10.0.19041-SP0)
- AZURECLI/2.24.0 azsdk-python-azure-mgmt-storage/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/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000002?api-version=2021-04-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_lp_create000001/providers/Microsoft.Storage/storageAccounts/clitest000002?api-version=2021-04-01
response:
body:
string: '{"sku":{"name":"Standard_LRS","tier":"Standard"},"kind":"Storage","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000002","name":"clitest000002","type":"Microsoft.Storage/storageAccounts","location":"southcentralus","tags":{},"properties":{"keyCreationTime":{"key1":"2021-05-12T02:44:06.3722100Z","key2":"2021-05-12T02:44:06.3722100Z"},"privateEndpointConnections":[],"networkAcls":{"bypass":"AzureServices","virtualNetworkRules":[],"ipRules":[],"defaultAction":"Allow"},"supportsHttpsTrafficOnly":true,"encryption":{"services":{"file":{"keyType":"Account","enabled":true,"lastEnabledTime":"2021-05-12T02:44:06.3722100Z"},"blob":{"keyType":"Account","enabled":true,"lastEnabledTime":"2021-05-12T02:44:06.3722100Z"}},"keySource":"Microsoft.Storage"},"provisioningState":"Succeeded","creationTime":"2021-05-12T02:44:06.3253300Z","primaryEndpoints":{"blob":"https://clitest000002.blob.core.windows.net/","queue":"https://clitest000002.queue.core.windows.net/","table":"https://clitest000002.table.core.windows.net/","file":"https://clitest000002.file.core.windows.net/"},"primaryLocation":"southcentralus","statusOfPrimary":"available"}}'
string: '{"sku":{"name":"Standard_LRS","tier":"Standard"},"kind":"Storage","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_lp_create000001/providers/Microsoft.Storage/storageAccounts/clitest000002","name":"clitest000002","type":"Microsoft.Storage/storageAccounts","location":"southcentralus","tags":{},"properties":{"keyCreationTime":{"key1":"2021-05-24T03:20:12.5094111Z","key2":"2021-05-24T03:20:12.5094111Z"},"privateEndpointConnections":[],"networkAcls":{"bypass":"AzureServices","virtualNetworkRules":[],"ipRules":[],"defaultAction":"Allow"},"supportsHttpsTrafficOnly":true,"encryption":{"services":{"file":{"keyType":"Account","enabled":true,"lastEnabledTime":"2021-05-24T03:20:12.5094111Z"},"blob":{"keyType":"Account","enabled":true,"lastEnabledTime":"2021-05-24T03:20:12.5094111Z"}},"keySource":"Microsoft.Storage"},"provisioningState":"Succeeded","creationTime":"2021-05-24T03:20:12.4177477Z","primaryEndpoints":{"blob":"https://clitest000002.blob.core.windows.net/","queue":"https://clitest000002.queue.core.windows.net/","table":"https://clitest000002.table.core.windows.net/","file":"https://clitest000002.file.core.windows.net/"},"primaryLocation":"southcentralus","statusOfPrimary":"available"}}'
headers:
cache-control:
- no-cache
Expand All @@ -27,7 +27,7 @@ interactions:
content-type:
- application/json
date:
- Wed, 12 May 2021 02:44:26 GMT
- Mon, 24 May 2021 03:20:34 GMT
expires:
- '-1'
pragma:
Expand All @@ -46,51 +46,7 @@ interactions:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- monitor log-profiles list
Connection:
- keep-alive
User-Agent:
- AZURECLI/2.23.0 azsdk-python-azure-mgmt-monitor/2.0.0 Python/3.7.7 (Windows-10-10.0.19041-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/logprofiles?api-version=2016-03-01
response:
body:
string: '{"value":[]}'
headers:
cache-control:
- no-cache
content-length:
- '12'
content-type:
- application/json; charset=utf-8
date:
- Wed, 12 May 2021 02:44:28 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
status:
code: 200
message: OK
- request:
body: '{"location": "southcentralus", "properties": {"storageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000002",
body: '{"location": "southcentralus", "properties": {"storageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_lp_create000001/providers/Microsoft.Storage/storageAccounts/clitest000002",
"locations": ["westus", "southcentralus"], "categories": ["Write"], "retentionPolicy":
{"enabled": false, "days": 1095}}}'
headers:
Expand All @@ -109,12 +65,12 @@ interactions:
ParameterSetName:
- --categories --enabled --days --location --locations --name --storage-account-id
User-Agent:
- AZURECLI/2.23.0 azsdk-python-azure-mgmt-monitor/2.0.0 Python/3.7.7 (Windows-10-10.0.19041-SP0)
- AZURECLI/2.24.0 azsdk-python-azure-mgmt-monitor/2.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/providers/microsoft.insights/logprofiles/clitest000003?api-version=2016-03-01
response:
body:
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/logprofiles/clitest000003","type":null,"name":"clitest000003","location":"southcentralus","kind":null,"tags":null,"properties":{"storageAccountId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000002","serviceBusRuleId":null,"locations":["westus","southcentralus"],"categories":["Write"],"retentionPolicy":{"enabled":false,"days":1095}},"identity":null}'
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/logprofiles/clitest000003","type":null,"name":"clitest000003","location":"southcentralus","kind":null,"tags":null,"properties":{"storageAccountId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_lp_create000001/providers/Microsoft.Storage/storageAccounts/clitest000002","serviceBusRuleId":null,"locations":["westus","southcentralus"],"categories":["Write"],"retentionPolicy":{"enabled":false,"days":1095}},"identity":null}'
headers:
cache-control:
- no-cache
Expand All @@ -123,7 +79,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Wed, 12 May 2021 02:44:31 GMT
- Mon, 24 May 2021 03:20:38 GMT
expires:
- '-1'
pragma:
Expand All @@ -139,7 +95,7 @@ interactions:
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-writes:
- '1187'
- '1199'
status:
code: 200
message: OK
Expand All @@ -159,7 +115,7 @@ interactions:
ParameterSetName:
- -n
User-Agent:
- AZURECLI/2.23.0 azsdk-python-azure-mgmt-monitor/2.0.0 Python/3.7.7 (Windows-10-10.0.19041-SP0)
- AZURECLI/2.24.0 azsdk-python-azure-mgmt-monitor/2.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0)
method: DELETE
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/logprofiles/clitest000003?api-version=2016-03-01
response:
Expand All @@ -171,7 +127,7 @@ interactions:
content-length:
- '0'
date:
- Wed, 12 May 2021 02:44:33 GMT
- Mon, 24 May 2021 03:20:39 GMT
expires:
- '-1'
pragma:
Expand All @@ -183,7 +139,7 @@ interactions:
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-deletes:
- '14998'
- '14999'
status:
code: 200
message: OK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@


class TestActionGroupScenarios(ScenarioTest):
@ResourceGroupPreparer(location='southcentralus')

@ResourceGroupPreparer(name_prefix='cli_test_monitor_ag_basic', location='southcentralus')
def test_monitor_action_group_basic_scenario(self, resource_group):
# the prefix is intentionally keep long so as to test the default short name conversion
action_group_name = self.create_random_name('cliactiongrouptest', 32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer, StorageAccountPreparer, live_only
import mock
import unittest
from msrestazure.tools import resource_id


Expand Down Expand Up @@ -193,7 +194,8 @@ def test_monitor_clone_public_ip_metric_alerts_scenario(self, resource_group):


class MonitorCloneStorageAccountAcrossSubsScenarios(ScenarioTest):
@live_only()
@unittest.skip('Accross subs are not supported now.')
# @live_only()
@ResourceGroupPreparer(name_prefix='cli_test_metric_alert_clone')
def test_monitor_clone_storage_metric_alerts_across_subs_scenario(self, resource_group):
self.kwargs.update({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@


class TestLogProfileScenarios(ScenarioTest):
@ResourceGroupPreparer(location='southcentralus')

@ResourceGroupPreparer(name_prefix='cli_test_monitor_lp_create', location='southcentralus')
@StorageAccountPreparer(location='southcentralus')
def test_monitor_create_log_profile(self, resource_group, storage_account):
self.kwargs.update({
'name': self.create_random_name('clitest', 20)
})
self.kwargs['storage'] = self.cmd('storage account show -n {sa} -g {rg} --query id -otsv').output.strip()
profiles = self.cmd("monitor log-profiles list").get_output_in_json()
for profile in profiles:
name = profile['name']
self.cmd("monitor log-profiles delete -n {}".format(name))
self.cmd("monitor log-profiles create --categories 'Write' --enabled false --days 1095 --location southcentralus --locations westus southcentralus --name {name} --storage-account-id {storage}", checks=[
self.check('storageAccountId', '{storage}'),
self.check('serviceBusRuleId', None),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ def test_metrics_alert_metric_name_with_special_characters(self, resource_group)
})

from azure.core.exceptions import HttpResponseError
with self.assertRaisesRegexp(HttpResponseError, 'were not found: MS-ERRORCODE-SU001'):
with self.assertRaisesRegexp(HttpResponseError, "Couldn't find a metric named MS-ERRORCODE-SU001"):
self.cmd('monitor metrics alert create -n {alert_name} -g {rg}'
' --scopes {storage_account_id}'
' --region {storage_location}'
' --condition "count account.MS-ERRORCODE-SU001 > 4" --description "Cloud_lumico"')

with self.assertRaisesRegexp(HttpResponseError, 'were not found: MS-ERRORCODE|,-SU001'):
with self.assertRaisesRegexp(HttpResponseError, "Couldn't find a metric named MS-ERRORCODE|,-SU001"):
self.cmd('monitor metrics alert create -n {alert_name} -g {rg}'
' --scopes {storage_account_id}'
' --region {storage_location}'
Expand Down