Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d26914d
Init SDK of API Version 2019-11-01
Jan 16, 2020
71a48e8
Init HISTORY.rst
Jan 16, 2020
24d14cf
Init README.md
Jan 16, 2020
d51c979
Init setup.py
Jan 16, 2020
3ff1ca4
Init extension structure
Jan 16, 2020
80d7ef6
Init draft code
Jan 16, 2020
5ef270c
Test get connection monitor and argparse action
Jan 16, 2020
4435032
Overwrite az network watcher connection-monitor create
Jan 18, 2020
e7e0640
Init _create_nw_connection_monidor_endpoint() and refect endpoint arg…
Jan 19, 2020
3d6eefb
Add parameters for test-configuration and test-group when creating CMv2
Jan 20, 2020
1707ef3
Init _create_nw_connection_monitor_v2_test_configuration()
Jan 27, 2020
bf2e375
Init _create_nw_connection_monitor_v2_test_group()
Jan 27, 2020
4abb624
Add default value to accelerate creation
Jan 28, 2020
ce50a54
Init command `network watcher connection-monitor endpoint add`
Jan 29, 2020
e4e7449
Init command `network watcher connection-monitor endpoint remove`
Jan 29, 2020
57ca778
Init command `network watcher connection-monitor endpoint show`
Jan 29, 2020
c5498c5
Init command `network watcher connection-monitor endpoint list`
Jan 29, 2020
3382cc5
command: network watcher connection-monitor test-configuration add
Jan 29, 2020
04c2892
command: network watcher connection-monitor test-configuration remove
Jan 29, 2020
412e930
command: network watcher connection-monitor test-configuration show
Jan 29, 2020
eca71a2
command: network watcher connection-monitor test-configuration list
Jan 29, 2020
c45f5ac
command: network watcher connection-monitor test-group add
Jan 30, 2020
c19c939
command: network watcher connection-monitor test-group remove
Jan 30, 2020
c96f555
command: network watcher connection-monitor test-group show
Jan 30, 2020
cbaf956
command: network watcher connection-monitor test-group list
Jan 30, 2020
df0c0e5
Refactor SDK directory
Jan 31, 2020
356e720
Refactor SDK directory
Jan 31, 2020
25f05a1
Add SDK of API Version 2019-06-01
Jan 31, 2020
4f79f12
Hack _create_nw_connection_monitor_v1() to allow to create V1 paramet…
Jan 31, 2020
924767d
Add test test_nw_connection_monitor_v2_creation
Feb 1, 2020
0f70087
Add test_nw_connection_monitor_v2_endpoint
Feb 1, 2020
c17b7b6
Add test_nw_connection_monitor_v2_test_configuration
Feb 2, 2020
6d1d5a8
Add test_connection_monitor_v2_test_group
Feb 2, 2020
5254a93
Add output option for create a V2 connection monitor
Feb 2, 2020
cf52a61
command: network watcher connection-monitor output add
Feb 2, 2020
5d87d49
command: network watcher connection-monitor output remove
Feb 2, 2020
cf561f2
command: network watcher connection-monitor output list
Feb 2, 2020
104e3c6
Merge branch 'master' into connection-monitor-v2
Feb 2, 2020
e6914d3
Fix code style error
Feb 2, 2020
eebac19
Fix flake8 error
Feb 2, 2020
ad43806
Update github code owner
Feb 2, 2020
05726c7
Use custom_show_command() instead custom_command()
Feb 3, 2020
113f1d8
Add azure-cli>=2.0.80 requirement warning
Feb 3, 2020
c7e234d
Add test_nw_connection_monitor_v1
Feb 3, 2020
81d03fa
Add long summary of help command and regroup arguments
Feb 3, 2020
074a669
Merge branch 'master' into connection-monitor-v2
Feb 3, 2020
1d50147
Change default location to westus in test
Feb 4, 2020
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
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@
/src/connectedmachine/ @farehar

/src/ip-group/ @haroldrandom

/src/connection-monitor-preview/ @haroldrandom
12 changes: 12 additions & 0 deletions src/connection-monitor-preview/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. :changelog:

Release History
===============

0.1.0
++++++
* Support to update connection-monitor with new V2 parameters set:
* `az network watcher connection-monitor endpoint add/remove`
* `az network watcher connection-monitor test-configuration add/remove`
* `az network watcher connection-monitor test-group add/remove`
* `az network watcher connection-monitor output add/remove`
19 changes: 19 additions & 0 deletions src/connection-monitor-preview/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Azure CLI Connection Monitor V2 Extension #
This is an extension to Azure CLI to manage Connection Monitor V2 preview features.
Connection monitor now supports to create V1 and V2 version of connection monitor.
- V1 connection monitor supports single source and destination endpoint which comes with V1 argument groups as usual. You can start/stop them.
- V2 connection monitor supports multiple endpoints and several test protocol which comes with V2 argument groups. You can disable/enable them in test group.

