Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

AEM: initial change for Azure Enhanced Monitoring Extension for SAP #41

Merged
merged 9 commits into from
Feb 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@

/src/eventhubs/ @v-ajnava

/src/webapps/ @panchagnula
/src/webapps/ @panchagnula

/src/aem/ @yugangw-msft
48 changes: 48 additions & 0 deletions src/aem/azext_aem/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader

import azext_aem._help # pylint: disable=unused-import


class AEMCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
aem_custom = CliCommandType(
operations_tmpl='azext_aem.custom#{}')
super(AEMCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=aem_custom)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set min profile here like with other command modules so it doesn't appear on the stack profile.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I put a comment in the code to do this, but looks like i still forgot it


def load_command_table(self, _):
with self.command_group('vm aem', min_api='2016-04-30-preview') as g:
g.custom_command('set', 'set_aem')
g.custom_command('delete', 'delete_aem')
g.custom_command('verify', 'verify_aem')

return self.command_table

def load_arguments(self, _):
# pylint: disable=line-too-long
from knack.arguments import CLIArgumentType
from azure.cli.core.commands.parameters import get_resource_name_completion_list
name_arg_type = CLIArgumentType(options_list=['--name', '-n'], metavar='NAME')
existing_vm_name = CLIArgumentType(overrides=name_arg_type,
configured_default='vm',
help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=<name>`",
completer=get_resource_name_completion_list('Microsoft.Compute/virtualMachines'), id_part='name')

with self.argument_context('vm aem') as c:
c.argument('vm_name', existing_vm_name)
c.argument('skip_storage_check', action='store_true',
help='Disables the test for table content')
c.argument('skip_storage_analytics', action='store_true',
help='skip enabling analytics on storage accounts')
c.argument('wait_time_in_minutes', type=int,
help='Maximum minutes to wait for the storage metrics to be available')


COMMAND_LOADER_CLS = AEMCommandsLoader
27 changes: 27 additions & 0 deletions src/aem/azext_aem/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from knack.help_files import helps

helps['vm aem'] = """
type: group
short-summary: Manage Azure Enhanced Monitoring Extension for SAP
"""

helps['vm aem set'] = """
type: command
short-summary: Configure Azure Enhanced Monitoring Extension
long-summary: It can take up to 15 minutes for the monitoring data to appear in the SAP system
"""

helps['vm aem delete'] = """
type: command
short-summary: Remove Azure Enhanced Monitoring Extension
"""

helps['vm aem verify'] = """
type: command
short-summary: Verify Azure Enhanced Monitoring Extensions configured correctly
"""
3 changes: 3 additions & 0 deletions src/aem/azext_aem/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"azext.minCliCoreVersion": "2.0.24"
}
549 changes: 549 additions & 0 deletions src/aem/azext_aem/custom.py

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/aem/azext_aem/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
1,206 changes: 1,206 additions & 0 deletions src/aem/azext_aem/tests/recordings/latest/test_vm_aem_configure.yaml

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions src/aem/azext_aem/tests/test_aem_commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer)

# pylint: disable=unused-argument,too-few-public-methods


class VMAEM(ScenarioTest):

@ResourceGroupPreparer()
def test_vm_aem_configure(self, resource_group):
self.kwargs.update({
'vm': 'vm1',
})
self.cmd('vm create -g {rg} -n {vm} --image centos')
self.cmd('vm aem set -g {rg} -n {vm}')
self.cmd('vm aem verify -g {rg} -n {vm}')
self.cmd('vm aem delete -g {rg} -n {vm}')
self.cmd('vm aem verify -g {rg} -n {vm}')
13 changes: 13 additions & 0 deletions src/aem/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Azure CLI Enhanced Monitoring Extension #
This is an extension to azure cli which provides commands to configure, verify and remove Azure Enhanced Monitoring Extension for SAP

## How to use ##
First, install the extension:
```
az extension add --name aem
```

Then, call it as you would any other az command:
```
az vm aem set --resource-group rg --name vm1
```
2 changes: 2 additions & 0 deletions src/aem/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal=1
42 changes: 42 additions & 0 deletions src/aem/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env python

# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from codecs import open
from setuptools import setup, find_packages

VERSION = "0.0.1"

CLASSIFIERS = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'License :: OSI Approved :: MIT License',
]

DEPENDENCIES = []

setup(
name='aem',
version=VERSION,
description='CLI Extension to managed Azure Enhanced Monitoring Extension for SAP',
long_description='N/A',
license='MIT',
author='Yugang Wang',
author_email='yugangw@microsoft.com',
url='https://github.com/Azure/azure-cli-extensions',
classifiers=CLASSIFIERS,
package_data={'azext_aem': ['azext_metadata.json']},
packages=find_packages(exclude=["tests"]),
install_requires=DEPENDENCIES
)