Skip to content

Commit

Permalink
[DNM] Adding support for Private DNS Public Preview (#5763)
Browse files Browse the repository at this point in the history
* Making changes to support Private DNS Public Preview.

* Adding test for Private DNS zones.

* Adding changelog and bumping versio.

* Adding tests for convenience params of 'network dns zone update'.

* Adding suppression for DNS extension 0.0.1.

* Updating azure-mgmt-dns version. Re-recording failing tests.

* Re-recording DNS tests

* Disabling line-too-long in __init__.py
  • Loading branch information
muwaqar authored and tjprescott committed Mar 15, 2018
1 parent 9c92fd5 commit 1138758
Show file tree
Hide file tree
Showing 21 changed files with 5,734 additions and 3,271 deletions.
6 changes: 5 additions & 1 deletion src/command_modules/azure-cli-network/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

2.0.26
++++++
* `network dns zone create/update`: Adding support for Private DNS zones.

2.0.25
++++++
* BREAKING CHANGE: `route-filter rule create`: The `--tags` parameter is no longer supported.
Expand Down Expand Up @@ -174,7 +178,7 @@ Release History

* Add support for active-active VNet gateways
* Remove nulls values from output of `network vpn-connection list/show` commands.
* BC: Fix bug in the output of `vpn-connection create`
* BC: Fix bug in the output of `vpn-connection create`
* Fix bug where '--key-length' argument of 'vpn-connection create' was not parsed correctly.
* Fix bug in `dns zone import` where records were not imported correctly.
* Fix bug where `traffic-manager endpoint update` did not work.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=line-too-long

from azure.cli.core import AzCommandsLoader
from azure.cli.core.profiles import ResourceType

Expand All @@ -12,11 +14,13 @@
class NetworkCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core import ModExtensionSuppress
from azure.cli.core.commands import CliCommandType
network_custom = CliCommandType(operations_tmpl='azure.cli.command_modules.network.custom#{}')
super(NetworkCommandsLoader, self).__init__(cli_ctx=cli_ctx,
resource_type=ResourceType.MGMT_NETWORK,
custom_command_type=network_custom)
custom_command_type=network_custom,
suppress_extension=ModExtensionSuppress(__name__, 'dns', '0.0.1', reason='These commands are now in the CLI.', recommend_remove=True))

def load_command_table(self, args):
from azure.cli.command_modules.network.commands import load_command_table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
validate_private_ip_address,
get_servers_validator, get_public_ip_validator, get_nsg_validator, get_subnet_validator,
get_network_watcher_from_vm, get_network_watcher_from_location,
get_asg_validator, validate_ip_tags)
get_asg_validator, get_vnet_validator, validate_ip_tags)
from azure.mgmt.network.models import ApplicationGatewaySslProtocol
from azure.mgmt.trafficmanager.models import MonitorProtocol
from azure.cli.command_modules.network._completers import (
Expand All @@ -42,13 +42,13 @@ def load_arguments(self, _):
ExpressRouteCircuitPeeringType, ExpressRouteCircuitSkuFamily, ExpressRouteCircuitSkuTier, IPAllocationMethod,
IPVersion, LoadBalancerSkuName, LoadDistribution, ProbeProtocol, ProcessorArchitecture, Protocol, PublicIPAddressSkuName,
RouteNextHopType, SecurityRuleAccess, SecurityRuleProtocol, SecurityRuleDirection, TransportProtocol,
VirtualNetworkGatewaySkuName, VirtualNetworkGatewayType, VpnClientProtocol, VpnType) = self.get_models(
VirtualNetworkGatewaySkuName, VirtualNetworkGatewayType, VpnClientProtocol, VpnType, ZoneType) = self.get_models(
'Access', 'ApplicationGatewayFirewallMode', 'ApplicationGatewayProtocol', 'ApplicationGatewayRedirectType',
'ApplicationGatewayRequestRoutingRuleType', 'ApplicationGatewaySkuName', 'AuthenticationMethod', 'Direction',
'ExpressRouteCircuitPeeringType', 'ExpressRouteCircuitSkuFamily', 'ExpressRouteCircuitSkuTier', 'IPAllocationMethod',
'IPVersion', 'LoadBalancerSkuName', 'LoadDistribution', 'ProbeProtocol', 'ProcessorArchitecture', 'Protocol', 'PublicIPAddressSkuName',
'RouteNextHopType', 'SecurityRuleAccess', 'SecurityRuleProtocol', 'SecurityRuleDirection', 'TransportProtocol',
'VirtualNetworkGatewaySkuName', 'VirtualNetworkGatewayType', 'VpnClientProtocol', 'VpnType')
'VirtualNetworkGatewaySkuName', 'VirtualNetworkGatewayType', 'VpnClientProtocol', 'VpnType', 'ZoneType')

default_existing = 'If only one exists, omit to use as default.'

Expand Down Expand Up @@ -315,15 +315,9 @@ def load_arguments(self, _):
c.argument('zone_name', name_arg_type)
c.ignore('location')

# TODO: remove when feature ready
c.ignore('zone_type')
c.ignore('registration_vnets')
c.ignore('resolution_vnets')

# TODO: Uncomment when feature is ready
# c.argument('zone_type', help='Type of DNS zone to create.', arg_type=get_enum_type(ZoneType))
# c.argument('registration_vnets', arg_group='Private Zone', nargs='+', help='Space-separated names or IDs of virtual networks that register hostnames in this DNS zone.', validator=get_vnet_validator('registration_vnets'))
# c.argument('resolution_vnets', arg_group='Private Zone', nargs='+', help='Space-separated names or IDs of virtual networks that resolve records in this DNS zone.', validator=get_vnet_validator('resolution_vnets'))
c.argument('zone_type', help='Type of DNS zone to create.', arg_type=get_enum_type(ZoneType))
c.argument('registration_vnets', arg_group='Private Zone', nargs='+', help='Space-separated names or IDs of virtual networks that register hostnames in this DNS zone.', validator=get_vnet_validator('registration_vnets'))
c.argument('resolution_vnets', arg_group='Private Zone', nargs='+', help='Space-separated names or IDs of virtual networks that resolve records in this DNS zone.', validator=get_vnet_validator('resolution_vnets'))

with self.argument_context('network dns zone import') as c:
c.argument('file_name', options_list=('--file-name', '-f'), type=file_type, completer=FilesCompleter(), help='Path to the DNS zone file to import')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def _make_singular(value):
g.custom_command('import', 'import_zone')
g.custom_command('export', 'export_zone')
g.custom_command('create', 'create_dns_zone', client_factory=cf_dns_mgmt_zones)
g.generic_update_command('update')
g.generic_update_command('update', custom_func_name='update_dns_zone')

with self.command_group('network dns record-set') as g:
g.custom_command('list', 'list_dns_record_set', client_factory=cf_dns_mgmt_record_sets, transform=transform_dns_record_set_output)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ def update_asg(instance, tags=None):

# region DNS Commands
def create_dns_zone(client, resource_group_name, zone_name, location='global', tags=None,
if_none_match=False, zone_type=None, resolution_vnets=None, registration_vnets=None):
if_none_match=False, zone_type='Public', resolution_vnets=None, registration_vnets=None):
zone = Zone(location=location, tags=tags)

if hasattr(zone, 'zone_type'):
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit 1138758

Please sign in to comment.