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

Commands/network dns #718

Merged
merged 2 commits into from
Aug 22, 2016
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
25 changes: 25 additions & 0 deletions azure-cli.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,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 @@ -611,6 +630,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 @@ -650,6 +672,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 @@ -746,6 +769,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'] = """
Copy link
Member

@tjprescott tjprescott Aug 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elps['network dn [](start = 1, length = 16)

Since Johan has been asking me, can you get adequate help for your create command by "stealing" the docstring from the SDK's record type object? #WontFix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this case the text all starts with "gets or sets the xyz value", so I opted for overwriting. If we're ok with some strange help artifacts, then grabbing the doc works fine here. To not incur more help debt, I added overrides with better text


In reply to: 75556265 [](ancestors = 75556265)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with that, but I think Johan would argue that we incur more "help debt" by writing our own custom help instead of pushing the SDK to fix their help.


In reply to: 75560645 [](ancestors = 75560645,75556265)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I filed an issue for this area. I'd like to leave this help in place since the SDK help is confusing and the issue suggests rolling our help back if we can get the SDK to update their text


In reply to: 75752065 [](ancestors = 75752065,75560645,75556265)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense to me.


In reply to: 75767560 [](ancestors = 75767560,75752065,75560645,75556265)

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