Skip to content

Commit d56c2c2

Browse files
authored
AEM: initial change for Azure Enhanced Monitoring Extension for SAP (#41)
* initial code * copy code over * wip * fix a few lint errors * address review feedback * add code owner * fix lint error * revert unnecessary script change * fix an incorrect usage of get_models
1 parent dbf5f18 commit d56c2c2

File tree

11 files changed

+1919
-1
lines changed

11 files changed

+1919
-1
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88

99
/src/eventhubs/ @v-ajnava
1010

11-
/src/webapps/ @panchagnula
11+
/src/webapps/ @panchagnula
12+
13+
/src/aem/ @yugangw-msft

src/aem/azext_aem/__init__.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
6+
from azure.cli.core import AzCommandsLoader
7+
8+
import azext_aem._help # pylint: disable=unused-import
9+
10+
11+
class AEMCommandsLoader(AzCommandsLoader):
12+
13+
def __init__(self, cli_ctx=None):
14+
from azure.cli.core.commands import CliCommandType
15+
aem_custom = CliCommandType(
16+
operations_tmpl='azext_aem.custom#{}')
17+
super(AEMCommandsLoader, self).__init__(cli_ctx=cli_ctx,
18+
custom_command_type=aem_custom)
19+
20+
def load_command_table(self, _):
21+
with self.command_group('vm aem', min_api='2016-04-30-preview') as g:
22+
g.custom_command('set', 'set_aem')
23+
g.custom_command('delete', 'delete_aem')
24+
g.custom_command('verify', 'verify_aem')
25+
26+
return self.command_table
27+
28+
def load_arguments(self, _):
29+
# pylint: disable=line-too-long
30+
from knack.arguments import CLIArgumentType
31+
from azure.cli.core.commands.parameters import get_resource_name_completion_list
32+
name_arg_type = CLIArgumentType(options_list=['--name', '-n'], metavar='NAME')
33+
existing_vm_name = CLIArgumentType(overrides=name_arg_type,
34+
configured_default='vm',
35+
help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=<name>`",
36+
completer=get_resource_name_completion_list('Microsoft.Compute/virtualMachines'), id_part='name')
37+
38+
with self.argument_context('vm aem') as c:
39+
c.argument('vm_name', existing_vm_name)
40+
c.argument('skip_storage_check', action='store_true',
41+
help='Disables the test for table content')
42+
c.argument('skip_storage_analytics', action='store_true',
43+
help='skip enabling analytics on storage accounts')
44+
c.argument('wait_time_in_minutes', type=int,
45+
help='Maximum minutes to wait for the storage metrics to be available')
46+
47+
48+
COMMAND_LOADER_CLS = AEMCommandsLoader

src/aem/azext_aem/_help.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
6+
from knack.help_files import helps
7+
8+
helps['vm aem'] = """
9+
type: group
10+
short-summary: Manage Azure Enhanced Monitoring Extension for SAP
11+
"""
12+
13+
helps['vm aem set'] = """
14+
type: command
15+
short-summary: Configure Azure Enhanced Monitoring Extension
16+
long-summary: It can take up to 15 minutes for the monitoring data to appear in the SAP system
17+
"""
18+
19+
helps['vm aem delete'] = """
20+
type: command
21+
short-summary: Remove Azure Enhanced Monitoring Extension
22+
"""
23+
24+
helps['vm aem verify'] = """
25+
type: command
26+
short-summary: Verify Azure Enhanced Monitoring Extensions configured correctly
27+
"""
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"azext.minCliCoreVersion": "2.0.24"
3+
}

src/aem/azext_aem/custom.py

Lines changed: 549 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------

src/aem/azext_aem/tests/recordings/latest/test_vm_aem_configure.yaml

Lines changed: 1206 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
6+
from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer)
7+
8+
# pylint: disable=unused-argument,too-few-public-methods
9+
10+
11+
class VMAEM(ScenarioTest):
12+
13+
@ResourceGroupPreparer()
14+
def test_vm_aem_configure(self, resource_group):
15+
self.kwargs.update({
16+
'vm': 'vm1',
17+
})
18+
self.cmd('vm create -g {rg} -n {vm} --image centos')
19+
self.cmd('vm aem set -g {rg} -n {vm}')
20+
self.cmd('vm aem verify -g {rg} -n {vm}')
21+
self.cmd('vm aem delete -g {rg} -n {vm}')
22+
self.cmd('vm aem verify -g {rg} -n {vm}')

src/aem/readme.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Azure CLI Enhanced Monitoring Extension #
2+
This is an extension to azure cli which provides commands to configure, verify and remove Azure Enhanced Monitoring Extension for SAP
3+
4+
## How to use ##
5+
First, install the extension:
6+
```
7+
az extension add --name aem
8+
```
9+
10+
Then, call it as you would any other az command:
11+
```
12+
az vm aem set --resource-group rg --name vm1
13+
```

src/aem/setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[bdist_wheel]
2+
universal=1

0 commit comments

Comments
 (0)