## How to use ##
First, install the extension:
```
az extension add --name connection-monitor-preview
```

Then, call the help to find out usage:
```
az network watcher connection-monitor -h
```

## Requirements ##
This extension requires `azure-cli >= 2.0.80` and support at most `azure-cli <= 2.0.82`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# --------------------------------------------------------------------------------------------
# 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
from azure.cli.core.profiles import register_resource_type

from ._client_factory import cf_nw_connection_monitor
from ._help import helps # pylint: disable=unused-import


class NWConnectionMonitorCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from .profiles import CUSTOM_NW_CONNECTION_MONITOR

register_resource_type('latest', CUSTOM_NW_CONNECTION_MONITOR, '2019-11-01')

nw_connection_monitor = CliCommandType(
operations_tmpl='azext_connection_monitor_preview.custom#{}',
client_factory=cf_nw_connection_monitor
)

super(NWConnectionMonitorCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=nw_connection_monitor,
resource_type=CUSTOM_NW_CONNECTION_MONITOR)

def load_command_table(self, args):
from .commands import load_command_table
load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
from ._params import load_arguments
load_arguments(self, command)


COMMAND_LOADER_CLS = NWConnectionMonitorCommandsLoader
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.
# --------------------------------------------------------------------------------------------


def network_client_factory(cli_ctx, **_):
from .profiles import CUSTOM_NW_CONNECTION_MONITOR
from azure.cli.core.commands.client_factory import get_mgmt_service_client
return get_mgmt_service_client(cli_ctx, CUSTOM_NW_CONNECTION_MONITOR, api_version='2019-11-01')


def cf_nw_connection_monitor(cli_ctx, _):
return network_client_factory(cli_ctx).connection_monitors


