Skip to content

Commit

Permalink
Commands/network dns (Azure#718)
Browse files Browse the repository at this point in the history
* Network Traffic Manager commands

* Network DNS commands
  • Loading branch information
BurtBiel authored Aug 22, 2016
1 parent f5f4ab4 commit a6412f5
Show file tree
Hide file tree
Showing 32 changed files with 4,363 additions and 5 deletions.
25 changes: 25 additions & 0 deletions azure-cli.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,25 @@
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_app_gateway\lib\version.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_app_gateway\lib\__init__.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_app_gateway\__init__.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\credentials.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\dns_zone_creation_client.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\exceptions.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\models\basic_dependency.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\models\dependency.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\models\deployment_dns_zone.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\models\deployment_extended.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\models\deployment_properties_extended.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\models\dns_zone_creation_client_enums.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\models\parameters_link.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\models\provider.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\models\provider_resource_type.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\models\template_link.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\models\__init__.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\operations\dns_zone_operations.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\operations\__init__.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\version.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\__init__.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\__init__.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_express_route_circuit\lib\credentials.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_express_route_circuit\lib\exceptions.py" />
<Compile Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_express_route_circuit\lib\express_route_circuit_creation_client.py" />
Expand Down Expand Up @@ -628,6 +647,9 @@
<Folder Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_app_gateway\lib\" />
<Folder Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_app_gateway\lib\models\" />
<Folder Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_app_gateway\lib\operations\" />
<Folder Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\" />
<Folder Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\models\" />
<Folder Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\lib\operations\" />
<Folder Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_express_route_circuit\lib\" />
<Folder Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_express_route_circuit\lib\models\" />
<Folder Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_express_route_circuit\lib\operations\" />
Expand Down Expand Up @@ -667,6 +689,7 @@
<Folder Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_express_route_circuit\" />
<Folder Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_express_route_peering\" />
<Folder Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_traffic_manager_profile\" />
<Folder Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\" />
<Folder Include="command_modules\azure-cli-redis\" />
<Folder Include="command_modules\azure-cli-redis\azure\" />
<Folder Include="command_modules\azure-cli-redis\azure\cli\" />
Expand Down Expand Up @@ -767,6 +790,8 @@
<Content Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_app_gateway\swagger_create_app_gateway.json" />
<Content Include="command_modules\azure-cli-feedback\README.rst" />
<Content Include="command_modules\azure-cli-feedback\requirements.txt" />
<Content Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\azuredeploy.json" />
<Content Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_dns_zone\swagger_create_dns_zone.json" />
<Content Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_express_route_circuit\azuredeploy.json" />
<Content Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_express_route_circuit\swagger_create_express_route_circuit.json" />
<Content Include="command_modules\azure-cli-network\azure\cli\command_modules\network\mgmt_express_route_peering\azuredeploy.json" />
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ applicationinsights==0.10.0
argcomplete==1.3.0
azure==2.0.0rc5
azure-mgmt-trafficmanager==0.30.0rc5
azure-mgmt-dns==0.30.0rc5
colorama==0.3.7
jmespath
mock==1.3.0
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
'argcomplete>=1.3.0',
'azure==2.0.0rc5',
'azure-mgmt-trafficmanager==0.30.0rc5',
'azure-mgmt-dns==0.30.0rc5',
'colorama',
'jmespath',
'msrest>=0.4.0',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,97 @@
from azure.cli.help_files import helps #pylint: disable=unused-import

#pylint: disable=line-too-long

helps['network dns record-set create'] = """
type: command
parameters:
- name: --type
short-summary: The type of DNS records in the record set.
- name: --ttl
short-summary: Record set TTL (time-to-live).
"""

for t in ['add', 'remove']:
helps['network dns record aaaa {0}'.format(t)] = """
type: command
parameters:
- name: --ipv6-address
short-summary: IPV6 address in string notation.
"""

helps['network dns record a {0}'.format(t)] = """
type: command
parameters:
- name: --ipv4-address
short-summary: IPV4 address in string notation.
"""

helps['network dns record cname {0}'.format(t)] = """
type: command
parameters:
- name: --cname
short-summary: Canonical name.
"""

helps['network dns record mx {0}'.format(t)] = """
type: command
parameters:
- name: --exchange
short-summary: Exchange metric
- name: --preference
short-summary: preference metric
"""

helps['network dns record ns {0}'.format(t)] = """
type: command
parameters:
- name: --dname
short-summary: Name server domain name.
"""

helps['network dns record ptr {0}'.format(t)] = """
type: command
parameters:
- name: --dname
short-summary: PTR target domain name.
"""

helps['network dns record soa {0}'.format(t)] = """
type: command
parameters:
- name: --host
short-summary: domain name of the authoritative name server
- name: --email
short-summary: Email address.
- name: --serial-number
short-summary: Serial number.
- name: --refresh-time
short-summary: Refresh value (seconds).
- name: --retry-time
short-summary: Retry time (seconds).
- name: --expire-time
short-summary: Expire time (seconds).
- name: --minimum-ttl
short-summary: Minimum TTL (time-to-live, seconds).
"""

helps['network dns record srv {0}'.format(t)] = """
type: command
parameters:
- name: --priority
short-summary: Priority metric.
- name: --weight
short-summary: Weight metric.
- name: --port
short-summary: Service port.
- name: --target
short-summary: Target domain name.
"""

helps['network dns record txt {0}'.format(t)] = """
type: command
parameters:
- name: --value
short-summary: List of text values.
"""

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ApplicationGatewayTier, ApplicationGatewayProtocol,
ApplicationGatewayRequestRoutingRuleType, ExpressRouteCircuitSkuFamily,
ExpressRouteCircuitSkuTier, ExpressRouteCircuitPeeringType)
from azure.mgmt.dns.models.dns_management_client_enums import RecordType

