Skip to content

Commit

Permalink
[Logz.io] Draft pull request
Browse files Browse the repository at this point in the history
* rename command group

* simplify several commands

* add alias for long parameter

* add replacer for credential scan

* fix style and linter check
  • Loading branch information
necusjz committed Oct 28, 2021
1 parent 98e777d commit 339406b
Show file tree
Hide file tree
Showing 58 changed files with 19,291 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 @@ -36,6 +36,8 @@

/src/log-analytics/ @alexeldeib

/src/logz/ @kairu-ms @necusjz

/src/mesh/ @linggengmsft @jeffj6123

/src/mixed-reality/ @xiangyul
Expand Down
8 changes: 8 additions & 0 deletions src/logz/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:
Release History
===============

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

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

### Included Features ###
#### logz monitor ####
##### Create #####
```
az logz monitor create --name "myMonitor" --location "West US" \
--plan-data billing-cycle="Monthly" effective-date="2019-08-30T15:14:33+02:00" plan-details="logzapitestplan" usage-type="Committed" \
--user-info email-address="[email protected]" first-name="Alice" last-name="Bob" phone-number="123456" \
--tags Environment="Dev" --resource-group "myResourceGroup"
az logz monitor wait --created --name "{myMonitor}" --resource-group "{rg}"
```
##### Show #####
```
az logz monitor show --name "myMonitor" --resource-group "myResourceGroup"
```
##### List #####
```
az logz monitor list --resource-group "myResourceGroup"
```
##### Update #####
```
az logz monitor update --name "myMonitor" --monitoring-status "Enabled" --tags Environment="Dev" \
--resource-group "myResourceGroup"
```
##### List-payload #####
```
az logz monitor list-payload --name "myMonitor" --resource-group "myResourceGroup"
```
##### List-resource #####
```
az logz monitor list-resource --name "myMonitor" --resource-group "myResourceGroup"
```
##### List-role #####
```
az logz monitor list-role --name "myMonitor" --resource-group "myResourceGroup"
```
##### List-vm #####
```
az logz monitor list-vm --name "myMonitor" --resource-group "myResourceGroup"
```
##### Update-vm #####
```
az logz monitor update-vm --name "myMonitor" --state "Install" --resource-group "myResourceGroup"
```
##### Delete #####
```
az logz monitor delete --name "myMonitor" --resource-group "myResourceGroup"
```
#### logz rule ####
##### Create #####
```
az logz 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 logz rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name "default"
```
##### List #####
```
az logz rule list --monitor-name "myMonitor" --resource-group "myResourceGroup"
```
##### Delete #####
```
az logz rule delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name "default"
```
#### logz sso ####
##### Create #####
```
az logz sso create --configuration-name "default" --monitor-name "myMonitor" \
--properties enterprise-app-id="00000000-0000-0000-0000-000000000000" single-sign-on-state="Enable" single-sign-on-url=null \
--resource-group "myResourceGroup"
```
##### Show #####
```
az logz sso show --configuration-name "default" --monitor-name "myMonitor" --resource-group "myResourceGroup"
```
##### List #####
```
az logz sso list --monitor-name "myMonitor" --resource-group "myResourceGroup"
```
#### logz sub-account ####
##### Create #####
```
az logz sub-account create --monitor-name "myMonitor" --type "Microsoft.Logz/monitors" --location "West US" \
--monitoring-status "Enabled" --tags Environment="Dev" --resource-group "myResourceGroup" --name "SubAccount1"
az logz sub-account wait --created --monitor-name "{myMonitor}" --resource-group "{rg}" --name "{mySubAccount}"
```
##### Show #####
```
az logz sub-account show --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "SubAccount1"
```
##### List #####
```
az logz sub-account list --monitor-name "myMonitor" --resource-group "myResourceGroup"
```
##### Update #####
```
az logz sub-account update --monitor-name "myMonitor" --monitoring-status "Enabled" --tags Environment="Dev" \
--resource-group "myResourceGroup" --name "SubAccount1"
```
##### List-payload #####
```
az logz sub-account list-payload --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "SubAccount1"
```
##### List-resource #####
```
az logz sub-account list-resource --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "SubAccount1"
```
##### List-vm #####
```
az logz sub-account list-vm --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "SubAccount1"
```
##### Update-vm #####
```
az logz sub-account update-vm --monitor-name "myMonitor" --state "Install" --resource-group "myResourceGroup" \
--name "SubAccount1"
```
##### Delete #####
```
az logz sub-account delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "someName"
```
#### logz sub-rule ####
##### Create #####
```
az logz sub-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" \
--sub-account-name "SubAccount1"
```
##### Show #####
```
az logz sub-rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name "default" \
--sub-account-name "SubAccount1"
```
##### List #####
```
az logz sub-rule list --monitor-name "myMonitor" --resource-group "myResourceGroup" --sub-account-name "SubAccount1"
```
##### Delete #####
```
az logz sub-rule delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name "default" \
--sub-account-name "SubAccount1"
```
53 changes: 53 additions & 0 deletions src/logz/azext_logz/__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_logz._help
from azure.cli.core import AzCommandsLoader


class MicrosoftLogzCommandsLoader(AzCommandsLoader):

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

def load_command_table(self, args):
from azext_logz.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_logz.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_logz.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_logz.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 = MicrosoftLogzCommandsLoader
20 changes: 20 additions & 0 deletions src/logz/azext_logz/_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/logz/azext_logz/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/logz/azext_logz/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/logz/azext_logz/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/logz/azext_logz/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__)
36 changes: 36 additions & 0 deletions src/logz/azext_logz/generated/_client_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# --------------------------------------------------------------------------
# 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_logz_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_logz.vendored_sdks.logz import MicrosoftLogz
return get_mgmt_service_client(cli_ctx,
MicrosoftLogz)


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


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


def cf_single_sign_on(cli_ctx, *_):
return cf_logz_cl(cli_ctx).single_sign_on


def cf_sub_account(cli_ctx, *_):
return cf_logz_cl(cli_ctx).sub_account


def cf_sub_account_tag_rule(cli_ctx, *_):
return cf_logz_cl(cli_ctx).sub_account_tag_rules
Loading

0 comments on commit 339406b

Please sign in to comment.