Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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/virtual-wan/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Release History
===============

0.2.12
++++++
*`az network vhub create`:support new parameters `--hub-routing-preference`.
Comment thread
YuanyuanNi marked this conversation as resolved.
Outdated
*`az network vhub update`:support new parameters `--hub-routing-preference`.

0.2.11
++++++
* add new command group: `az network vpn-gateway connection vpn-site-link-conn`.
Expand Down
9 changes: 8 additions & 1 deletion src/virtual-wan/azext_vwan/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,19 @@ def network_client_factory_2021_03_01(cli_ctx, aux_subscriptions=None, **_):
api_version='2021-03-01')


def network_client_factory_2021_08_01(cli_ctx, aux_subscriptions=None, **_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from .profiles import CUSTOM_VWAN_2021_08_01
return get_mgmt_service_client(cli_ctx, CUSTOM_VWAN_2021_08_01, aux_subscriptions=aux_subscriptions,
api_version='2021-08-01')


def cf_virtual_wans(cli_ctx, _):
return network_client_factory(cli_ctx).virtual_wans


def cf_virtual_hubs(cli_ctx, _):
return network_client_factory(cli_ctx).virtual_hubs
return network_client_factory_2021_08_01(cli_ctx).virtual_hubs


def cf_virtual_hub_connection(cli_ctx, _):
Expand Down
1 change: 1 addition & 0 deletions src/virtual-wan/azext_vwan/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def load_arguments(self, _):
c.argument('virtual_wan', options_list='--vwan', help='Name or ID of the virtual WAN.', validator=get_network_resource_name_or_id('virtual_wan', 'virtualWans'))
c.argument('address_prefix', help='CIDR address prefix for the virtual hub.')
c.argument('sku', arg_type=get_enum_type(['Basic', 'Standard']), help='The sku of the VirtualHub.')
c.argument('hub_routing_preference', arg_type=get_enum_type(['ExpressRoute', 'VpnGateway', 'ASPath']), help='The routing preference in virtual hub of customer.')

with self.argument_context('network vhub', arg_group='Gateway') as c:
c.argument('express_route_gateway', help='Name or ID of an ExpressRoute gateway.', validator=get_network_resource_name_or_id('express_route_gateway', 'expressRouteGateways'))
Expand Down
6 changes: 3 additions & 3 deletions src/virtual-wan/azext_vwan/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# pylint: disable=line-too-long
from azure.cli.core.commands import CliCommandType
from .profiles import CUSTOM_VWAN, CUSTOM_VWAN_2021_03_01
from .profiles import CUSTOM_VWAN, CUSTOM_VWAN_2021_03_01, CUSTOM_VWAN_2021_08_01

from ._client_factory import (
cf_virtual_wans, cf_virtual_hubs, cf_vpn_sites, cf_vpn_site_configs,
Expand All @@ -24,9 +24,9 @@
def load_command_table(self, _):

network_vhub_sdk = CliCommandType(
operations_tmpl='azext_vwan.vendored_sdks.v2020_05_01.operations#VirtualHubsOperations.{}',
operations_tmpl='azext_vwan.vendored_sdks.v2021_08_01.v2021_08_01.operations#VirtualHubsOperations.{}',
client_factory=cf_virtual_hubs,
resource_type=CUSTOM_VWAN,
resource_type=CUSTOM_VWAN_2021_08_01,
min_api='2018-08-01'
)

Expand Down
13 changes: 8 additions & 5 deletions src/virtual-wan/azext_vwan/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

from azure.cli.core.util import sdk_no_wait

from ._client_factory import network_client_factory, cf_virtual_hub_bgpconnections, cf_virtual_hub_connection
from ._client_factory import network_client_factory, cf_virtual_hub_bgpconnections, cf_virtual_hub_connection, \
network_client_factory_2021_08_01
from ._util import _get_property

logger = get_logger(__name__)
Expand Down Expand Up @@ -136,15 +137,16 @@ def list_virtual_wans(cmd, resource_group_name=None):

# region VirtualHubs
def create_virtual_hub(cmd, resource_group_name, virtual_hub_name, address_prefix, virtual_wan,
location=None, tags=None, no_wait=False, sku=None):
client = network_client_factory(cmd.cli_ctx).virtual_hubs
location=None, tags=None, no_wait=False, sku=None, hub_routing_preference=None):
client = network_client_factory_2021_08_01(cmd.cli_ctx).virtual_hubs
VirtualHub, SubResource = cmd.get_models('VirtualHub', 'SubResource')
hub = VirtualHub(
tags=tags,
location=location,
address_prefix=address_prefix,
virtual_wan=SubResource(id=virtual_wan),
sku=sku
sku=sku,
hub_routing_preference=hub_routing_preference
)
return sdk_no_wait(no_wait, client.begin_create_or_update,
resource_group_name, virtual_hub_name, hub)
Expand Down Expand Up @@ -177,13 +179,14 @@ def raw(response, *_):
)


def update_virtual_hub(instance, cmd, address_prefix=None, virtual_wan=None, tags=None, sku=None):
def update_virtual_hub(instance, cmd, address_prefix=None, virtual_wan=None, tags=None, sku=None, hub_routing_preference=None):
SubResource = cmd.get_models('SubResource')
with UpdateContext(instance) as c:
c.update_param('tags', tags, True)
c.update_param('address_prefix', address_prefix, False)
c.update_param('virtual_wan', SubResource(id=virtual_wan) if virtual_wan else None, False)
c.update_param('sku', sku, False)
c.update_param('hub_routing_preference', hub_routing_preference, False)
return instance


Expand Down
1 change: 1 addition & 0 deletions src/virtual-wan/azext_vwan/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@

CUSTOM_VWAN = CustomResourceType('azext_vwan.vendored_sdks.v2020_05_01', 'NetworkManagementClient')
CUSTOM_VWAN_2021_03_01 = CustomResourceType('azext_vwan.vendored_sdks.v2021_03_01', 'NetworkManagementClient')
CUSTOM_VWAN_2021_08_01 = CustomResourceType('azext_vwan.vendored_sdks.v2021_08_01.v2021_08_01', 'NetworkManagementClient')
Comment thread
YuanyuanNi marked this conversation as resolved.
Outdated
Loading