from azure.cli.commands import CliArgumentType, register_cli_argument, register_extra_cli_argument
from azure.cli.commands.parameters import (location_type, get_resource_name_completion_list,
Expand Down Expand Up @@ -382,7 +383,19 @@ def completer(prefix, action, parsed_args, **kwargs): # pylint: disable=unused-a
register_cli_argument('network traffic-manager profile check-dns', 'type', help=argparse.SUPPRESS, default='Microsoft.Network/trafficManagerProfiles')

# Traffic manager endpoints
register_cli_argument('network traffic-manager endpoint', 'endpoint_name', name_arg_type, id_part='name', help='Endpoint name.', completer=get_tm_endpoint_completion_list())
endpoint_types = ['azureEndpoints', 'externalEndpoints', 'nestedEndpoints']
register_cli_argument('network traffic-manager endpoint', 'endpoint_name', name_arg_type, id_part='name', help='Endpoint name.', completer=get_tm_endpoint_completion_list())
register_cli_argument('network traffic-manager endpoint', 'endpoint_type', options_list=('--type',), help='Endpoint type. Values include: {}.'.format(', '.join(endpoint_types)), completer=get_generic_completion_list(endpoint_types))
register_cli_argument('network traffic-manager endpoint', 'profile_name', help='Name of parent profile.', completer=get_resource_name_completion_list('Microsoft.Network/trafficManagerProfiles'))

# DNS
register_cli_argument('network dns zone', 'zone_name', name_arg_type)
register_cli_argument('network dns', 'record_set_name', name_arg_type, help='The name of the RecordSet, relative to the name of the zone.')
register_cli_argument('network dns', 'relative_record_set_name', name_arg_type, help='The name of the RecordSet, relative to the name of the zone.')
register_cli_argument('network dns', 'zone_name', help='The name of the zone without a terminating dot.')
register_cli_argument('network dns record-set create', 'record_set_type', options_list=('--type',), choices=get_enum_choices(RecordType), type=str.upper)
register_cli_argument('network dns record-set create', 'ttl', default=3600)
register_cli_argument('network dns', 'record_type', options_list=('--type',), choices=get_enum_choices(RecordType), type=str.upper)
register_cli_argument('network dns record', 'record_set_name', options_list=('--record-set-name',))
register_cli_argument('network dns record txt add', 'value', nargs='+')
register_cli_argument('network dns record txt remove', 'value', nargs='+')
Loading

0 comments on commit a6412f5

Please sign in to comment.