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

{Express-route-cross-connection} Migrate express-route-cross-connection to AAZ #8191

Merged
merged 3 commits into from
Oct 25, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 12 additions & 0 deletions src/express-route-cross-connection/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. :changelog:

Release History
===============

1.0.0
++++++
* Migrate to aaz commands.

0.1.1
++++++
* Initial release.
Original file line number Diff line number Diff line change
@@ -1,34 +1,42 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

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

import azext_expressroutecrossconnection._help # pylint: disable=unused-import
from azext_expressroutecrossconnection._help import helps # pylint: disable=unused-import


class ExpressRouteCrossConnectionCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from .profiles import CUSTOM_ER_CC
register_resource_type('latest', CUSTOM_ER_CC, '2018-04-01')
super(ExpressRouteCrossConnectionCommandsLoader, self).__init__(
cli_ctx=cli_ctx,
custom_command_type=CliCommandType(operations_tmpl='azext_expressroutecrossconnection.custom#{}'),
resource_type=CUSTOM_ER_CC
)
custom_command_type = CliCommandType(
operations_tmpl='azext_expressroutecrossconnection.custom#{}')
super().__init__(cli_ctx=cli_ctx,
custom_command_type=custom_command_type)

def load_command_table(self, args):
from .commands import load_command_table
from azext_expressroutecrossconnection.commands import load_command_table
from azure.cli.core.aaz import load_aaz_command_table
try:
from . import aaz
except ImportError:
aaz = None
if aaz:
load_aaz_command_table(
loader=self,
aaz_pkg_name=aaz.__name__,
args=args
)
load_command_table(self, args)
return self.command_table

def load_arguments(self, args):
from ._params import load_arguments
load_arguments(self, args)
def load_arguments(self, command):
from azext_expressroutecrossconnection._params import load_arguments
load_arguments(self, command)


COMMAND_LOADER_CLS = ExpressRouteCrossConnectionCommandsLoader

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,115 +1,11 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

from knack.help_files import helps
# pylint: disable=line-too-long
# pylint: disable=too-many-lines


helps['network cross-connection'] = """
type: group
short-summary: Manage customers' ExpressRoute circuits.
long-summary: >
To learn more about ExpressRoute circuits visit
https://docs.microsoft.com/azure/expressroute/howto-circuit-cli
"""

helps['network cross-connection list'] = """
type: command
short-summary: List all ExpressRoute cross-connections for the current subscription.
examples:
- name: List all ExpressRoute cross-connections for the current subscription.
text: >
az network cross-connection list -g MyResourceGroup
"""

helps['network cross-connection list-arp-tables'] = """
type: command
short-summary: Show the current Address Resolution Protocol (ARP) table of an ExpressRoute cross-connection peering.
examples:
- name: Show the current Address Resolution Protocol (ARP) table of an ExpressRoute cross-connection.
text: |
az network cross-connection list-arp-tables -g MyResourceGroup -n MyCircuit \\
--path primary --peering-name AzurePrivatePeering
"""

helps['network cross-connection list-route-tables'] = """
type: command
short-summary: Show the current routing table of an ExpressRoute cross-connection peering.
examples:
- name: Show the current routing table of an ExpressRoute cross-connection peering.
text: |
az network cross-connection list-route-tables -g MyResourceGroup -n MyCircuit \\
--path primary --peering-name AzurePrivatePeering
"""

helps['network cross-connection show'] = """
type: command
short-summary: Get the details of an ExpressRoute cross-connection.
examples:
- name: Get the details of an ExpressRoute cross-connection.
text: >
az network cross-connection show -n MyCircuit -g MyResourceGroup
"""

helps['network cross-connection update'] = """
type: command
short-summary: Update settings of an ExpressRoute cross-connection.
"""

helps['network cross-connection wait'] = """
type: command
short-summary: Place the CLI in a waiting state until a condition of the ExpressRoute is met.
examples:
- name: Pause executing next line of CLI script until the ExpressRoute cross-connection is successfully provisioned.
text: az network cross-connection wait -n MyCircuit -g MyResourceGroup --created
"""

helps['network cross-connection peering'] = """
type: group
short-summary: Manage ExpressRoute peering of an ExpressRoute cross-connection.
"""

helps['network cross-connection peering create'] = """
type: command
short-summary: Create peering settings for an ExpressRoute cross-connection.
examples:
- name: Create Microsoft Peering settings with IPv4 configuration.
text: |
az network cross-connection peering create -g MyResourceGroup --cross-connection-name MyCircuit \\
--peering-type MicrosoftPeering --peer-asn 10002 --vlan-id 103 \\
--primary-peer-subnet 101.0.0.0/30 --secondary-peer-subnet 102.0.0.0/30 \\
--advertised-public-prefixes 101.0.0.0/30
"""

helps['network cross-connection peering update'] = """
type: command
short-summary: Update peering settings for an ExpressRoute cross-connection.
"""

