Skip to content

Commit

Permalink
[Elastic] Initial GA Elastic (#3921)
Browse files Browse the repository at this point in the history
* first generation

* regen the elastic extension

* fix sytle

* fix recording

* add codeowners

* rename commands

* update readme
  • Loading branch information
00Kai0 authored Oct 21, 2021
1 parent 9745a8d commit 215720a
Show file tree
Hide file tree
Showing 60 changed files with 9,127 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,5 @@
/src/authV2/ @mkarmark

/src/purview/ @kairu-ms @jsntcy

/src/elastic/ @kairu-ms @jsntcy
8 changes: 8 additions & 0 deletions src/elastic/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:
Release History
===============

0.1.0
++++++
* Initial release.
77 changes: 77 additions & 0 deletions src/elastic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Azure CLI elastic Extension #
This is the extension for elastic

### How to use ###
Install this extension using the below CLI command
```
az extension add --name elastic
```

### Included Features ###
#### elastic monitor ####
##### Create #####
```
az elastic monitor create --monitor-name "myMonitor" --name "myMonitor" --location "West US 2" \
--user-info "{\\"companyInfo\\":{\\"business\\":\\"Technology\\",\\"country\\":\\"US\\",\\"domain\\":\\"microsoft.com\\",\\"employeeNumber\\":\\"10000\\",\\"state\\":\\"WA\\"},\\"companyName\\":\\"Microsoft\\",\\"emailAddress\\":\\"alice@microsoft.com\\",\\"firstName\\":\\"Alice\\",\\"lastName\\":\\"Bob\\"}" \
--sku "free_Monthly" --tags Environment="Dev" --resource-group "myResourceGroup"
az elastic monitor wait --created --monitor-name "{myMonitor}" --resource-group "{rg}"
```
##### Show #####
```
az elastic monitor show --name "myMonitor" --resource-group "myResourceGroup"
```
##### List #####
```
az elastic monitor list --resource-group "myResourceGroup"
```
##### Update #####
```
az elastic monitor update --name "myMonitor" --tags Environment="Dev" --resource-group "myResourceGroup"
```
##### Delete #####
```
az elastic monitor delete --name "myMonitor" --resource-group "myResourceGroup"
```
##### List Resource #####
```
az elastic monitor list-resource --name "myMonitor" --resource-group "myResourceGroup"
```
##### List Deployment Info #####
```
az elastic monitor list-deployment-info --name "myMonitor" --resource-group "myResourceGroup"
```
##### List VM Host #####
```
az elastic monitor list-vm-host --name "myMonitor" --resource-group "myResourceGroup"
```
##### List VM Ingestion Detail #####
```
az elastic monitor list-vm-ingestion-detail --name "myMonitor" --resource-group "myResourceGroup"
```
##### Update VM Collection #####
```
az elastic monitor update-vm-collection --name "myMonitor" --operation-name "Add" --vm-resource-id \
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtual\
machines/myVM" --resource-group "myResourceGroup"
```
#### elastic monitor tag-rule ####
##### Create #####
```
az elastic monitor tag-rule create --monitor-name "myMonitor" \
--filtering-tags name="Environment" action="Include" value="Prod" \
--filtering-tags name="Environment" action="Exclude" value="Dev" --send-aad-logs false --send-activity-logs true \
--send-subscription-logs true --resource-group "myResourceGroup" --rule-set-name "default"
```
##### Show #####
```
az monitor elastic tag-rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name "default"
```
##### List #####
```
az monitor elastic tag-rule list --monitor-name "myMonitor" --resource-group "myResourceGroup"
```
##### Delete #####
```
az monitor elastic tag-rule delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name "default"
```
53 changes: 53 additions & 0 deletions src/elastic/azext_elastic/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
# pylint: disable=unused-import

import azext_elastic._help
from azure.cli.core import AzCommandsLoader


class MicrosoftElasticCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_elastic.generated._client_factory import cf_elastic_cl
elastic_custom = CliCommandType(
operations_tmpl='azext_elastic.custom#{}',
client_factory=cf_elastic_cl)
parent = super(MicrosoftElasticCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=elastic_custom)

def load_command_table(self, args):
from azext_elastic.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_elastic.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError as e:
if e.name.endswith('manual.commands'):
pass
else:
raise e
return self.command_table

def load_arguments(self, command):
from azext_elastic.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_elastic.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError as e:
if e.name.endswith('manual._params'):
pass
else:
raise e


COMMAND_LOADER_CLS = MicrosoftElasticCommandsLoader
20 changes: 20 additions & 0 deletions src/elastic/azext_elastic/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import
# pylint: disable=unused-import
from .generated._help import helps # pylint: disable=reimported
try:
from .manual._help import helps # pylint: disable=reimported
except ImportError as e:
if e.name.endswith('manual._help'):
pass
else:
raise e
20 changes: 20 additions & 0 deletions src/elastic/azext_elastic/action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError as e:
if e.name.endswith('manual.action'):
pass
else:
raise e
4 changes: 4 additions & 0 deletions src/elastic/azext_elastic/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.15.0"
}
20 changes: 20 additions & 0 deletions src/elastic/azext_elastic/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.custom import * # noqa: F403
try:
from .manual.custom import * # noqa: F403
except ImportError as e:
if e.name.endswith('manual.custom'):
pass
else:
raise e
12 changes: 12 additions & 0 deletions src/elastic/azext_elastic/generated/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
44 changes: 44 additions & 0 deletions src/elastic/azext_elastic/generated/_client_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------


def cf_elastic_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_elastic.vendored_sdks.elastic import MicrosoftElastic
return get_mgmt_service_client(cli_ctx,
MicrosoftElastic)


def cf_monitor(cli_ctx, *_):
return cf_elastic_cl(cli_ctx).monitors


def cf_monitored_resource(cli_ctx, *_):
return cf_elastic_cl(cli_ctx).monitored_resources


def cf_deployment_info(cli_ctx, *_):
return cf_elastic_cl(cli_ctx).deployment_info


def cf_tag_rule(cli_ctx, *_):
return cf_elastic_cl(cli_ctx).tag_rules


def cf_vm_host(cli_ctx, *_):
return cf_elastic_cl(cli_ctx).vm_host


def cf_vm_ingestion(cli_ctx, *_):
return cf_elastic_cl(cli_ctx).vm_ingestion


def cf_vm_collection(cli_ctx, *_):
return cf_elastic_cl(cli_ctx).vm_collection
Loading

0 comments on commit 215720a

Please sign in to comment.