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

{NetworkManager}Fix bugs #4584

Merged
merged 20 commits into from
Mar 29, 2022
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
5 changes: 5 additions & 0 deletions src/network-manager/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Release History
===============
0.4.1
+++++
* 'az network manager connect-config update': update parameter '--connectivity-topology'
* 'az network manager group create': update parameter '--member-type' and remove parameters `--group-members` and '--conditional-membership'
* 'az network manager security-admin-config create': add parameter '--apply-on'

0.4.0
+++++
Expand Down
24 changes: 5 additions & 19 deletions src/network-manager/azext_network_manager/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,35 +284,21 @@
type: command
short-summary: "Create a network group."
parameters:
- name: --group-members
short-summary: "Group members of network group."
- name: --member-type
short-summary: "Group member type"
long-summary: |
Usage: --group-members resource-id=XX

resource-id: Resource Id.

Multiple actions can be specified by using more than one --group-members argument.
Usage: --member-type "Microsoft.Network/virtualNetworks"
examples:
- name: Create/Update Azure Virtual Network Manager Network Group
text: |-
az network manager group create --name "TestNetworkGroup" --network-manager-name "testNetworkManager" \
--description "A sample group" --conditional-membership "" --display-name "My Network Group" --group-members \
resource-id="/subscriptions/subscriptionC/resourceGroup/rg1/providers/Microsoft.Network/virtualnetworks/vnet1" \
--description "A sample group" --display-name "My Network Group" \
--member-type "Microsoft.Network/virtualNetworks" --resource-group "rg1"
"""

helps['network manager group update'] = """
type: command
short-summary: "Update a network group."
parameters:
- name: --group-members
short-summary: "Group members of network group."
long-summary: |
Usage: --group-members resource-id=XX

resource-id: Resource Id.

Multiple actions can be specified by using more than one --group-members argument.
"""

helps['network manager group delete'] = """
Expand Down Expand Up @@ -421,7 +407,7 @@
text: |-
az network manager security-admin-config create --configuration-name "myTestSecurityConfig" \
--network-manager-name "testNetworkManager" --resource-group "rg1" --description "A sample policy" \
--delete-existing-ns-gs true
--delete-existing-ns-gs true --apply-on None
"""

helps['network manager security-admin-config update'] = """
Expand Down
14 changes: 8 additions & 6 deletions src/network-manager/azext_network_manager/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def load_arguments(self, _):
id_part='child_name_1')
c.argument('display_name', type=str, help='A friendly name for the resource.')
c.argument('description', type=str, help='A description of the connectivity configuration.')
c.argument('connectivity_topology', arg_type=get_enum_type(['HubAndSpokeTopology', 'MeshTopology']),
c.argument('connectivity_topology', arg_type=get_enum_type(['HubAndSpoke', 'Mesh']),
help='Connectivity topology type.')
c.argument('is_global', arg_type=get_three_state_flag(), help='Flag if global mesh is supported.')
c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups '
Expand Down Expand Up @@ -233,9 +233,7 @@ def load_arguments(self, _):
'changes.')
c.argument('display_name', type=str, help='A friendly name for the network group.')
c.argument('description', type=str, help='A description of the network group.')
c.argument('member_type', arg_type=get_enum_type(['Microsoft.Network/virtualNetworks', 'Microsoft.Network/virtualNetworks/subnets']), help='Group member type.')
c.argument('group_members', action=AddGroupMembers, nargs='+', help='Group members of network group.')
c.argument('conditional_membership', type=str, help='Network group conditional filter.')
c.argument('member_type', arg_type=get_enum_type(['Microsoft.Network/virtualNetworks']), help='Group member type.')

with self.argument_context('network manager group update') as c:
c.argument('resource_group_name', resource_group_name_type)
Expand All @@ -248,8 +246,6 @@ def load_arguments(self, _):
c.argument('display_name', type=str, help='A friendly name for the network group.')
c.argument('description', type=str, help='A description of the network group.')
c.argument('member_type', arg_type=get_enum_type(['VirtualNetwork', 'Subnet']), help='Group member type.')
c.argument('group_members', action=AddGroupMembers, nargs='+', help='Group members of network group.')
c.argument('conditional_membership', type=str, help='Network group conditional filter.')
c.ignore('parameters')