helps['network cross-connection peering delete'] = """
type: command
short-summary: Delete peering settings.
examples:
- name: Delete private peering.
text: >
az network cross-connection peering delete -g MyResourceGroup --cross-connection-name MyCircuit -n AzurePrivatePeering
"""

helps['network cross-connection peering list'] = """
type: command
short-summary: List peering settings of an ExpressRoute cross-connection.
examples:
- name: List peering settings of an ExpressRoute cross-connection.
text: >
az network cross-connection peering list -g MyResourceGroup --cross-connection-name MyCircuit
"""

helps['network cross-connection peering show'] = """
type: command
short-summary: Get the details of an express route peering.
examples:
- name: Get private peering details of an ExpressRoute cross-connection.
text: >
az network cross-connection peering show -g MyResourceGroup --cross-connection-name MyCircuit -n AzurePrivatePeering
"""
from knack.help_files import helps # pylint: disable=unused-import
Original file line number Diff line number Diff line change
@@ -1,49 +1,13 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: disable=line-too-long
import six
# pylint: disable=too-many-lines
# pylint: disable=too-many-statements

from knack.arguments import CLIArgumentType

from azure.cli.core.commands.parameters import (get_resource_name_completion_list, get_enum_type)
from azure.cli.command_modules.network._validators import validate_peering_type


# pylint: disable=too-many-locals, too-many-branches, too-many-statements
def load_arguments(self, _):

ExpressRoutePeeringType = self.get_models('ExpressRoutePeeringType')

name_arg_type = CLIArgumentType(options_list=('--name', '-n'), metavar='NAME')
cross_connection_name_type = CLIArgumentType(options_list=('--cross-connection-name',), metavar='NAME', help='ExpressRoute cross-connection name.', id_part='name', completer=get_resource_name_completion_list('Microsoft.Network/expressRouteCrossConnections'))
routing_registry_values = ['ARIN', 'APNIC', 'AFRINIC', 'LACNIC', 'RIPENCC', 'RADB', 'ALTDB', 'LEVEL3']
device_path_values = ['primary', 'secondary']

with self.argument_context('network cross-connection') as c:
c.argument('cross_connection_name', cross_connection_name_type, options_list=['--name', '-n'])
c.argument('device_path', options_list='--path', arg_type=get_enum_type(device_path_values))

with self.argument_context('network cross-connection update') as c:
c.argument('notes', help='Service provider notes.')
c.argument('provisioning_state', arg_type=get_enum_type(['Provisioning', 'Provisioned', 'NotProvisioned']), help='Provisioning state of the customer ExpressRoute circuit.')

with self.argument_context('network cross-connection peering') as c:
# Using six.integer_types so we get int for Py3 and long for Py2
c.argument('peer_asn', help='Autonomous system number of the customer/connectivity provider.', type=six.integer_types[-1])
c.argument('vlan_id', help='Identifier used to identify the customer.', type=int)
c.argument('cross_connection_name', cross_connection_name_type)
c.argument('peering_name', name_arg_type, id_part='child_name_1')
c.argument('peering_type', validator=validate_peering_type, arg_type=get_enum_type(ExpressRoutePeeringType), help='BGP peering type for the circuit.')
c.argument('primary_peer_address_prefix', options_list='--primary-peer-subnet', help='/30 subnet used to configure IP addresses for primary interface.')
c.argument('secondary_peer_address_prefix', options_list='--secondary-peer-subnet', help='/30 subnet used to configure IP addresses for secondary interface.')
c.argument('advertised_public_prefixes', arg_group='Microsoft Peering', nargs='+', help='Space-separated list of prefixes to be advertised through the BGP peering.')
c.argument('customer_asn', arg_group='Microsoft Peering', help='Autonomous system number of the customer.')
c.argument('routing_registry_name', arg_group='Microsoft Peering', arg_type=get_enum_type(routing_registry_values), help='Internet Routing Registry / Regional Internet Registry')
c.argument('ip_version', min_api='2017-06-01', help='The IP version to update Microsoft Peering settings for.', arg_group='Microsoft Peering', arg_type=get_enum_type(['IPv4', 'IPv6']))
c.argument('shared_key', help='Key for generating an MD5 for the BGP session.')

with self.argument_context('network cross-connection peering list') as c:
c.argument('cross_connection_name', id_part=None)
def load_arguments(self, _): # pylint: disable=unused-argument
pass
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# coding=utf-8
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------

VERSION = "2.0.0rc3"
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

from azure.cli.core.profiles import CustomResourceType
# pylint: skip-file
# flake8: noqa

CUSTOM_ER_CC = CustomResourceType('azext_expressroutecrossconnection.vendored_sdks', 'NetworkManagementClient')
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"network",
)
class __CMDGroup(AAZCommandGroup):
"""Manage Azure Network resources.
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# coding=utf-8
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

VERSION = ""
# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"network cross-connection",
)
class __CMDGroup(AAZCommandGroup):
"""Manage express route cross connection
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
from ._list import *
from ._list_arp_tables import *
from ._list_route_tables import *
from ._show import *
from ._summarize_route_table import *
from ._update import *
from ._wait import *
Loading
Loading