forked from Azure/azure-cli-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Front Door and Express Route extensions. (Azure#330)
* Copy code. * Add VisualStudio proj and sln files. Update help. * Port latest commits. * Remove unnecessary files.
- Loading branch information
1 parent
2cf34b2
commit 5bc1bee
Showing
817 changed files
with
82,975 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.25420.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "azure-cli-extensions", "azure-cli-extensions.pyproj", "{884FE35D-DA8A-4CD2-8206-7CB961BF8FDC}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{884FE35D-DA8A-4CD2-8206-7CB961BF8FDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{884FE35D-DA8A-4CD2-8206-7CB961BF8FDC}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.28010.2016 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "azure-cli-extensions", "azure-cli-extensions.pyproj", "{884FE35D-DA8A-4CD2-8206-7CB961BF8FDC}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{884FE35D-DA8A-4CD2-8206-7CB961BF8FDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{884FE35D-DA8A-4CD2-8206-7CB961BF8FDC}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {6C1EBF89-8ED0-409A-8798-92DE03547465} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
from azure.cli.core import AzCommandsLoader | ||
from azure.cli.core.profiles import register_resource_type | ||
|
||
import azext_express_route._help # pylint: disable=unused-import | ||
|
||
|
||
class ExpressRouteCommandsLoader(AzCommandsLoader): | ||
|
||
def __init__(self, cli_ctx=None): | ||
from azure.cli.core.commands import CliCommandType | ||
from .profiles import CUSTOM_ER | ||
register_resource_type('latest', CUSTOM_ER, '2018-08-01') | ||
super(ExpressRouteCommandsLoader, self).__init__( | ||
cli_ctx=cli_ctx, | ||
custom_command_type=CliCommandType(operations_tmpl='azext_express_route.custom#{}'), | ||
resource_type=CUSTOM_ER | ||
) | ||
|
||
def load_command_table(self, args): | ||
from .commands import load_command_table | ||
load_command_table(self, args) | ||
return self.command_table | ||
|
||
def load_arguments(self, args): | ||
from ._params import load_arguments | ||
load_arguments(self, args) | ||
|
||
|
||
COMMAND_LOADER_CLS = ExpressRouteCommandsLoader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
|
||
def network_client_factory(cli_ctx, aux_subscriptions=None, **_): | ||
from azure.cli.core.commands.client_factory import get_mgmt_service_client | ||
from .profiles import CUSTOM_ER | ||
return get_mgmt_service_client(cli_ctx, CUSTOM_ER, | ||
aux_subscriptions=aux_subscriptions) | ||
|
||
|
||
def cf_express_route_circuits(cli_ctx, _): | ||
return network_client_factory(cli_ctx).express_route_circuits | ||
|
||
|
||
def cf_express_route_connections(cli_ctx, _): | ||
return network_client_factory(cli_ctx).express_route_connections | ||
|
||
|
||
def cf_express_route_gateways(cli_ctx, _): | ||
return network_client_factory(cli_ctx).express_route_gateways | ||
|
||
|
||
def cf_express_route_ports(cli_ctx, _): | ||
return network_client_factory(cli_ctx).express_route_ports | ||
|
||
|
||
def cf_express_route_port_locations(cli_ctx, _): | ||
return network_client_factory(cli_ctx).express_route_ports_locations | ||
|
||
|
||
def cf_express_route_links(cli_ctx, _): | ||
return network_client_factory(cli_ctx).express_route_links |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
from knack.help_files import helps | ||
|
||
|
||
# region Express Route Gateway | ||
helps['network express-route gateway'] = """ | ||
type: group | ||
short-summary: Manage ExpressRoute gateways. | ||
""" | ||
|
||
helps['network express-route gateway create'] = """ | ||
type: command | ||
short-summary: Create an ExpressRoute gateway. | ||
""" | ||
|
||
helps['network express-route gateway delete'] = """ | ||
type: command | ||
short-summary: Delete an ExpressRoute gateway. | ||
""" | ||
|
||
helps['network express-route gateway list'] = """ | ||
type: command | ||
short-summary: List ExpressRoute gateways. | ||
""" | ||
|
||
helps['network express-route gateway show'] = """ | ||
type: command | ||
short-summary: Get the details of an ExpressRoute gateway. | ||
""" | ||
|
||
helps['network express-route gateway update'] = """ | ||
type: command | ||
short-summary: Update settings of an ExpressRoute gateway. | ||
""" | ||
# endregion | ||
|
||
# region Express Route gateway connection | ||
helps['network express-route gateway connection'] = """ | ||
type: group | ||
short-summary: Manage ExpressRoute gateway connections. | ||
""" | ||
|
||
helps['network express-route gateway connection create'] = """ | ||
type: command | ||
short-summary: Create an ExpressRoute gateway connection. | ||
""" | ||
|
||
helps['network express-route gateway connection delete'] = """ | ||
type: command | ||
short-summary: Delete an ExpressRoute gateway connection. | ||
""" | ||
|
||
helps['network express-route gateway connection list'] = """ | ||
type: command | ||
short-summary: List ExpressRoute gateway connections. | ||
""" | ||
|
||
helps['network express-route gateway connection show'] = """ | ||
type: command | ||
short-summary: Get the details of an ExpressRoute gateway connection. | ||
""" | ||
|
||
helps['network express-route gateway connection update'] = """ | ||
type: command | ||
short-summary: Update an ExpressRoute gateway connection. | ||
""" | ||
# endregion | ||
|
||
# region Express Route Port | ||
helps['network express-route port'] = """ | ||
type: group | ||
short-summary: Manage ExpressRoute ports. | ||
""" | ||
|
||
helps['network express-route port create'] = """ | ||
type: command | ||
short-summary: Create an ExpressRoute port. | ||
""" | ||
|
||
helps['network express-route port delete'] = """ | ||
type: command | ||
short-summary: Delete an ExpressRoute port. | ||
""" | ||
|
||
helps['network express-route port list'] = """ | ||
type: command | ||
short-summary: List ExpressRoute ports. | ||
""" | ||
|
||
helps['network express-route port show'] = """ | ||
type: command | ||
short-summary: Get the details of an ExpressRoute port. | ||
""" | ||
|
||
helps['network express-route port update'] = """ | ||
type: command | ||
short-summary: Update settings of an ExpressRoute port. | ||
""" | ||
# endregion | ||
|
||
# region Express Route Link | ||
helps['network express-route port link'] = """ | ||
type: group | ||
short-summary: View ExpressRoute links. | ||
""" | ||
|
||
helps['network express-route port link list'] = """ | ||
type: command | ||
short-summary: List ExpressRoute links. | ||
""" | ||
|
||
helps['network express-route port link show'] = """ | ||
type: command | ||
short-summary: Get the details of an ExpressRoute link. | ||
""" | ||
# endregion | ||
|
||
# region Express Route Port Locations | ||
helps['network express-route port location'] = """ | ||
type: group | ||
short-summary: View ExpressRoute port location information. | ||
""" | ||
|
||
helps['network express-route port location list'] = """ | ||
type: command | ||
short-summary: List ExpressRoute port locations. | ||
""" | ||
|
||
helps['network express-route port location show'] = """ | ||
type: command | ||
short-summary: Get the details of an ExpressRoute port location. | ||
""" | ||
# endregion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
# pylint: disable=line-too-long | ||
from knack.arguments import CLIArgumentType | ||
|
||
from azure.cli.core.commands.parameters import ( | ||
get_resource_name_completion_list, tags_type, get_location_type, get_three_state_flag, get_enum_type) | ||
from azure.cli.core.commands.validators import get_default_location_from_resource_group | ||
|
||
from ._validators import ( | ||
validate_express_route_peering, validate_virtual_hub, validate_express_route_port, | ||
validate_circuit_bandwidth) | ||
|
||
|
||
# pylint: disable=too-many-locals, too-many-branches, too-many-statements | ||
def load_arguments(self, _): | ||
|
||
ExpressRoutePortsEncapsulation, ExpressRouteCircuitSkuFamily, ExpressRouteCircuitSkuTier = self.get_models( | ||
'ExpressRoutePortsEncapsulation', 'ExpressRouteCircuitSkuFamily', 'ExpressRouteCircuitSkuTier') | ||
|
||
er_circuit_name_type = CLIArgumentType(options_list=('--circuit-name',), metavar='NAME', help='ExpressRoute circuit name.', id_part='name', completer=get_resource_name_completion_list('Microsoft.Network/expressRouteCircuits')) | ||
er_gateway_name_type = CLIArgumentType(options_list=('--gateway-name',), metavar='NAME', help='ExpressRoute gateway name.', id_part='name', completer=get_resource_name_completion_list('Microsoft.Network/expressRouteGateways')) | ||
er_port_name_type = CLIArgumentType(options_list=('--port-name',), metavar='NAME', help='ExpressRoute port name.', id_part='name', completer=get_resource_name_completion_list('Microsoft.Network/expressRoutePorts')) | ||
|
||
with self.argument_context('network express-route') as c: | ||
c.argument('tags', tags_type) | ||
c.argument('location', arg_type=get_location_type(self.cli_ctx), validator=get_default_location_from_resource_group) | ||
|
||
with self.argument_context('network express-route gateway') as c: | ||
c.argument('express_route_gateway_name', er_gateway_name_type, options_list=['--name', '-n']) | ||
c.argument('min_val', help='Minimum number of scale units deployed for gateway.', type=int, arg_group='Autoscale') | ||
c.argument('max_val', help='Maximum number of scale units deployed for gateway.', type=int, arg_group='Autoscale') | ||
c.argument('virtual_hub', help='Name or ID of the virtual hub to associate with the gateway.', validator=validate_virtual_hub) | ||
|
||
with self.argument_context('network express-route gateway connection') as c: | ||
c.argument('express_route_gateway_name', er_gateway_name_type) | ||
c.argument('connection_name', options_list=['--name', '-n'], help='ExpressRoute connection name.', id_part='child_name_1') | ||
c.argument('routing_weight', help='Routing weight associated with the connection.', type=int) | ||
c.argument('authorization_key', help='Authorization key to establish the connection.') | ||
|
||
with self.argument_context('network express-route gateway connection', arg_group='Peering') as c: | ||
c.argument('peering', help='Name or ID of an ExpressRoute peering.', validator=validate_express_route_peering) | ||
c.argument('circuit_name', er_circuit_name_type, id_part=None) | ||
|
||
with self.argument_context('network express-route gateway connection list') as c: | ||
c.argument('express_route_gateway_name', er_gateway_name_type, id_part=None) | ||
|
||
with self.argument_context('network express-route port') as c: | ||
c.argument('express_route_port_name', er_port_name_type, options_list=['--name', '-n']) | ||
c.argument('encapsulation', arg_type=get_enum_type(ExpressRoutePortsEncapsulation), help='Encapsulation method on physical ports.') | ||
c.argument('bandwidth', help='Bandwidth of procured ports in Gbps', nargs='+') | ||
c.argument('peering_location', help='The name of the peering location that the port is mapped to physically.') | ||
|
||
with self.argument_context('network express-route port link') as c: | ||
c.argument('express_route_port_name', er_port_name_type) | ||
c.argument('link_name', options_list=['--name', '-n'], id_part='child_name_1') | ||
|
||
with self.argument_context('network express-route port link list') as c: | ||
c.argument('express_route_port_name', er_port_name_type, id_part=None) | ||
|
||
with self.argument_context('network express-route port location') as c: | ||
c.argument('location_name', options_list=['--location', '-l']) | ||
|
||
# region ExpressRoutes | ||
device_path_values = ['primary', 'secondary'] | ||
sku_family_type = CLIArgumentType(help='Chosen SKU family of ExpressRoute circuit.', arg_type=get_enum_type(ExpressRouteCircuitSkuFamily), default=ExpressRouteCircuitSkuFamily.metered_data.value) | ||
sku_tier_type = CLIArgumentType(help='SKU Tier of ExpressRoute circuit.', arg_type=get_enum_type(ExpressRouteCircuitSkuTier), default=ExpressRouteCircuitSkuTier.standard.value) | ||
with self.argument_context('network express-route') as c: | ||
c.argument('circuit_name', er_circuit_name_type, options_list=('--name', '-n')) | ||
c.argument('sku_family', sku_family_type) | ||
c.argument('sku_tier', sku_tier_type) | ||
c.argument('bandwidth_in_mbps', nargs='+', options_list='--bandwidth', help='Bandwidth of the circuit. Should be Mbps for service providers or Gbps for ExpressRoute ports. Usage: INT {Mbps,Gbps}', validator=validate_circuit_bandwidth) | ||
c.argument('service_provider_name', options_list=('--provider',), help="Name of the ExpressRoute Service Provider.") | ||
c.argument('peering_location', help="Name of the peering location.") | ||
c.argument('device_path', options_list=('--path',), arg_type=get_enum_type(device_path_values)) | ||
c.argument('vlan_id', type=int) | ||
c.argument('allow_global_reach', arg_type=get_three_state_flag(), min_api='2018-07-01', help='Enable global reach on the circuit.') | ||
|
||
with self.argument_context('network express-route') as c: | ||
c.argument('express_route_port', help='Name or ID of an ExpressRoute port.', validator=validate_express_route_port) | ||
|
||
with self.argument_context('network express-route update') as c: | ||
c.argument('sku_family', sku_family_type, default=None) | ||
c.argument('sku_tier', sku_tier_type, default=None) | ||
# endregion |
Oops, something went wrong.