with self.argument_context('network manager group delete') as c:
Expand Down Expand Up @@ -337,6 +333,9 @@ def load_arguments(self, _):
c.argument('security_type', arg_type=get_enum_type(['AdminPolicy', 'UserPolicy']), help='Security Type.')
c.argument('delete_existing_ns_gs', arg_type=get_three_state_flag(), help='Flag if need to delete existing '
'network security groups.')
c.argument('apply_on_network_intent_policy_based_services', options_list=['--apply-on-network-intent-policy',
'--apply-on'], nargs='+',
arg_type=get_enum_type(['None', 'All']), help='Enum list of network intent policy based services.')

with self.argument_context('network manager security-admin-config update') as c:
c.argument('resource_group_name', resource_group_name_type)
Expand All @@ -348,6 +347,9 @@ def load_arguments(self, _):
c.argument('security_type', arg_type=get_enum_type(['AdminPolicy', 'UserPolicy']), help='Security Type.')
c.argument('delete_existing_ns_gs', arg_type=get_three_state_flag(), help='Flag if need to delete existing '
'network security groups.')
c.argument('apply_on_network_intent_policy_based_services', options_list=['--apply-on-network-intent-policy',
'--apply-on'], nargs='+',
arg_type=get_enum_type(['None', 'All']), help='Enum list of network intent policy based services.')
c.ignore('security_configuration')

with self.argument_context('network manager security-admin-config delete') as c:
Expand Down
26 changes: 11 additions & 15 deletions src/network-manager/azext_network_manager/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,18 +351,14 @@ def network_manager_group_create(client,
resource_group_name,
network_manager_name,
network_group_name,
member_type,
if_match=None,
display_name=None,
description=None,
member_type=None,
group_members=None,
conditional_membership=None):
description=None):
parameters = {}
parameters['display_name'] = display_name
parameters['description'] = description
parameters['member_type'] = member_type
parameters['group_members'] = group_members
parameters['conditional_membership'] = conditional_membership
return client.create_or_update(resource_group_name=resource_group_name,
network_manager_name=network_manager_name,
network_group_name=network_group_name,
Expand All @@ -377,19 +373,13 @@ def network_manager_group_update(instance,
if_match=None,
display_name=None,
description=None,
member_type=None,
group_members=None,
conditional_membership=None):
member_type=None):
if display_name is not None:
instance.display_name = display_name
if description is not None:
instance.description = description
if member_type is not None:
instance.member_type = member_type
if group_members is not None:
instance.group_members = group_members
if conditional_membership is not None:
instance.conditional_membership = conditional_membership
return instance


Expand Down Expand Up @@ -495,11 +485,14 @@ def network_manager_security_admin_config_create(client,
configuration_name,
display_name=None,
description=None,
delete_existing_ns_gs=None):
delete_existing_ns_gs=None,
apply_on_network_intent_policy_based_services=None):
security_configuration = {}
security_configuration['display_name'] = display_name
security_configuration['description'] = description
security_configuration['delete_existing_ns_gs'] = delete_existing_ns_gs
security_configuration['apply_on_network_intent_policy_based_services'] = \
apply_on_network_intent_policy_based_services
return client.create_or_update(resource_group_name=resource_group_name,
network_manager_name=network_manager_name,
configuration_name=configuration_name,
Expand All @@ -512,13 +505,16 @@ def network_manager_security_admin_config_update(instance,
configuration_name,
display_name=None,
description=None,
delete_existing_ns_gs=None):
delete_existing_ns_gs=None,
apply_on_network_intent_policy_based_services=None):
if display_name is not None:
instance.display_name = display_name
if description is not None:
instance.description = description
if delete_existing_ns_gs is not None:
instance.delete_existing_ns_gs = delete_existing_ns_gs
if apply_on_network_intent_policy_based_services is not None:
instance.apply_on_network_intent_policy_based_services = apply_on_network_intent_policy_based_services
return instance


Expand Down
Loading