Skip to content

Commit

Permalink
[NetworkManager] az network manager connection management-group: Re…
Browse files Browse the repository at this point in the history
…open the set of commands (#5260)

* Update test_network_manager_static_member_crud.yaml

* Update _params.py

* fix various broken commands

* fix network manager connection update command

* add test recordings for network manager connections

* Update test_network_manager_scope_connection.yaml

Co-authored-by: Jared Gorthy <[email protected]>
  • Loading branch information
ZengTaoxu and Jared Gorthy authored Aug 23, 2022
1 parent daf2f9d commit 9b6be1a
Show file tree
Hide file tree
Showing 9 changed files with 581 additions and 153 deletions.
4 changes: 4 additions & 0 deletions src/network-manager/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Release History
===============
0.5.2
+++++
* 'az network manager connection management-group': reopen the set of commands.

0.5.1
+++++
* 'az network manager group': remove parameters '--member-type' and '--display-name'
Expand Down
104 changes: 54 additions & 50 deletions src/network-manager/azext_network_manager/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,56 +778,60 @@
short-summary: Manage connection with network manager
"""

# helps['network manager connection management-group'] = """
# type: group
# short-summary: Manage management-group connection with network
# """
#
# helps['network manager connection management-group list'] = """
# type: command
# short-summary: "List all network manager connections created by this management group."
# examples:
# - name: List management-group connections in a network manager
# text: |-
# az network manager connection management-group list --management-group-id "testManagementGroupId" \
# --resource-group "rg1"
# """
#
# helps['network manager connection management-group show'] = """
# type: command
# short-summary: "Get a specified connection created by this management group."
# examples:
# - name: Get network manager connection management-group
# text: |-
# az network manager connection management-group show --management-group-id "testManagementGroupId" \
# --connection-name "testNetworkManagerConnection" --resource-group "rg1"
# """
#
# helps['network manager connection management-group create'] = """
# type: command
# short-summary: Create a connection to a cross tenant network manager"
# examples:
# - name: Create network manager connection management-group
# text: |-
# az network manager connection management-group create --management-group-id "testManagementGroupId" \
# --connection-name "testNetworkManagerConnection" --resource-group "rg1" --network-manager "testNetworkManagerId" \
# --description "A sample policy"
# """
#
# helps['network manager connection management-group update'] = """
# type: command
# short-summary: "Update a connection to a cross tenant network manager"
# """
#
# helps['network manager connection management-group delete'] = """
# type: command
# short-summary: "Delete specified pending connection created by this management group."
# examples:
# - name: Delete network manager connection management-group
# text: |-
# az network manager connection management-group delete --management-group-id "testManagementGroupId" \
# --connection-name "testNetworkManagerConnection" --resource-group "rg1"
# """
helps['network manager connection management-group'] = """
type: group
short-summary: Manage management-group connection with network
"""

helps['network manager connection management-group list'] = """
type: command
short-summary: "List all network manager connections created by this management group."
examples:
- name: List management-group connections in a network manager
text: |-
az network manager connection management-group list --management-group-id "testManagementGroupId"
"""

helps['network manager connection management-group show'] = """
type: command
short-summary: "Get a specified connection created by this management group."
examples:
- name: Get network manager connection management-group
text: |-
az network manager connection management-group show --management-group-id "testManagementGroupId" \
--connection-name "testNetworkManagerConnection"
"""

helps['network manager connection management-group create'] = """
type: command
short-summary: Create a connection to a cross tenant network manager"
examples:
- name: Create network manager connection management-group
text: |-
az network manager connection management-group create --management-group-id "testManagementGroupId" \
--connection-name "testNetworkManagerConnection" --network-manager "testNetworkManagerId" \
--description "A sample policy"
"""

helps['network manager connection management-group update'] = """
type: command
short-summary: "Update a connection to a cross tenant network manager"
examples:
- name: Update network manager connection management-group
text: |-
az network manager connection management-group update --management-group-id "testManagementGroupId" \
--connection-name "testNetworkManagerConnection" --description "My Test Network Manager Connection"
"""

helps['network manager connection management-group delete'] = """
type: command
short-summary: "Delete specified pending connection created by this management group."
examples:
- name: Delete network manager connection management-group
text: |-
az network manager connection management-group delete --management-group-id "testManagementGroupId" \
--connection-name "testNetworkManagerConnection"
"""

helps['network manager scope-connection'] = """
type: group
Expand Down
78 changes: 39 additions & 39 deletions src/network-manager/azext_network_manager/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,45 +576,45 @@ def load_arguments(self, _):
c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'],
type=str, help='The name of the network manager connection.', id_part='name')

# with self.argument_context('network manager connection management-group create') as c:
# c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'], type=str,
# help='The name of the network manager connection.')
# c.argument('management_group_id', type=str,
# help='The management group id which uniquely identify the microsoft azure management group')
# c.argument('network_manager_id', options_list=['--network-manager', '--network-manager-id'], type=str,
# help='the name or id of the network manager.', validator=validate_network_manager)
# c.argument('description', type=str, help='A description of the scope connection.')
#
# with self.argument_context('network manager connection management-group update') as c:
# c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'], type=str,
# help='The name of the network manager connection.', id_part='child_name_1')
# c.argument('management_group_id', type=str, help='The management group id which uniquely identify '
# 'the microsoft azure management group', id_part='name')
# c.argument('network_manager_id', options_list=['--network-manager', '--network-manager-id'], type=str,
# help='the name or id of the network manager.', validator=validate_network_manager)
# c.argument('description', type=str, help='A description of the scope connection.')
# c.ignore('parameters')
#
# with self.argument_context('network manager connection management-group list') as c:
# c.argument('management_group_id', type=str,
# help='The management group id which uniquely identify the microsoft azure management group')
# c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to '
# 'be returned by the server.')
# c.argument('skip_token', type=str, help='SkipToken is only used if a previous operation returned a partial '
# 'result. If a previous response contains a nextLink element, the value of the nextLink element will '
# 'include a skipToken parameter that specifies a starting point to use for subsequent calls.')
#
# with self.argument_context('network manager connection management-group show') as c:
# c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'], type=str,
# help='The name of the network manager connection.', id_part='name')
# c.argument('management_group_id', type=str,
# help='The management group id which uniquely identify the microsoft azure management group')
#
# with self.argument_context('network manager connection management-group delete') as c:
# c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'], type=str,
# help='The name of the network manager connection.', id_part='name')
# c.argument('management_group_id', type=str,
# help='The management group id which uniquely identify the microsoft azure management group')
with self.argument_context('network manager connection management-group create') as c:
c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'], type=str,
help='The name of the network manager connection.')
c.argument('management_group_id', type=str,
help='The management group id which uniquely identify the microsoft azure management group')
c.argument('network_manager_id', options_list=['--network-manager', '--network-manager-id'], type=str,
help='the name or id of the network manager.')
c.argument('description', type=str, help='A description of the scope connection.')

with self.argument_context('network manager connection management-group update') as c:
c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'], type=str,
help='The name of the network manager connection.', id_part='child_name_1')
c.argument('management_group_id', type=str, help='The management group id which uniquely identify '
'the microsoft azure management group', required=True, id_part='name')
c.argument('network_manager_id', options_list=['--network-manager', '--network-manager-id'], type=str,
help='the name or id of the network manager.')
c.argument('description', type=str, help='A description of the scope connection.')
c.ignore('parameters')

with self.argument_context('network manager connection management-group list') as c:
c.argument('management_group_id', type=str,
help='The management group id which uniquely identify the microsoft azure management group')
c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to '
'be returned by the server.')
c.argument('skip_token', type=str, help='SkipToken is only used if a previous operation returned a partial '
'result. If a previous response contains a nextLink element, the value of the nextLink element will '
'include a skipToken parameter that specifies a starting point to use for subsequent calls.')

with self.argument_context('network manager connection management-group show') as c:
c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'], type=str,
help='The name of the network manager connection.', id_part='name')
c.argument('management_group_id', type=str,
help='The management group id which uniquely identify the microsoft azure management group')

with self.argument_context('network manager connection management-group delete') as c:
c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'], type=str,
help='The name of the network manager connection.', id_part='name')
c.argument('management_group_id', type=str,
help='The management group id which uniquely identify the microsoft azure management group')

with self.argument_context('network manager scope-connection create') as c:
c.argument('resource_group_name', resource_group_name_type)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"azext.isPreview": true,
"azext.minCliCoreVersion": "2.15.0"
}
20 changes: 10 additions & 10 deletions src/network-manager/azext_network_manager/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ def load_command_table(self, _):
client_factory=cf_subscriptionconnection
)

# network_managementgroupconnection = CliCommandType(
# operations_tmpl='azext_network_manager.vendored_sdks.operations._management_group_network_manager_connections_operations#ManagementGroupNetworkManagerConnectionsOperations.{}',
# client_factory=cf_managementgroupconnection
# )
network_managementgroupconnection = CliCommandType(
operations_tmpl='azext_network_manager.vendored_sdks.operations._operations#ManagementGroupNetworkManagerConnectionsOperations.{}',
client_factory=cf_managementgroupconnection
)

with self.command_group('network manager', network_networkmanager, client_factory=cf_networkmanager) as g:
g.custom_command('create', 'network_manager_create')
Expand Down Expand Up @@ -171,12 +171,12 @@ def load_command_table(self, _):
g.custom_show_command('show', 'network_manager_connection_subscription_show')
g.custom_command('delete', 'network_manager_connection_subscription_delete', confirmation=True)

# with self.command_group('network manager connection management-group', network_managementgroupconnection, client_factory=cf_managementgroupconnection) as g:
# g.custom_command('create', 'network_manager_connection_management_group_create')
# g.generic_update_command('update', setter_arg_name='connection_management_group', custom_func_name='network_manager_connection_management_group_update')
# g.custom_command('list', 'network_manager_connection_management_group_list')
# g.custom_show_command('show', 'network_manager_connection_management_group_show')
# g.custom_command('delete', 'network_manager_connection_management_group_delete', confirmation=True)
with self.command_group('network manager connection management-group', network_managementgroupconnection, client_factory=cf_managementgroupconnection) as g:
g.custom_command('create', 'network_manager_connection_management_group_create')
g.generic_update_command('update', custom_func_name='network_manager_connection_management_group_update')
g.custom_command('list', 'network_manager_connection_management_group_list')
g.custom_show_command('show', 'network_manager_connection_management_group_show')
g.custom_command('delete', 'network_manager_connection_management_group_delete', confirmation=True)

with self.command_group('network manager scope-connection', network_scopeconnection, client_factory=cf_scopeconnection) as g:
g.custom_command('create', 'network_manager_scope_connection_create')
Expand Down
Loading

0 comments on commit 9b6be1a

Please sign in to comment.