def cf_nw_connection_monitor_v1(cli_ctx, **_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from .profiles import CUSTOM_NW_CONNECTION_MONITOR_V1
return get_mgmt_service_client(cli_ctx, CUSTOM_NW_CONNECTION_MONITOR_V1, api_version='2019-06-01')
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
# 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.
# --------------------------------------------------------------------------------------------

from knack.help_files import helps # pylint: disable=unused-import

helps['network watcher connection-monitor create'] = """
type: command
short-summary: Create a connection monitor.
long-summary: |
This extension allow to create V1 and V2 version of connection monitor.
V1 connection monitor supports single source and destination endpoint which comes with V1 argument groups as usual.
V2 connection monitor supports multiple endpoints and several test protocol which comes with V2 argument groups.
parameters:
- name: --source-resource
short-summary: >
Currently only Virtual Machines are supported.
- name: --dest-resource
short-summary: >
Currently only Virtual Machines are supported.
examples:
- name: Create a connection monitor for a virtual machine.
text: |
az network watcher connection-monitor create -g MyResourceGroup -n MyConnectionMonitorName \\
--source-resource MyVM
- name: Create a V2 connection monitor
text: >
az network watcher connection-monitor create
--location westus
--name MyV2ConnectionMonitor
--endpoint-source-name "vm01"
--endpoint-source-resource-id MyVM01ResourceID
--endpoint-dest-name bing
--endpoint-dest-address bing.com
--test-config-name TCPTestConfig
--protocol Tcp
--tcp-port 2048
"""


helps['network watcher connection-monitor endpoint'] = """
type: group
short-summary: Manage endpoint of a connection monitor
"""

helps['network watcher connection-monitor endpoint add'] = """
type: command
short-summary: Add an endpoint to a connection monitor
examples:
- name: Add an endpoint as destination
text: >
az network watcher connection-monitor endpoint add
--connection-monitor MyConnectionMonitor
--location westus
--name MyEndpoint
--address "bing.com"
--dest-test-groups DefaultTestGroup
- name: Add an endpoint as source
text: >
az network watcher connection-monitor endpoint add
--connection-monitor MyConnectionMonitor
--location westus
--name MyEndpoint
--resource-id MyVMResourceID
--source-test-groups DefaultTestGroup
- name: Add an endpoint with filter
text: >
az network watcher connection-monitor endpoint add
--connection-monitor MyConnectionMonitor
--location westus
--name MyEndpoint
--resource-id MyLogAnalysisWorkSpaceID
--source-test-groups DefaultTestGroup
--filter-type Include
--filter-item type=AgentAddress address=npmuser
--filter-item type=AgentAddress address=pypiuser
"""

helps['network watcher connection-monitor endpoint remove'] = """
type: command
short-summary: Remove an endpoint from a connection monitor
examples:
- name: Remove endpoint from all test groups of a connection monitor
text: >
az network watcher connection-monitor endpoint remove
--connection-monitor MyConnectionMonitor
--location westus
--name MyEndpoint
- name: Remove endpoint from two test groups of a connection monitor
text: >
az network watcher connection-monitor endpoint remove
--connection-monitor MyConnectionMonitor
--location westus
--name MyEndpoint
--test-groups DefaultTestGroup HealthCheckTestGroup
"""

helps['network watcher connection-monitor endpoint show'] = """
type: command
short-summary: Show an endpoint from a connection monitor
"""

helps['network watcher connection-monitor endpoint list'] = """
type: command
short-summary: List all endpoints form a connection monitor
"""

helps['network watcher connection-monitor test-configuration'] = """
type: group
short-summary: Manage test configuration of a connection monitor
"""

helps['network watcher connection-monitor test-configuration add'] = """
type: command
short-summary: Add a test configuration to a connection monitor
examples:
- name: Add a test configuration with HTTP supported
text: >
az network watcher connection-monitor test-configuration add
--connection-monitor MyConnectionMonitor
--location westus
--name MyHTTPTestConfiguration
--test-groups DefaultTestGroup
--protocol Http
--http-request-header name=Host value=bing.com
--http-request-header name=UserAgent value=Edge
- name: Add a test configuration with TCP supported
text: >
az network watcher connection-monitor test-configuration add
--connection-monitor MyConnectionMonitor
--location westus
--name MyHTTPTestConfiguration
--test-groups TCPTestGroup DefaultTestGroup
--protocol Tcp
--tcp-port 4096
"""

helps['network watcher connection-monitor test-configuration remove'] = """
type: command
short-summary: Remove a test configuration from a connection monitor
examples:
- name: Remove a test configuration from all test groups of a connection monitor
text: >
az network watcher connection-monitor test-configuration remove
--connection-monitor MyConnectionMonitor
--location westus
--name MyTCPTestConfiguration
- name: Remove a test configuration from two test groups of a connection monitor
text: >
az network watcher connection-monitor test-configuration remove
--connection-monitor MyConnectionMonitor
--location westus
--name MyHTTPTestConfiguration
--test-groups HTTPTestGroup DefaultTestGroup
"""

helps['network watcher connection-monitor test-configuration show'] = """
type: command
short-summary: Show a test configuration from a connection monitor
"""

helps['network watcher connection-monitor test-configuration list'] = """
type: command
short-summary: List all test configurations of a connection monitor
"""

helps['network watcher connection-monitor test-group'] = """
type: group
short-summary: Manage a test group of a connection monitor
"""

helps['network watcher connection-monitor test-group add'] = """
type: command
short-summary: Add a test group along with new-added/existing endpoint and test configuration to a connection monitor
examples:
- name: Add a test group along with existing endpoint and test configuration via their names
text: >
az network watcher connection-monitor test-group add
--connection-monitor MyConnectionMonitor
--location westus
--name MyHTTPTestGroup
--endpoint-source-name MySourceEndpoint
--endpoint-dest-name MyDestinationEndpoint
--test-config-name MyTestConfiguration
- name: Add a test group long with new-added source endpoint and existing test configuration via its name
text: >
az network watcher connection-monitor test-group add
--connection-monitor MyConnectionMonitor
--location westus
--name MyAccessibilityTestGroup
--endpoint-source-name MySourceEndpoint
--endpoint-source-resource-id MyLogAnalysisWorkspaceID
--endpoint-dest-name MyExistingDestinationEndpoint
--test-config-name MyExistingTestConfiguration
- name: Add a test group along with new-added endpoints and test configuration
text: >
az network watcher connection-monitor test-group add
--connection-monitor MyConnectionMonitor
--location westus
--name MyAccessibilityTestGroup
--endpoint-source-name MySourceEndpoint
--endpoint-source-resource-id MyVMResourceID
--endpoint-dest-name bing
--endpoint-dest-address bing.com
--test-config-name MyNewTestConfiguration
--protocol Tcp
--tcp-port 4096
"""

helps['network watcher connection-monitor test-group remove'] = """
type: command
short-summary: Remove test group from a connection monitor
"""

helps['network watcher connection-monitor test-group show'] = """
type: command
short-summary: Show a test group of a connection monitor
"""

helps['network watcher connection-monitor test-group list'] = """
type: command
short-summary: List all test groups of a connection monitor
"""

helps['network watcher connection-monitor output'] = """
type: group
short-summary: Manage output of connection monitor
"""

helps['network watcher connection-monitor output add'] = """
type: command
short-summary: Add an output to a connection monitor
"""

helps['network watcher connection-monitor output remove'] = """
type: command
short-summary: Remove all outputs from a connection monitor
"""

helps['network watcher connection-monitor output list'] = """
type: command
short-summary: List all output from a connection monitor
"""
Loading